diff options
author | Silly Carbon <crew.long@outlook.com> | 2024-01-26 15:03:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 08:03:41 +0100 |
commit | 243f1e6cd5e147fdd96b5298e4df44546e5eea28 (patch) | |
tree | b1c5b4089c8ceac16961c6e91a73dda29f444c61 | |
parent | d44b0b186943b3187e6dbc8bc5d304f402d978dc (diff) | |
download | Nim-243f1e6cd5e147fdd96b5298e4df44546e5eea28.tar.gz |
Fixes #23085: update grammars for 'concept' (#23256)
Fixes #23085
-rw-r--r-- | compiler/parser.nim | 5 | ||||
-rw-r--r-- | doc/grammar.txt | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index 024807a8a..9390c7d1b 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -2189,7 +2189,8 @@ proc parseObject(p: var Parser): PNode = proc parseTypeClassParam(p: var Parser): PNode = let modifier = case p.tok.tokType - of tkOut, tkVar: nkVarTy + of tkVar: nkVarTy + of tkOut: nkOutTy of tkPtr: nkPtrTy of tkRef: nkRefTy of tkStatic: nkStaticTy @@ -2205,7 +2206,7 @@ proc parseTypeClassParam(p: var Parser): PNode = setEndInfo() proc parseTypeClass(p: var Parser): PNode = - #| conceptParam = ('var' | 'out')? symbol + #| conceptParam = ('var' | 'out' | 'ptr' | 'ref' | 'static' | 'type')? symbol #| conceptDecl = 'concept' conceptParam ^* ',' (pragma)? ('of' typeDesc ^* ',')? #| &IND{>} stmt result = newNodeP(nkTypeClassTy, p) diff --git a/doc/grammar.txt b/doc/grammar.txt index f1484bb0b..51b3e0053 100644 --- a/doc/grammar.txt +++ b/doc/grammar.txt @@ -187,7 +187,7 @@ objectCase = 'case' declColonEquals ':'? COMMENT? objectPart = IND{>} objectPart^+IND{=} DED / objectWhen / objectCase / 'nil' / 'discard' / declColonEquals objectDecl = 'object' ('of' typeDesc)? COMMENT? objectPart -conceptParam = ('var' | 'out')? symbol +conceptParam = ('var' | 'out' | 'ptr' | 'ref' | 'static' | 'type')? symbol conceptDecl = 'concept' conceptParam ^* ',' (pragma)? ('of' typeDesc ^* ',')? &IND{>} stmt typeDef = identVisDot genericParamList? pragma '=' optInd typeDefValue |