Add nil keyword

This commit is contained in:
2024-06-06 19:06:45 -07:00
parent f1a998c25b
commit d5c33f9e5d
5 changed files with 340 additions and 295 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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]*