diff --git a/examples/parsers/golang.c b/examples/parsers/golang.c index 72fb832b..2c2137bf 100644 --- a/examples/parsers/golang.c +++ b/examples/parsers/golang.c @@ -109,22 +109,22 @@ SYMBOL_NAMES = { [ts_aux_sym__func_signature_repeat2] = "_func_signature_repeat2", [ts_aux_sym__func_signature_repeat3] = "_func_signature_repeat3", [ts_aux_sym__func_signature_repeat4] = "_func_signature_repeat4", - [ts_aux_sym_token0] = "", - [ts_aux_sym_token1] = "", + [ts_aux_sym_token0] = "'package'", + [ts_aux_sym_token1] = "'import'", [ts_aux_sym_token2] = "'('", [ts_aux_sym_token3] = "')'", - [ts_aux_sym_token4] = "", - [ts_aux_sym_token5] = "", + [ts_aux_sym_token4] = "'type'", + [ts_aux_sym_token5] = "'var'", [ts_aux_sym_token6] = "'='", - [ts_aux_sym_token7] = "", + [ts_aux_sym_token7] = "'func'", [ts_aux_sym_token8] = "'{'", [ts_aux_sym_token9] = "'}'", [ts_aux_sym_token10] = "'*'", - [ts_aux_sym_token11] = "", + [ts_aux_sym_token11] = "'map'", [ts_aux_sym_token12] = "'['", [ts_aux_sym_token13] = "']'", - [ts_aux_sym_token14] = "", - [ts_aux_sym_token15] = "", + [ts_aux_sym_token14] = "'struct'", + [ts_aux_sym_token15] = "'interface'", [ts_aux_sym_token16] = "'/'", [ts_aux_sym_token17] = "'+'", [ts_aux_sym_token18] = "'-'", diff --git a/examples/parsers/javascript.c b/examples/parsers/javascript.c index fbeb6ea5..34e66ad7 100644 --- a/examples/parsers/javascript.c +++ b/examples/parsers/javascript.c @@ -138,20 +138,20 @@ SYMBOL_NAMES = { [ts_aux_sym_array_repeat0] = "array_repeat0", [ts_aux_sym_token0] = "'{'", [ts_aux_sym_token1] = "'}'", - [ts_aux_sym_token2] = "", + [ts_aux_sym_token2] = "'for'", [ts_aux_sym_token3] = "'('", [ts_aux_sym_token4] = "')'", - [ts_aux_sym_token5] = "", - [ts_aux_sym_token6] = "", - [ts_aux_sym_token7] = "", - [ts_aux_sym_token8] = "", - [ts_aux_sym_token9] = "", + [ts_aux_sym_token5] = "'if'", + [ts_aux_sym_token6] = "'else'", + [ts_aux_sym_token7] = "'switch'", + [ts_aux_sym_token8] = "'case'", + [ts_aux_sym_token9] = "'default'", [ts_aux_sym_token10] = "':'", - [ts_aux_sym_token11] = "", - [ts_aux_sym_token12] = "", + [ts_aux_sym_token11] = "'break'", + [ts_aux_sym_token12] = "'var'", [ts_aux_sym_token13] = "','", - [ts_aux_sym_token14] = "", - [ts_aux_sym_token15] = "", + [ts_aux_sym_token14] = "'return'", + [ts_aux_sym_token15] = "'delete'", [ts_aux_sym_token16] = "'++'", [ts_aux_sym_token17] = "'--'", [ts_aux_sym_token18] = "'+'", @@ -174,8 +174,8 @@ SYMBOL_NAMES = { [ts_aux_sym_token35] = "'!'", [ts_aux_sym_token36] = "'?'", [ts_aux_sym_token37] = "'='", - [ts_aux_sym_token38] = "", - [ts_aux_sym_token39] = "", + [ts_aux_sym_token38] = "'function'", + [ts_aux_sym_token39] = "'new'", [ts_aux_sym_token40] = "'.'", [ts_aux_sym_token41] = "'['", [ts_aux_sym_token42] = "']'", diff --git a/src/compiler/generate_code/token_description.cc b/src/compiler/generate_code/token_description.cc index 25bc828e..3b271368 100644 --- a/src/compiler/generate_code/token_description.cc +++ b/src/compiler/generate_code/token_description.cc @@ -3,6 +3,7 @@ #include "compiler/rules/visitor.h" #include "compiler/rules/pattern.h" #include "compiler/rules/string.h" +#include "compiler/rules/metadata.h" namespace tree_sitter { using std::string; @@ -16,6 +17,10 @@ namespace tree_sitter { string apply_to(const rules::String *rule) { return "'" + rule->value + "'"; } + + string apply_to(const rules::Metadata *rule) { + return apply(rule->rule); + } }; std::string token_description(const rules::rule_ptr &rule) {