Add nil keyword
This commit is contained in:
606
parser/parser.go
606
parser/parser.go
File diff suppressed because it is too large
Load Diff
@@ -129,7 +129,7 @@ ParamList = '(' params:(Expr ( ',' _ Expr )* )? ')' {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
Value = not:"!"? node:(MethodCall / FieldAccess / Index / String / RawString / Float / Integer / Bool / FuncCall / VariableOr / Ident / ParenExpr / Array / Map) {
|
||||
Value = not:"!"? node:(Nil / MethodCall / FieldAccess / Index / String / RawString / Float / Integer / Bool / FuncCall / VariableOr / Ident / ParenExpr / Array / Map) {
|
||||
return ast.Value{
|
||||
Node: node.(ast.Node),
|
||||
Not: not != nil,
|
||||
@@ -288,6 +288,10 @@ ArithmeticOp = ('+' / '-' / '/' / '*' / '%') {
|
||||
}, nil
|
||||
}
|
||||
|
||||
Nil = "nil" {
|
||||
return ast.Nil{Position: getPos(c)}, nil
|
||||
}
|
||||
|
||||
Text = . [^#]* { return ast.Text{Data: c.text, Position: getPos(c)}, nil }
|
||||
|
||||
_ "whitespace" ← [ \t\r\n]*
|
||||
|
||||
Reference in New Issue
Block a user