From 8d62122aaa6ff05aaadeb4f52d0148b4c71e09d1 Mon Sep 17 00:00:00 2001 From: Aymeric Wibo Date: Thu, 4 Jul 2024 12:55:52 +0200 Subject: [PATCH] formatting: I really need to make a precommit hook for this lol --- src/grammar.json | 1804 +++++++++++++++++++++---------------------- src/node-types.json | 1438 +++++++++++++++++----------------- 2 files changed, 1621 insertions(+), 1621 deletions(-) diff --git a/src/grammar.json b/src/grammar.json index 160cb17..6ff2555 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -1,904 +1,904 @@ { - "name": "flamingo", - "rules": { - "source_file": { - "type": "REPEAT", - "content": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "statement" - }, - { - "type": "SYMBOL", - "name": "doc_comment" - }, - { - "type": "SYMBOL", - "name": "comment" - } - ] - } - }, - "comment": { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "#" - }, - { - "type": "PATTERN", - "value": "[^#].*" - } - ] - } - }, - "doc_comment": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "##" - }, - { - "type": "SYMBOL", - "name": "doc_comment_content" - } - ] - }, - "doc_comment_content": { - "type": "PATTERN", - "value": ".*" - }, - "statement": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "block" - }, - { - "type": "SYMBOL", - "name": "expression" - }, - { - "type": "SYMBOL", - "name": "print" - }, - { - "type": "SYMBOL", - "name": "assert" - }, - { - "type": "SYMBOL", - "name": "assignment" - }, - { - "type": "SYMBOL", - "name": "var_declaration" - }, - { - "type": "SYMBOL", - "name": "import" - }, - { - "type": "SYMBOL", - "name": "function_declaration" - }, - { - "type": "SYMBOL", - "name": "class_declaration" - }, - { - "type": "SYMBOL", - "name": "return" - } - ] - }, - "block": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "{" - }, - { - "type": "FIELD", - "name": "body", - "content": { - "type": "REPEAT", - "content": { - "type": "SYMBOL", - "name": "statement" - } - } - }, - { - "type": "STRING", - "value": "}" - } - ] - }, - "import": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "import" - }, - { - "type": "FIELD", - "name": "path", - "content": { - "type": "SYMBOL", - "name": "identifier" - } - } - ] - }, - "qualifier": { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "extern" - }, - { - "type": "STRING", - "value": "pure" - } - ] - }, - "qualifier_list": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "qualifier" - }, - { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "qualifier" - }, - { - "type": "SYMBOL", - "name": "qualifier_list" - } - ] - } - ] - }, - "function_declaration": { - "type": "PREC", - "value": 100, - "content": { - "type": "SEQ", - "members": [ - { - "type": "FIELD", - "name": "qualifiers", - "content": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "qualifier_list" - }, - { - "type": "BLANK" - } - ] - } - }, - { - "type": "STRING", - "value": "fn" - }, - { - "type": "FIELD", - "name": "name", - "content": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "identifier" - }, - { - "type": "SYMBOL", - "name": "overloadable_operator" - } - ] - } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "(" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "FIELD", - "name": "params", - "content": { - "type": "SYMBOL", - "name": "param_list" - } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "STRING", - "value": ")" - } - ] - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "FIELD", - "name": "body", - "content": { - "type": "SYMBOL", - "name": "statement" - } - } - ] - } - }, - "function_expression": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "fn" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "(" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "FIELD", - "name": "params", - "content": { - "type": "SYMBOL", - "name": "param_list" - } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "STRING", - "value": ")" - } - ] - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "FIELD", - "name": "body", - "content": { - "type": "SYMBOL", - "name": "statement" - } - } - ] - }, - "class_declaration": { - "type": "SEQ", - "members": [ - { - "type": "FIELD", - "name": "qualifiers", - "content": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "qualifier_list" - }, - { - "type": "BLANK" - } - ] - } - }, - { - "type": "STRING", - "value": "class" - }, - { - "type": "FIELD", - "name": "name", - "content": { - "type": "SYMBOL", - "name": "identifier" - } - }, - { - "type": "STRING", - "value": "{" - }, - { - "type": "FIELD", - "name": "body", - "content": { - "type": "REPEAT", - "content": { - "type": "SYMBOL", - "name": "statement" - } - } - }, - { - "type": "STRING", - "value": "}" - } - ] - }, - "print": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "print" - }, - { - "type": "FIELD", - "name": "msg", - "content": { - "type": "SYMBOL", - "name": "expression" - } - } - ] - }, - "assert": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "assert" - }, - { - "type": "FIELD", - "name": "test", - "content": { - "type": "SYMBOL", - "name": "expression" - } - } - ] - }, - "expression": { - "type": "PREC", - "value": -1, - "content": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "identifier" - }, - { - "type": "SYMBOL", - "name": "literal" - }, - { - "type": "SYMBOL", - "name": "call" - }, - { - "type": "SYMBOL", - "name": "access_list" - }, - { - "type": "SYMBOL", - "name": "parenthesized_expression" - } - ] - } - }, - "parenthesized_expression": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "(" - }, - { - "type": "FIELD", - "name": "expression", - "content": { - "type": "SYMBOL", - "name": "expression" - } - }, - { - "type": "STRING", - "value": ")" - } - ] - }, - "access_list": { - "type": "SEQ", - "members": [ - { - "type": "FIELD", - "name": "accessed", - "content": { - "type": "SYMBOL", - "name": "expression" - } - }, - { - "type": "STRING", - "value": "." - }, - { - "type": "FIELD", - "name": "accessor", - "content": { - "type": "SYMBOL", - "name": "identifier" - } - } - ] - }, - "call": { - "type": "PREC", - "value": 99, - "content": { - "type": "SEQ", - "members": [ - { - "type": "FIELD", - "name": "callable", - "content": { - "type": "SYMBOL", - "name": "expression" - } - }, - { - "type": "STRING", - "value": "(" - }, - { - "type": "FIELD", - "name": "args", - "content": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "argument_list" - }, - { - "type": "BLANK" - } - ] - } - }, - { - "type": "STRING", - "value": ")" - } - ] - } - }, - "template_type": { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "vec" - }, - { - "type": "STRING", - "value": "map" - } - ] - }, - "type_name": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "identifier" - }, - { - "type": "STRING", - "value": "vec" - }, - { - "type": "STRING", - "value": "map" - } - ] - }, - "type": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "type_name" - }, - { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "vec" - }, - { - "type": "STRING", - "value": "<" - }, - { - "type": "SYMBOL", - "name": "type" - }, - { - "type": "STRING", - "value": ">" - } - ] - }, - { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "map" - }, - { - "type": "STRING", - "value": "<" - }, - { - "type": "SYMBOL", - "name": "type" - }, - { - "type": "STRING", - "value": "," - }, - { - "type": "SYMBOL", - "name": "type" - }, - { - "type": "STRING", - "value": ">" - } - ] - } - ] - }, - "param": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "identifier" - }, - { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "identifier" - }, - { - "type": "STRING", - "value": ":" - }, - { - "type": "SYMBOL", - "name": "type" - } - ] - } - ] - }, - "param_list": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "param" - }, - { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "param" - }, - { - "type": "STRING", - "value": "," - }, - { - "type": "SYMBOL", - "name": "param_list" - } - ] - } - ] - }, - "argument_list": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "expression" - }, - { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "expression" - }, - { - "type": "STRING", - "value": "," - }, - { - "type": "SYMBOL", - "name": "argument_list" - } - ] - } - ] - }, - "literal": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "number" - }, - { - "type": "SYMBOL", - "name": "string" - }, - { - "type": "SYMBOL", - "name": "bool" - } - ] - }, - "var_declaration": { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "identifier" - }, - { - "type": "STRING", - "value": ":" - }, - { - "type": "SYMBOL", - "name": "type" - } - ] - }, - "assignment": { - "type": "SEQ", - "members": [ - { - "type": "FIELD", - "name": "left", - "content": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "var_declaration" - }, - { - "type": "SYMBOL", - "name": "identifier" - } - ] - } - }, - { - "type": "STRING", - "value": "=" - }, - { - "type": "FIELD", - "name": "right", - "content": { - "type": "SYMBOL", - "name": "expression" - } - } - ] - }, - "return": { - "type": "PREC_LEFT", - "value": 100, - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "return" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "expression" - }, - { - "type": "BLANK" - } - ] - } - ] - } - }, - "unary_expression": { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "-" - }, - { - "type": "SYMBOL", - "name": "expression" - } - ] - }, - { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "!" - }, - { - "type": "SYMBOL", - "name": "expression" - } - ] - } - ] - }, - "overloadable_operator": { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "++" - }, - { - "type": "STRING", - "value": "===" - } - ] - }, - "primitive_type": { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "any" - }, - { - "type": "STRING", - "value": "int" - }, - { - "type": "STRING", - "value": "str" - }, - { - "type": "STRING", - "value": "bool" - }, - { - "type": "STRING", - "value": "void" - } - ] - }, - "identifier": { - "type": "CHOICE", - "members": [ - { - "type": "PATTERN", - "value": "[_A-z][_A-z0-9]*" - }, - { - "type": "SYMBOL", - "name": "primitive_type" - } - ] - }, - "number": { - "type": "PATTERN", - "value": "\\d+" - }, - "string": { - "type": "PATTERN", - "value": "\"([^\"\\\\]|\\\\.)*\"" - }, - "bool": { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "true" - }, - { - "type": "STRING", - "value": "false" - }, - { - "type": "STRING", - "value": "error" - } - ] - } - }, - "extras": [ - { - "type": "PATTERN", - "value": "\\s" - } - ], - "conflicts": [], - "precedences": [], - "externals": [], - "inline": [], - "supertypes": [] + "name": "flamingo", + "rules": { + "source_file": { + "type": "REPEAT", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "statement" + }, + { + "type": "SYMBOL", + "name": "doc_comment" + }, + { + "type": "SYMBOL", + "name": "comment" + } + ] + } + }, + "comment": { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "#" + }, + { + "type": "PATTERN", + "value": "[^#].*" + } + ] + } + }, + "doc_comment": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "##" + }, + { + "type": "SYMBOL", + "name": "doc_comment_content" + } + ] + }, + "doc_comment_content": { + "type": "PATTERN", + "value": ".*" + }, + "statement": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "block" + }, + { + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "SYMBOL", + "name": "print" + }, + { + "type": "SYMBOL", + "name": "assert" + }, + { + "type": "SYMBOL", + "name": "assignment" + }, + { + "type": "SYMBOL", + "name": "var_declaration" + }, + { + "type": "SYMBOL", + "name": "import" + }, + { + "type": "SYMBOL", + "name": "function_declaration" + }, + { + "type": "SYMBOL", + "name": "class_declaration" + }, + { + "type": "SYMBOL", + "name": "return" + } + ] + }, + "block": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "{" + }, + { + "type": "FIELD", + "name": "body", + "content": { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "statement" + } + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "import": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "import" + }, + { + "type": "FIELD", + "name": "path", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + } + ] + }, + "qualifier": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "extern" + }, + { + "type": "STRING", + "value": "pure" + } + ] + }, + "qualifier_list": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "qualifier" + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "qualifier" + }, + { + "type": "SYMBOL", + "name": "qualifier_list" + } + ] + } + ] + }, + "function_declaration": { + "type": "PREC", + "value": 100, + "content": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "qualifiers", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "qualifier_list" + }, + { + "type": "BLANK" + } + ] + } + }, + { + "type": "STRING", + "value": "fn" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "SYMBOL", + "name": "overloadable_operator" + } + ] + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "(" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "FIELD", + "name": "params", + "content": { + "type": "SYMBOL", + "name": "param_list" + } + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "STRING", + "value": ")" + } + ] + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "FIELD", + "name": "body", + "content": { + "type": "SYMBOL", + "name": "statement" + } + } + ] + } + }, + "function_expression": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "fn" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "(" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "FIELD", + "name": "params", + "content": { + "type": "SYMBOL", + "name": "param_list" + } + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "STRING", + "value": ")" + } + ] + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "FIELD", + "name": "body", + "content": { + "type": "SYMBOL", + "name": "statement" + } + } + ] + }, + "class_declaration": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "qualifiers", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "qualifier_list" + }, + { + "type": "BLANK" + } + ] + } + }, + { + "type": "STRING", + "value": "class" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "FIELD", + "name": "body", + "content": { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "statement" + } + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "print": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "print" + }, + { + "type": "FIELD", + "name": "msg", + "content": { + "type": "SYMBOL", + "name": "expression" + } + } + ] + }, + "assert": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "assert" + }, + { + "type": "FIELD", + "name": "test", + "content": { + "type": "SYMBOL", + "name": "expression" + } + } + ] + }, + "expression": { + "type": "PREC", + "value": -1, + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "SYMBOL", + "name": "literal" + }, + { + "type": "SYMBOL", + "name": "call" + }, + { + "type": "SYMBOL", + "name": "access_list" + }, + { + "type": "SYMBOL", + "name": "parenthesized_expression" + } + ] + } + }, + "parenthesized_expression": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "(" + }, + { + "type": "FIELD", + "name": "expression", + "content": { + "type": "SYMBOL", + "name": "expression" + } + }, + { + "type": "STRING", + "value": ")" + } + ] + }, + "access_list": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "accessed", + "content": { + "type": "SYMBOL", + "name": "expression" + } + }, + { + "type": "STRING", + "value": "." + }, + { + "type": "FIELD", + "name": "accessor", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + } + ] + }, + "call": { + "type": "PREC", + "value": 99, + "content": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "callable", + "content": { + "type": "SYMBOL", + "name": "expression" + } + }, + { + "type": "STRING", + "value": "(" + }, + { + "type": "FIELD", + "name": "args", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "argument_list" + }, + { + "type": "BLANK" + } + ] + } + }, + { + "type": "STRING", + "value": ")" + } + ] + } + }, + "template_type": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "vec" + }, + { + "type": "STRING", + "value": "map" + } + ] + }, + "type_name": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "STRING", + "value": "vec" + }, + { + "type": "STRING", + "value": "map" + } + ] + }, + "type": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "type_name" + }, + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "vec" + }, + { + "type": "STRING", + "value": "<" + }, + { + "type": "SYMBOL", + "name": "type" + }, + { + "type": "STRING", + "value": ">" + } + ] + }, + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "map" + }, + { + "type": "STRING", + "value": "<" + }, + { + "type": "SYMBOL", + "name": "type" + }, + { + "type": "STRING", + "value": "," + }, + { + "type": "SYMBOL", + "name": "type" + }, + { + "type": "STRING", + "value": ">" + } + ] + } + ] + }, + "param": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "STRING", + "value": ":" + }, + { + "type": "SYMBOL", + "name": "type" + } + ] + } + ] + }, + "param_list": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "param" + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "param" + }, + { + "type": "STRING", + "value": "," + }, + { + "type": "SYMBOL", + "name": "param_list" + } + ] + } + ] + }, + "argument_list": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "STRING", + "value": "," + }, + { + "type": "SYMBOL", + "name": "argument_list" + } + ] + } + ] + }, + "literal": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "number" + }, + { + "type": "SYMBOL", + "name": "string" + }, + { + "type": "SYMBOL", + "name": "bool" + } + ] + }, + "var_declaration": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "STRING", + "value": ":" + }, + { + "type": "SYMBOL", + "name": "type" + } + ] + }, + "assignment": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "left", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "var_declaration" + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + } + }, + { + "type": "STRING", + "value": "=" + }, + { + "type": "FIELD", + "name": "right", + "content": { + "type": "SYMBOL", + "name": "expression" + } + } + ] + }, + "return": { + "type": "PREC_LEFT", + "value": 100, + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "return" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "BLANK" + } + ] + } + ] + } + }, + "unary_expression": { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "-" + }, + { + "type": "SYMBOL", + "name": "expression" + } + ] + }, + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "!" + }, + { + "type": "SYMBOL", + "name": "expression" + } + ] + } + ] + }, + "overloadable_operator": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "++" + }, + { + "type": "STRING", + "value": "===" + } + ] + }, + "primitive_type": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "any" + }, + { + "type": "STRING", + "value": "int" + }, + { + "type": "STRING", + "value": "str" + }, + { + "type": "STRING", + "value": "bool" + }, + { + "type": "STRING", + "value": "void" + } + ] + }, + "identifier": { + "type": "CHOICE", + "members": [ + { + "type": "PATTERN", + "value": "[_A-z][_A-z0-9]*" + }, + { + "type": "SYMBOL", + "name": "primitive_type" + } + ] + }, + "number": { + "type": "PATTERN", + "value": "\\d+" + }, + "string": { + "type": "PATTERN", + "value": "\"([^\"\\\\]|\\\\.)*\"" + }, + "bool": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "true" + }, + { + "type": "STRING", + "value": "false" + }, + { + "type": "STRING", + "value": "error" + } + ] + } + }, + "extras": [ + { + "type": "PATTERN", + "value": "\\s" + } + ], + "conflicts": [], + "precedences": [], + "externals": [], + "inline": [], + "supertypes": [] } diff --git a/src/node-types.json b/src/node-types.json index 3cc911d..671280c 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -1,720 +1,720 @@ [ - { - "type": "access_list", - "named": true, - "fields": { - "accessed": { - "multiple": false, - "required": true, - "types": [ - { - "type": "expression", - "named": true - } - ] - }, - "accessor": { - "multiple": false, - "required": true, - "types": [ - { - "type": "identifier", - "named": true - } - ] - } - } - }, - { - "type": "argument_list", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "argument_list", - "named": true - }, - { - "type": "expression", - "named": true - } - ] - } - }, - { - "type": "assert", - "named": true, - "fields": { - "test": { - "multiple": false, - "required": true, - "types": [ - { - "type": "expression", - "named": true - } - ] - } - } - }, - { - "type": "assignment", - "named": true, - "fields": { - "left": { - "multiple": false, - "required": true, - "types": [ - { - "type": "identifier", - "named": true - }, - { - "type": "var_declaration", - "named": true - } - ] - }, - "right": { - "multiple": false, - "required": true, - "types": [ - { - "type": "expression", - "named": true - } - ] - } - } - }, - { - "type": "block", - "named": true, - "fields": { - "body": { - "multiple": true, - "required": false, - "types": [ - { - "type": "statement", - "named": true - } - ] - } - } - }, - { - "type": "bool", - "named": true, - "fields": {} - }, - { - "type": "call", - "named": true, - "fields": { - "args": { - "multiple": false, - "required": false, - "types": [ - { - "type": "argument_list", - "named": true - } - ] - }, - "callable": { - "multiple": false, - "required": true, - "types": [ - { - "type": "expression", - "named": true - } - ] - } - } - }, - { - "type": "class_declaration", - "named": true, - "fields": { - "body": { - "multiple": true, - "required": false, - "types": [ - { - "type": "statement", - "named": true - } - ] - }, - "name": { - "multiple": false, - "required": true, - "types": [ - { - "type": "identifier", - "named": true - } - ] - }, - "qualifiers": { - "multiple": false, - "required": false, - "types": [ - { - "type": "qualifier_list", - "named": true - } - ] - } - } - }, - { - "type": "doc_comment", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ - { - "type": "doc_comment_content", - "named": true - } - ] - } - }, - { - "type": "expression", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ - { - "type": "access_list", - "named": true - }, - { - "type": "call", - "named": true - }, - { - "type": "identifier", - "named": true - }, - { - "type": "literal", - "named": true - }, - { - "type": "parenthesized_expression", - "named": true - } - ] - } - }, - { - "type": "function_declaration", - "named": true, - "fields": { - "body": { - "multiple": false, - "required": true, - "types": [ - { - "type": "statement", - "named": true - } - ] - }, - "name": { - "multiple": false, - "required": true, - "types": [ - { - "type": "identifier", - "named": true - }, - { - "type": "overloadable_operator", - "named": true - } - ] - }, - "params": { - "multiple": false, - "required": false, - "types": [ - { - "type": "param_list", - "named": true - } - ] - }, - "qualifiers": { - "multiple": false, - "required": false, - "types": [ - { - "type": "qualifier_list", - "named": true - } - ] - } - } - }, - { - "type": "identifier", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": false, - "types": [ - { - "type": "primitive_type", - "named": true - } - ] - } - }, - { - "type": "import", - "named": true, - "fields": { - "path": { - "multiple": false, - "required": true, - "types": [ - { - "type": "identifier", - "named": true - } - ] - } - } - }, - { - "type": "literal", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ - { - "type": "bool", - "named": true - }, - { - "type": "number", - "named": true - }, - { - "type": "string", - "named": true - } - ] - } - }, - { - "type": "overloadable_operator", - "named": true, - "fields": {} - }, - { - "type": "param", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "identifier", - "named": true - }, - { - "type": "type", - "named": true - } - ] - } - }, - { - "type": "param_list", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "param", - "named": true - }, - { - "type": "param_list", - "named": true - } - ] - } - }, - { - "type": "parenthesized_expression", - "named": true, - "fields": { - "expression": { - "multiple": false, - "required": true, - "types": [ - { - "type": "expression", - "named": true - } - ] - } - } - }, - { - "type": "primitive_type", - "named": true, - "fields": {} - }, - { - "type": "print", - "named": true, - "fields": { - "msg": { - "multiple": false, - "required": true, - "types": [ - { - "type": "expression", - "named": true - } - ] - } - } - }, - { - "type": "qualifier", - "named": true, - "fields": {} - }, - { - "type": "qualifier_list", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "qualifier", - "named": true - }, - { - "type": "qualifier_list", - "named": true - } - ] - } - }, - { - "type": "return", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": false, - "types": [ - { - "type": "expression", - "named": true - } - ] - } - }, - { - "type": "source_file", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": false, - "types": [ - { - "type": "comment", - "named": true - }, - { - "type": "doc_comment", - "named": true - }, - { - "type": "statement", - "named": true - } - ] - } - }, - { - "type": "statement", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ - { - "type": "assert", - "named": true - }, - { - "type": "assignment", - "named": true - }, - { - "type": "block", - "named": true - }, - { - "type": "class_declaration", - "named": true - }, - { - "type": "expression", - "named": true - }, - { - "type": "function_declaration", - "named": true - }, - { - "type": "import", - "named": true - }, - { - "type": "print", - "named": true - }, - { - "type": "return", - "named": true - }, - { - "type": "var_declaration", - "named": true - } - ] - } - }, - { - "type": "type", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "type", - "named": true - }, - { - "type": "type_name", - "named": true - } - ] - } - }, - { - "type": "type_name", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": false, - "types": [ - { - "type": "identifier", - "named": true - } - ] - } - }, - { - "type": "var_declaration", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "identifier", - "named": true - }, - { - "type": "type", - "named": true - } - ] - } - }, - { - "type": "!", - "named": false - }, - { - "type": "##", - "named": false - }, - { - "type": "(", - "named": false - }, - { - "type": ")", - "named": false - }, - { - "type": "++", - "named": false - }, - { - "type": ",", - "named": false - }, - { - "type": "-", - "named": false - }, - { - "type": ".", - "named": false - }, - { - "type": ":", - "named": false - }, - { - "type": "<", - "named": false - }, - { - "type": "=", - "named": false - }, - { - "type": "===", - "named": false - }, - { - "type": ">", - "named": false - }, - { - "type": "any", - "named": false - }, - { - "type": "assert", - "named": false - }, - { - "type": "bool", - "named": false - }, - { - "type": "class", - "named": false - }, - { - "type": "comment", - "named": true - }, - { - "type": "doc_comment_content", - "named": true - }, - { - "type": "error", - "named": false - }, - { - "type": "extern", - "named": false - }, - { - "type": "false", - "named": false - }, - { - "type": "fn", - "named": false - }, - { - "type": "import", - "named": false - }, - { - "type": "int", - "named": false - }, - { - "type": "map", - "named": false - }, - { - "type": "number", - "named": true - }, - { - "type": "print", - "named": false - }, - { - "type": "pure", - "named": false - }, - { - "type": "return", - "named": false - }, - { - "type": "str", - "named": false - }, - { - "type": "string", - "named": true - }, - { - "type": "true", - "named": false - }, - { - "type": "vec", - "named": false - }, - { - "type": "void", - "named": false - }, - { - "type": "{", - "named": false - }, - { - "type": "}", - "named": false - } -] \ No newline at end of file + { + "type": "access_list", + "named": true, + "fields": { + "accessed": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + }, + "accessor": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + } + }, + { + "type": "argument_list", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "argument_list", + "named": true + }, + { + "type": "expression", + "named": true + } + ] + } + }, + { + "type": "assert", + "named": true, + "fields": { + "test": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + } + }, + { + "type": "assignment", + "named": true, + "fields": { + "left": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + }, + { + "type": "var_declaration", + "named": true + } + ] + }, + "right": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + } + }, + { + "type": "block", + "named": true, + "fields": { + "body": { + "multiple": true, + "required": false, + "types": [ + { + "type": "statement", + "named": true + } + ] + } + } + }, + { + "type": "bool", + "named": true, + "fields": {} + }, + { + "type": "call", + "named": true, + "fields": { + "args": { + "multiple": false, + "required": false, + "types": [ + { + "type": "argument_list", + "named": true + } + ] + }, + "callable": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + } + }, + { + "type": "class_declaration", + "named": true, + "fields": { + "body": { + "multiple": true, + "required": false, + "types": [ + { + "type": "statement", + "named": true + } + ] + }, + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + }, + "qualifiers": { + "multiple": false, + "required": false, + "types": [ + { + "type": "qualifier_list", + "named": true + } + ] + } + } + }, + { + "type": "doc_comment", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "doc_comment_content", + "named": true + } + ] + } + }, + { + "type": "expression", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "access_list", + "named": true + }, + { + "type": "call", + "named": true + }, + { + "type": "identifier", + "named": true + }, + { + "type": "literal", + "named": true + }, + { + "type": "parenthesized_expression", + "named": true + } + ] + } + }, + { + "type": "function_declaration", + "named": true, + "fields": { + "body": { + "multiple": false, + "required": true, + "types": [ + { + "type": "statement", + "named": true + } + ] + }, + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + }, + { + "type": "overloadable_operator", + "named": true + } + ] + }, + "params": { + "multiple": false, + "required": false, + "types": [ + { + "type": "param_list", + "named": true + } + ] + }, + "qualifiers": { + "multiple": false, + "required": false, + "types": [ + { + "type": "qualifier_list", + "named": true + } + ] + } + } + }, + { + "type": "identifier", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": false, + "types": [ + { + "type": "primitive_type", + "named": true + } + ] + } + }, + { + "type": "import", + "named": true, + "fields": { + "path": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + } + }, + { + "type": "literal", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "bool", + "named": true + }, + { + "type": "number", + "named": true + }, + { + "type": "string", + "named": true + } + ] + } + }, + { + "type": "overloadable_operator", + "named": true, + "fields": {} + }, + { + "type": "param", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + }, + { + "type": "type", + "named": true + } + ] + } + }, + { + "type": "param_list", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "param", + "named": true + }, + { + "type": "param_list", + "named": true + } + ] + } + }, + { + "type": "parenthesized_expression", + "named": true, + "fields": { + "expression": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + } + }, + { + "type": "primitive_type", + "named": true, + "fields": {} + }, + { + "type": "print", + "named": true, + "fields": { + "msg": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + } + }, + { + "type": "qualifier", + "named": true, + "fields": {} + }, + { + "type": "qualifier_list", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "qualifier", + "named": true + }, + { + "type": "qualifier_list", + "named": true + } + ] + } + }, + { + "type": "return", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": false, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + }, + { + "type": "source_file", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "comment", + "named": true + }, + { + "type": "doc_comment", + "named": true + }, + { + "type": "statement", + "named": true + } + ] + } + }, + { + "type": "statement", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "assert", + "named": true + }, + { + "type": "assignment", + "named": true + }, + { + "type": "block", + "named": true + }, + { + "type": "class_declaration", + "named": true + }, + { + "type": "expression", + "named": true + }, + { + "type": "function_declaration", + "named": true + }, + { + "type": "import", + "named": true + }, + { + "type": "print", + "named": true + }, + { + "type": "return", + "named": true + }, + { + "type": "var_declaration", + "named": true + } + ] + } + }, + { + "type": "type", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "type", + "named": true + }, + { + "type": "type_name", + "named": true + } + ] + } + }, + { + "type": "type_name", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": false, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + { + "type": "var_declaration", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + }, + { + "type": "type", + "named": true + } + ] + } + }, + { + "type": "!", + "named": false + }, + { + "type": "##", + "named": false + }, + { + "type": "(", + "named": false + }, + { + "type": ")", + "named": false + }, + { + "type": "++", + "named": false + }, + { + "type": ",", + "named": false + }, + { + "type": "-", + "named": false + }, + { + "type": ".", + "named": false + }, + { + "type": ":", + "named": false + }, + { + "type": "<", + "named": false + }, + { + "type": "=", + "named": false + }, + { + "type": "===", + "named": false + }, + { + "type": ">", + "named": false + }, + { + "type": "any", + "named": false + }, + { + "type": "assert", + "named": false + }, + { + "type": "bool", + "named": false + }, + { + "type": "class", + "named": false + }, + { + "type": "comment", + "named": true + }, + { + "type": "doc_comment_content", + "named": true + }, + { + "type": "error", + "named": false + }, + { + "type": "extern", + "named": false + }, + { + "type": "false", + "named": false + }, + { + "type": "fn", + "named": false + }, + { + "type": "import", + "named": false + }, + { + "type": "int", + "named": false + }, + { + "type": "map", + "named": false + }, + { + "type": "number", + "named": true + }, + { + "type": "print", + "named": false + }, + { + "type": "pure", + "named": false + }, + { + "type": "return", + "named": false + }, + { + "type": "str", + "named": false + }, + { + "type": "string", + "named": true + }, + { + "type": "true", + "named": false + }, + { + "type": "vec", + "named": false + }, + { + "type": "void", + "named": false + }, + { + "type": "{", + "named": false + }, + { + "type": "}", + "named": false + } +]