Allow ubiquitous tokens to also be used in grammar rules

This commit is contained in:
Max Brunsfeld 2014-06-26 08:52:42 -07:00
parent a9dff20658
commit 9686c57e90
22 changed files with 49452 additions and 47887 deletions

View file

@ -6,7 +6,7 @@ extern "C" {
#endif
//#define TS_DEBUG_PARSE
//#define TS_DEBUG_LEX
// #define TS_DEBUG_LEX
#include "tree_sitter/runtime.h"
#include "tree_sitter/parser/lexer.h"
@ -19,9 +19,6 @@ static const char *ts_symbol_names[]
#define HIDDEN_SYMBOLS \
static const int hidden_symbol_flags[SYMBOL_COUNT]
#define UBIQUITOUS_SYMBOLS \
static const int ubiquitous_symbol_flags[SYMBOL_COUNT]
#define LEX_STATES \
static ts_state_id ts_lex_states[STATE_COUNT]
@ -79,7 +76,7 @@ static const ts_tree * ts_parse(void *data, ts_input input, ts_input_edit *edit)
ts_lr_parser *parser = (ts_lr_parser *)data;
ts_lr_parser_initialize(parser, input, edit);
for (;;) {
ts_tree *tree = ts_lr_parser_parse(parser, ts_symbol_names);
const ts_tree *tree = ts_lr_parser_parse(parser, ts_symbol_names);
if (tree) return tree;
}
}
@ -95,8 +92,7 @@ ts_parser constructor_name() { \
(const ts_parse_action *)ts_parse_actions, \
ts_lex_states, \
ts_lex, \
hidden_symbol_flags, \
ubiquitous_symbol_flags \
hidden_symbol_flags \
), \
}; \
}