Browse Source

Update GDScript EBNF grammar

- More assignment operator
- $ get_node shorthand
- base class function call
Student Main 4 years ago
parent
commit
7fe1cb7ed4
1 changed files with 6 additions and 2 deletions
  1. 6 2
      development/file_formats/gdscript_grammar.rst

+ 6 - 2
development/file_formats/gdscript_grammar.rst

@@ -108,7 +108,8 @@ for reference purposes.
         | "return" [ expression ] stmtEnd
         ;
 
-    assignmentStmt = subscription "=" expression stmtEnd;
+    assignmentStmt = subscription ( "=" | "+=" | "-=" | "*=" | "/=" 
+    | "%=" | "&=" | "|=" | "^=" ) expression stmtEnd;
     varDeclStmt = "var" IDENTIFIER [ "=" expression ] stmtEnd;
 
     assertStmt = "assert" "(" expression [ "," STRING ] ")" stmtEnd ;
@@ -136,7 +137,10 @@ for reference purposes.
     sign = ( "-" | "+" ) sign | bitNot ;
     bitNot = "~" bitNot | is ;
     is = call [ "is" ( IDENTIFIER | BUILTINTYPE ) ] ;
-    call = attribute [ "(" [ argList ] ")" ];
+    call 
+        = (attribute [ "(" [ argList ] ")" ]) 
+        | "." IDENTIFIER "(" [ argList ] ")" 
+        | "$" ( STRING | IDENTIFIER { '/' IDENTIFIER } );
     attribute = subscription { "." IDENTIFIER } ;
     subscription = primary [ "[" expression "]" ] ;
     primary = "true" | "false" | "null" | "self" | literal | arrayDecl