typeClasses now documented in grammar.txt
This commit is contained in:
parent
556efb5158
commit
3e5cb6644f
2 changed files with 8 additions and 0 deletions
|
|
@ -1048,6 +1048,7 @@ proc parseTypeDesc(p: var TParser): PNode =
|
||||||
|
|
||||||
proc parseTypeDefAux(p: var TParser): PNode =
|
proc parseTypeDefAux(p: var TParser): PNode =
|
||||||
#| typeDefAux = simpleExpr
|
#| typeDefAux = simpleExpr
|
||||||
|
#| | 'generic' typeClass
|
||||||
result = simpleExpr(p, pmTypeDef)
|
result = simpleExpr(p, pmTypeDef)
|
||||||
|
|
||||||
proc makeCall(n: PNode): PNode =
|
proc makeCall(n: PNode): PNode =
|
||||||
|
|
@ -1672,6 +1673,9 @@ proc parseTypeClassParam(p: var TParser): PNode =
|
||||||
result = p.parseSymbol
|
result = p.parseSymbol
|
||||||
|
|
||||||
proc parseTypeClass(p: var TParser): PNode =
|
proc parseTypeClass(p: var TParser): PNode =
|
||||||
|
#| typeClassParam = ('var')? symbol
|
||||||
|
#| typeClass = typeClassParam ^* ',' (pragma)? ('of' typeDesc ^* ',')?
|
||||||
|
#| &IND{>} stmt
|
||||||
result = newNodeP(nkTypeClassTy, p)
|
result = newNodeP(nkTypeClassTy, p)
|
||||||
getTok(p)
|
getTok(p)
|
||||||
var args = newNode(nkArgList)
|
var args = newNode(nkArgList)
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ primary = typeKeyw typeDescK
|
||||||
/ 'bind' primary
|
/ 'bind' primary
|
||||||
typeDesc = simpleExpr
|
typeDesc = simpleExpr
|
||||||
typeDefAux = simpleExpr
|
typeDefAux = simpleExpr
|
||||||
|
| 'generic' typeClass
|
||||||
macroColon = ':' stmt? ( IND{=} 'of' exprList ':' stmt
|
macroColon = ':' stmt? ( IND{=} 'of' exprList ':' stmt
|
||||||
| IND{=} 'elif' expr ':' stmt
|
| IND{=} 'elif' expr ':' stmt
|
||||||
| IND{=} 'except' exprList ':' stmt
|
| IND{=} 'except' exprList ':' stmt
|
||||||
|
|
@ -163,6 +164,9 @@ objectCase = 'case' identWithPragma ':' typeDesc ':'? COMMENT?
|
||||||
objectPart = IND{>} objectPart^+IND{=} DED
|
objectPart = IND{>} objectPart^+IND{=} DED
|
||||||
/ objectWhen / objectCase / 'nil' / declColonEquals
|
/ objectWhen / objectCase / 'nil' / declColonEquals
|
||||||
object = 'object' pragma? ('of' typeDesc)? COMMENT? objectPart
|
object = 'object' pragma? ('of' typeDesc)? COMMENT? objectPart
|
||||||
|
typeClassParam = ('var')? symbol
|
||||||
|
typeClass = typeClassParam ^* ',' (pragma)? ('of' typeDesc ^* ',')?
|
||||||
|
&IND{>} stmt
|
||||||
distinct = 'distinct' optInd typeDesc
|
distinct = 'distinct' optInd typeDesc
|
||||||
typeDef = identWithPragma genericParamList? '=' optInd typeDefAux
|
typeDef = identWithPragma genericParamList? '=' optInd typeDefAux
|
||||||
indAndComment?
|
indAndComment?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue