Merge pull request #5 from amaanq/regex-i-flag

Regex i flag
This commit is contained in:
Emmanuel Briot 2023-08-22 08:59:04 +02:00 committed by GitHub
commit 5bec028d82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2595 additions and 2241 deletions

View File

@ -3,13 +3,9 @@
*/ */
const reservedWord = word => const reservedWord = word =>
// word || // when debugging conflict error msgs // word || // when debugging conflict error msgs
alias(reserved(caseInsensitive(word)), word) alias(reserved(word), word)
; ;
const reserved = regex => token(prec(2, new RegExp(regex))); const reserved = regex => token(prec(2, new RegExp(regex, 'i')));
const caseInsensitive = word =>
word.split('')
.map(letter => `[${letter}${letter.toUpperCase()}]`)
.join('');
/** /**
* A list of rules * A list of rules
@ -50,9 +46,6 @@ module.exports = grammar({
// specified in at_clause. // specified in at_clause.
[$.at_clause, $._name], [$.at_clause, $._name],
// 'case' '(' identifier . '=>' ...
[$._name, $.component_choice_list],
// 'case' '(' _name '(' _discrete_range ')' . '=>' // 'case' '(' _name '(' _discrete_range ')' . '=>'
[$.slice, $._discrete_range], [$.slice, $._discrete_range],
@ -81,9 +74,6 @@ module.exports = grammar({
// could be either a record_extension_part or an aspect_specification. // could be either a record_extension_part or an aspect_specification.
[$.derived_type_definition], [$.derived_type_definition],
// 'for' name 'use' '(' 'for' identifier 'in' name . 'use'
[$.iterator_specification, $._subtype_indication],
// 'type' identifier known_discriminant_part . 'is' ... // 'type' identifier known_discriminant_part . 'is' ...
// This could be either a _discriminant_part or known_discriminant_part, // This could be either a _discriminant_part or known_discriminant_part,
// the latter in case we are declaring a private type. We can't make the // the latter in case we are declaring a private type. We can't make the
@ -99,7 +89,6 @@ module.exports = grammar({
// (via formal_complete_type_declaration) // (via formal_complete_type_declaration)
[$.formal_derived_type_definition], [$.formal_derived_type_definition],
[$.function_call, $.procedure_call_statement],
[$._name, $._aspect_mark], [$._name, $._aspect_mark],
[$._name, $.package_body_stub], [$._name, $.package_body_stub],
[$._name, $._subtype_indication], [$._name, $._subtype_indication],

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -13,9 +13,8 @@ extern "C" {
#define ts_builtin_sym_end 0 #define ts_builtin_sym_end 0
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 #define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
typedef uint16_t TSStateId;
#ifndef TREE_SITTER_API_H_ #ifndef TREE_SITTER_API_H_
typedef uint16_t TSStateId;
typedef uint16_t TSSymbol; typedef uint16_t TSSymbol;
typedef uint16_t TSFieldId; typedef uint16_t TSFieldId;
typedef struct TSLanguage TSLanguage; typedef struct TSLanguage TSLanguage;
@ -140,7 +139,8 @@ struct TSLanguage {
lexer->advance(lexer, skip); \ lexer->advance(lexer, skip); \
start: \ start: \
skip = false; \ skip = false; \
lookahead = lexer->lookahead; lookahead = lexer->lookahead; \
eof = lexer->eof(lexer);
#define ADVANCE(state_value) \ #define ADVANCE(state_value) \
{ \ { \
@ -166,7 +166,7 @@ struct TSLanguage {
* Parse Table Macros * Parse Table Macros
*/ */
#define SMALL_STATE(id) id - LARGE_STATE_COUNT #define SMALL_STATE(id) ((id) - LARGE_STATE_COUNT)
#define STATE(id) id #define STATE(id) id
@ -176,7 +176,7 @@ struct TSLanguage {
{{ \ {{ \
.shift = { \ .shift = { \
.type = TSParseActionTypeShift, \ .type = TSParseActionTypeShift, \
.state = state_value \ .state = (state_value) \
} \ } \
}} }}
@ -184,7 +184,7 @@ struct TSLanguage {
{{ \ {{ \
.shift = { \ .shift = { \
.type = TSParseActionTypeShift, \ .type = TSParseActionTypeShift, \
.state = state_value, \ .state = (state_value), \
.repetition = true \ .repetition = true \
} \ } \
}} }}