diff --git a/grammar.js b/grammar.js index 0655b91..aa29845 100644 --- a/grammar.js +++ b/grammar.js @@ -5,44 +5,56 @@ module.exports = grammar({ name: "flamingo", rules: { - source_file: $ => repeat($.statement), - - statement: $ => choice( - $.expression, - $.print, - $.assignment, - ), - - print: $ => seq( - "print", - field("msg", $.expression), - ), - - expression: $ => choice( - $.identifier, - $.literal, - ), - - literal: $ => choice( - $.number, - $.string, - ), - - assignment: $ => seq( - field("left", $.identifier), - "=", - field("right", $.expression), - ), - - block: $ => seq("{", repeat($.statement), "}"), - - unary_expression: $ => choice( - seq("-", $.expression), - seq("!", $.expression), - ), + source_file: $ => repeat(choice($.statement, $.comment)), + + comment: _ => token(seq("#", /.*/)), + + statement: $ => + choice($.block, $.expression, $.print, $.assignment, $.import, $.function_declaration, $.class_declaration), + + block: $ => seq("{", field("body", repeat($.statement)), "}"), + + import: $ => seq("import", field("path", $.identifier)), + + function_declaration: $ => + prec( + 100, + seq( + "fn", + field("name", $.identifier), + optional(seq("(", optional(field("params", $.param_list)), ")")), + field("body", $.statement), + ), + ), + + function_expression: $ => + seq("fn", optional(seq("(", optional(field("params", $.param_list)), ")")), field("body", $.statement)), + + class_declaration: $ => seq("class", field("name", $.identifier), "{", field("body", repeat($.statement)), "}"), + + print: $ => seq("print", field("msg", $.expression)), + + expression: $ => prec(-1, choice($.identifier, $.literal, $.call, $.access_list, $.parenthesized_expression)), + + parenthesized_expression: $ => seq("(", field("expression", $.expression), ")"), + + access_list: $ => seq(field("accessed", $.expression), ".", field("accessor", $.identifier)), + + call: $ => prec(99, seq(field("callable", $.expression), "(", field("args", optional($.argument_list)), ")")), + + param_list: $ => choice($.identifier, seq($.identifier, ",", $.param_list)), + + argument_list: $ => choice($.expression, seq($.expression, ",", $.argument_list)), + + literal: $ => choice($.number, $.string, $.bool), + + assignment: $ => seq(field("left", $.identifier), "=", field("right", $.expression)), + + unary_expression: $ => choice(seq("-", $.expression), seq("!", $.expression)), identifier: _ => /[_A-z][_A-z0-9]*/, number: _ => /\d+/, string: _ => /"([^"\\]|\\.)*"/, + bool: _ => choice("true", "false", "error"), }, }) diff --git a/queries/highlights.scm b/queries/highlights.scm index 5994220..b7b6bce 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -1,2 +1,46 @@ -"print" @keyword +; This Source Form is subject to the terms of the AQUA Software License, +; v. 1.0. Copyright (c) 2024 Aymeric Wibo + +(comment) @comment + +; function calls + +(call + callable: (expression (identifier)) @function +) + +; builtins + +[ + "print" +] @function.builtin + +; identifiers + +(identifier) @variable + +; declarations + +(function_declaration name: (identifier) @function) +(class_declaration name: (identifier) @function) + +; operators + +; [ +; "+" +; ] @operator + +; keywords + +[ + "print" + "fn" + "class" + "import" +] @keyword + +; literals + (string) @string +(number) @number +(bool) @constant.builtin diff --git a/src/grammar.json b/src/grammar.json index 6452c7b..952ca07 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -1,171 +1,565 @@ { - "name": "flamingo", - "rules": { - "source_file": { - "type": "REPEAT", - "content": { - "type": "SYMBOL", - "name": "statement" - } - }, - "statement": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "expression" - }, - { - "type": "SYMBOL", - "name": "print" - }, - { - "type": "SYMBOL", - "name": "assignment" - } - ] - }, - "print": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "print" - }, - { - "type": "FIELD", - "name": "msg", - "content": { - "type": "SYMBOL", - "name": "expression" - } - } - ] - }, - "expression": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "identifier" - }, - { - "type": "SYMBOL", - "name": "literal" - } - ] - }, - "literal": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "number" - }, - { - "type": "SYMBOL", - "name": "string" - } - ] - }, - "assignment": { - "type": "SEQ", - "members": [ - { - "type": "FIELD", - "name": "left", - "content": { - "type": "SYMBOL", - "name": "identifier" - } - }, - { - "type": "STRING", - "value": "=" - }, - { - "type": "FIELD", - "name": "right", - "content": { - "type": "SYMBOL", - "name": "expression" - } - } - ] - }, - "block": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "{" - }, - { - "type": "REPEAT", - "content": { - "type": "SYMBOL", - "name": "statement" - } - }, - { - "type": "STRING", - "value": "}" - } - ] - }, - "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" - } - ] - } - ] - }, - "identifier": { - "type": "PATTERN", - "value": "[_A-z][_A-z0-9]*" - }, - "number": { - "type": "PATTERN", - "value": "\\d+" - }, - "string": { - "type": "PATTERN", - "value": "\"([^\"\\\\]|\\\\.)*\"" - } - }, - "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": "comment" + } + ] + } + }, + "comment": { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "#" + }, + { + "type": "PATTERN", + "value": ".*" + } + ] + } + }, + "statement": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "block" + }, + { + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "SYMBOL", + "name": "print" + }, + { + "type": "SYMBOL", + "name": "assignment" + }, + { + "type": "SYMBOL", + "name": "import" + }, + { + "type": "SYMBOL", + "name": "function_declaration" + }, + { + "type": "SYMBOL", + "name": "class_declaration" + } + ] + }, + "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" + } + } + ] + }, + "function_declaration": { + "type": "PREC", + "value": 100, + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "fn" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "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": "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" + } + } + ] + }, + "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": ")" + } + ] + } + }, + "param_list": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "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" + } + ] + }, + "assignment": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "left", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "STRING", + "value": "=" + }, + { + "type": "FIELD", + "name": "right", + "content": { + "type": "SYMBOL", + "name": "expression" + } + } + ] + }, + "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" + } + ] + } + ] + }, + "identifier": { + "type": "PATTERN", + "value": "[_A-z][_A-z0-9]*" + }, + "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 8cb17bd..9e11733 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -1,156 +1,441 @@ [ - { - "type": "assignment", - "named": true, - "fields": { - "left": { - "multiple": false, - "required": true, - "types": [ - { - "type": "identifier", - "named": true - } - ] - }, - "right": { - "multiple": false, - "required": true, - "types": [ - { - "type": "expression", - "named": true - } - ] - } - } - }, - { - "type": "expression", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ - { - "type": "identifier", - "named": true - }, - { - "type": "literal", - "named": true - } - ] - } - }, - { - "type": "literal", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ - { - "type": "number", - "named": true - }, - { - "type": "string", - "named": true - } - ] - } - }, - { - "type": "print", - "named": true, - "fields": { - "msg": { - "multiple": false, - "required": true, - "types": [ - { - "type": "expression", - "named": true - } - ] - } - } - }, - { - "type": "source_file", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": false, - "types": [ - { - "type": "statement", - "named": true - } - ] - } - }, - { - "type": "statement", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ - { - "type": "assignment", - "named": true - }, - { - "type": "expression", - "named": true - }, - { - "type": "print", - "named": true - } - ] - } - }, - { - "type": "!", - "named": false - }, - { - "type": "-", - "named": false - }, - { - "type": "=", - "named": false - }, - { - "type": "identifier", - "named": true - }, - { - "type": "number", - "named": true - }, - { - "type": "print", - "named": false - }, - { - "type": "string", - "named": true - }, - { - "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": "assignment", + "named": true, + "fields": { + "left": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "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 + } + ] + } + } + }, + { + "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 + } + ] + }, + "params": { + "multiple": false, + "required": false, + "types": [ + { + "type": "param_list", + "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": "param_list", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + }, + { + "type": "param_list", + "named": true + } + ] + } + }, + { + "type": "parenthesized_expression", + "named": true, + "fields": { + "expression": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + } + }, + { + "type": "print", + "named": true, + "fields": { + "msg": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + } + }, + { + "type": "source_file", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "comment", + "named": true + }, + { + "type": "statement", + "named": true + } + ] + } + }, + { + "type": "statement", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "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": "!", + "named": false + }, + { + "type": "(", + "named": false + }, + { + "type": ")", + "named": false + }, + { + "type": ",", + "named": false + }, + { + "type": "-", + "named": false + }, + { + "type": ".", + "named": false + }, + { + "type": "=", + "named": false + }, + { + "type": "class", + "named": false + }, + { + "type": "comment", + "named": true + }, + { + "type": "error", + "named": false + }, + { + "type": "false", + "named": false + }, + { + "type": "fn", + "named": false + }, + { + "type": "identifier", + "named": true + }, + { + "type": "import", + "named": false + }, + { + "type": "number", + "named": true + }, + { + "type": "print", + "named": false + }, + { + "type": "string", + "named": true + }, + { + "type": "true", + "named": false + }, + { + "type": "{", + "named": false + }, + { + "type": "}", + "named": false + } +] diff --git a/src/parser.c b/src/parser.c index e703566..ba07be6 100644 --- a/src/parser.c +++ b/src/parser.c @@ -6,73 +6,139 @@ #endif #define LANGUAGE_VERSION 14 -#define STATE_COUNT 13 -#define LARGE_STATE_COUNT 4 -#define SYMBOL_COUNT 17 +#define STATE_COUNT 53 +#define LARGE_STATE_COUNT 12 +#define SYMBOL_COUNT 39 #define ALIAS_COUNT 0 -#define TOKEN_COUNT 10 +#define TOKEN_COUNT 21 #define EXTERNAL_TOKEN_COUNT 0 -#define FIELD_COUNT 3 -#define MAX_ALIAS_SEQUENCE_LENGTH 3 -#define PRODUCTION_ID_COUNT 3 +#define FIELD_COUNT 12 +#define MAX_ALIAS_SEQUENCE_LENGTH 6 +#define PRODUCTION_ID_COUNT 14 enum ts_symbol_identifiers { - anon_sym_print = 1, - anon_sym_EQ = 2, - anon_sym_LBRACE = 3, - anon_sym_RBRACE = 4, - anon_sym_DASH = 5, - anon_sym_BANG = 6, - sym_identifier = 7, - sym_number = 8, - sym_string = 9, - sym_source_file = 10, - sym_statement = 11, - sym_print = 12, - sym_expression = 13, - sym_literal = 14, - sym_assignment = 15, - aux_sym_source_file_repeat1 = 16, + sym_comment = 1, + anon_sym_LBRACE = 2, + anon_sym_RBRACE = 3, + anon_sym_import = 4, + anon_sym_fn = 5, + anon_sym_LPAREN = 6, + anon_sym_RPAREN = 7, + anon_sym_class = 8, + anon_sym_print = 9, + anon_sym_DOT = 10, + anon_sym_COMMA = 11, + anon_sym_EQ = 12, + anon_sym_DASH = 13, + anon_sym_BANG = 14, + sym_identifier = 15, + sym_number = 16, + sym_string = 17, + anon_sym_true = 18, + anon_sym_false = 19, + anon_sym_error = 20, + sym_source_file = 21, + sym_statement = 22, + sym_block = 23, + sym_import = 24, + sym_function_declaration = 25, + sym_class_declaration = 26, + sym_print = 27, + sym_expression = 28, + sym_parenthesized_expression = 29, + sym_access_list = 30, + sym_call = 31, + sym_param_list = 32, + sym_argument_list = 33, + sym_literal = 34, + sym_assignment = 35, + sym_bool = 36, + aux_sym_source_file_repeat1 = 37, + aux_sym_block_repeat1 = 38, }; static const char * const ts_symbol_names[] = { [ts_builtin_sym_end] = "end", - [anon_sym_print] = "print", - [anon_sym_EQ] = "=", + [sym_comment] = "comment", [anon_sym_LBRACE] = "{", [anon_sym_RBRACE] = "}", + [anon_sym_import] = "import", + [anon_sym_fn] = "fn", + [anon_sym_LPAREN] = "(", + [anon_sym_RPAREN] = ")", + [anon_sym_class] = "class", + [anon_sym_print] = "print", + [anon_sym_DOT] = ".", + [anon_sym_COMMA] = ",", + [anon_sym_EQ] = "=", [anon_sym_DASH] = "-", [anon_sym_BANG] = "!", [sym_identifier] = "identifier", [sym_number] = "number", [sym_string] = "string", + [anon_sym_true] = "true", + [anon_sym_false] = "false", + [anon_sym_error] = "error", [sym_source_file] = "source_file", [sym_statement] = "statement", + [sym_block] = "block", + [sym_import] = "import", + [sym_function_declaration] = "function_declaration", + [sym_class_declaration] = "class_declaration", [sym_print] = "print", [sym_expression] = "expression", + [sym_parenthesized_expression] = "parenthesized_expression", + [sym_access_list] = "access_list", + [sym_call] = "call", + [sym_param_list] = "param_list", + [sym_argument_list] = "argument_list", [sym_literal] = "literal", [sym_assignment] = "assignment", + [sym_bool] = "bool", [aux_sym_source_file_repeat1] = "source_file_repeat1", + [aux_sym_block_repeat1] = "block_repeat1", }; static const TSSymbol ts_symbol_map[] = { [ts_builtin_sym_end] = ts_builtin_sym_end, - [anon_sym_print] = anon_sym_print, - [anon_sym_EQ] = anon_sym_EQ, + [sym_comment] = sym_comment, [anon_sym_LBRACE] = anon_sym_LBRACE, [anon_sym_RBRACE] = anon_sym_RBRACE, + [anon_sym_import] = anon_sym_import, + [anon_sym_fn] = anon_sym_fn, + [anon_sym_LPAREN] = anon_sym_LPAREN, + [anon_sym_RPAREN] = anon_sym_RPAREN, + [anon_sym_class] = anon_sym_class, + [anon_sym_print] = anon_sym_print, + [anon_sym_DOT] = anon_sym_DOT, + [anon_sym_COMMA] = anon_sym_COMMA, + [anon_sym_EQ] = anon_sym_EQ, [anon_sym_DASH] = anon_sym_DASH, [anon_sym_BANG] = anon_sym_BANG, [sym_identifier] = sym_identifier, [sym_number] = sym_number, [sym_string] = sym_string, + [anon_sym_true] = anon_sym_true, + [anon_sym_false] = anon_sym_false, + [anon_sym_error] = anon_sym_error, [sym_source_file] = sym_source_file, [sym_statement] = sym_statement, + [sym_block] = sym_block, + [sym_import] = sym_import, + [sym_function_declaration] = sym_function_declaration, + [sym_class_declaration] = sym_class_declaration, [sym_print] = sym_print, [sym_expression] = sym_expression, + [sym_parenthesized_expression] = sym_parenthesized_expression, + [sym_access_list] = sym_access_list, + [sym_call] = sym_call, + [sym_param_list] = sym_param_list, + [sym_argument_list] = sym_argument_list, [sym_literal] = sym_literal, [sym_assignment] = sym_assignment, + [sym_bool] = sym_bool, [aux_sym_source_file_repeat1] = aux_sym_source_file_repeat1, + [aux_sym_block_repeat1] = aux_sym_block_repeat1, }; static const TSSymbolMetadata ts_symbol_metadata[] = { @@ -80,19 +146,51 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = false, .named = true, }, + [sym_comment] = { + .visible = true, + .named = true, + }, + [anon_sym_LBRACE] = { + .visible = true, + .named = false, + }, + [anon_sym_RBRACE] = { + .visible = true, + .named = false, + }, + [anon_sym_import] = { + .visible = true, + .named = false, + }, + [anon_sym_fn] = { + .visible = true, + .named = false, + }, + [anon_sym_LPAREN] = { + .visible = true, + .named = false, + }, + [anon_sym_RPAREN] = { + .visible = true, + .named = false, + }, + [anon_sym_class] = { + .visible = true, + .named = false, + }, [anon_sym_print] = { .visible = true, .named = false, }, - [anon_sym_EQ] = { + [anon_sym_DOT] = { .visible = true, .named = false, }, - [anon_sym_LBRACE] = { + [anon_sym_COMMA] = { .visible = true, .named = false, }, - [anon_sym_RBRACE] = { + [anon_sym_EQ] = { .visible = true, .named = false, }, @@ -116,6 +214,18 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [anon_sym_true] = { + .visible = true, + .named = false, + }, + [anon_sym_false] = { + .visible = true, + .named = false, + }, + [anon_sym_error] = { + .visible = true, + .named = false, + }, [sym_source_file] = { .visible = true, .named = true, @@ -124,6 +234,22 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym_block] = { + .visible = true, + .named = true, + }, + [sym_import] = { + .visible = true, + .named = true, + }, + [sym_function_declaration] = { + .visible = true, + .named = true, + }, + [sym_class_declaration] = { + .visible = true, + .named = true, + }, [sym_print] = { .visible = true, .named = true, @@ -132,6 +258,26 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym_parenthesized_expression] = { + .visible = true, + .named = true, + }, + [sym_access_list] = { + .visible = true, + .named = true, + }, + [sym_call] = { + .visible = true, + .named = true, + }, + [sym_param_list] = { + .visible = true, + .named = true, + }, + [sym_argument_list] = { + .visible = true, + .named = true, + }, [sym_literal] = { .visible = true, .named = true, @@ -140,36 +286,102 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym_bool] = { + .visible = true, + .named = true, + }, [aux_sym_source_file_repeat1] = { .visible = false, .named = false, }, + [aux_sym_block_repeat1] = { + .visible = false, + .named = false, + }, }; enum ts_field_identifiers { - field_left = 1, - field_msg = 2, - field_right = 3, + field_accessed = 1, + field_accessor = 2, + field_args = 3, + field_body = 4, + field_callable = 5, + field_expression = 6, + field_left = 7, + field_msg = 8, + field_name = 9, + field_params = 10, + field_path = 11, + field_right = 12, }; static const char * const ts_field_names[] = { [0] = NULL, + [field_accessed] = "accessed", + [field_accessor] = "accessor", + [field_args] = "args", + [field_body] = "body", + [field_callable] = "callable", + [field_expression] = "expression", [field_left] = "left", [field_msg] = "msg", + [field_name] = "name", + [field_params] = "params", + [field_path] = "path", [field_right] = "right", }; static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = { [1] = {.index = 0, .length = 1}, - [2] = {.index = 1, .length = 2}, + [2] = {.index = 1, .length = 1}, + [3] = {.index = 2, .length = 1}, + [4] = {.index = 3, .length = 2}, + [5] = {.index = 5, .length = 1}, + [6] = {.index = 6, .length = 2}, + [7] = {.index = 8, .length = 1}, + [8] = {.index = 9, .length = 2}, + [9] = {.index = 11, .length = 1}, + [10] = {.index = 12, .length = 2}, + [11] = {.index = 14, .length = 2}, + [12] = {.index = 16, .length = 2}, + [13] = {.index = 18, .length = 3}, }; static const TSFieldMapEntry ts_field_map_entries[] = { [0] = - {field_msg, 1}, + {field_path, 1}, [1] = + {field_msg, 1}, + [2] = + {field_body, 1}, + [3] = + {field_body, 2}, + {field_name, 1}, + [5] = + {field_expression, 1}, + [6] = {field_left, 0}, {field_right, 2}, + [8] = + {field_callable, 0}, + [9] = + {field_accessed, 0}, + {field_accessor, 2}, + [11] = + {field_name, 1}, + [12] = + {field_args, 2}, + {field_callable, 0}, + [14] = + {field_body, 4}, + {field_name, 1}, + [16] = + {field_body, 3}, + {field_name, 1}, + [18] = + {field_body, 5}, + {field_name, 1}, + {field_params, 3}, }; static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { @@ -194,6 +406,46 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [10] = 10, [11] = 11, [12] = 12, + [13] = 13, + [14] = 14, + [15] = 15, + [16] = 16, + [17] = 17, + [18] = 18, + [19] = 19, + [20] = 20, + [21] = 21, + [22] = 22, + [23] = 23, + [24] = 24, + [25] = 25, + [26] = 26, + [27] = 27, + [28] = 28, + [29] = 29, + [30] = 30, + [31] = 31, + [32] = 32, + [33] = 33, + [34] = 34, + [35] = 35, + [36] = 36, + [37] = 37, + [38] = 38, + [39] = 39, + [40] = 40, + [41] = 41, + [42] = 42, + [43] = 43, + [44] = 44, + [45] = 45, + [46] = 46, + [47] = 47, + [48] = 48, + [49] = 49, + [50] = 50, + [51] = 51, + [52] = 52, }; static bool ts_lex(TSLexer *lexer, TSStateId state) { @@ -201,45 +453,62 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { eof = lexer->eof(lexer); switch (state) { case 0: - if (eof) ADVANCE(4); - if (lookahead == '!') ADVANCE(10); + if (eof) ADVANCE(5); + if (lookahead == '!') ADVANCE(19); if (lookahead == '"') ADVANCE(2); - if (lookahead == '-') ADVANCE(9); - if (lookahead == '=') ADVANCE(6); - if (lookahead == 'p') ADVANCE(13); + if (lookahead == '#') ADVANCE(6); + if (lookahead == '(') ADVANCE(11); + if (lookahead == ')') ADVANCE(12); + if (lookahead == ',') ADVANCE(16); + if (lookahead == '-') ADVANCE(18); + if (lookahead == '.') ADVANCE(15); + if (lookahead == '=') ADVANCE(17); + if (lookahead == 'c') ADVANCE(26); + if (lookahead == 'e') ADVANCE(38); + if (lookahead == 'f') ADVANCE(21); + if (lookahead == 'i') ADVANCE(28); + if (lookahead == 'p') ADVANCE(33); + if (lookahead == 't') ADVANCE(34); if (lookahead == '{') ADVANCE(7); if (lookahead == '}') ADVANCE(8); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') SKIP(0) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(16); - if (('A' <= lookahead && lookahead <= 'z')) ADVANCE(15); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(46); + if (('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 1: if (lookahead == '"') ADVANCE(2); + if (lookahead == '(') ADVANCE(11); + if (lookahead == ')') ADVANCE(12); + if (lookahead == 'e') ADVANCE(38); + if (lookahead == 'f') ADVANCE(22); + if (lookahead == 't') ADVANCE(34); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') SKIP(1) - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(16); - if (('A' <= lookahead && lookahead <= 'z')) ADVANCE(15); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(46); + if (('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 2: - if (lookahead == '"') ADVANCE(17); - if (lookahead == '\\') ADVANCE(3); + if (lookahead == '"') ADVANCE(47); + if (lookahead == '\\') ADVANCE(4); if (lookahead != 0) ADVANCE(2); END_STATE(); case 3: - if (lookahead != 0 && - lookahead != '\n') ADVANCE(2); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') SKIP(3) + if (('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 4: - ACCEPT_TOKEN(ts_builtin_sym_end); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(2); END_STATE(); case 5: - ACCEPT_TOKEN(anon_sym_print); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'z')) ADVANCE(15); + ACCEPT_TOKEN(ts_builtin_sym_end); END_STATE(); case 6: - ACCEPT_TOKEN(anon_sym_EQ); + ACCEPT_TOKEN(sym_comment); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(6); END_STATE(); case 7: ACCEPT_TOKEN(anon_sym_LBRACE); @@ -248,47 +517,224 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { ACCEPT_TOKEN(anon_sym_RBRACE); END_STATE(); case 9: - ACCEPT_TOKEN(anon_sym_DASH); + ACCEPT_TOKEN(anon_sym_import); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 10: - ACCEPT_TOKEN(anon_sym_BANG); + ACCEPT_TOKEN(anon_sym_fn); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 11: + ACCEPT_TOKEN(anon_sym_LPAREN); + END_STATE(); + case 12: + ACCEPT_TOKEN(anon_sym_RPAREN); + END_STATE(); + case 13: + ACCEPT_TOKEN(anon_sym_class); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 14: + ACCEPT_TOKEN(anon_sym_print); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 15: + ACCEPT_TOKEN(anon_sym_DOT); + END_STATE(); + case 16: + ACCEPT_TOKEN(anon_sym_COMMA); + END_STATE(); + case 17: + ACCEPT_TOKEN(anon_sym_EQ); + END_STATE(); + case 18: + ACCEPT_TOKEN(anon_sym_DASH); + END_STATE(); + case 19: + ACCEPT_TOKEN(anon_sym_BANG); + END_STATE(); + case 20: ACCEPT_TOKEN(sym_identifier); - if (lookahead == 'i') ADVANCE(12); + if (lookahead == 'a') ADVANCE(41); if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'z')) ADVANCE(15); + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); - case 12: + case 21: ACCEPT_TOKEN(sym_identifier); - if (lookahead == 'n') ADVANCE(14); + if (lookahead == 'a') ADVANCE(27); + if (lookahead == 'n') ADVANCE(10); if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'z')) ADVANCE(15); + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); - case 13: + case 22: ACCEPT_TOKEN(sym_identifier); - if (lookahead == 'r') ADVANCE(11); + if (lookahead == 'a') ADVANCE(27); if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'z')) ADVANCE(15); + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); - case 14: + case 23: ACCEPT_TOKEN(sym_identifier); - if (lookahead == 't') ADVANCE(5); + if (lookahead == 'e') ADVANCE(48); if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'z')) ADVANCE(15); + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); - case 15: + case 24: ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'e') ADVANCE(49); if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'z')) ADVANCE(15); + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); - case 16: + case 25: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'i') ADVANCE(29); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 26: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'l') ADVANCE(20); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 27: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'l') ADVANCE(40); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 28: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'm') ADVANCE(32); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 29: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'n') ADVANCE(42); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 30: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'o') ADVANCE(36); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 31: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'o') ADVANCE(37); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 32: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'p') ADVANCE(31); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 33: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'r') ADVANCE(25); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 34: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'r') ADVANCE(44); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 35: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'r') ADVANCE(30); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 36: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'r') ADVANCE(50); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 37: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'r') ADVANCE(43); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 38: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'r') ADVANCE(35); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 39: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 's') ADVANCE(13); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 40: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 's') ADVANCE(24); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 41: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 's') ADVANCE(39); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 42: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 't') ADVANCE(14); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 43: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 't') ADVANCE(9); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 44: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'u') ADVANCE(23); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 45: + ACCEPT_TOKEN(sym_identifier); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 46: ACCEPT_TOKEN(sym_number); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(16); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(46); END_STATE(); - case 17: + case 47: ACCEPT_TOKEN(sym_string); END_STATE(); + case 48: + ACCEPT_TOKEN(anon_sym_true); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 49: + ACCEPT_TOKEN(anon_sym_false); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); + case 50: + ACCEPT_TOKEN(anon_sym_error); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'z')) ADVANCE(45); + END_STATE(); default: return false; } @@ -300,184 +746,1140 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [2] = {.lex_state = 0}, [3] = {.lex_state = 0}, [4] = {.lex_state = 0}, - [5] = {.lex_state = 1}, + [5] = {.lex_state = 0}, [6] = {.lex_state = 0}, [7] = {.lex_state = 0}, [8] = {.lex_state = 0}, [9] = {.lex_state = 0}, - [10] = {.lex_state = 1}, + [10] = {.lex_state = 0}, [11] = {.lex_state = 0}, [12] = {.lex_state = 0}, + [13] = {.lex_state = 0}, + [14] = {.lex_state = 0}, + [15] = {.lex_state = 0}, + [16] = {.lex_state = 0}, + [17] = {.lex_state = 0}, + [18] = {.lex_state = 0}, + [19] = {.lex_state = 0}, + [20] = {.lex_state = 0}, + [21] = {.lex_state = 0}, + [22] = {.lex_state = 0}, + [23] = {.lex_state = 0}, + [24] = {.lex_state = 1}, + [25] = {.lex_state = 0}, + [26] = {.lex_state = 0}, + [27] = {.lex_state = 0}, + [28] = {.lex_state = 1}, + [29] = {.lex_state = 0}, + [30] = {.lex_state = 0}, + [31] = {.lex_state = 0}, + [32] = {.lex_state = 0}, + [33] = {.lex_state = 0}, + [34] = {.lex_state = 1}, + [35] = {.lex_state = 1}, + [36] = {.lex_state = 1}, + [37] = {.lex_state = 1}, + [38] = {.lex_state = 0}, + [39] = {.lex_state = 0}, + [40] = {.lex_state = 0}, + [41] = {.lex_state = 3}, + [42] = {.lex_state = 0}, + [43] = {.lex_state = 0}, + [44] = {.lex_state = 0}, + [45] = {.lex_state = 0}, + [46] = {.lex_state = 3}, + [47] = {.lex_state = 3}, + [48] = {.lex_state = 0}, + [49] = {.lex_state = 3}, + [50] = {.lex_state = 0}, + [51] = {.lex_state = 0}, + [52] = {.lex_state = 3}, }; static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [0] = { [ts_builtin_sym_end] = ACTIONS(1), - [anon_sym_print] = ACTIONS(1), - [anon_sym_EQ] = ACTIONS(1), + [sym_comment] = ACTIONS(1), [anon_sym_LBRACE] = ACTIONS(1), [anon_sym_RBRACE] = ACTIONS(1), + [anon_sym_import] = ACTIONS(1), + [anon_sym_fn] = ACTIONS(1), + [anon_sym_LPAREN] = ACTIONS(1), + [anon_sym_RPAREN] = ACTIONS(1), + [anon_sym_class] = ACTIONS(1), + [anon_sym_print] = ACTIONS(1), + [anon_sym_DOT] = ACTIONS(1), + [anon_sym_COMMA] = ACTIONS(1), + [anon_sym_EQ] = ACTIONS(1), [anon_sym_DASH] = ACTIONS(1), [anon_sym_BANG] = ACTIONS(1), [sym_identifier] = ACTIONS(1), [sym_number] = ACTIONS(1), [sym_string] = ACTIONS(1), + [anon_sym_true] = ACTIONS(1), + [anon_sym_false] = ACTIONS(1), + [anon_sym_error] = ACTIONS(1), }, [1] = { - [sym_source_file] = STATE(12), - [sym_statement] = STATE(2), - [sym_print] = STATE(7), - [sym_expression] = STATE(7), - [sym_literal] = STATE(8), - [sym_assignment] = STATE(7), - [aux_sym_source_file_repeat1] = STATE(2), + [sym_source_file] = STATE(44), + [sym_statement] = STATE(3), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [aux_sym_source_file_repeat1] = STATE(3), [ts_builtin_sym_end] = ACTIONS(3), - [anon_sym_print] = ACTIONS(5), - [sym_identifier] = ACTIONS(7), - [sym_number] = ACTIONS(9), - [sym_string] = ACTIONS(9), + [sym_comment] = ACTIONS(5), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_import] = ACTIONS(9), + [anon_sym_fn] = ACTIONS(11), + [anon_sym_LPAREN] = ACTIONS(13), + [anon_sym_class] = ACTIONS(15), + [anon_sym_print] = ACTIONS(17), + [sym_identifier] = ACTIONS(19), + [sym_number] = ACTIONS(21), + [sym_string] = ACTIONS(21), + [anon_sym_true] = ACTIONS(23), + [anon_sym_false] = ACTIONS(23), + [anon_sym_error] = ACTIONS(23), }, [2] = { - [sym_statement] = STATE(3), - [sym_print] = STATE(7), - [sym_expression] = STATE(7), - [sym_literal] = STATE(8), - [sym_assignment] = STATE(7), - [aux_sym_source_file_repeat1] = STATE(3), - [ts_builtin_sym_end] = ACTIONS(11), - [anon_sym_print] = ACTIONS(5), - [sym_identifier] = ACTIONS(7), - [sym_number] = ACTIONS(9), - [sym_string] = ACTIONS(9), + [sym_statement] = STATE(2), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [aux_sym_source_file_repeat1] = STATE(2), + [ts_builtin_sym_end] = ACTIONS(25), + [sym_comment] = ACTIONS(27), + [anon_sym_LBRACE] = ACTIONS(30), + [anon_sym_import] = ACTIONS(33), + [anon_sym_fn] = ACTIONS(36), + [anon_sym_LPAREN] = ACTIONS(39), + [anon_sym_class] = ACTIONS(42), + [anon_sym_print] = ACTIONS(45), + [sym_identifier] = ACTIONS(48), + [sym_number] = ACTIONS(51), + [sym_string] = ACTIONS(51), + [anon_sym_true] = ACTIONS(54), + [anon_sym_false] = ACTIONS(54), + [anon_sym_error] = ACTIONS(54), }, [3] = { - [sym_statement] = STATE(3), - [sym_print] = STATE(7), - [sym_expression] = STATE(7), - [sym_literal] = STATE(8), - [sym_assignment] = STATE(7), - [aux_sym_source_file_repeat1] = STATE(3), - [ts_builtin_sym_end] = ACTIONS(13), - [anon_sym_print] = ACTIONS(15), - [sym_identifier] = ACTIONS(18), + [sym_statement] = STATE(2), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [aux_sym_source_file_repeat1] = STATE(2), + [ts_builtin_sym_end] = ACTIONS(57), + [sym_comment] = ACTIONS(59), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_import] = ACTIONS(9), + [anon_sym_fn] = ACTIONS(11), + [anon_sym_LPAREN] = ACTIONS(13), + [anon_sym_class] = ACTIONS(15), + [anon_sym_print] = ACTIONS(17), + [sym_identifier] = ACTIONS(19), + [sym_number] = ACTIONS(21), + [sym_string] = ACTIONS(21), + [anon_sym_true] = ACTIONS(23), + [anon_sym_false] = ACTIONS(23), + [anon_sym_error] = ACTIONS(23), + }, + [4] = { + [sym_statement] = STATE(8), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [aux_sym_block_repeat1] = STATE(8), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_RBRACE] = ACTIONS(61), + [anon_sym_import] = ACTIONS(9), + [anon_sym_fn] = ACTIONS(11), + [anon_sym_LPAREN] = ACTIONS(13), + [anon_sym_class] = ACTIONS(15), + [anon_sym_print] = ACTIONS(17), + [sym_identifier] = ACTIONS(19), [sym_number] = ACTIONS(21), [sym_string] = ACTIONS(21), + [anon_sym_true] = ACTIONS(23), + [anon_sym_false] = ACTIONS(23), + [anon_sym_error] = ACTIONS(23), + }, + [5] = { + [sym_statement] = STATE(7), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [aux_sym_block_repeat1] = STATE(7), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_RBRACE] = ACTIONS(63), + [anon_sym_import] = ACTIONS(9), + [anon_sym_fn] = ACTIONS(11), + [anon_sym_LPAREN] = ACTIONS(13), + [anon_sym_class] = ACTIONS(15), + [anon_sym_print] = ACTIONS(17), + [sym_identifier] = ACTIONS(19), + [sym_number] = ACTIONS(21), + [sym_string] = ACTIONS(21), + [anon_sym_true] = ACTIONS(23), + [anon_sym_false] = ACTIONS(23), + [anon_sym_error] = ACTIONS(23), + }, + [6] = { + [sym_statement] = STATE(4), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [aux_sym_block_repeat1] = STATE(4), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_RBRACE] = ACTIONS(65), + [anon_sym_import] = ACTIONS(9), + [anon_sym_fn] = ACTIONS(11), + [anon_sym_LPAREN] = ACTIONS(13), + [anon_sym_class] = ACTIONS(15), + [anon_sym_print] = ACTIONS(17), + [sym_identifier] = ACTIONS(19), + [sym_number] = ACTIONS(21), + [sym_string] = ACTIONS(21), + [anon_sym_true] = ACTIONS(23), + [anon_sym_false] = ACTIONS(23), + [anon_sym_error] = ACTIONS(23), + }, + [7] = { + [sym_statement] = STATE(8), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [aux_sym_block_repeat1] = STATE(8), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_RBRACE] = ACTIONS(67), + [anon_sym_import] = ACTIONS(9), + [anon_sym_fn] = ACTIONS(11), + [anon_sym_LPAREN] = ACTIONS(13), + [anon_sym_class] = ACTIONS(15), + [anon_sym_print] = ACTIONS(17), + [sym_identifier] = ACTIONS(19), + [sym_number] = ACTIONS(21), + [sym_string] = ACTIONS(21), + [anon_sym_true] = ACTIONS(23), + [anon_sym_false] = ACTIONS(23), + [anon_sym_error] = ACTIONS(23), + }, + [8] = { + [sym_statement] = STATE(8), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [aux_sym_block_repeat1] = STATE(8), + [anon_sym_LBRACE] = ACTIONS(69), + [anon_sym_RBRACE] = ACTIONS(72), + [anon_sym_import] = ACTIONS(74), + [anon_sym_fn] = ACTIONS(77), + [anon_sym_LPAREN] = ACTIONS(80), + [anon_sym_class] = ACTIONS(83), + [anon_sym_print] = ACTIONS(86), + [sym_identifier] = ACTIONS(89), + [sym_number] = ACTIONS(92), + [sym_string] = ACTIONS(92), + [anon_sym_true] = ACTIONS(95), + [anon_sym_false] = ACTIONS(95), + [anon_sym_error] = ACTIONS(95), + }, + [9] = { + [sym_statement] = STATE(27), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_import] = ACTIONS(9), + [anon_sym_fn] = ACTIONS(11), + [anon_sym_LPAREN] = ACTIONS(13), + [anon_sym_class] = ACTIONS(15), + [anon_sym_print] = ACTIONS(17), + [sym_identifier] = ACTIONS(19), + [sym_number] = ACTIONS(21), + [sym_string] = ACTIONS(21), + [anon_sym_true] = ACTIONS(23), + [anon_sym_false] = ACTIONS(23), + [anon_sym_error] = ACTIONS(23), + }, + [10] = { + [sym_statement] = STATE(29), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_import] = ACTIONS(9), + [anon_sym_fn] = ACTIONS(11), + [anon_sym_LPAREN] = ACTIONS(98), + [anon_sym_class] = ACTIONS(15), + [anon_sym_print] = ACTIONS(17), + [sym_identifier] = ACTIONS(19), + [sym_number] = ACTIONS(21), + [sym_string] = ACTIONS(21), + [anon_sym_true] = ACTIONS(23), + [anon_sym_false] = ACTIONS(23), + [anon_sym_error] = ACTIONS(23), + }, + [11] = { + [sym_statement] = STATE(25), + [sym_block] = STATE(33), + [sym_import] = STATE(33), + [sym_function_declaration] = STATE(33), + [sym_class_declaration] = STATE(33), + [sym_print] = STATE(33), + [sym_expression] = STATE(21), + [sym_parenthesized_expression] = STATE(17), + [sym_access_list] = STATE(17), + [sym_call] = STATE(17), + [sym_literal] = STATE(17), + [sym_assignment] = STATE(33), + [sym_bool] = STATE(14), + [anon_sym_LBRACE] = ACTIONS(7), + [anon_sym_import] = ACTIONS(9), + [anon_sym_fn] = ACTIONS(11), + [anon_sym_LPAREN] = ACTIONS(13), + [anon_sym_class] = ACTIONS(15), + [anon_sym_print] = ACTIONS(17), + [sym_identifier] = ACTIONS(19), + [sym_number] = ACTIONS(21), + [sym_string] = ACTIONS(21), + [anon_sym_true] = ACTIONS(23), + [anon_sym_false] = ACTIONS(23), + [anon_sym_error] = ACTIONS(23), }, }; static const uint16_t ts_small_parse_table[] = { - [0] = 3, - ACTIONS(28), 1, + [0] = 2, + ACTIONS(102), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + ACTIONS(100), 10, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + anon_sym_RPAREN, + anon_sym_DOT, + anon_sym_COMMA, + sym_number, + sym_string, + [23] = 2, + ACTIONS(106), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + ACTIONS(104), 10, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + anon_sym_RPAREN, + anon_sym_DOT, + anon_sym_COMMA, + sym_number, + sym_string, + [46] = 2, + ACTIONS(110), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + ACTIONS(108), 10, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + anon_sym_RPAREN, + anon_sym_DOT, + anon_sym_COMMA, + sym_number, + sym_string, + [69] = 2, + ACTIONS(114), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + ACTIONS(112), 10, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + anon_sym_RPAREN, + anon_sym_DOT, + anon_sym_COMMA, + sym_number, + sym_string, + [92] = 2, + ACTIONS(118), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + ACTIONS(116), 10, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + anon_sym_RPAREN, + anon_sym_DOT, + anon_sym_COMMA, + sym_number, + sym_string, + [115] = 2, + ACTIONS(122), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + ACTIONS(120), 10, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + anon_sym_RPAREN, + anon_sym_DOT, + anon_sym_COMMA, + sym_number, + sym_string, + [138] = 2, + ACTIONS(126), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + ACTIONS(124), 10, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + anon_sym_RPAREN, + anon_sym_DOT, + anon_sym_COMMA, + sym_number, + sym_string, + [161] = 3, + ACTIONS(128), 1, anon_sym_EQ, - ACTIONS(26), 2, + ACTIONS(120), 8, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + anon_sym_DOT, + sym_number, + sym_string, + ACTIONS(122), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, anon_sym_print, sym_identifier, - ACTIONS(24), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [185] = 4, + ACTIONS(134), 1, + anon_sym_LPAREN, + ACTIONS(136), 1, + anon_sym_DOT, + ACTIONS(130), 6, ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, sym_number, sym_string, - [13] = 4, - ACTIONS(30), 1, + ACTIONS(132), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, sym_identifier, - STATE(8), 1, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [210] = 4, + ACTIONS(134), 1, + anon_sym_LPAREN, + ACTIONS(136), 1, + anon_sym_DOT, + ACTIONS(138), 6, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + sym_number, + sym_string, + ACTIONS(140), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [235] = 4, + ACTIONS(134), 1, + anon_sym_LPAREN, + ACTIONS(136), 1, + anon_sym_DOT, + ACTIONS(142), 6, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + sym_number, + sym_string, + ACTIONS(144), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [260] = 2, + ACTIONS(146), 7, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + sym_number, + sym_string, + ACTIONS(148), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [280] = 9, + ACTIONS(13), 1, + anon_sym_LPAREN, + ACTIONS(150), 1, + anon_sym_RPAREN, + ACTIONS(152), 1, + sym_identifier, + STATE(14), 1, + sym_bool, + STATE(38), 1, + sym_expression, + STATE(43), 1, + sym_argument_list, + ACTIONS(21), 2, + sym_number, + sym_string, + ACTIONS(23), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + STATE(17), 4, + sym_parenthesized_expression, + sym_access_list, + sym_call, sym_literal, - STATE(9), 1, + [314] = 2, + ACTIONS(154), 7, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + sym_number, + sym_string, + ACTIONS(156), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [334] = 2, + ACTIONS(158), 7, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + sym_number, + sym_string, + ACTIONS(160), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [354] = 2, + ACTIONS(162), 7, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + sym_number, + sym_string, + ACTIONS(164), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, + sym_identifier, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [374] = 9, + ACTIONS(13), 1, + anon_sym_LPAREN, + ACTIONS(166), 1, + anon_sym_RPAREN, + ACTIONS(168), 1, + sym_identifier, + STATE(14), 1, + sym_bool, + STATE(40), 1, sym_expression, - ACTIONS(9), 2, + STATE(45), 1, + sym_param_list, + ACTIONS(21), 2, sym_number, sym_string, - [27] = 2, - ACTIONS(34), 2, + ACTIONS(23), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + STATE(17), 4, + sym_parenthesized_expression, + sym_access_list, + sym_call, + sym_literal, + [408] = 2, + ACTIONS(170), 7, + ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, + sym_number, + sym_string, + ACTIONS(172), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, anon_sym_print, sym_identifier, - ACTIONS(32), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [428] = 2, + ACTIONS(174), 7, ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, sym_number, sym_string, - [37] = 2, - ACTIONS(38), 2, + ACTIONS(176), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, anon_sym_print, sym_identifier, - ACTIONS(36), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [448] = 2, + ACTIONS(178), 7, ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, sym_number, sym_string, - [47] = 2, - ACTIONS(26), 2, + ACTIONS(180), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, anon_sym_print, sym_identifier, - ACTIONS(24), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [468] = 2, + ACTIONS(182), 7, ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, sym_number, sym_string, - [57] = 2, - ACTIONS(42), 2, + ACTIONS(184), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, anon_sym_print, sym_identifier, - ACTIONS(40), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [488] = 2, + ACTIONS(138), 7, ts_builtin_sym_end, + sym_comment, + anon_sym_LBRACE, + anon_sym_RBRACE, + anon_sym_LPAREN, sym_number, sym_string, - [67] = 4, - ACTIONS(30), 1, + ACTIONS(140), 8, + anon_sym_import, + anon_sym_fn, + anon_sym_class, + anon_sym_print, sym_identifier, - STATE(8), 1, + anon_sym_true, + anon_sym_false, + anon_sym_error, + [508] = 8, + ACTIONS(13), 1, + anon_sym_LPAREN, + ACTIONS(152), 1, + sym_identifier, + STATE(14), 1, + sym_bool, + STATE(38), 1, + sym_expression, + STATE(50), 1, + sym_argument_list, + ACTIONS(21), 2, + sym_number, + sym_string, + ACTIONS(23), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + STATE(17), 4, + sym_parenthesized_expression, + sym_access_list, + sym_call, sym_literal, - STATE(11), 1, + [539] = 7, + ACTIONS(13), 1, + anon_sym_LPAREN, + ACTIONS(152), 1, + sym_identifier, + STATE(14), 1, + sym_bool, + STATE(22), 1, sym_expression, - ACTIONS(9), 2, + ACTIONS(21), 2, sym_number, sym_string, - [81] = 2, - ACTIONS(46), 2, - anon_sym_print, + ACTIONS(23), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + STATE(17), 4, + sym_parenthesized_expression, + sym_access_list, + sym_call, + sym_literal, + [567] = 7, + ACTIONS(13), 1, + anon_sym_LPAREN, + ACTIONS(152), 1, sym_identifier, - ACTIONS(44), 3, - ts_builtin_sym_end, + STATE(14), 1, + sym_bool, + STATE(40), 1, + sym_expression, + ACTIONS(21), 2, + sym_number, + sym_string, + ACTIONS(23), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + STATE(17), 4, + sym_parenthesized_expression, + sym_access_list, + sym_call, + sym_literal, + [595] = 7, + ACTIONS(13), 1, + anon_sym_LPAREN, + ACTIONS(152), 1, + sym_identifier, + STATE(14), 1, + sym_bool, + STATE(20), 1, + sym_expression, + ACTIONS(21), 2, sym_number, sym_string, - [91] = 1, - ACTIONS(48), 1, + ACTIONS(23), 3, + anon_sym_true, + anon_sym_false, + anon_sym_error, + STATE(17), 4, + sym_parenthesized_expression, + sym_access_list, + sym_call, + sym_literal, + [623] = 4, + ACTIONS(134), 1, + anon_sym_LPAREN, + ACTIONS(136), 1, + anon_sym_DOT, + ACTIONS(186), 1, + anon_sym_RPAREN, + ACTIONS(188), 1, + anon_sym_COMMA, + [636] = 3, + ACTIONS(190), 1, + anon_sym_RPAREN, + ACTIONS(192), 1, + anon_sym_COMMA, + ACTIONS(120), 2, + anon_sym_LPAREN, + anon_sym_DOT, + [647] = 3, + ACTIONS(134), 1, + anon_sym_LPAREN, + ACTIONS(136), 1, + anon_sym_DOT, + ACTIONS(194), 1, + anon_sym_RPAREN, + [657] = 2, + ACTIONS(196), 1, + sym_identifier, + STATE(51), 1, + sym_param_list, + [664] = 2, + ACTIONS(190), 1, + anon_sym_RPAREN, + ACTIONS(192), 1, + anon_sym_COMMA, + [671] = 1, + ACTIONS(198), 1, + anon_sym_RPAREN, + [675] = 1, + ACTIONS(200), 1, ts_builtin_sym_end, + [679] = 1, + ACTIONS(202), 1, + anon_sym_RPAREN, + [683] = 1, + ACTIONS(204), 1, + sym_identifier, + [687] = 1, + ACTIONS(206), 1, + sym_identifier, + [691] = 1, + ACTIONS(208), 1, + anon_sym_LBRACE, + [695] = 1, + ACTIONS(210), 1, + sym_identifier, + [699] = 1, + ACTIONS(212), 1, + anon_sym_RPAREN, + [703] = 1, + ACTIONS(214), 1, + anon_sym_RPAREN, + [707] = 1, + ACTIONS(216), 1, + sym_identifier, }; static const uint32_t ts_small_parse_table_map[] = { - [SMALL_STATE(4)] = 0, - [SMALL_STATE(5)] = 13, - [SMALL_STATE(6)] = 27, - [SMALL_STATE(7)] = 37, - [SMALL_STATE(8)] = 47, - [SMALL_STATE(9)] = 57, - [SMALL_STATE(10)] = 67, - [SMALL_STATE(11)] = 81, - [SMALL_STATE(12)] = 91, + [SMALL_STATE(12)] = 0, + [SMALL_STATE(13)] = 23, + [SMALL_STATE(14)] = 46, + [SMALL_STATE(15)] = 69, + [SMALL_STATE(16)] = 92, + [SMALL_STATE(17)] = 115, + [SMALL_STATE(18)] = 138, + [SMALL_STATE(19)] = 161, + [SMALL_STATE(20)] = 185, + [SMALL_STATE(21)] = 210, + [SMALL_STATE(22)] = 235, + [SMALL_STATE(23)] = 260, + [SMALL_STATE(24)] = 280, + [SMALL_STATE(25)] = 314, + [SMALL_STATE(26)] = 334, + [SMALL_STATE(27)] = 354, + [SMALL_STATE(28)] = 374, + [SMALL_STATE(29)] = 408, + [SMALL_STATE(30)] = 428, + [SMALL_STATE(31)] = 448, + [SMALL_STATE(32)] = 468, + [SMALL_STATE(33)] = 488, + [SMALL_STATE(34)] = 508, + [SMALL_STATE(35)] = 539, + [SMALL_STATE(36)] = 567, + [SMALL_STATE(37)] = 595, + [SMALL_STATE(38)] = 623, + [SMALL_STATE(39)] = 636, + [SMALL_STATE(40)] = 647, + [SMALL_STATE(41)] = 657, + [SMALL_STATE(42)] = 664, + [SMALL_STATE(43)] = 671, + [SMALL_STATE(44)] = 675, + [SMALL_STATE(45)] = 679, + [SMALL_STATE(46)] = 683, + [SMALL_STATE(47)] = 687, + [SMALL_STATE(48)] = 691, + [SMALL_STATE(49)] = 695, + [SMALL_STATE(50)] = 699, + [SMALL_STATE(51)] = 703, + [SMALL_STATE(52)] = 707, }; static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0), - [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(5), - [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(4), - [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), - [11] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), - [13] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), - [15] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(5), - [18] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(4), - [21] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(6), - [24] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1), - [26] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expression, 1), - [28] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), - [30] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), - [32] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_literal, 1), - [34] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_literal, 1), - [36] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 1), - [38] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_statement, 1), - [40] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_print, 2, .production_id = 1), - [42] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_print, 2, .production_id = 1), - [44] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 3, .production_id = 2), - [46] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 3, .production_id = 2), - [48] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), + [9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(52), + [11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(49), + [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), + [15] = {.entry = {.count = 1, .reusable = false}}, SHIFT(47), + [17] = {.entry = {.count = 1, .reusable = false}}, SHIFT(35), + [19] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), + [21] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), + [23] = {.entry = {.count = 1, .reusable = false}}, SHIFT(15), + [25] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), + [27] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(2), + [30] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(5), + [33] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(52), + [36] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(49), + [39] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(36), + [42] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(47), + [45] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(35), + [48] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(19), + [51] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(14), + [54] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(15), + [57] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), + [59] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), + [61] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), + [63] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), + [65] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30), + [67] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), + [69] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(5), + [72] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), + [74] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(52), + [77] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(49), + [80] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(36), + [83] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(47), + [86] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(35), + [89] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(19), + [92] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(14), + [95] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(15), + [98] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), + [100] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_call, 4, .production_id = 10), + [102] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_call, 4, .production_id = 10), + [104] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_access_list, 3, .production_id = 8), + [106] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_access_list, 3, .production_id = 8), + [108] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_literal, 1), + [110] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_literal, 1), + [112] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_bool, 1), + [114] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_bool, 1), + [116] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_call, 3, .production_id = 7), + [118] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_call, 3, .production_id = 7), + [120] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1), + [122] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expression, 1), + [124] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_parenthesized_expression, 3, .production_id = 5), + [126] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_parenthesized_expression, 3, .production_id = 5), + [128] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), + [130] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 3, .production_id = 6), + [132] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 3, .production_id = 6), + [134] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), + [136] = {.entry = {.count = 1, .reusable = true}}, SHIFT(46), + [138] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 1), + [140] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_statement, 1), + [142] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_print, 2, .production_id = 2), + [144] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_print, 2, .production_id = 2), + [146] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 3, .production_id = 3), + [148] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_block, 3, .production_id = 3), + [150] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), + [152] = {.entry = {.count = 1, .reusable = false}}, SHIFT(17), + [154] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_declaration, 6, .production_id = 13), + [156] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_declaration, 6, .production_id = 13), + [158] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_class_declaration, 5, .production_id = 12), + [160] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_class_declaration, 5, .production_id = 12), + [162] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_declaration, 5, .production_id = 11), + [164] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_declaration, 5, .production_id = 11), + [166] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), + [168] = {.entry = {.count = 1, .reusable = false}}, SHIFT(39), + [170] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_function_declaration, 3, .production_id = 4), + [172] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_function_declaration, 3, .production_id = 4), + [174] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_class_declaration, 4, .production_id = 9), + [176] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_class_declaration, 4, .production_id = 9), + [178] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import, 2, .production_id = 1), + [180] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_import, 2, .production_id = 1), + [182] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 2), + [184] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_block, 2), + [186] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_argument_list, 1), + [188] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), + [190] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_param_list, 1), + [192] = {.entry = {.count = 1, .reusable = true}}, SHIFT(41), + [194] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), + [196] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42), + [198] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), + [200] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [202] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), + [204] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), + [206] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), + [208] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), + [210] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), + [212] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_argument_list, 3), + [214] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_param_list, 3), + [216] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), }; #ifdef __cplusplus diff --git a/test/corpus/access_list.txt b/test/corpus/access_list.txt new file mode 100644 index 0000000..9d77d9b --- /dev/null +++ b/test/corpus/access_list.txt @@ -0,0 +1,50 @@ +=== +Access list +=== + +("some expression").first +"some other expression".first.second.third # this expression is not parenthesized because that would be ambiguous + +--- + +(source_file + (statement + (expression + (access_list + accessed: (expression + (parenthesized_expression + expression: (expression + (literal + (string) + ) + ) + ) + ) + accessor: (identifier) + ) + ) + ) + (statement + (expression + (access_list + accessed: (expression + (access_list + accessed: (expression + (access_list + accessed: (expression + (literal + (string) + ) + ) + accessor: (identifier) + ) + ) + accessor: (identifier) + ) + ) + accessor: (identifier) + ) + ) + ) + (comment) +) diff --git a/test/corpus/function_declaration.txt b/test/corpus/function_declaration.txt new file mode 100644 index 0000000..1dfd7db --- /dev/null +++ b/test/corpus/function_declaration.txt @@ -0,0 +1,108 @@ +=== +Function declaration +=== + +fn function_without_params { + print "Hello world!" +} + +fn function_without_params_but_with_parentheses() { + print "Hello world!" +} + +fn function_with_one_param(a) { + print "Hello world!" +} + +fn function_with_multiple_params(a, b, c) { + print "Hello world!" +} + +--- + +(source_file + (statement + (function_declaration + name: (identifier) + body: (statement + (block + body: (statement + (print + msg: (expression + (literal + (string) + ) + ) + ) + ) + ) + ) + ) + ) + (statement + (function_declaration + name: (identifier) + body: (statement + (block + body: (statement + (print + msg: (expression + (literal + (string) + ) + ) + ) + ) + ) + ) + ) + ) + (statement + (function_declaration + name: (identifier) + params: (param_list + (identifier) + ) + body: (statement + (block + body: (statement + (print + msg: (expression + (literal + (string) + ) + ) + ) + ) + ) + ) + ) + ) + (statement + (function_declaration + name: (identifier) + params: (param_list + (identifier) + (param_list + (identifier) + (param_list + (identifier) + ) + ) + ) + body: (statement + (block + body: (statement + (print + msg: (expression + (literal + (string) + ) + ) + ) + ) + ) + ) + ) + ) +) diff --git a/test/corpus/number.txt b/test/corpus/number.txt index a84a1c7..6ad0107 100644 --- a/test/corpus/number.txt +++ b/test/corpus/number.txt @@ -9,7 +9,9 @@ Numbers (source_file (statement (expression - (number) + (literal + (number) + ) ) ) ) diff --git a/test/corpus/print.txt b/test/corpus/print.txt index d6b1888..b3c5f9b 100644 --- a/test/corpus/print.txt +++ b/test/corpus/print.txt @@ -9,8 +9,10 @@ print "Hello world!" (source_file (statement (print - (expression - (string) + msg: (expression + (literal + (string) + ) ) ) )