From 8e1f80fae9106981b6f3d0e97c3aea3a8404130e Mon Sep 17 00:00:00 2001 From: Maix0 Date: Sun, 9 Jun 2024 20:56:50 +0200 Subject: [PATCH] Update: Grammar --- Makefile | 16 +- parser/src/scanner.c | 2233 +++++++++-------- .../alias_sequences/alias_sequences_0.c | 10 +- .../field_map_slices/field_map_slices_0.c | 81 +- parser/static/headers/constants.h | 2 +- .../parse_actions_entries_10.c | 4 +- .../parse_actions_entries_11.c | 2 +- .../parse_actions_entries_12.c | 20 +- .../parse_actions_entries_13.c | 10 +- .../parse_actions_entries_14.c | 6 +- .../parse_actions_entries_15.c | 10 +- .../parse_actions_entries_24.c | 40 +- .../parse_actions_entries_25.c | 50 +- .../parse_actions_entries_26.c | 6 +- .../parse_actions_entries_27.c | 24 +- .../parse_actions_entries_30.c | 20 +- .../parse_actions_entries_35.c | 2 +- .../parse_actions_entries_36.c | 38 +- .../parse_actions_entries_37.c | 8 +- .../parse_actions_entries_38.c | 4 +- .../parse_actions_entries_41.c | 4 +- .../parse_actions_entries_42.c | 4 +- .../parse_actions_entries_43.c | 2 +- .../parse_actions_entries_44.c | 20 +- .../parse_actions_entries_48.c | 4 +- .../parse_actions_entries_5.c | 26 +- .../parse_actions_entries_6.c | 42 +- .../parse_actions_entries_8.c | 2 +- .../symbols_metadata/symbols_metadata_0.c | 102 +- .../symbols_metadata/symbols_metadata_1.c | 2 +- parser/static/symbols_names/symbols_names_0.c | 102 +- parser/static/symbols_names/symbols_names_1.c | 2 +- .../unique_symbols_map/unique_symbols_map_0.c | 106 +- sources/node/node.c | 27 +- tree-sitter-sh/grammar.js | 26 +- 35 files changed, 1551 insertions(+), 1506 deletions(-) diff --git a/Makefile b/Makefile index a3d34ef8..f6706eab 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,12 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/06/09 19:05:51 by maiboyer ### ########.fr # +# Updated: 2024/06/09 19:17:04 by maiboyer ### ########.fr # # # # **************************************************************************** # # Objdir -BUILD_DIR = $(shell realpath build) +BUILD_DIR = $(shell realpath ./build) # Colors GREEN = \033[32m @@ -42,14 +42,14 @@ endif # All (make all) all: - @$(MAKE) --no-print-directory header BUILD_DIR=$(BUILD_DIR) BASE_PATH=$(shell pwd) - @$(MAKE) --no-print-directory -f./Minishell.mk BUILD_DIR=$(BUILD_DIR) BASE_PATH=$(shell pwd) $(PMAKE) - @$(MAKE) --no-print-directory footer BUILD_DIR=$(BUILD_DIR) BASE_PATH=$(shell pwd) + @$(MAKE) --no-print-directory header "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" + @$(MAKE) --no-print-directory -f./Minishell.mk "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" $(PMAKE) + @$(MAKE) --no-print-directory footer "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" bonus: - @$(MAKE) --no-print-directory header BUILD_DIR=$(BUILD_DIR) BASE_PATH=$(shell pwd) - @$(MAKE) --no-print-directory -f./Minishell.mk BUILD_DIR=$(BUILD_DIR) BASE_PATH=$(shell pwd) $(PMAKE) bonus - @$(MAKE) --no-print-directory footer BUILD_DIR=$(BUILD_DIR) BASE_PATH=$(shell pwd) + @$(MAKE) --no-print-directory header "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" + @$(MAKE) --no-print-directory -f./Minishell.mk "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" $(PMAKE) bonus + @$(MAKE) --no-print-directory footer "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" # Header header: diff --git a/parser/src/scanner.c b/parser/src/scanner.c index a5f66327..c8dd9cfb 100644 --- a/parser/src/scanner.c +++ b/parser/src/scanner.c @@ -5,152 +5,207 @@ #include #include -enum TokenType { - HEREDOC_START, - SIMPLE_HEREDOC_BODY, - HEREDOC_BODY_BEGINNING, - HEREDOC_CONTENT, - HEREDOC_END, - FILE_DESCRIPTOR, - EMPTY_VALUE, - CONCAT, - VARIABLE_NAME, - TEST_OPERATOR, - REGEX, - REGEX_NO_SLASH, - REGEX_NO_SPACE, - EXPANSION_WORD, - EXTGLOB_PATTERN, - BARE_DOLLAR, - BRACE_START, - IMMEDIATE_DOUBLE_HASH, - EXTERNAL_EXPANSION_SYM_HASH, - EXTERNAL_EXPANSION_SYM_BANG, - EXTERNAL_EXPANSION_SYM_EQUAL, - CLOSING_BRACE, - CLOSING_BRACKET, - HEREDOC_ARROW, - HEREDOC_ARROW_DASH, - NEWLINE, - OPENING_PAREN, - ESAC, - ERROR_RECOVERY, +enum TokenType +{ + HEREDOC_START, + SIMPLE_HEREDOC_BODY, + HEREDOC_BODY_BEGINNING, + HEREDOC_CONTENT, + HEREDOC_END, + FILE_DESCRIPTOR, + EMPTY_VALUE, + CONCAT, + VARIABLE_NAME, + REGEX, + EXPANSION_WORD, + EXTGLOB_PATTERN, + BARE_DOLLAR, + IMMEDIATE_DOUBLE_HASH, + HEREDOC_ARROW, + HEREDOC_ARROW_DASH, + NEWLINE, + OPENING_PAREN, + ESAC, + ERROR_RECOVERY, }; +/* +enum TokenType { + HEREDOC_START, + SIMPLE_HEREDOC_BODY, + HEREDOC_BODY_BEGINNING, + HEREDOC_CONTENT, + HEREDOC_END, + FILE_DESCRIPTOR, + EMPTY_VALUE, + CONCAT, + VARIABLE_NAME, + TEST_OPERATOR, + REGEX, + REGEX_NO_SLASH, + REGEX_NO_SPACE, + EXPANSION_WORD, + EXTGLOB_PATTERN, + BARE_DOLLAR, + BRACE_START, + IMMEDIATE_DOUBLE_HASH, + EXTERNAL_EXPANSION_SYM_HASH, + EXTERNAL_EXPANSION_SYM_BANG, + EXTERNAL_EXPANSION_SYM_EQUAL, + CLOSING_BRACE, + CLOSING_BRACKET, + HEREDOC_ARROW, + HEREDOC_ARROW_DASH, + NEWLINE, + OPENING_PAREN, + ESAC, + ERROR_RECOVERY, +}; +*/ + typedef Array(char) String; -typedef struct { - bool is_raw; - bool started; - bool allows_indent; - String delimiter; - String current_leading_word; +typedef struct +{ + bool is_raw; + bool started; + bool allows_indent; + String delimiter; + String current_leading_word; } Heredoc; -#define heredoc_new() \ - { \ - .is_raw = false, \ - .started = false, \ - .allows_indent = false, \ - .delimiter = array_new(), \ - .current_leading_word = array_new(), \ - }; +#define heredoc_new() \ + { \ + .is_raw = false, \ + .started = false, \ + .allows_indent = false, \ + .delimiter = array_new(), \ + .current_leading_word = array_new(), \ + }; -typedef struct { - uint8_t last_glob_paren_depth; - bool ext_was_in_double_quote; - bool ext_saw_outside_quote; - Array(Heredoc) heredocs; +typedef struct +{ + uint8_t last_glob_paren_depth; + bool ext_was_in_double_quote; + bool ext_saw_outside_quote; + Array(Heredoc) heredocs; } Scanner; -static inline void advance(t_lexer_data *lexer) { lexer->advance(lexer, false); } - -static inline void skip(t_lexer_data *lexer) { lexer->advance(lexer, true); } - -static inline bool in_error_recovery(const bool *valid_symbols) { return valid_symbols[ERROR_RECOVERY]; } - -static inline void reset_string(String *string) { - if (string->size > 0) { - memset(string->contents, 0, string->size); - array_clear(string); - } +static inline void advance(t_lexer_data *lexer) +{ + lexer->advance(lexer, false); } -static inline void reset_heredoc(Heredoc *heredoc) { - heredoc->is_raw = false; - heredoc->started = false; - heredoc->allows_indent = false; - reset_string(&heredoc->delimiter); +static inline void skip(t_lexer_data *lexer) +{ + lexer->advance(lexer, true); } -static inline void reset(Scanner *scanner) { - for (uint32_t i = 0; i < scanner->heredocs.size; i++) { - reset_heredoc(array_get(&scanner->heredocs, i)); - } +static inline bool in_error_recovery(const bool *valid_symbols) +{ + return valid_symbols[ERROR_RECOVERY]; } -static unsigned serialize(Scanner *scanner, char *buffer) { - uint32_t size = 0; - - buffer[size++] = (char)scanner->last_glob_paren_depth; - buffer[size++] = (char)scanner->ext_was_in_double_quote; - buffer[size++] = (char)scanner->ext_saw_outside_quote; - buffer[size++] = (char)scanner->heredocs.size; - - for (uint32_t i = 0; i < scanner->heredocs.size; i++) { - Heredoc *heredoc = array_get(&scanner->heredocs, i); - if (heredoc->delimiter.size + 3 + size >= TREE_SITTER_SERIALIZATION_BUFFER_SIZE) { - return 0; - } - - buffer[size++] = (char)heredoc->is_raw; - buffer[size++] = (char)heredoc->started; - buffer[size++] = (char)heredoc->allows_indent; - - memcpy(&buffer[size], &heredoc->delimiter.size, sizeof(uint32_t)); - size += sizeof(uint32_t); - if (heredoc->delimiter.size > 0) { - memcpy(&buffer[size], heredoc->delimiter.contents, heredoc->delimiter.size); - size += heredoc->delimiter.size; - } - } - return size; +static inline void reset_string(String *string) +{ + if (string->size > 0) + { + memset(string->contents, 0, string->size); + array_clear(string); + } } -static void deserialize(Scanner *scanner, const char *buffer, unsigned length) { - if (length == 0) { - reset(scanner); - } else { - uint32_t size = 0; - scanner->last_glob_paren_depth = buffer[size++]; - scanner->ext_was_in_double_quote = buffer[size++]; - scanner->ext_saw_outside_quote = buffer[size++]; - uint32_t heredoc_count = (unsigned char)buffer[size++]; - for (uint32_t i = 0; i < heredoc_count; i++) { - Heredoc *heredoc = NULL; - if (i < scanner->heredocs.size) { - heredoc = array_get(&scanner->heredocs, i); - } else { - Heredoc new_heredoc = heredoc_new(); - array_push(&scanner->heredocs, new_heredoc); - heredoc = array_back(&scanner->heredocs); - } +static inline void reset_heredoc(Heredoc *heredoc) +{ + heredoc->is_raw = false; + heredoc->started = false; + heredoc->allows_indent = false; + reset_string(&heredoc->delimiter); +} - heredoc->is_raw = buffer[size++]; - heredoc->started = buffer[size++]; - heredoc->allows_indent = buffer[size++]; +static inline void reset(Scanner *scanner) +{ + for (uint32_t i = 0; i < scanner->heredocs.size; i++) + { + reset_heredoc(array_get(&scanner->heredocs, i)); + } +} - memcpy(&heredoc->delimiter.size, &buffer[size], sizeof(uint32_t)); - size += sizeof(uint32_t); - array_reserve(&heredoc->delimiter, heredoc->delimiter.size); +static unsigned serialize(Scanner *scanner, char *buffer) +{ + uint32_t size = 0; - if (heredoc->delimiter.size > 0) { - memcpy(heredoc->delimiter.contents, &buffer[size], heredoc->delimiter.size); - size += heredoc->delimiter.size; - } - } - assert(size == length); - } + buffer[size++] = (char)scanner->last_glob_paren_depth; + buffer[size++] = (char)scanner->ext_was_in_double_quote; + buffer[size++] = (char)scanner->ext_saw_outside_quote; + buffer[size++] = (char)scanner->heredocs.size; + + for (uint32_t i = 0; i < scanner->heredocs.size; i++) + { + Heredoc *heredoc = array_get(&scanner->heredocs, i); + if (heredoc->delimiter.size + 3 + size >= TREE_SITTER_SERIALIZATION_BUFFER_SIZE) + { + return 0; + } + + buffer[size++] = (char)heredoc->is_raw; + buffer[size++] = (char)heredoc->started; + buffer[size++] = (char)heredoc->allows_indent; + + memcpy(&buffer[size], &heredoc->delimiter.size, sizeof(uint32_t)); + size += sizeof(uint32_t); + if (heredoc->delimiter.size > 0) + { + memcpy(&buffer[size], heredoc->delimiter.contents, heredoc->delimiter.size); + size += heredoc->delimiter.size; + } + } + return size; +} + +static void deserialize(Scanner *scanner, const char *buffer, unsigned length) +{ + if (length == 0) + { + reset(scanner); + } + else + { + uint32_t size = 0; + scanner->last_glob_paren_depth = buffer[size++]; + scanner->ext_was_in_double_quote = buffer[size++]; + scanner->ext_saw_outside_quote = buffer[size++]; + uint32_t heredoc_count = (unsigned char)buffer[size++]; + for (uint32_t i = 0; i < heredoc_count; i++) + { + Heredoc *heredoc = NULL; + if (i < scanner->heredocs.size) + { + heredoc = array_get(&scanner->heredocs, i); + } + else + { + Heredoc new_heredoc = heredoc_new(); + array_push(&scanner->heredocs, new_heredoc); + heredoc = array_back(&scanner->heredocs); + } + + heredoc->is_raw = buffer[size++]; + heredoc->started = buffer[size++]; + heredoc->allows_indent = buffer[size++]; + + memcpy(&heredoc->delimiter.size, &buffer[size], sizeof(uint32_t)); + size += sizeof(uint32_t); + array_reserve(&heredoc->delimiter, heredoc->delimiter.size); + + if (heredoc->delimiter.size > 0) + { + memcpy(heredoc->delimiter.contents, &buffer[size], heredoc->delimiter.size); + size += heredoc->delimiter.size; + } + } + assert(size == length); + } } /** @@ -160,1057 +215,1049 @@ static void deserialize(Scanner *scanner, const char *buffer, unsigned length) { * POSIX-mandated substitution, and assumes the default value for * IFS. */ -static bool advance_word(t_lexer_data *lexer, String *unquoted_word) { - bool empty = true; +static bool advance_word(t_lexer_data *lexer, String *unquoted_word) +{ + bool empty = true; - int32_t quote = 0; - if (lexer->lookahead == '\'' || lexer->lookahead == '"') { - quote = lexer->lookahead; - advance(lexer); - } + int32_t quote = 0; + if (lexer->lookahead == '\'' || lexer->lookahead == '"') + { + quote = lexer->lookahead; + advance(lexer); + } - while (lexer->lookahead && - !(quote ? lexer->lookahead == quote || lexer->lookahead == '\r' || lexer->lookahead == '\n' - : iswspace(lexer->lookahead))) { - if (lexer->lookahead == '\\') { - advance(lexer); - if (!lexer->lookahead) { - return false; - } - } - empty = false; - array_push(unquoted_word, lexer->lookahead); - advance(lexer); - } - array_push(unquoted_word, '\0'); + while (lexer->lookahead && + !(quote ? lexer->lookahead == quote || lexer->lookahead == '\r' || lexer->lookahead == '\n' : iswspace(lexer->lookahead))) + { + if (lexer->lookahead == '\\') + { + advance(lexer); + if (!lexer->lookahead) + { + return false; + } + } + empty = false; + array_push(unquoted_word, lexer->lookahead); + advance(lexer); + } + array_push(unquoted_word, '\0'); - if (quote && lexer->lookahead == quote) { - advance(lexer); - } + if (quote && lexer->lookahead == quote) + { + advance(lexer); + } - return !empty; + return !empty; } -static inline bool scan_bare_dollar(t_lexer_data *lexer) { - while (iswspace(lexer->lookahead) && lexer->lookahead != '\n' && !lexer->eof(lexer)) { - skip(lexer); - } +static inline bool scan_bare_dollar(t_lexer_data *lexer) +{ + while (iswspace(lexer->lookahead) && lexer->lookahead != '\n' && !lexer->eof(lexer)) + { + skip(lexer); + } - if (lexer->lookahead == '$') { - advance(lexer); - lexer->result_symbol = BARE_DOLLAR; - lexer->mark_end(lexer); - return iswspace(lexer->lookahead) || lexer->eof(lexer) || lexer->lookahead == '\"'; - } + if (lexer->lookahead == '$') + { + advance(lexer); + lexer->result_symbol = BARE_DOLLAR; + lexer->mark_end(lexer); + return iswspace(lexer->lookahead) || lexer->eof(lexer) || lexer->lookahead == '\"'; + } - return false; + return false; } -static bool scan_heredoc_start(Heredoc *heredoc, t_lexer_data *lexer) { - while (iswspace(lexer->lookahead)) { - skip(lexer); - } +static bool scan_heredoc_start(Heredoc *heredoc, t_lexer_data *lexer) +{ + while (iswspace(lexer->lookahead)) + { + skip(lexer); + } - lexer->result_symbol = HEREDOC_START; - heredoc->is_raw = lexer->lookahead == '\'' || lexer->lookahead == '"' || lexer->lookahead == '\\'; + lexer->result_symbol = HEREDOC_START; + heredoc->is_raw = lexer->lookahead == '\'' || lexer->lookahead == '"' || lexer->lookahead == '\\'; - bool found_delimiter = advance_word(lexer, &heredoc->delimiter); - if (!found_delimiter) { - reset_string(&heredoc->delimiter); - return false; - } - return found_delimiter; + bool found_delimiter = advance_word(lexer, &heredoc->delimiter); + if (!found_delimiter) + { + reset_string(&heredoc->delimiter); + return false; + } + return found_delimiter; } -static bool scan_heredoc_end_identifier(Heredoc *heredoc, t_lexer_data *lexer) { - reset_string(&heredoc->current_leading_word); - // Scan the first 'n' characters on this line, to see if they match the - // heredoc delimiter - int32_t size = 0; - if (heredoc->delimiter.size > 0) { - while (lexer->lookahead != '\0' && lexer->lookahead != '\n' && - (int32_t)*array_get(&heredoc->delimiter, size) == lexer->lookahead && - heredoc->current_leading_word.size < heredoc->delimiter.size) { - array_push(&heredoc->current_leading_word, lexer->lookahead); - advance(lexer); - size++; - } - } - array_push(&heredoc->current_leading_word, '\0'); - return heredoc->delimiter.size == 0 - ? false - : strcmp(heredoc->current_leading_word.contents, heredoc->delimiter.contents) == 0; +static bool scan_heredoc_end_identifier(Heredoc *heredoc, t_lexer_data *lexer) +{ + reset_string(&heredoc->current_leading_word); + // Scan the first 'n' characters on this line, to see if they match the + // heredoc delimiter + int32_t size = 0; + if (heredoc->delimiter.size > 0) + { + while (lexer->lookahead != '\0' && lexer->lookahead != '\n' && (int32_t)*array_get(&heredoc->delimiter, size) == lexer->lookahead && + heredoc->current_leading_word.size < heredoc->delimiter.size) + { + array_push(&heredoc->current_leading_word, lexer->lookahead); + advance(lexer); + size++; + } + } + array_push(&heredoc->current_leading_word, '\0'); + return heredoc->delimiter.size == 0 ? false : strcmp(heredoc->current_leading_word.contents, heredoc->delimiter.contents) == 0; } -static bool scan_heredoc_content(Scanner *scanner, t_lexer_data *lexer, enum TokenType middle_type, - enum TokenType end_type) { - bool did_advance = false; - Heredoc *heredoc = array_back(&scanner->heredocs); +static bool scan_heredoc_content(Scanner *scanner, t_lexer_data *lexer, enum TokenType middle_type, enum TokenType end_type) +{ + bool did_advance = false; + Heredoc *heredoc = array_back(&scanner->heredocs); - for (;;) { - switch (lexer->lookahead) { - case '\0': { - if (lexer->eof(lexer) && did_advance) { - reset_heredoc(heredoc); - lexer->result_symbol = end_type; - return true; - } - return false; - } + for (;;) + { + switch (lexer->lookahead) + { + case '\0': { + if (lexer->eof(lexer) && did_advance) + { + reset_heredoc(heredoc); + lexer->result_symbol = end_type; + return true; + } + return false; + } - case '\\': { - did_advance = true; - advance(lexer); - advance(lexer); - break; - } + case '\\': { + did_advance = true; + advance(lexer); + advance(lexer); + break; + } - case '$': { - if (heredoc->is_raw) { - did_advance = true; - advance(lexer); - break; - } - if (did_advance) { - lexer->mark_end(lexer); - lexer->result_symbol = middle_type; - heredoc->started = true; - advance(lexer); - if (iswalpha(lexer->lookahead) || lexer->lookahead == '{' || lexer->lookahead == '(') { - return true; - } - break; - } - if (middle_type == HEREDOC_BODY_BEGINNING && lexer->get_column(lexer) == 0) { - lexer->result_symbol = middle_type; - heredoc->started = true; - return true; - } - return false; - } + case '$': { + if (heredoc->is_raw) + { + did_advance = true; + advance(lexer); + break; + } + if (did_advance) + { + lexer->mark_end(lexer); + lexer->result_symbol = middle_type; + heredoc->started = true; + advance(lexer); + if (iswalpha(lexer->lookahead) || lexer->lookahead == '{' || lexer->lookahead == '(') + { + return true; + } + break; + } + if (middle_type == HEREDOC_BODY_BEGINNING && lexer->get_column(lexer) == 0) + { + lexer->result_symbol = middle_type; + heredoc->started = true; + return true; + } + return false; + } - case '\n': { - if (!did_advance) { - skip(lexer); - } else { - advance(lexer); - } - did_advance = true; - if (heredoc->allows_indent) { - while (iswspace(lexer->lookahead)) { - advance(lexer); - } - } - lexer->result_symbol = heredoc->started ? middle_type : end_type; - lexer->mark_end(lexer); - if (scan_heredoc_end_identifier(heredoc, lexer)) { - if (lexer->result_symbol == HEREDOC_END) { - (void) array_pop(&scanner->heredocs); - } - return true; - } - break; - } + case '\n': { + if (!did_advance) + { + skip(lexer); + } + else + { + advance(lexer); + } + did_advance = true; + if (heredoc->allows_indent) + { + while (iswspace(lexer->lookahead)) + { + advance(lexer); + } + } + lexer->result_symbol = heredoc->started ? middle_type : end_type; + lexer->mark_end(lexer); + if (scan_heredoc_end_identifier(heredoc, lexer)) + { + if (lexer->result_symbol == HEREDOC_END) + { + (void)array_pop(&scanner->heredocs); + } + return true; + } + break; + } - default: { - if (lexer->get_column(lexer) == 0) { - // an alternative is to check the starting column of the - // heredoc body and track that statefully - while (iswspace(lexer->lookahead)) { - if (did_advance) { - advance(lexer); - } else { - skip(lexer); - } - } - if (end_type != SIMPLE_HEREDOC_BODY) { - lexer->result_symbol = middle_type; - if (scan_heredoc_end_identifier(heredoc, lexer)) { - return true; - } - } - if (end_type == SIMPLE_HEREDOC_BODY) { - lexer->result_symbol = end_type; - lexer->mark_end(lexer); - if (scan_heredoc_end_identifier(heredoc, lexer)) { - return true; - } - } - } - did_advance = true; - advance(lexer); - break; - } - } - } + default: { + if (lexer->get_column(lexer) == 0) + { + // an alternative is to check the starting column of the + // heredoc body and track that statefully + while (iswspace(lexer->lookahead)) + { + if (did_advance) + { + advance(lexer); + } + else + { + skip(lexer); + } + } + if (end_type != SIMPLE_HEREDOC_BODY) + { + lexer->result_symbol = middle_type; + if (scan_heredoc_end_identifier(heredoc, lexer)) + { + return true; + } + } + if (end_type == SIMPLE_HEREDOC_BODY) + { + lexer->result_symbol = end_type; + lexer->mark_end(lexer); + if (scan_heredoc_end_identifier(heredoc, lexer)) + { + return true; + } + } + } + did_advance = true; + advance(lexer); + break; + } + } + } } -static bool scan(Scanner *scanner, t_lexer_data *lexer, const bool *valid_symbols) { - if (valid_symbols[CONCAT] && !in_error_recovery(valid_symbols)) { - if (!(lexer->lookahead == 0 || iswspace(lexer->lookahead) || lexer->lookahead == '>' || - lexer->lookahead == '<' || lexer->lookahead == ')' || lexer->lookahead == '(' || - lexer->lookahead == ';' || lexer->lookahead == '&' || lexer->lookahead == '|' || - (lexer->lookahead == '}' && valid_symbols[CLOSING_BRACE]) || - (lexer->lookahead == ']' && valid_symbols[CLOSING_BRACKET]))) { - lexer->result_symbol = CONCAT; - // So for a`b`, we want to return a concat. We check if the - // 2nd backtick has whitespace after it, and if it does we - // return concat. - if (lexer->lookahead == '`') { - lexer->mark_end(lexer); - advance(lexer); - while (lexer->lookahead != '`' && !lexer->eof(lexer)) { - advance(lexer); - } - if (lexer->eof(lexer)) { - return false; - } - if (lexer->lookahead == '`') { - advance(lexer); - } - return iswspace(lexer->lookahead) || lexer->eof(lexer); - } - // strings w/ expansions that contains escaped quotes or - // backslashes need this to return a concat - if (lexer->lookahead == '\\') { - lexer->mark_end(lexer); - advance(lexer); - if (lexer->lookahead == '"' || lexer->lookahead == '\'' || lexer->lookahead == '\\') { - return true; - } - if (lexer->eof(lexer)) { - return false; - } - } else { - return true; - } - } - if (iswspace(lexer->lookahead) && valid_symbols[CLOSING_BRACE] && !valid_symbols[EXPANSION_WORD]) { - lexer->result_symbol = CONCAT; - return true; - } - } +static bool scan(Scanner *scanner, t_lexer_data *lexer, const bool *valid_symbols) +{ + if (valid_symbols[CONCAT] && !in_error_recovery(valid_symbols)) + { + if (!(lexer->lookahead == 0 || iswspace(lexer->lookahead) || lexer->lookahead == '>' || lexer->lookahead == '<' || + lexer->lookahead == ')' || lexer->lookahead == '(' || lexer->lookahead == ';' || lexer->lookahead == '&' || + lexer->lookahead == '|')) + { + lexer->result_symbol = CONCAT; + // So for a`b`, we want to return a concat. We check if the + // 2nd backtick has whitespace after it, and if it does we + // return concat. + if (lexer->lookahead == '`') + { + lexer->mark_end(lexer); + advance(lexer); + while (lexer->lookahead != '`' && !lexer->eof(lexer)) + { + advance(lexer); + } + if (lexer->eof(lexer)) + { + return false; + } + if (lexer->lookahead == '`') + { + advance(lexer); + } + return iswspace(lexer->lookahead) || lexer->eof(lexer); + } + // strings w/ expansions that contains escaped quotes or + // backslashes need this to return a concat + if (lexer->lookahead == '\\') + { + lexer->mark_end(lexer); + advance(lexer); + if (lexer->lookahead == '"' || lexer->lookahead == '\'' || lexer->lookahead == '\\') + { + return true; + } + if (lexer->eof(lexer)) + { + return false; + } + } + else + { + return true; + } + } + if (iswspace(lexer->lookahead) && !valid_symbols[EXPANSION_WORD]) + { + lexer->result_symbol = CONCAT; + return true; + } + } - if (valid_symbols[IMMEDIATE_DOUBLE_HASH] && !in_error_recovery(valid_symbols)) { - // advance two # and ensure not } after - if (lexer->lookahead == '#') { - lexer->mark_end(lexer); - advance(lexer); - if (lexer->lookahead == '#') { - advance(lexer); - if (lexer->lookahead != '}') { - lexer->result_symbol = IMMEDIATE_DOUBLE_HASH; - lexer->mark_end(lexer); - return true; - } - } - } - } + if (valid_symbols[IMMEDIATE_DOUBLE_HASH] && !in_error_recovery(valid_symbols)) + { + // advance two # and ensure not } after + if (lexer->lookahead == '#') + { + lexer->mark_end(lexer); + advance(lexer); + if (lexer->lookahead == '#') + { + advance(lexer); + if (lexer->lookahead != '}') + { + lexer->result_symbol = IMMEDIATE_DOUBLE_HASH; + lexer->mark_end(lexer); + return true; + } + } + } + } - if (valid_symbols[EXTERNAL_EXPANSION_SYM_HASH] && !in_error_recovery(valid_symbols)) { - if (lexer->lookahead == '#' || lexer->lookahead == '=' || lexer->lookahead == '!') { - lexer->result_symbol = lexer->lookahead == '#' ? EXTERNAL_EXPANSION_SYM_HASH - : lexer->lookahead == '!' ? EXTERNAL_EXPANSION_SYM_BANG - : EXTERNAL_EXPANSION_SYM_EQUAL; - advance(lexer); - lexer->mark_end(lexer); - while (lexer->lookahead == '#' || lexer->lookahead == '=' || lexer->lookahead == '!') { - advance(lexer); - } - while (iswspace(lexer->lookahead)) { - skip(lexer); - } - if (lexer->lookahead == '}') { - return true; - } - return false; - } - } + if (valid_symbols[EMPTY_VALUE]) + { + if (iswspace(lexer->lookahead) || lexer->eof(lexer) || lexer->lookahead == ';' || lexer->lookahead == '&') + { + lexer->result_symbol = EMPTY_VALUE; + return true; + } + } - if (valid_symbols[EMPTY_VALUE]) { - if (iswspace(lexer->lookahead) || lexer->eof(lexer) || lexer->lookahead == ';' || lexer->lookahead == '&') { - lexer->result_symbol = EMPTY_VALUE; - return true; - } - } + if ((valid_symbols[HEREDOC_BODY_BEGINNING] || valid_symbols[SIMPLE_HEREDOC_BODY]) && scanner->heredocs.size > 0 && + !array_back(&scanner->heredocs)->started && !in_error_recovery(valid_symbols)) + { + return scan_heredoc_content(scanner, lexer, HEREDOC_BODY_BEGINNING, SIMPLE_HEREDOC_BODY); + } - if ((valid_symbols[HEREDOC_BODY_BEGINNING] || valid_symbols[SIMPLE_HEREDOC_BODY]) && scanner->heredocs.size > 0 && - !array_back(&scanner->heredocs)->started && !in_error_recovery(valid_symbols)) { - return scan_heredoc_content(scanner, lexer, HEREDOC_BODY_BEGINNING, SIMPLE_HEREDOC_BODY); - } + if (valid_symbols[HEREDOC_END] && scanner->heredocs.size > 0) + { + Heredoc *heredoc = array_back(&scanner->heredocs); + if (scan_heredoc_end_identifier(heredoc, lexer)) + { + array_delete(&heredoc->current_leading_word); + array_delete(&heredoc->delimiter); + (void)array_pop(&scanner->heredocs); + lexer->result_symbol = HEREDOC_END; + return true; + } + } - if (valid_symbols[HEREDOC_END] && scanner->heredocs.size > 0) { - Heredoc *heredoc = array_back(&scanner->heredocs); - if (scan_heredoc_end_identifier(heredoc, lexer)) { - array_delete(&heredoc->current_leading_word); - array_delete(&heredoc->delimiter); - (void)array_pop(&scanner->heredocs); - lexer->result_symbol = HEREDOC_END; - return true; - } - } + if (valid_symbols[HEREDOC_CONTENT] && scanner->heredocs.size > 0 && array_back(&scanner->heredocs)->started && + !in_error_recovery(valid_symbols)) + { + return scan_heredoc_content(scanner, lexer, HEREDOC_CONTENT, HEREDOC_END); + } - if (valid_symbols[HEREDOC_CONTENT] && scanner->heredocs.size > 0 && array_back(&scanner->heredocs)->started && - !in_error_recovery(valid_symbols)) { - return scan_heredoc_content(scanner, lexer, HEREDOC_CONTENT, HEREDOC_END); - } + if (valid_symbols[HEREDOC_START] && !in_error_recovery(valid_symbols) && scanner->heredocs.size > 0) + { + return scan_heredoc_start(array_back(&scanner->heredocs), lexer); + } - if (valid_symbols[HEREDOC_START] && !in_error_recovery(valid_symbols) && scanner->heredocs.size > 0) { - return scan_heredoc_start(array_back(&scanner->heredocs), lexer); - } + if ((valid_symbols[VARIABLE_NAME] || valid_symbols[FILE_DESCRIPTOR] || valid_symbols[HEREDOC_ARROW]) && + !in_error_recovery(valid_symbols)) + { + for (;;) + { + if ((lexer->lookahead == ' ' || lexer->lookahead == '\t' || lexer->lookahead == '\r' || + (lexer->lookahead == '\n' && !valid_symbols[NEWLINE])) && + !valid_symbols[EXPANSION_WORD]) + { + skip(lexer); + } + else if (lexer->lookahead == '\\') + { + skip(lexer); - if (valid_symbols[TEST_OPERATOR] && !valid_symbols[EXPANSION_WORD]) { - while (iswspace(lexer->lookahead) && lexer->lookahead != '\n') { - skip(lexer); - } + if (lexer->eof(lexer)) + { + lexer->mark_end(lexer); + lexer->result_symbol = VARIABLE_NAME; + return true; + } - if (lexer->lookahead == '\\') { - if (valid_symbols[EXTGLOB_PATTERN]) { - goto extglob_pattern; - } - if (valid_symbols[REGEX_NO_SPACE]) { - goto regex; - } - skip(lexer); + if (lexer->lookahead == '\r') + { + skip(lexer); + } + if (lexer->lookahead == '\n') + { + skip(lexer); + } + else + { + if (lexer->lookahead == '\\' && valid_symbols[EXPANSION_WORD]) + { + goto expansion_word; + } + return false; + } + } + else + { + break; + } + } - if (lexer->eof(lexer)) { - return false; - } + // no '*', '@', '?', '-', '$', '0', '_' + if (!valid_symbols[EXPANSION_WORD] && (lexer->lookahead == '*' || lexer->lookahead == '@' || lexer->lookahead == '?' || + lexer->lookahead == '-' || lexer->lookahead == '0' || lexer->lookahead == '_')) + { + lexer->mark_end(lexer); + advance(lexer); + if (lexer->lookahead == '=' || lexer->lookahead == '[' || lexer->lookahead == ':' || lexer->lookahead == '-' || + lexer->lookahead == '%' || lexer->lookahead == '#' || lexer->lookahead == '/') + { + return false; + } + if (valid_symbols[EXTGLOB_PATTERN] && iswspace(lexer->lookahead)) + { + lexer->mark_end(lexer); + lexer->result_symbol = EXTGLOB_PATTERN; + return true; + } + } - if (lexer->lookahead == '\r') { - skip(lexer); - if (lexer->lookahead == '\n') { - skip(lexer); - } - } else if (lexer->lookahead == '\n') { - skip(lexer); - } else { - return false; - } + if (valid_symbols[HEREDOC_ARROW] && lexer->lookahead == '<') + { + advance(lexer); + if (lexer->lookahead == '<') + { + advance(lexer); + if (lexer->lookahead == '-') + { + advance(lexer); + Heredoc heredoc = heredoc_new(); + heredoc.allows_indent = true; + array_push(&scanner->heredocs, heredoc); + lexer->result_symbol = HEREDOC_ARROW_DASH; + } + else if (lexer->lookahead == '<' || lexer->lookahead == '=') + { + return false; + } + else + { + Heredoc heredoc = heredoc_new(); + array_push(&scanner->heredocs, heredoc); + lexer->result_symbol = HEREDOC_ARROW; + } + return true; + } + return false; + } - while (iswspace(lexer->lookahead)) { - skip(lexer); - } - } + bool is_number = true; + if (iswdigit(lexer->lookahead)) + { + advance(lexer); + } + else if (iswalpha(lexer->lookahead) || lexer->lookahead == '_') + { + is_number = false; + advance(lexer); + } + else + { + if (lexer->lookahead == '{') + { + goto brace_start; + } + if (valid_symbols[EXPANSION_WORD]) + { + goto expansion_word; + } + if (valid_symbols[EXTGLOB_PATTERN]) + { + goto extglob_pattern; + } + return false; + } - if (lexer->lookahead == '\n' && !valid_symbols[NEWLINE]) { - skip(lexer); + for (;;) + { + if (iswdigit(lexer->lookahead)) + { + advance(lexer); + } + else if (iswalpha(lexer->lookahead) || lexer->lookahead == '_') + { + is_number = false; + advance(lexer); + } + else + { + break; + } + } - while (iswspace(lexer->lookahead)) { - skip(lexer); - } - } + if (is_number && valid_symbols[FILE_DESCRIPTOR] && (lexer->lookahead == '>' || lexer->lookahead == '<')) + { + lexer->result_symbol = FILE_DESCRIPTOR; + return true; + } - if (lexer->lookahead == '-') { - advance(lexer); + if (valid_symbols[VARIABLE_NAME]) + { + if (lexer->lookahead == '+') + { + lexer->mark_end(lexer); + advance(lexer); + if (lexer->lookahead == '=' || lexer->lookahead == ':') + { + lexer->result_symbol = VARIABLE_NAME; + return true; + } + return false; + } + if (lexer->lookahead == '/') + { + return false; + } + if (lexer->lookahead == '=' || lexer->lookahead == '[' || + (lexer->lookahead == ':' && + !valid_symbols[OPENING_PAREN]) || // TODO(amaanq): more cases for regular word chars but not variable + // names for function words, only handling : for now? #235 + lexer->lookahead == '%' || + (lexer->lookahead == '#' && !is_number) || lexer->lookahead == '@' || (lexer->lookahead == '-')) + { + lexer->mark_end(lexer); + lexer->result_symbol = VARIABLE_NAME; + return true; + } - bool advanced_once = false; - while (iswalpha(lexer->lookahead)) { - advanced_once = true; - advance(lexer); - } + if (lexer->lookahead == '?') + { + lexer->mark_end(lexer); + advance(lexer); + lexer->result_symbol = VARIABLE_NAME; + return iswalpha(lexer->lookahead); + } + } - if (iswspace(lexer->lookahead) && advanced_once) { - lexer->mark_end(lexer); - advance(lexer); - if (lexer->lookahead == '}' && valid_symbols[CLOSING_BRACE]) { - if (valid_symbols[EXPANSION_WORD]) { - lexer->mark_end(lexer); - lexer->result_symbol = EXPANSION_WORD; - return true; - } - return false; - } - lexer->result_symbol = TEST_OPERATOR; - return true; - } - if (iswspace(lexer->lookahead) && valid_symbols[EXTGLOB_PATTERN]) { - lexer->result_symbol = EXTGLOB_PATTERN; - return true; - } - } + return false; + } - if (valid_symbols[BARE_DOLLAR] && !in_error_recovery(valid_symbols) && scan_bare_dollar(lexer)) { - return true; - } - } + if (valid_symbols[BARE_DOLLAR] && !in_error_recovery(valid_symbols) && scan_bare_dollar(lexer)) + { + return true; + } - if ((valid_symbols[VARIABLE_NAME] || valid_symbols[FILE_DESCRIPTOR] || valid_symbols[HEREDOC_ARROW]) && - !valid_symbols[REGEX_NO_SLASH] && !in_error_recovery(valid_symbols)) { - for (;;) { - if ((lexer->lookahead == ' ' || lexer->lookahead == '\t' || lexer->lookahead == '\r' || - (lexer->lookahead == '\n' && !valid_symbols[NEWLINE])) && - !valid_symbols[EXPANSION_WORD]) { - skip(lexer); - } else if (lexer->lookahead == '\\') { - skip(lexer); + if (valid_symbols[REGEX] && !in_error_recovery(valid_symbols)) + { + if (valid_symbols[REGEX]) + { + while (iswspace(lexer->lookahead)) + { + skip(lexer); + } + } - if (lexer->eof(lexer)) { - lexer->mark_end(lexer); - lexer->result_symbol = VARIABLE_NAME; - return true; - } + if ((lexer->lookahead != '"' && lexer->lookahead != '\'') || ((lexer->lookahead == '$' || lexer->lookahead == '\'')) || + (lexer->lookahead == '\'')) + { + typedef struct + { + bool done; + bool advanced_once; + bool found_non_alnumdollarunderdash; + bool last_was_escape; + bool in_single_quote; + uint32_t paren_depth; + uint32_t bracket_depth; + uint32_t brace_depth; + } State; - if (lexer->lookahead == '\r') { - skip(lexer); - } - if (lexer->lookahead == '\n') { - skip(lexer); - } else { - if (lexer->lookahead == '\\' && valid_symbols[EXPANSION_WORD]) { - goto expansion_word; - } - return false; - } - } else { - break; - } - } + if (lexer->lookahead == '$') + { + lexer->mark_end(lexer); + advance(lexer); + if (lexer->lookahead == '(') + { + return false; + } + } - // no '*', '@', '?', '-', '$', '0', '_' - if (!valid_symbols[EXPANSION_WORD] && - (lexer->lookahead == '*' || lexer->lookahead == '@' || lexer->lookahead == '?' || lexer->lookahead == '-' || - lexer->lookahead == '0' || lexer->lookahead == '_')) { - lexer->mark_end(lexer); - advance(lexer); - if (lexer->lookahead == '=' || lexer->lookahead == '[' || lexer->lookahead == ':' || - lexer->lookahead == '-' || lexer->lookahead == '%' || lexer->lookahead == '#' || - lexer->lookahead == '/') { - return false; - } - if (valid_symbols[EXTGLOB_PATTERN] && iswspace(lexer->lookahead)) { - lexer->mark_end(lexer); - lexer->result_symbol = EXTGLOB_PATTERN; - return true; - } - } + lexer->mark_end(lexer); - if (valid_symbols[HEREDOC_ARROW] && lexer->lookahead == '<') { - advance(lexer); - if (lexer->lookahead == '<') { - advance(lexer); - if (lexer->lookahead == '-') { - advance(lexer); - Heredoc heredoc = heredoc_new(); - heredoc.allows_indent = true; - array_push(&scanner->heredocs, heredoc); - lexer->result_symbol = HEREDOC_ARROW_DASH; - } else if (lexer->lookahead == '<' || lexer->lookahead == '=') { - return false; - } else { - Heredoc heredoc = heredoc_new(); - array_push(&scanner->heredocs, heredoc); - lexer->result_symbol = HEREDOC_ARROW; - } - return true; - } - return false; - } + State state = {false, false, false, false, false, 0, 0, 0}; + while (!state.done) + { + if (state.in_single_quote) + { + if (lexer->lookahead == '\'') + { + state.in_single_quote = false; + advance(lexer); + lexer->mark_end(lexer); + } + } + switch (lexer->lookahead) + { + case '\\': + state.last_was_escape = true; + break; + case '\0': + return false; + case '(': + state.paren_depth++; + state.last_was_escape = false; + break; + case '[': + state.bracket_depth++; + state.last_was_escape = false; + break; + case '{': + if (!state.last_was_escape) + { + state.brace_depth++; + } + state.last_was_escape = false; + break; + case ')': + if (state.paren_depth == 0) + { + state.done = true; + } + state.paren_depth--; + state.last_was_escape = false; + break; + case ']': + if (state.bracket_depth == 0) + { + state.done = true; + } + state.bracket_depth--; + state.last_was_escape = false; + break; + case '}': + if (state.brace_depth == 0) + { + state.done = true; + } + state.brace_depth--; + state.last_was_escape = false; + break; + case '\'': + // Enter or exit a single-quoted string. + state.in_single_quote = !state.in_single_quote; + advance(lexer); + state.advanced_once = true; + state.last_was_escape = false; + continue; + default: + state.last_was_escape = false; + break; + } - bool is_number = true; - if (iswdigit(lexer->lookahead)) { - advance(lexer); - } else if (iswalpha(lexer->lookahead) || lexer->lookahead == '_') { - is_number = false; - advance(lexer); - } else { - if (lexer->lookahead == '{') { - goto brace_start; - } - if (valid_symbols[EXPANSION_WORD]) { - goto expansion_word; - } - if (valid_symbols[EXTGLOB_PATTERN]) { - goto extglob_pattern; - } - return false; - } + if (!state.done) + { + if (valid_symbols[REGEX]) + { + bool was_space = !state.in_single_quote && iswspace(lexer->lookahead); + advance(lexer); + state.advanced_once = true; + if (!was_space || state.paren_depth > 0) + { + lexer->mark_end(lexer); + } + } + } + } - for (;;) { - if (iswdigit(lexer->lookahead)) { - advance(lexer); - } else if (iswalpha(lexer->lookahead) || lexer->lookahead == '_') { - is_number = false; - advance(lexer); - } else { - break; - } - } - - if (is_number && valid_symbols[FILE_DESCRIPTOR] && (lexer->lookahead == '>' || lexer->lookahead == '<')) { - lexer->result_symbol = FILE_DESCRIPTOR; - return true; - } - - if (valid_symbols[VARIABLE_NAME]) { - if (lexer->lookahead == '+') { - lexer->mark_end(lexer); - advance(lexer); - if (lexer->lookahead == '=' || lexer->lookahead == ':' || valid_symbols[CLOSING_BRACE]) { - lexer->result_symbol = VARIABLE_NAME; - return true; - } - return false; - } - if (lexer->lookahead == '/') { - return false; - } - if (lexer->lookahead == '=' || lexer->lookahead == '[' || - (lexer->lookahead == ':' && !valid_symbols[CLOSING_BRACE] && - !valid_symbols[OPENING_PAREN]) || // TODO(amaanq): more cases for regular word chars but not variable - // names for function words, only handling : for now? #235 - lexer->lookahead == '%' || - (lexer->lookahead == '#' && !is_number) || lexer->lookahead == '@' || - (lexer->lookahead == '-' && valid_symbols[CLOSING_BRACE])) { - lexer->mark_end(lexer); - lexer->result_symbol = VARIABLE_NAME; - return true; - } - - if (lexer->lookahead == '?') { - lexer->mark_end(lexer); - advance(lexer); - lexer->result_symbol = VARIABLE_NAME; - return iswalpha(lexer->lookahead); - } - } - - return false; - } - - if (valid_symbols[BARE_DOLLAR] && !in_error_recovery(valid_symbols) && scan_bare_dollar(lexer)) { - return true; - } - -regex: - if ((valid_symbols[REGEX] || valid_symbols[REGEX_NO_SLASH] || valid_symbols[REGEX_NO_SPACE]) && - !in_error_recovery(valid_symbols)) { - if (valid_symbols[REGEX] || valid_symbols[REGEX_NO_SPACE]) { - while (iswspace(lexer->lookahead)) { - skip(lexer); - } - } - - if ((lexer->lookahead != '"' && lexer->lookahead != '\'') || - ((lexer->lookahead == '$' || lexer->lookahead == '\'') && valid_symbols[REGEX_NO_SLASH]) || - (lexer->lookahead == '\'' && valid_symbols[REGEX_NO_SPACE])) { - typedef struct { - bool done; - bool advanced_once; - bool found_non_alnumdollarunderdash; - bool last_was_escape; - bool in_single_quote; - uint32_t paren_depth; - uint32_t bracket_depth; - uint32_t brace_depth; - } State; - - if (lexer->lookahead == '$' && valid_symbols[REGEX_NO_SLASH]) { - lexer->mark_end(lexer); - advance(lexer); - if (lexer->lookahead == '(') { - return false; - } - } - - lexer->mark_end(lexer); - - State state = {false, false, false, false, false, 0, 0, 0}; - while (!state.done) { - if (state.in_single_quote) { - if (lexer->lookahead == '\'') { - state.in_single_quote = false; - advance(lexer); - lexer->mark_end(lexer); - } - } - switch (lexer->lookahead) { - case '\\': - state.last_was_escape = true; - break; - case '\0': - return false; - case '(': - state.paren_depth++; - state.last_was_escape = false; - break; - case '[': - state.bracket_depth++; - state.last_was_escape = false; - break; - case '{': - if (!state.last_was_escape) { - state.brace_depth++; - } - state.last_was_escape = false; - break; - case ')': - if (state.paren_depth == 0) { - state.done = true; - } - state.paren_depth--; - state.last_was_escape = false; - break; - case ']': - if (state.bracket_depth == 0) { - state.done = true; - } - state.bracket_depth--; - state.last_was_escape = false; - break; - case '}': - if (state.brace_depth == 0) { - state.done = true; - } - state.brace_depth--; - state.last_was_escape = false; - break; - case '\'': - // Enter or exit a single-quoted string. - state.in_single_quote = !state.in_single_quote; - advance(lexer); - state.advanced_once = true; - state.last_was_escape = false; - continue; - default: - state.last_was_escape = false; - break; - } - - if (!state.done) { - if (valid_symbols[REGEX]) { - bool was_space = !state.in_single_quote && iswspace(lexer->lookahead); - advance(lexer); - state.advanced_once = true; - if (!was_space || state.paren_depth > 0) { - lexer->mark_end(lexer); - } - } else if (valid_symbols[REGEX_NO_SLASH]) { - if (lexer->lookahead == '/') { - lexer->mark_end(lexer); - lexer->result_symbol = REGEX_NO_SLASH; - return state.advanced_once; - } - if (lexer->lookahead == '\\') { - advance(lexer); - state.advanced_once = true; - if (!lexer->eof(lexer) && lexer->lookahead != '[' && lexer->lookahead != '/') { - advance(lexer); - lexer->mark_end(lexer); - } - } else { - bool was_space = !state.in_single_quote && iswspace(lexer->lookahead); - advance(lexer); - state.advanced_once = true; - if (!was_space) { - lexer->mark_end(lexer); - } - } - } else if (valid_symbols[REGEX_NO_SPACE]) { - if (lexer->lookahead == '\\') { - state.found_non_alnumdollarunderdash = true; - advance(lexer); - if (!lexer->eof(lexer)) { - advance(lexer); - } - } else if (lexer->lookahead == '$') { - lexer->mark_end(lexer); - advance(lexer); - // do not parse a command - // substitution - if (lexer->lookahead == '(') { - return false; - } - // end $ always means regex, e.g. - // 99999999$ - if (iswspace(lexer->lookahead)) { - lexer->result_symbol = REGEX_NO_SPACE; - lexer->mark_end(lexer); - return true; - } - } else { - bool was_space = !state.in_single_quote && iswspace(lexer->lookahead); - if (was_space && state.paren_depth == 0) { - lexer->mark_end(lexer); - lexer->result_symbol = REGEX_NO_SPACE; - return state.found_non_alnumdollarunderdash; - } - if (!iswalnum(lexer->lookahead) && lexer->lookahead != '$' && lexer->lookahead != '-' && - lexer->lookahead != '_') { - state.found_non_alnumdollarunderdash = true; - } - advance(lexer); - } - } - } - } - - lexer->result_symbol = valid_symbols[REGEX_NO_SLASH] ? REGEX_NO_SLASH - : valid_symbols[REGEX_NO_SPACE] ? REGEX_NO_SPACE - : REGEX; - if (valid_symbols[REGEX] && !state.advanced_once) { - return false; - } - return true; - } - } + lexer->result_symbol = REGEX; + if (valid_symbols[REGEX] && !state.advanced_once) + { + return false; + } + return true; + } + } extglob_pattern: - if (valid_symbols[EXTGLOB_PATTERN] && !in_error_recovery(valid_symbols)) { - // first skip ws, then check for ? * + @ ! - while (iswspace(lexer->lookahead)) { - skip(lexer); - } + if (valid_symbols[EXTGLOB_PATTERN] && !in_error_recovery(valid_symbols)) + { + // first skip ws, then check for ? * + @ ! + while (iswspace(lexer->lookahead)) + { + skip(lexer); + } - if (lexer->lookahead == '?' || lexer->lookahead == '*' || lexer->lookahead == '+' || lexer->lookahead == '@' || - lexer->lookahead == '!' || lexer->lookahead == '-' || lexer->lookahead == ')' || lexer->lookahead == '\\' || - lexer->lookahead == '.' || lexer->lookahead == '[' || (iswalpha(lexer->lookahead))) { - if (lexer->lookahead == '\\') { - advance(lexer); - if ((iswspace(lexer->lookahead) || lexer->lookahead == '"') && lexer->lookahead != '\r' && - lexer->lookahead != '\n') { - advance(lexer); - } else { - return false; - } - } + if (lexer->lookahead == '?' || lexer->lookahead == '*' || lexer->lookahead == '+' || lexer->lookahead == '@' || + lexer->lookahead == '!' || lexer->lookahead == '-' || lexer->lookahead == ')' || lexer->lookahead == '\\' || + lexer->lookahead == '.' || lexer->lookahead == '[' || (iswalpha(lexer->lookahead))) + { + if (lexer->lookahead == '\\') + { + advance(lexer); + if ((iswspace(lexer->lookahead) || lexer->lookahead == '"') && lexer->lookahead != '\r' && lexer->lookahead != '\n') + { + advance(lexer); + } + else + { + return false; + } + } - if (lexer->lookahead == ')' && scanner->last_glob_paren_depth == 0) { - lexer->mark_end(lexer); - advance(lexer); + if (lexer->lookahead == ')' && scanner->last_glob_paren_depth == 0) + { + lexer->mark_end(lexer); + advance(lexer); - if (iswspace(lexer->lookahead)) { - return false; - } - } + if (iswspace(lexer->lookahead)) + { + return false; + } + } - lexer->mark_end(lexer); - bool was_non_alpha = !iswalpha(lexer->lookahead); - if (lexer->lookahead != '[') { - // no esac - if (lexer->lookahead == 'e') { - lexer->mark_end(lexer); - advance(lexer); - if (lexer->lookahead == 's') { - advance(lexer); - if (lexer->lookahead == 'a') { - advance(lexer); - if (lexer->lookahead == 'c') { - advance(lexer); - if (iswspace(lexer->lookahead)) { - return false; - } - } - } - } - } else { - advance(lexer); - } - } + lexer->mark_end(lexer); + bool was_non_alpha = !iswalpha(lexer->lookahead); + if (lexer->lookahead != '[') + { + // no esac + if (lexer->lookahead == 'e') + { + lexer->mark_end(lexer); + advance(lexer); + if (lexer->lookahead == 's') + { + advance(lexer); + if (lexer->lookahead == 'a') + { + advance(lexer); + if (lexer->lookahead == 'c') + { + advance(lexer); + if (iswspace(lexer->lookahead)) + { + return false; + } + } + } + } + } + else + { + advance(lexer); + } + } - // -\w is just a word, find something else special - if (lexer->lookahead == '-') { - lexer->mark_end(lexer); - advance(lexer); - while (iswalnum(lexer->lookahead)) { - advance(lexer); - } + // -\w is just a word, find something else special + if (lexer->lookahead == '-') + { + lexer->mark_end(lexer); + advance(lexer); + while (iswalnum(lexer->lookahead)) + { + advance(lexer); + } - if (lexer->lookahead == ')' || lexer->lookahead == '\\' || lexer->lookahead == '.') { - return false; - } - lexer->mark_end(lexer); - } + if (lexer->lookahead == ')' || lexer->lookahead == '\\' || lexer->lookahead == '.') + { + return false; + } + lexer->mark_end(lexer); + } - // case item -) or *) - if (lexer->lookahead == ')' && scanner->last_glob_paren_depth == 0) { - lexer->mark_end(lexer); - advance(lexer); - if (iswspace(lexer->lookahead)) { - lexer->result_symbol = EXTGLOB_PATTERN; - return was_non_alpha; - } - } + // case item -) or *) + if (lexer->lookahead == ')' && scanner->last_glob_paren_depth == 0) + { + lexer->mark_end(lexer); + advance(lexer); + if (iswspace(lexer->lookahead)) + { + lexer->result_symbol = EXTGLOB_PATTERN; + return was_non_alpha; + } + } - if (iswspace(lexer->lookahead)) { - lexer->mark_end(lexer); - lexer->result_symbol = EXTGLOB_PATTERN; - scanner->last_glob_paren_depth = 0; - return true; - } + if (iswspace(lexer->lookahead)) + { + lexer->mark_end(lexer); + lexer->result_symbol = EXTGLOB_PATTERN; + scanner->last_glob_paren_depth = 0; + return true; + } - if (lexer->lookahead == '$') { - lexer->mark_end(lexer); - advance(lexer); - if (lexer->lookahead == '{' || lexer->lookahead == '(') { - lexer->result_symbol = EXTGLOB_PATTERN; - return true; - } - } + if (lexer->lookahead == '$') + { + lexer->mark_end(lexer); + advance(lexer); + if (lexer->lookahead == '{' || lexer->lookahead == '(') + { + lexer->result_symbol = EXTGLOB_PATTERN; + return true; + } + } - if (lexer->lookahead == '|') { - lexer->mark_end(lexer); - advance(lexer); - lexer->result_symbol = EXTGLOB_PATTERN; - return true; - } + if (lexer->lookahead == '|') + { + lexer->mark_end(lexer); + advance(lexer); + lexer->result_symbol = EXTGLOB_PATTERN; + return true; + } - if (!iswalnum(lexer->lookahead) && lexer->lookahead != '(' && lexer->lookahead != '"' && - lexer->lookahead != '[' && lexer->lookahead != '?' && lexer->lookahead != '/' && - lexer->lookahead != '\\' && lexer->lookahead != '_' && lexer->lookahead != '*') { - return false; - } + if (!iswalnum(lexer->lookahead) && lexer->lookahead != '(' && lexer->lookahead != '"' && lexer->lookahead != '[' && + lexer->lookahead != '?' && lexer->lookahead != '/' && lexer->lookahead != '\\' && lexer->lookahead != '_' && + lexer->lookahead != '*') + { + return false; + } - typedef struct { - bool done; - bool saw_non_alphadot; - uint32_t paren_depth; - uint32_t bracket_depth; - uint32_t brace_depth; - } State; + typedef struct + { + bool done; + bool saw_non_alphadot; + uint32_t paren_depth; + uint32_t bracket_depth; + uint32_t brace_depth; + } State; - State state = {false, was_non_alpha, scanner->last_glob_paren_depth, 0, 0}; - while (!state.done) { - switch (lexer->lookahead) { - case '\0': - return false; - case '(': - state.paren_depth++; - break; - case '[': - state.bracket_depth++; - break; - case '{': - state.brace_depth++; - break; - case ')': - if (state.paren_depth == 0) { - state.done = true; - } - state.paren_depth--; - break; - case ']': - if (state.bracket_depth == 0) { - state.done = true; - } - state.bracket_depth--; - break; - case '}': - if (state.brace_depth == 0) { - state.done = true; - } - state.brace_depth--; - break; - } + State state = {false, was_non_alpha, scanner->last_glob_paren_depth, 0, 0}; + while (!state.done) + { + switch (lexer->lookahead) + { + case '\0': + return false; + case '(': + state.paren_depth++; + break; + case '[': + state.bracket_depth++; + break; + case '{': + state.brace_depth++; + break; + case ')': + if (state.paren_depth == 0) + { + state.done = true; + } + state.paren_depth--; + break; + case ']': + if (state.bracket_depth == 0) + { + state.done = true; + } + state.bracket_depth--; + break; + case '}': + if (state.brace_depth == 0) + { + state.done = true; + } + state.brace_depth--; + break; + } - if (lexer->lookahead == '|') { - lexer->mark_end(lexer); - advance(lexer); - if (state.paren_depth == 0 && state.bracket_depth == 0 && state.brace_depth == 0) { - lexer->result_symbol = EXTGLOB_PATTERN; - return true; - } - } + if (lexer->lookahead == '|') + { + lexer->mark_end(lexer); + advance(lexer); + if (state.paren_depth == 0 && state.bracket_depth == 0 && state.brace_depth == 0) + { + lexer->result_symbol = EXTGLOB_PATTERN; + return true; + } + } - if (!state.done) { - bool was_space = iswspace(lexer->lookahead); - if (lexer->lookahead == '$') { - lexer->mark_end(lexer); - if (!iswalpha(lexer->lookahead) && lexer->lookahead != '.' && lexer->lookahead != '\\') { - state.saw_non_alphadot = true; - } - advance(lexer); - if (lexer->lookahead == '(' || lexer->lookahead == '{') { - lexer->result_symbol = EXTGLOB_PATTERN; - scanner->last_glob_paren_depth = state.paren_depth; - return state.saw_non_alphadot; - } - } - if (was_space) { - lexer->mark_end(lexer); - lexer->result_symbol = EXTGLOB_PATTERN; - scanner->last_glob_paren_depth = 0; - return state.saw_non_alphadot; - } - if (lexer->lookahead == '"') { - lexer->mark_end(lexer); - lexer->result_symbol = EXTGLOB_PATTERN; - scanner->last_glob_paren_depth = 0; - return state.saw_non_alphadot; - } - if (lexer->lookahead == '\\') { - if (!iswalpha(lexer->lookahead) && lexer->lookahead != '.' && lexer->lookahead != '\\') { - state.saw_non_alphadot = true; - } - advance(lexer); - if (iswspace(lexer->lookahead) || lexer->lookahead == '"') { - advance(lexer); - } - } else { - if (!iswalpha(lexer->lookahead) && lexer->lookahead != '.' && lexer->lookahead != '\\') { - state.saw_non_alphadot = true; - } - advance(lexer); - } - if (!was_space) { - lexer->mark_end(lexer); - } - } - } + if (!state.done) + { + bool was_space = iswspace(lexer->lookahead); + if (lexer->lookahead == '$') + { + lexer->mark_end(lexer); + if (!iswalpha(lexer->lookahead) && lexer->lookahead != '.' && lexer->lookahead != '\\') + { + state.saw_non_alphadot = true; + } + advance(lexer); + if (lexer->lookahead == '(' || lexer->lookahead == '{') + { + lexer->result_symbol = EXTGLOB_PATTERN; + scanner->last_glob_paren_depth = state.paren_depth; + return state.saw_non_alphadot; + } + } + if (was_space) + { + lexer->mark_end(lexer); + lexer->result_symbol = EXTGLOB_PATTERN; + scanner->last_glob_paren_depth = 0; + return state.saw_non_alphadot; + } + if (lexer->lookahead == '"') + { + lexer->mark_end(lexer); + lexer->result_symbol = EXTGLOB_PATTERN; + scanner->last_glob_paren_depth = 0; + return state.saw_non_alphadot; + } + if (lexer->lookahead == '\\') + { + if (!iswalpha(lexer->lookahead) && lexer->lookahead != '.' && lexer->lookahead != '\\') + { + state.saw_non_alphadot = true; + } + advance(lexer); + if (iswspace(lexer->lookahead) || lexer->lookahead == '"') + { + advance(lexer); + } + } + else + { + if (!iswalpha(lexer->lookahead) && lexer->lookahead != '.' && lexer->lookahead != '\\') + { + state.saw_non_alphadot = true; + } + advance(lexer); + } + if (!was_space) + { + lexer->mark_end(lexer); + } + } + } - lexer->result_symbol = EXTGLOB_PATTERN; - scanner->last_glob_paren_depth = 0; - return state.saw_non_alphadot; - } - scanner->last_glob_paren_depth = 0; + lexer->result_symbol = EXTGLOB_PATTERN; + scanner->last_glob_paren_depth = 0; + return state.saw_non_alphadot; + } + scanner->last_glob_paren_depth = 0; - return false; - } + return false; + } expansion_word: - if (valid_symbols[EXPANSION_WORD]) { - bool advanced_once = false; - bool advance_once_space = false; - for (;;) { - if (lexer->lookahead == '\"') { - return false; - } - if (lexer->lookahead == '$') { - lexer->mark_end(lexer); - advance(lexer); - if (lexer->lookahead == '{' || lexer->lookahead == '(' || lexer->lookahead == '\'' || - iswalnum(lexer->lookahead)) { - lexer->result_symbol = EXPANSION_WORD; - return advanced_once; - } - advanced_once = true; - } + if (valid_symbols[EXPANSION_WORD]) + { + bool advanced_once = false; + bool advance_once_space = false; + for (;;) + { + if (lexer->lookahead == '\"') + { + return false; + } + if (lexer->lookahead == '$') + { + lexer->mark_end(lexer); + advance(lexer); + if (lexer->lookahead == '{' || lexer->lookahead == '(' || lexer->lookahead == '\'' || iswalnum(lexer->lookahead)) + { + lexer->result_symbol = EXPANSION_WORD; + return advanced_once; + } + advanced_once = true; + } - if (lexer->lookahead == '}') { - lexer->mark_end(lexer); - lexer->result_symbol = EXPANSION_WORD; - return advanced_once || advance_once_space; - } + if (lexer->lookahead == '}') + { + lexer->mark_end(lexer); + lexer->result_symbol = EXPANSION_WORD; + return advanced_once || advance_once_space; + } - if (lexer->lookahead == '(' && !(advanced_once || advance_once_space)) { - lexer->mark_end(lexer); - advance(lexer); - while (lexer->lookahead != ')' && !lexer->eof(lexer)) { - // if we find a $( or ${ assume this is valid and is - // a garbage concatenation of some weird word + an - // expansion - // I wonder where this can fail - if (lexer->lookahead == '$') { - lexer->mark_end(lexer); - advance(lexer); - if (lexer->lookahead == '{' || lexer->lookahead == '(' || lexer->lookahead == '\'' || - iswalnum(lexer->lookahead)) { - lexer->result_symbol = EXPANSION_WORD; - return advanced_once; - } - advanced_once = true; - } else { - advanced_once = advanced_once || !iswspace(lexer->lookahead); - advance_once_space = advance_once_space || iswspace(lexer->lookahead); - advance(lexer); - } - } - lexer->mark_end(lexer); - if (lexer->lookahead == ')') { - advanced_once = true; - advance(lexer); - lexer->mark_end(lexer); - if (lexer->lookahead == '}') { - return false; - } - } else { - return false; - } - } + if (lexer->lookahead == '(' && !(advanced_once || advance_once_space)) + { + lexer->mark_end(lexer); + advance(lexer); + while (lexer->lookahead != ')' && !lexer->eof(lexer)) + { + // if we find a $( or ${ assume this is valid and is + // a garbage concatenation of some weird word + an + // expansion + // I wonder where this can fail + if (lexer->lookahead == '$') + { + lexer->mark_end(lexer); + advance(lexer); + if (lexer->lookahead == '{' || lexer->lookahead == '(' || lexer->lookahead == '\'' || iswalnum(lexer->lookahead)) + { + lexer->result_symbol = EXPANSION_WORD; + return advanced_once; + } + advanced_once = true; + } + else + { + advanced_once = advanced_once || !iswspace(lexer->lookahead); + advance_once_space = advance_once_space || iswspace(lexer->lookahead); + advance(lexer); + } + } + lexer->mark_end(lexer); + if (lexer->lookahead == ')') + { + advanced_once = true; + advance(lexer); + lexer->mark_end(lexer); + if (lexer->lookahead == '}') + { + return false; + } + } + else + { + return false; + } + } - if (lexer->lookahead == '\'') { - return false; - } + if (lexer->lookahead == '\'') + { + return false; + } - if (lexer->eof(lexer)) { - return false; - } - advanced_once = advanced_once || !iswspace(lexer->lookahead); - advance_once_space = advance_once_space || iswspace(lexer->lookahead); - advance(lexer); - } - } + if (lexer->eof(lexer)) + { + return false; + } + advanced_once = advanced_once || !iswspace(lexer->lookahead); + advance_once_space = advance_once_space || iswspace(lexer->lookahead); + advance(lexer); + } + } brace_start: - if (valid_symbols[BRACE_START] && !in_error_recovery(valid_symbols)) { - while (iswspace(lexer->lookahead)) { - skip(lexer); - } - if (lexer->lookahead != '{') { - return false; - } - - advance(lexer); - lexer->mark_end(lexer); - - while (isdigit(lexer->lookahead)) { - advance(lexer); - } - - if (lexer->lookahead != '.') { - return false; - } - advance(lexer); - - if (lexer->lookahead != '.') { - return false; - } - advance(lexer); - - while (isdigit(lexer->lookahead)) { - advance(lexer); - } - - if (lexer->lookahead != '}') { - return false; - } - - lexer->result_symbol = BRACE_START; - return true; - } - - return false; + return false; } -void *tree_sitter_bash_external_scanner_create() { - Scanner *scanner = calloc(1, sizeof(Scanner)); - array_init(&scanner->heredocs); - return scanner; +void *tree_sitter_bash_external_scanner_create() +{ + Scanner *scanner = calloc(1, sizeof(Scanner)); + array_init(&scanner->heredocs); + return scanner; } -bool tree_sitter_bash_external_scanner_scan(void *payload, t_lexer_data *lexer, const bool *valid_symbols) { - Scanner *scanner = (Scanner *)payload; - return scan(scanner, lexer, valid_symbols); +bool tree_sitter_bash_external_scanner_scan(void *payload, t_lexer_data *lexer, const bool *valid_symbols) +{ + Scanner *scanner = (Scanner *)payload; + return scan(scanner, lexer, valid_symbols); } -unsigned tree_sitter_bash_external_scanner_serialize(void *payload, char *state) { - Scanner *scanner = (Scanner *)payload; - return serialize(scanner, state); +unsigned tree_sitter_bash_external_scanner_serialize(void *payload, char *state) +{ + Scanner *scanner = (Scanner *)payload; + return serialize(scanner, state); } -void tree_sitter_bash_external_scanner_deserialize(void *payload, const char *state, unsigned length) { - Scanner *scanner = (Scanner *)payload; - deserialize(scanner, state, length); +void tree_sitter_bash_external_scanner_deserialize(void *payload, const char *state, unsigned length) +{ + Scanner *scanner = (Scanner *)payload; + deserialize(scanner, state, length); } -void tree_sitter_bash_external_scanner_destroy(void *payload) { - Scanner *scanner = (Scanner *)payload; - for (size_t i = 0; i < scanner->heredocs.size; i++) { - Heredoc *heredoc = array_get(&scanner->heredocs, i); - array_delete(&heredoc->current_leading_word); - array_delete(&heredoc->delimiter); - } - array_delete(&scanner->heredocs); - free(scanner); +void tree_sitter_bash_external_scanner_destroy(void *payload) +{ + Scanner *scanner = (Scanner *)payload; + for (size_t i = 0; i < scanner->heredocs.size; i++) + { + Heredoc *heredoc = array_get(&scanner->heredocs, i); + array_delete(&heredoc->current_leading_word); + array_delete(&heredoc->delimiter); + } + array_delete(&scanner->heredocs); + free(scanner); } diff --git a/parser/static/alias_sequences/alias_sequences_0.c b/parser/static/alias_sequences/alias_sequences_0.c index 45667e23..f4b27cc7 100644 --- a/parser/static/alias_sequences/alias_sequences_0.c +++ b/parser/static/alias_sequences/alias_sequences_0.c @@ -14,10 +14,12 @@ void alias_sequences_0(t_alias_sequences_array *v) { - v->a[6][1] = anon_sym_AT; - v->a[7][0] = anon_sym_AT; - v->a[18][0] = anon_sym_AT; - v->a[29][0] = sym_regex; + v->a[6][1] = anon_sym_POUND; + v->a[7][0] = anon_sym_POUND; + v->a[16][0] = sym__immediate_double_hash; + v->a[19][0] = anon_sym_POUND; + v->a[29][1] = sym__immediate_double_hash; + v->a[30][0] = sym_regex; } /* EOF alias_sequences_0.c */ diff --git a/parser/static/field_map_slices/field_map_slices_0.c b/parser/static/field_map_slices/field_map_slices_0.c index 0bed11cd..7db96fa5 100644 --- a/parser/static/field_map_slices/field_map_slices_0.c +++ b/parser/static/field_map_slices/field_map_slices_0.c @@ -28,57 +28,58 @@ void field_map_slices_0(t_field_map_slices_array *v) v->a[13] = fmap_slice(16, 3); v->a[14] = fmap_slice(19, 2); v->a[15] = fmap_slice(21, 2); - v->a[16] = fmap_slice(23, 1); - v->a[17] = fmap_slice(24, 2); + v->a[16] = fmap_slice(0, 1); + v->a[17] = fmap_slice(23, 1); v->a[18] = fmap_slice(24, 2); - v->a[19] = fmap_slice(26, 2); - v->a[20] = fmap_slice(28, 1); - v->a[21] = fmap_slice(29, 3); + v->a[19] = fmap_slice(24, 2); + v->a[20] = fmap_slice(26, 2); + v->a[21] = fmap_slice(28, 1); field_map_slices_1(v); } void field_map_slices_1(t_field_map_slices_array *v) { - v->a[22] = fmap_slice(32, 2); - v->a[23] = fmap_slice(34, 3); - v->a[24] = fmap_slice(37, 2); - v->a[25] = fmap_slice(39, 1); - v->a[26] = fmap_slice(40, 1); - v->a[27] = fmap_slice(41, 1); - v->a[28] = fmap_slice(42, 3); - v->a[30] = fmap_slice(45, 2); - v->a[31] = fmap_slice(47, 4); - v->a[32] = fmap_slice(51, 2); - v->a[33] = fmap_slice(53, 2); - v->a[34] = fmap_slice(55, 3); - v->a[35] = fmap_slice(58, 4); - v->a[36] = fmap_slice(62, 2); - v->a[37] = fmap_slice(64, 2); - v->a[38] = fmap_slice(66, 5); - v->a[39] = fmap_slice(71, 3); - v->a[40] = fmap_slice(74, 3); - v->a[41] = fmap_slice(77, 2); - v->a[42] = fmap_slice(79, 2); + v->a[22] = fmap_slice(29, 3); + v->a[23] = fmap_slice(32, 2); + v->a[24] = fmap_slice(34, 3); + v->a[25] = fmap_slice(37, 2); + v->a[26] = fmap_slice(39, 1); + v->a[27] = fmap_slice(40, 1); + v->a[28] = fmap_slice(41, 1); + v->a[29] = fmap_slice(42, 3); + v->a[31] = fmap_slice(45, 2); + v->a[32] = fmap_slice(47, 4); + v->a[33] = fmap_slice(51, 2); + v->a[34] = fmap_slice(53, 2); + v->a[35] = fmap_slice(55, 3); + v->a[36] = fmap_slice(58, 4); + v->a[37] = fmap_slice(62, 2); + v->a[38] = fmap_slice(64, 2); + v->a[39] = fmap_slice(66, 5); + v->a[40] = fmap_slice(71, 3); + v->a[41] = fmap_slice(74, 3); + v->a[42] = fmap_slice(77, 2); field_map_slices_2(v); } void field_map_slices_2(t_field_map_slices_array *v) { - v->a[43] = fmap_slice(81, 2); - v->a[44] = fmap_slice(83, 5); - v->a[45] = fmap_slice(88, 2); - v->a[46] = fmap_slice(90, 3); - v->a[47] = fmap_slice(93, 4); - v->a[48] = fmap_slice(97, 4); - v->a[49] = fmap_slice(101, 3); - v->a[50] = fmap_slice(104, 3); - v->a[51] = fmap_slice(107, 4); - v->a[52] = fmap_slice(111, 2); - v->a[53] = fmap_slice(113, 3); - v->a[54] = fmap_slice(116, 3); - v->a[55] = fmap_slice(119, 5); - v->a[56] = fmap_slice(124, 5); - v->a[57] = fmap_slice(129, 3); + v->a[43] = fmap_slice(79, 2); + v->a[44] = fmap_slice(81, 2); + v->a[45] = fmap_slice(83, 5); + v->a[46] = fmap_slice(88, 2); + v->a[47] = fmap_slice(90, 3); + v->a[48] = fmap_slice(93, 4); + v->a[49] = fmap_slice(97, 4); + v->a[50] = fmap_slice(101, 3); + v->a[51] = fmap_slice(104, 3); + v->a[52] = fmap_slice(107, 4); + v->a[53] = fmap_slice(111, 2); + v->a[54] = fmap_slice(113, 3); + v->a[55] = fmap_slice(116, 3); + v->a[56] = fmap_slice(119, 5); + v->a[57] = fmap_slice(124, 5); + v->a[58] = fmap_slice(129, 3); } /* EOF field_map_slices_0.c */ diff --git a/parser/static/headers/constants.h b/parser/static/headers/constants.h index 582b8b3c..edb59ede 100644 --- a/parser/static/headers/constants.h +++ b/parser/static/headers/constants.h @@ -22,6 +22,6 @@ # define EXTERNAL_TOKEN_COUNT 20 # define FIELD_COUNT 17 # define MAX_ALIAS_SEQUENCE_LENGTH 8 -# define PRODUCTION_ID_COUNT 58 +# define PRODUCTION_ID_COUNT 59 #endif // CONSTANTS_H diff --git a/parser/static/parse_actions_entries/parse_actions_entries_10.c b/parser/static/parse_actions_entries/parse_actions_entries_10.c index eb7c7f37..9d0abee8 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_10.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_10.c @@ -19,7 +19,7 @@ void parse_actions_entries_50(t_parse_actions_entries_array *v) v->a[1002] = entry(1, false); v->a[1003] = reduce(sym__statement_not_pipeline, 1, 0, 0); v->a[1004] = entry(1, false); - v->a[1005] = reduce(sym_list, 3, 0, 21); + v->a[1005] = reduce(sym_list, 3, 0, 22); v->a[1006] = entry(1, true); v->a[1007] = reduce(aux_sym_command_repeat1, 1, 0, 0); v->a[1008] = entry(2, true); @@ -101,7 +101,7 @@ void parse_actions_entries_53(t_parse_actions_entries_array *v) v->a[1069] = entry(1, false); v->a[1070] = shift(767); v->a[1071] = entry(1, true); - v->a[1072] = reduce(sym_list, 3, 0, 21); + v->a[1072] = reduce(sym_list, 3, 0, 22); v->a[1073] = entry(1, false); v->a[1074] = reduce(sym__statements, 1, 0, 0); v->a[1075] = entry(1, false); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_11.c b/parser/static/parse_actions_entries/parse_actions_entries_11.c index b32407bd..b378fcc9 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_11.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_11.c @@ -103,7 +103,7 @@ void parse_actions_entries_58(t_parse_actions_entries_array *v) v->a[1171] = entry(1, false); v->a[1172] = shift(740); v->a[1173] = entry(2, false); - v->a[1174] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1174] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1175] = shift_repeat(759); v->a[1176] = entry(1, false); v->a[1177] = shift(758); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_12.c b/parser/static/parse_actions_entries/parse_actions_entries_12.c index 66aac8ef..59652f0f 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_12.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_12.c @@ -95,19 +95,19 @@ void parse_actions_entries_63(t_parse_actions_entries_array *v) v->a[1263] = entry(1, true); v->a[1264] = shift(1494); v->a[1265] = entry(2, false); - v->a[1266] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1266] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1267] = shift_repeat(800); v->a[1268] = entry(2, false); - v->a[1269] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1269] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1270] = shift_repeat(821); v->a[1271] = entry(2, false); - v->a[1272] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1272] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1273] = shift_repeat(1821); v->a[1274] = entry(2, false); - v->a[1275] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1275] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1276] = shift_repeat(1782); v->a[1277] = entry(2, false); - v->a[1278] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1278] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1279] = shift_repeat(845); parse_actions_entries_64(v); } @@ -115,19 +115,19 @@ void parse_actions_entries_63(t_parse_actions_entries_array *v) void parse_actions_entries_64(t_parse_actions_entries_array *v) { v->a[1280] = entry(2, false); - v->a[1281] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1281] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1282] = shift_repeat(1971); v->a[1283] = entry(2, false); - v->a[1284] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1284] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1285] = shift_repeat(1700); v->a[1286] = entry(2, false); - v->a[1287] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1287] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1288] = shift_repeat(89); v->a[1289] = entry(2, false); - v->a[1290] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1290] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1291] = shift_repeat(87); v->a[1292] = entry(2, true); - v->a[1293] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[1293] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[1294] = shift_repeat(932); v->a[1295] = entry(1, false); v->a[1296] = shift(1451); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_13.c b/parser/static/parse_actions_entries/parse_actions_entries_13.c index d8dd60cf..e6ae2682 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_13.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_13.c @@ -24,13 +24,13 @@ void parse_actions_entries_65(t_parse_actions_entries_array *v) v->a[1307] = reduce(aux_sym_concatenation_repeat1, 2, 0, 0); v->a[1308] = shift_repeat(1494); v->a[1309] = entry(1, false); - v->a[1310] = reduce(sym_command_substitution, 3, 0, 20); + v->a[1310] = reduce(sym_command_substitution, 3, 0, 21); v->a[1311] = entry(1, true); - v->a[1312] = reduce(sym_command_substitution, 3, 0, 20); + v->a[1312] = reduce(sym_command_substitution, 3, 0, 21); v->a[1313] = entry(1, false); - v->a[1314] = reduce(sym_expansion, 3, 0, 19); + v->a[1314] = reduce(sym_expansion, 3, 0, 20); v->a[1315] = entry(1, true); - v->a[1316] = reduce(sym_expansion, 3, 0, 19); + v->a[1316] = reduce(sym_expansion, 3, 0, 20); v->a[1317] = entry(1, false); v->a[1318] = reduce(sym_string, 3, 0, 0); v->a[1319] = entry(1, true); @@ -133,7 +133,7 @@ void parse_actions_entries_69(t_parse_actions_entries_array *v) v->a[1396] = entry(1, true); v->a[1397] = shift(1458); v->a[1398] = entry(1, false); - v->a[1399] = reduce(sym_arithmetic_binary_expression, 3, 0, 28); + v->a[1399] = reduce(sym_arithmetic_binary_expression, 3, 0, 29); parse_actions_entries_70(v); } diff --git a/parser/static/parse_actions_entries/parse_actions_entries_14.c b/parser/static/parse_actions_entries/parse_actions_entries_14.c index db5386d3..ac5ceecd 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_14.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_14.c @@ -15,7 +15,7 @@ void parse_actions_entries_70(t_parse_actions_entries_array *v) { v->a[1400] = entry(1, true); - v->a[1401] = reduce(sym_arithmetic_binary_expression, 3, 0, 28); + v->a[1401] = reduce(sym_arithmetic_binary_expression, 3, 0, 29); v->a[1402] = entry(1, true); v->a[1403] = shift(438); v->a[1404] = entry(1, true); @@ -130,9 +130,9 @@ void parse_actions_entries_74(t_parse_actions_entries_array *v) v->a[1493] = entry(1, false); v->a[1494] = shift(111); v->a[1495] = entry(1, false); - v->a[1496] = reduce(sym_arithmetic_postfix_expression, 2, 0, 16); + v->a[1496] = reduce(sym_arithmetic_postfix_expression, 2, 0, 17); v->a[1497] = entry(1, true); - v->a[1498] = reduce(sym_arithmetic_postfix_expression, 2, 0, 16); + v->a[1498] = reduce(sym_arithmetic_postfix_expression, 2, 0, 17); v->a[1499] = entry(2, false); parse_actions_entries_75(v); } diff --git a/parser/static/parse_actions_entries/parse_actions_entries_15.c b/parser/static/parse_actions_entries/parse_actions_entries_15.c index b0eae51a..9d201bde 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_15.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_15.c @@ -28,9 +28,9 @@ void parse_actions_entries_75(t_parse_actions_entries_array *v) v->a[1511] = entry(1, true); v->a[1512] = shift(1386); v->a[1513] = entry(1, false); - v->a[1514] = reduce(sym_arithmetic_unary_expression, 2, 0, 1); + v->a[1514] = reduce(sym_arithmetic_unary_expression, 2, 0, 16); v->a[1515] = entry(1, true); - v->a[1516] = reduce(sym_arithmetic_unary_expression, 2, 0, 1); + v->a[1516] = reduce(sym_arithmetic_unary_expression, 2, 0, 16); v->a[1517] = entry(1, true); v->a[1518] = shift(1412); v->a[1519] = entry(1, true); @@ -55,9 +55,9 @@ void parse_actions_entries_76(t_parse_actions_entries_array *v) v->a[1533] = entry(1, true); v->a[1534] = shift(1485); v->a[1535] = entry(1, false); - v->a[1536] = reduce(sym_arithmetic_ternary_expression, 5, 0, 39); + v->a[1536] = reduce(sym_arithmetic_ternary_expression, 5, 0, 40); v->a[1537] = entry(1, true); - v->a[1538] = reduce(sym_arithmetic_ternary_expression, 5, 0, 39); + v->a[1538] = reduce(sym_arithmetic_ternary_expression, 5, 0, 40); v->a[1539] = entry(1, false); parse_actions_entries_77(v); } @@ -125,7 +125,7 @@ void parse_actions_entries_79(t_parse_actions_entries_array *v) v->a[1588] = entry(1, false); v->a[1589] = shift(152); v->a[1590] = entry(1, false); - v->a[1591] = reduce(sym__heredoc_expression, 2, 0, 33); + v->a[1591] = reduce(sym__heredoc_expression, 2, 0, 34); v->a[1592] = entry(1, false); v->a[1593] = reduce(sym__heredoc_pipeline, 2, 0, 0); v->a[1594] = entry(1, true); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_24.c b/parser/static/parse_actions_entries/parse_actions_entries_24.c index aa540410..1c624fed 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_24.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_24.c @@ -17,9 +17,9 @@ void parse_actions_entries_120(t_parse_actions_entries_array *v) v->a[2400] = reduce(aux_sym_redirected_statement_repeat1, 2, 0, 0); v->a[2401] = shift_repeat(1819); v->a[2402] = entry(1, true); - v->a[2403] = reduce(sym_case_statement, 6, 0, 26); + v->a[2403] = reduce(sym_case_statement, 6, 0, 27); v->a[2404] = entry(1, false); - v->a[2405] = reduce(sym_case_statement, 6, 0, 26); + v->a[2405] = reduce(sym_case_statement, 6, 0, 27); v->a[2406] = entry(1, false); v->a[2407] = reduce(aux_sym_redirected_statement_repeat2, 2, 0, 0); v->a[2408] = entry(2, false); @@ -43,19 +43,19 @@ void parse_actions_entries_121(t_parse_actions_entries_array *v) v->a[2421] = entry(1, false); v->a[2422] = reduce(sym_heredoc_redirect, 6, 0, 4); v->a[2423] = entry(1, true); - v->a[2424] = reduce(sym_case_statement, 7, 0, 44); + v->a[2424] = reduce(sym_case_statement, 7, 0, 45); v->a[2425] = entry(1, false); - v->a[2426] = reduce(sym_case_statement, 7, 0, 44); + v->a[2426] = reduce(sym_case_statement, 7, 0, 45); v->a[2427] = entry(1, true); - v->a[2428] = reduce(sym_if_statement, 7, 0, 25); + v->a[2428] = reduce(sym_if_statement, 7, 0, 26); v->a[2429] = entry(1, false); - v->a[2430] = reduce(sym_if_statement, 7, 0, 25); + v->a[2430] = reduce(sym_if_statement, 7, 0, 26); v->a[2431] = entry(1, true); v->a[2432] = shift(1449); v->a[2433] = entry(1, true); - v->a[2434] = reduce(sym_heredoc_redirect, 5, 0, 42); + v->a[2434] = reduce(sym_heredoc_redirect, 5, 0, 43); v->a[2435] = entry(1, false); - v->a[2436] = reduce(sym_heredoc_redirect, 5, 0, 42); + v->a[2436] = reduce(sym_heredoc_redirect, 5, 0, 43); v->a[2437] = entry(2, false); v->a[2438] = reduce(aux_sym_redirected_statement_repeat2, 2, 0, 0); v->a[2439] = shift_repeat(1401); @@ -71,9 +71,9 @@ void parse_actions_entries_122(t_parse_actions_entries_array *v) v->a[2444] = reduce(aux_sym_redirected_statement_repeat2, 2, 0, 0); v->a[2445] = shift_repeat(1841); v->a[2446] = entry(1, true); - v->a[2447] = reduce(sym_heredoc_redirect, 5, 0, 41); + v->a[2447] = reduce(sym_heredoc_redirect, 5, 0, 42); v->a[2448] = entry(1, false); - v->a[2449] = reduce(sym_heredoc_redirect, 5, 0, 41); + v->a[2449] = reduce(sym_heredoc_redirect, 5, 0, 42); v->a[2450] = entry(1, true); v->a[2451] = reduce(sym_do_group, 2, 0, 0); v->a[2452] = entry(1, false); @@ -92,9 +92,9 @@ void parse_actions_entries_123(t_parse_actions_entries_array *v) v->a[2460] = entry(1, true); v->a[2461] = shift(1732); v->a[2462] = entry(1, true); - v->a[2463] = reduce(sym_heredoc_redirect, 5, 0, 40); + v->a[2463] = reduce(sym_heredoc_redirect, 5, 0, 41); v->a[2464] = entry(1, false); - v->a[2465] = reduce(sym_heredoc_redirect, 5, 0, 40); + v->a[2465] = reduce(sym_heredoc_redirect, 5, 0, 41); v->a[2466] = entry(1, false); v->a[2467] = reduce(sym_redirected_statement, 1, -1, 3); v->a[2468] = entry(1, true); @@ -102,9 +102,9 @@ void parse_actions_entries_123(t_parse_actions_entries_array *v) v->a[2470] = entry(1, true); v->a[2471] = shift(1841); v->a[2472] = entry(1, true); - v->a[2473] = reduce(sym_heredoc_redirect, 6, 0, 48); + v->a[2473] = reduce(sym_heredoc_redirect, 6, 0, 49); v->a[2474] = entry(1, false); - v->a[2475] = reduce(sym_heredoc_redirect, 6, 0, 48); + v->a[2475] = reduce(sym_heredoc_redirect, 6, 0, 49); v->a[2476] = entry(1, true); v->a[2477] = shift(740); v->a[2478] = entry(1, true); @@ -115,23 +115,23 @@ void parse_actions_entries_123(t_parse_actions_entries_array *v) void parse_actions_entries_124(t_parse_actions_entries_array *v) { v->a[2480] = entry(1, true); - v->a[2481] = reduce(sym_function_definition, 4, 0, 30); + v->a[2481] = reduce(sym_function_definition, 4, 0, 31); v->a[2482] = entry(1, false); - v->a[2483] = reduce(sym_function_definition, 4, 0, 30); + v->a[2483] = reduce(sym_function_definition, 4, 0, 31); v->a[2484] = entry(1, true); v->a[2485] = reduce(sym_heredoc_redirect, 5, 0, 1); v->a[2486] = entry(1, false); v->a[2487] = reduce(sym_heredoc_redirect, 5, 0, 1); v->a[2488] = entry(1, true); - v->a[2489] = reduce(sym_case_statement, 4, 0, 26); + v->a[2489] = reduce(sym_case_statement, 4, 0, 27); v->a[2490] = entry(1, false); - v->a[2491] = reduce(sym_case_statement, 4, 0, 26); + v->a[2491] = reduce(sym_case_statement, 4, 0, 27); v->a[2492] = entry(1, true); v->a[2493] = shift(1849); v->a[2494] = entry(1, true); - v->a[2495] = reduce(sym_heredoc_redirect, 6, 0, 49); + v->a[2495] = reduce(sym_heredoc_redirect, 6, 0, 50); v->a[2496] = entry(1, false); - v->a[2497] = reduce(sym_heredoc_redirect, 6, 0, 49); + v->a[2497] = reduce(sym_heredoc_redirect, 6, 0, 50); v->a[2498] = entry(1, true); v->a[2499] = reduce(sym__heredoc_body, 2, 0, 0); parse_actions_entries_125(v); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_25.c b/parser/static/parse_actions_entries/parse_actions_entries_25.c index 68b163b7..6b2428f7 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_25.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_25.c @@ -19,17 +19,17 @@ void parse_actions_entries_125(t_parse_actions_entries_array *v) v->a[2502] = entry(1, true); v->a[2503] = shift(2174); v->a[2504] = entry(1, true); - v->a[2505] = reduce(sym_heredoc_redirect, 6, 0, 50); + v->a[2505] = reduce(sym_heredoc_redirect, 6, 0, 51); v->a[2506] = entry(1, false); - v->a[2507] = reduce(sym_heredoc_redirect, 6, 0, 50); + v->a[2507] = reduce(sym_heredoc_redirect, 6, 0, 51); v->a[2508] = entry(1, true); v->a[2509] = reduce(sym__simple_heredoc_body, 2, 0, 0); v->a[2510] = entry(1, false); v->a[2511] = reduce(sym__simple_heredoc_body, 2, 0, 0); v->a[2512] = entry(1, true); - v->a[2513] = reduce(sym_heredoc_redirect, 6, 0, 51); + v->a[2513] = reduce(sym_heredoc_redirect, 6, 0, 52); v->a[2514] = entry(1, false); - v->a[2515] = reduce(sym_heredoc_redirect, 6, 0, 51); + v->a[2515] = reduce(sym_heredoc_redirect, 6, 0, 52); v->a[2516] = entry(1, true); v->a[2517] = reduce(sym_do_group, 3, 0, 0); v->a[2518] = entry(1, false); @@ -44,21 +44,21 @@ void parse_actions_entries_126(t_parse_actions_entries_array *v) v->a[2522] = entry(1, false); v->a[2523] = reduce(sym_heredoc_redirect, 5, 0, 4); v->a[2524] = entry(1, true); - v->a[2525] = reduce(sym_if_statement, 5, 0, 25); + v->a[2525] = reduce(sym_if_statement, 5, 0, 26); v->a[2526] = entry(1, false); - v->a[2527] = reduce(sym_if_statement, 5, 0, 25); + v->a[2527] = reduce(sym_if_statement, 5, 0, 26); v->a[2528] = entry(1, true); - v->a[2529] = reduce(sym_case_statement, 6, 0, 35); + v->a[2529] = reduce(sym_case_statement, 6, 0, 36); v->a[2530] = entry(1, false); - v->a[2531] = reduce(sym_case_statement, 6, 0, 35); + v->a[2531] = reduce(sym_case_statement, 6, 0, 36); v->a[2532] = entry(1, true); v->a[2533] = shift(1836); v->a[2534] = entry(1, true); v->a[2535] = shift(796); v->a[2536] = entry(1, true); - v->a[2537] = reduce(sym_case_statement, 5, 0, 26); + v->a[2537] = reduce(sym_case_statement, 5, 0, 27); v->a[2538] = entry(1, false); - v->a[2539] = reduce(sym_case_statement, 5, 0, 26); + v->a[2539] = reduce(sym_case_statement, 5, 0, 27); parse_actions_entries_127(v); } @@ -75,36 +75,36 @@ void parse_actions_entries_127(t_parse_actions_entries_array *v) v->a[2548] = entry(1, true); v->a[2549] = shift(766); v->a[2550] = entry(1, true); - v->a[2551] = reduce(sym_for_statement, 4, 0, 24); + v->a[2551] = reduce(sym_for_statement, 4, 0, 25); v->a[2552] = entry(1, false); - v->a[2553] = reduce(sym_for_statement, 4, 0, 24); + v->a[2553] = reduce(sym_for_statement, 4, 0, 25); v->a[2554] = entry(1, true); v->a[2555] = reduce(sym_while_statement, 3, 0, 15); v->a[2556] = entry(1, false); v->a[2557] = reduce(sym_while_statement, 3, 0, 15); v->a[2558] = entry(1, true); - v->a[2559] = reduce(sym_case_statement, 6, 0, 38); + v->a[2559] = reduce(sym_case_statement, 6, 0, 39); parse_actions_entries_128(v); } void parse_actions_entries_128(t_parse_actions_entries_array *v) { v->a[2560] = entry(1, false); - v->a[2561] = reduce(sym_case_statement, 6, 0, 38); + v->a[2561] = reduce(sym_case_statement, 6, 0, 39); v->a[2562] = entry(1, true); - v->a[2563] = reduce(sym_case_statement, 5, 0, 31); + v->a[2563] = reduce(sym_case_statement, 5, 0, 32); v->a[2564] = entry(1, false); - v->a[2565] = reduce(sym_case_statement, 5, 0, 31); + v->a[2565] = reduce(sym_case_statement, 5, 0, 32); v->a[2566] = entry(1, true); - v->a[2567] = reduce(sym_case_statement, 8, 0, 55); + v->a[2567] = reduce(sym_case_statement, 8, 0, 56); v->a[2568] = entry(1, false); - v->a[2569] = reduce(sym_case_statement, 8, 0, 55); + v->a[2569] = reduce(sym_case_statement, 8, 0, 56); v->a[2570] = entry(1, true); v->a[2571] = shift(620); v->a[2572] = entry(1, true); - v->a[2573] = reduce(sym_heredoc_redirect, 7, 0, 56); + v->a[2573] = reduce(sym_heredoc_redirect, 7, 0, 57); v->a[2574] = entry(1, false); - v->a[2575] = reduce(sym_heredoc_redirect, 7, 0, 56); + v->a[2575] = reduce(sym_heredoc_redirect, 7, 0, 57); v->a[2576] = entry(2, false); v->a[2577] = reduce(aux_sym_redirected_statement_repeat2, 2, 0, 0); v->a[2578] = shift_repeat(1417); @@ -124,15 +124,15 @@ void parse_actions_entries_129(t_parse_actions_entries_array *v) v->a[2587] = entry(1, false); v->a[2588] = reduce(sym_command, 3, 0, 11); v->a[2589] = entry(1, true); - v->a[2590] = reduce(sym_for_statement, 6, 0, 34); + v->a[2590] = reduce(sym_for_statement, 6, 0, 35); v->a[2591] = entry(1, false); - v->a[2592] = reduce(sym_for_statement, 6, 0, 34); + v->a[2592] = reduce(sym_for_statement, 6, 0, 35); v->a[2593] = entry(1, true); - v->a[2594] = reduce(sym_if_statement, 6, 0, 25); + v->a[2594] = reduce(sym_if_statement, 6, 0, 26); v->a[2595] = entry(1, false); - v->a[2596] = reduce(sym_if_statement, 6, 0, 25); + v->a[2596] = reduce(sym_if_statement, 6, 0, 26); v->a[2597] = entry(1, true); - v->a[2598] = reduce(sym_case_statement, 7, 0, 47); + v->a[2598] = reduce(sym_case_statement, 7, 0, 48); v->a[2599] = entry(1, false); parse_actions_entries_130(v); } diff --git a/parser/static/parse_actions_entries/parse_actions_entries_26.c b/parser/static/parse_actions_entries/parse_actions_entries_26.c index bb44e423..504bb91d 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_26.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_26.c @@ -14,7 +14,7 @@ void parse_actions_entries_130(t_parse_actions_entries_array *v) { - v->a[2600] = reduce(sym_case_statement, 7, 0, 47); + v->a[2600] = reduce(sym_case_statement, 7, 0, 48); v->a[2601] = entry(2, false); v->a[2602] = reduce(aux_sym_redirected_statement_repeat2, 2, 0, 0); v->a[2603] = shift_repeat(1461); @@ -25,9 +25,9 @@ void parse_actions_entries_130(t_parse_actions_entries_array *v) v->a[2608] = reduce(aux_sym_redirected_statement_repeat2, 2, 0, 0); v->a[2609] = shift_repeat(1850); v->a[2610] = entry(1, true); - v->a[2611] = reduce(sym_if_statement, 4, 0, 25); + v->a[2611] = reduce(sym_if_statement, 4, 0, 26); v->a[2612] = entry(1, false); - v->a[2613] = reduce(sym_if_statement, 4, 0, 25); + v->a[2613] = reduce(sym_if_statement, 4, 0, 26); v->a[2614] = entry(2, true); v->a[2615] = reduce(aux_sym_variable_assignments_repeat1, 2, 0, 0); v->a[2616] = shift_repeat(2174); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_27.c b/parser/static/parse_actions_entries/parse_actions_entries_27.c index 1f46ac48..c52952d4 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_27.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_27.c @@ -21,19 +21,19 @@ void parse_actions_entries_135(t_parse_actions_entries_array *v) v->a[2704] = reduce(aux_sym_redirected_statement_repeat2, 2, 0, 0); v->a[2705] = shift_repeat(1839); v->a[2706] = entry(2, false); - v->a[2707] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2707] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); v->a[2708] = shift_repeat(1908); v->a[2709] = entry(2, false); - v->a[2710] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2710] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); v->a[2711] = shift_repeat(1324); v->a[2712] = entry(2, false); - v->a[2713] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2713] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); v->a[2714] = shift_repeat(849); v->a[2715] = entry(2, false); - v->a[2716] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2716] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); v->a[2717] = shift_repeat(1748); v->a[2718] = entry(2, false); - v->a[2719] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2719] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); parse_actions_entries_136(v); } @@ -41,22 +41,22 @@ void parse_actions_entries_136(t_parse_actions_entries_array *v) { v->a[2720] = shift_repeat(1749); v->a[2721] = entry(2, false); - v->a[2722] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2722] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); v->a[2723] = shift_repeat(1995); v->a[2724] = entry(2, false); - v->a[2725] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2725] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); v->a[2726] = shift_repeat(1919); v->a[2727] = entry(2, false); - v->a[2728] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2728] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); v->a[2729] = shift_repeat(1670); v->a[2730] = entry(2, false); - v->a[2731] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2731] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); v->a[2732] = shift_repeat(94); v->a[2733] = entry(2, false); - v->a[2734] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2734] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); v->a[2735] = shift_repeat(99); v->a[2736] = entry(2, true); - v->a[2737] = reduce(aux_sym_case_statement_repeat1, 2, 0, 32); + v->a[2737] = reduce(aux_sym_case_statement_repeat1, 2, 0, 33); v->a[2738] = shift_repeat(1851); v->a[2739] = entry(2, false); parse_actions_entries_137(v); @@ -95,7 +95,7 @@ void parse_actions_entries_138(t_parse_actions_entries_array *v) v->a[2763] = entry(1, true); v->a[2764] = shift(2234); v->a[2765] = entry(1, true); - v->a[2766] = reduce(sym__heredoc_expression, 2, 0, 33); + v->a[2766] = reduce(sym__heredoc_expression, 2, 0, 34); v->a[2767] = entry(2, false); v->a[2768] = reduce(aux_sym_redirected_statement_repeat1, 2, 0, 0); v->a[2769] = shift_repeat(1408); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_30.c b/parser/static/parse_actions_entries/parse_actions_entries_30.c index d25d5e88..67066824 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_30.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_30.c @@ -24,15 +24,15 @@ void parse_actions_entries_150(t_parse_actions_entries_array *v) v->a[3007] = entry(1, true); v->a[3008] = shift(2069); v->a[3009] = entry(2, false); - v->a[3010] = reduce(aux_sym__heredoc_command, 2, 0, 22); + v->a[3010] = reduce(aux_sym__heredoc_command, 2, 0, 23); v->a[3011] = shift_repeat(1614); v->a[3012] = entry(1, false); - v->a[3013] = reduce(aux_sym__heredoc_command, 2, 0, 22); + v->a[3013] = reduce(aux_sym__heredoc_command, 2, 0, 23); v->a[3014] = entry(2, false); - v->a[3015] = reduce(aux_sym__heredoc_command, 2, 0, 22); + v->a[3015] = reduce(aux_sym__heredoc_command, 2, 0, 23); v->a[3016] = shift_repeat(826); v->a[3017] = entry(2, false); - v->a[3018] = reduce(aux_sym__heredoc_command, 2, 0, 22); + v->a[3018] = reduce(aux_sym__heredoc_command, 2, 0, 23); v->a[3019] = shift_repeat(1734); parse_actions_entries_151(v); } @@ -40,22 +40,22 @@ void parse_actions_entries_150(t_parse_actions_entries_array *v) void parse_actions_entries_151(t_parse_actions_entries_array *v) { v->a[3020] = entry(2, false); - v->a[3021] = reduce(aux_sym__heredoc_command, 2, 0, 22); + v->a[3021] = reduce(aux_sym__heredoc_command, 2, 0, 23); v->a[3022] = shift_repeat(1735); v->a[3023] = entry(2, false); - v->a[3024] = reduce(aux_sym__heredoc_command, 2, 0, 22); + v->a[3024] = reduce(aux_sym__heredoc_command, 2, 0, 23); v->a[3025] = shift_repeat(1578); v->a[3026] = entry(2, false); - v->a[3027] = reduce(aux_sym__heredoc_command, 2, 0, 22); + v->a[3027] = reduce(aux_sym__heredoc_command, 2, 0, 23); v->a[3028] = shift_repeat(1915); v->a[3029] = entry(2, false); - v->a[3030] = reduce(aux_sym__heredoc_command, 2, 0, 22); + v->a[3030] = reduce(aux_sym__heredoc_command, 2, 0, 23); v->a[3031] = shift_repeat(1698); v->a[3032] = entry(2, false); - v->a[3033] = reduce(aux_sym__heredoc_command, 2, 0, 22); + v->a[3033] = reduce(aux_sym__heredoc_command, 2, 0, 23); v->a[3034] = shift_repeat(77); v->a[3035] = entry(2, false); - v->a[3036] = reduce(aux_sym__heredoc_command, 2, 0, 22); + v->a[3036] = reduce(aux_sym__heredoc_command, 2, 0, 23); v->a[3037] = shift_repeat(39); v->a[3038] = entry(1, true); v->a[3039] = shift(1406); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_35.c b/parser/static/parse_actions_entries/parse_actions_entries_35.c index 01e37d15..5666e70d 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_35.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_35.c @@ -133,7 +133,7 @@ void parse_actions_entries_179(t_parse_actions_entries_array *v) v->a[3596] = entry(1, true); v->a[3597] = shift(1969); v->a[3598] = entry(1, false); - v->a[3599] = reduce(sym_case_item, 6, 0, 52); + v->a[3599] = reduce(sym_case_item, 6, 0, 53); parse_actions_entries_180(v); } diff --git a/parser/static/parse_actions_entries/parse_actions_entries_36.c b/parser/static/parse_actions_entries/parse_actions_entries_36.c index ab567d2f..b01f3722 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_36.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_36.c @@ -15,32 +15,32 @@ void parse_actions_entries_180(t_parse_actions_entries_array *v) { v->a[3600] = entry(1, false); - v->a[3601] = reduce(sym__case_item_last, 6, 0, 52); + v->a[3601] = reduce(sym__case_item_last, 6, 0, 53); v->a[3602] = entry(1, true); - v->a[3603] = reduce(sym_case_item, 6, 0, 52); + v->a[3603] = reduce(sym_case_item, 6, 0, 53); v->a[3604] = entry(1, true); v->a[3605] = shift(1016); v->a[3606] = entry(1, false); - v->a[3607] = reduce(sym_case_item, 7, 0, 57); + v->a[3607] = reduce(sym_case_item, 7, 0, 58); v->a[3608] = entry(1, false); - v->a[3609] = reduce(sym__case_item_last, 7, 0, 57); + v->a[3609] = reduce(sym__case_item_last, 7, 0, 58); v->a[3610] = entry(1, true); - v->a[3611] = reduce(sym_case_item, 7, 0, 57); + v->a[3611] = reduce(sym_case_item, 7, 0, 58); v->a[3612] = entry(1, true); v->a[3613] = shift(964); v->a[3614] = entry(1, true); v->a[3615] = shift(1538); v->a[3616] = entry(1, false); - v->a[3617] = reduce(sym_case_item, 5, 0, 46); + v->a[3617] = reduce(sym_case_item, 5, 0, 47); v->a[3618] = entry(1, false); - v->a[3619] = reduce(sym__case_item_last, 5, 0, 46); + v->a[3619] = reduce(sym__case_item_last, 5, 0, 47); parse_actions_entries_181(v); } void parse_actions_entries_181(t_parse_actions_entries_array *v) { v->a[3620] = entry(1, true); - v->a[3621] = reduce(sym_case_item, 5, 0, 46); + v->a[3621] = reduce(sym_case_item, 5, 0, 47); v->a[3622] = entry(1, true); v->a[3623] = shift(1881); v->a[3624] = entry(1, true); @@ -50,11 +50,11 @@ void parse_actions_entries_181(t_parse_actions_entries_array *v) v->a[3628] = entry(1, false); v->a[3629] = shift(2019); v->a[3630] = entry(1, false); - v->a[3631] = reduce(sym_case_item, 6, 0, 53); + v->a[3631] = reduce(sym_case_item, 6, 0, 54); v->a[3632] = entry(1, false); - v->a[3633] = reduce(sym__case_item_last, 6, 0, 53); + v->a[3633] = reduce(sym__case_item_last, 6, 0, 54); v->a[3634] = entry(1, true); - v->a[3635] = reduce(sym_case_item, 6, 0, 53); + v->a[3635] = reduce(sym_case_item, 6, 0, 54); v->a[3636] = entry(1, true); v->a[3637] = shift(2025); v->a[3638] = entry(1, true); @@ -79,11 +79,11 @@ void parse_actions_entries_182(t_parse_actions_entries_array *v) v->a[3652] = entry(1, true); v->a[3653] = shift(1076); v->a[3654] = entry(1, false); - v->a[3655] = reduce(sym_case_item, 6, 0, 54); + v->a[3655] = reduce(sym_case_item, 6, 0, 55); v->a[3656] = entry(1, false); - v->a[3657] = reduce(sym__case_item_last, 6, 0, 54); + v->a[3657] = reduce(sym__case_item_last, 6, 0, 55); v->a[3658] = entry(1, true); - v->a[3659] = reduce(sym_case_item, 6, 0, 54); + v->a[3659] = reduce(sym_case_item, 6, 0, 55); parse_actions_entries_183(v); } @@ -108,16 +108,16 @@ void parse_actions_entries_183(t_parse_actions_entries_array *v) v->a[3676] = entry(1, true); v->a[3677] = shift(1862); v->a[3678] = entry(1, false); - v->a[3679] = reduce(sym_case_item, 4, 0, 36); + v->a[3679] = reduce(sym_case_item, 4, 0, 37); parse_actions_entries_184(v); } void parse_actions_entries_184(t_parse_actions_entries_array *v) { v->a[3680] = entry(1, false); - v->a[3681] = reduce(sym__case_item_last, 4, 0, 36); + v->a[3681] = reduce(sym__case_item_last, 4, 0, 37); v->a[3682] = entry(1, true); - v->a[3683] = reduce(sym_case_item, 4, 0, 36); + v->a[3683] = reduce(sym_case_item, 4, 0, 37); v->a[3684] = entry(1, true); v->a[3685] = shift(536); v->a[3686] = entry(1, true); @@ -131,9 +131,9 @@ void parse_actions_entries_184(t_parse_actions_entries_array *v) v->a[3694] = entry(1, true); v->a[3695] = shift(1383); v->a[3696] = entry(1, false); - v->a[3697] = reduce(sym_case_item, 5, 0, 45); + v->a[3697] = reduce(sym_case_item, 5, 0, 46); v->a[3698] = entry(1, false); - v->a[3699] = reduce(sym__case_item_last, 5, 0, 45); + v->a[3699] = reduce(sym__case_item_last, 5, 0, 46); parse_actions_entries_185(v); } diff --git a/parser/static/parse_actions_entries/parse_actions_entries_37.c b/parser/static/parse_actions_entries/parse_actions_entries_37.c index 7dd25461..627c0427 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_37.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_37.c @@ -15,13 +15,13 @@ void parse_actions_entries_185(t_parse_actions_entries_array *v) { v->a[3700] = entry(1, true); - v->a[3701] = reduce(sym_case_item, 5, 0, 45); + v->a[3701] = reduce(sym_case_item, 5, 0, 46); v->a[3702] = entry(1, false); - v->a[3703] = reduce(sym_case_item, 5, 0, 43); + v->a[3703] = reduce(sym_case_item, 5, 0, 44); v->a[3704] = entry(1, false); - v->a[3705] = reduce(sym__case_item_last, 5, 0, 43); + v->a[3705] = reduce(sym__case_item_last, 5, 0, 44); v->a[3706] = entry(1, true); - v->a[3707] = reduce(sym_case_item, 5, 0, 43); + v->a[3707] = reduce(sym_case_item, 5, 0, 44); v->a[3708] = entry(1, true); v->a[3709] = shift(993); v->a[3710] = entry(1, true); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_38.c b/parser/static/parse_actions_entries/parse_actions_entries_38.c index fe8269da..5ff924ce 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_38.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_38.c @@ -98,9 +98,9 @@ void parse_actions_entries_193(t_parse_actions_entries_array *v) v->a[3866] = entry(1, false); v->a[3867] = shift(1128); v->a[3868] = entry(1, false); - v->a[3869] = reduce(aux_sym_case_statement_repeat1, 1, 0, 27); + v->a[3869] = reduce(aux_sym_case_statement_repeat1, 1, 0, 28); v->a[3870] = entry(1, true); - v->a[3871] = reduce(aux_sym_case_statement_repeat1, 1, 0, 27); + v->a[3871] = reduce(aux_sym_case_statement_repeat1, 1, 0, 28); v->a[3872] = entry(1, false); v->a[3873] = shift(1641); v->a[3874] = entry(1, false); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_41.c b/parser/static/parse_actions_entries/parse_actions_entries_41.c index a698d0aa..1eb1ac0d 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_41.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_41.c @@ -18,7 +18,7 @@ void parse_actions_entries_205(t_parse_actions_entries_array *v) v->a[4101] = entry(1, false); v->a[4102] = shift(1907); v->a[4103] = entry(1, false); - v->a[4104] = reduce(sym_expansion_regex, 1, 0, 1); + v->a[4104] = reduce(sym_expansion_regex, 1, 0, 16); v->a[4105] = entry(1, false); v->a[4106] = shift(1759); v->a[4107] = entry(1, false); @@ -47,7 +47,7 @@ void parse_actions_entries_206(t_parse_actions_entries_array *v) v->a[4125] = entry(1, true); v->a[4126] = shift(1875); v->a[4127] = entry(1, false); - v->a[4128] = reduce(sym_expansion_regex, 2, 0, 1); + v->a[4128] = reduce(sym_expansion_regex, 2, 0, 16); v->a[4129] = entry(1, false); v->a[4130] = shift(1865); v->a[4131] = entry(1, true); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_42.c b/parser/static/parse_actions_entries/parse_actions_entries_42.c index ad042819..ca02bb7b 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_42.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_42.c @@ -15,9 +15,9 @@ void parse_actions_entries_210(t_parse_actions_entries_array *v) { v->a[4200] = entry(1, false); - v->a[4201] = reduce(aux_sym_expansion_regex_repeat1, 1, 0, 29); + v->a[4201] = reduce(aux_sym_expansion_regex_repeat1, 1, 0, 30); v->a[4202] = entry(1, true); - v->a[4203] = reduce(aux_sym_expansion_regex_repeat1, 1, 0, 29); + v->a[4203] = reduce(aux_sym_expansion_regex_repeat1, 1, 0, 30); v->a[4204] = entry(1, true); v->a[4205] = shift(24); v->a[4206] = entry(1, true); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_43.c b/parser/static/parse_actions_entries/parse_actions_entries_43.c index 36ff2b74..511fb56d 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_43.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_43.c @@ -90,7 +90,7 @@ void parse_actions_entries_217(t_parse_actions_entries_array *v) void parse_actions_entries_218(t_parse_actions_entries_array *v) { v->a[4360] = entry(1, true); - v->a[4361] = reduce(aux_sym__case_item_last_repeat1, 2, 0, 26); + v->a[4361] = reduce(aux_sym__case_item_last_repeat1, 2, 0, 27); v->a[4362] = entry(1, true); v->a[4363] = shift(1691); v->a[4364] = entry(1, true); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_44.c b/parser/static/parse_actions_entries/parse_actions_entries_44.c index e9e5e972..88852fe4 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_44.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_44.c @@ -64,16 +64,16 @@ void parse_actions_entries_221(t_parse_actions_entries_array *v) void parse_actions_entries_222(t_parse_actions_entries_array *v) { - v->a[4440] = reduce(aux_sym__case_item_last_repeat1, 2, 0, 37); + v->a[4440] = reduce(aux_sym__case_item_last_repeat1, 2, 0, 38); v->a[4441] = shift_repeat(1326); v->a[4442] = entry(1, true); - v->a[4443] = reduce(aux_sym__case_item_last_repeat1, 2, 0, 37); + v->a[4443] = reduce(aux_sym__case_item_last_repeat1, 2, 0, 38); v->a[4444] = entry(1, true); v->a[4445] = shift(31); v->a[4446] = entry(1, true); v->a[4447] = shift(33); v->a[4448] = entry(1, true); - v->a[4449] = reduce(sym__case_item_last, 5, 0, 54); + v->a[4449] = reduce(sym__case_item_last, 5, 0, 55); v->a[4450] = entry(1, true); v->a[4451] = shift(1695); v->a[4452] = entry(1, true); @@ -81,7 +81,7 @@ void parse_actions_entries_222(t_parse_actions_entries_array *v) v->a[4454] = entry(1, true); v->a[4455] = shift(148); v->a[4456] = entry(1, true); - v->a[4457] = reduce(sym__case_item_last, 5, 0, 52); + v->a[4457] = reduce(sym__case_item_last, 5, 0, 53); v->a[4458] = entry(1, true); v->a[4459] = shift(1671); parse_actions_entries_223(v); @@ -90,13 +90,13 @@ void parse_actions_entries_222(t_parse_actions_entries_array *v) void parse_actions_entries_223(t_parse_actions_entries_array *v) { v->a[4460] = entry(1, true); - v->a[4461] = reduce(sym__case_item_last, 5, 0, 53); + v->a[4461] = reduce(sym__case_item_last, 5, 0, 54); v->a[4462] = entry(1, true); v->a[4463] = shift(1680); v->a[4464] = entry(1, true); v->a[4465] = shift(1683); v->a[4466] = entry(1, true); - v->a[4467] = reduce(sym__case_item_last, 3, 0, 36); + v->a[4467] = reduce(sym__case_item_last, 3, 0, 37); v->a[4468] = entry(1, true); v->a[4469] = shift(1703); v->a[4470] = entry(1, true); @@ -119,21 +119,21 @@ void parse_actions_entries_224(t_parse_actions_entries_array *v) v->a[4482] = entry(1, true); v->a[4483] = shift(155); v->a[4484] = entry(1, true); - v->a[4485] = reduce(sym__case_item_last, 4, 0, 46); + v->a[4485] = reduce(sym__case_item_last, 4, 0, 47); v->a[4486] = entry(1, true); v->a[4487] = shift(1676); v->a[4488] = entry(1, true); v->a[4489] = shift(1709); v->a[4490] = entry(1, true); - v->a[4491] = reduce(sym__case_item_last, 6, 0, 57); + v->a[4491] = reduce(sym__case_item_last, 6, 0, 58); v->a[4492] = entry(1, true); v->a[4493] = shift(1714); v->a[4494] = entry(1, true); - v->a[4495] = reduce(sym__case_item_last, 4, 0, 45); + v->a[4495] = reduce(sym__case_item_last, 4, 0, 46); v->a[4496] = entry(1, true); v->a[4497] = shift(1711); v->a[4498] = entry(1, true); - v->a[4499] = reduce(sym__case_item_last, 4, 0, 43); + v->a[4499] = reduce(sym__case_item_last, 4, 0, 44); parse_actions_entries_225(v); } diff --git a/parser/static/parse_actions_entries/parse_actions_entries_48.c b/parser/static/parse_actions_entries/parse_actions_entries_48.c index 0bb2e37f..2425696d 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_48.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_48.c @@ -44,9 +44,9 @@ void parse_actions_entries_241(t_parse_actions_entries_array *v) v->a[4822] = entry(1, true); v->a[4823] = shift(441); v->a[4824] = entry(1, true); - v->a[4825] = reduce(sym__expansion_body, 2, 0, 18); + v->a[4825] = reduce(sym__expansion_body, 2, 0, 19); v->a[4826] = entry(1, true); - v->a[4827] = reduce(sym__expansion_body, 2, 0, 17); + v->a[4827] = reduce(sym__expansion_body, 2, 0, 18); v->a[4828] = entry(1, true); v->a[4829] = shift(1248); v->a[4830] = entry(1, true); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_5.c b/parser/static/parse_actions_entries/parse_actions_entries_5.c index f1ad328a..6181c5ec 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_5.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_5.c @@ -82,14 +82,14 @@ void parse_actions_entries_27(t_parse_actions_entries_array *v) v->a[555] = entry(1, true); v->a[556] = reduce(sym_file_redirect, 3, 0, 13); v->a[557] = entry(1, false); - v->a[558] = reduce(sym_command, 3, 0, 23); + v->a[558] = reduce(sym_command, 3, 0, 24); v->a[559] = entry(1, true); parse_actions_entries_28(v); } void parse_actions_entries_28(t_parse_actions_entries_array *v) { - v->a[560] = reduce(sym_command, 3, 0, 23); + v->a[560] = reduce(sym_command, 3, 0, 24); v->a[561] = entry(1, false); v->a[562] = reduce(sym_command, 2, 0, 10); v->a[563] = entry(1, true); @@ -99,15 +99,15 @@ void parse_actions_entries_28(t_parse_actions_entries_array *v) v->a[567] = entry(1, false); v->a[568] = reduce(sym_file_redirect, 2, 0, 5); v->a[569] = entry(2, false); - v->a[570] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[570] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[571] = shift_repeat(341); v->a[572] = entry(1, false); - v->a[573] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[573] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[574] = entry(2, false); - v->a[575] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[575] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[576] = shift_repeat(812); v->a[577] = entry(2, false); - v->a[578] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[578] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[579] = shift_repeat(1753); parse_actions_entries_29(v); } @@ -115,25 +115,25 @@ void parse_actions_entries_28(t_parse_actions_entries_array *v) void parse_actions_entries_29(t_parse_actions_entries_array *v) { v->a[580] = entry(2, false); - v->a[581] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[581] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[582] = shift_repeat(1762); v->a[583] = entry(2, false); - v->a[584] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[584] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[585] = shift_repeat(483); v->a[586] = entry(2, false); - v->a[587] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[587] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[588] = shift_repeat(1930); v->a[589] = entry(2, false); - v->a[590] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[590] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[591] = shift_repeat(1686); v->a[592] = entry(2, false); - v->a[593] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[593] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[594] = shift_repeat(43); v->a[595] = entry(2, false); - v->a[596] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[596] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[597] = shift_repeat(104); v->a[598] = entry(1, true); - v->a[599] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[599] = reduce(aux_sym_command_repeat2, 2, 0, 23); parse_actions_entries_30(v); } diff --git a/parser/static/parse_actions_entries/parse_actions_entries_6.c b/parser/static/parse_actions_entries/parse_actions_entries_6.c index 05d3230c..2ae3fb68 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_6.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_6.c @@ -15,25 +15,25 @@ void parse_actions_entries_30(t_parse_actions_entries_array *v) { v->a[600] = entry(2, true); - v->a[601] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[601] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[602] = shift_repeat(753); v->a[603] = entry(2, false); - v->a[604] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[604] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[605] = shift_repeat(343); v->a[606] = entry(2, false); - v->a[607] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[607] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[608] = shift_repeat(813); v->a[609] = entry(2, false); - v->a[610] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[610] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[611] = shift_repeat(1815); v->a[612] = entry(2, false); - v->a[613] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[613] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[614] = shift_repeat(1811); v->a[615] = entry(2, false); - v->a[616] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[616] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[617] = shift_repeat(497); v->a[618] = entry(2, false); - v->a[619] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[619] = reduce(aux_sym_command_repeat2, 2, 0, 23); parse_actions_entries_31(v); } @@ -41,16 +41,16 @@ void parse_actions_entries_31(t_parse_actions_entries_array *v) { v->a[620] = shift_repeat(1958); v->a[621] = entry(2, false); - v->a[622] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[622] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[623] = shift_repeat(1706); v->a[624] = entry(2, false); - v->a[625] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[625] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[626] = shift_repeat(57); v->a[627] = entry(2, false); - v->a[628] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[628] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[629] = shift_repeat(54); v->a[630] = entry(2, true); - v->a[631] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[631] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[632] = shift_repeat(739); v->a[633] = entry(2, false); v->a[634] = reduce(aux_sym_for_statement_repeat1, 2, 0, 0); @@ -94,19 +94,19 @@ void parse_actions_entries_33(t_parse_actions_entries_array *v) v->a[662] = entry(1, true); v->a[663] = reduce(aux_sym_for_statement_repeat1, 2, 0, 0); v->a[664] = entry(2, false); - v->a[665] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[665] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[666] = shift_repeat(358); v->a[667] = entry(2, false); - v->a[668] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[668] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[669] = shift_repeat(869); v->a[670] = entry(2, false); - v->a[671] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[671] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[672] = shift_repeat(1773); v->a[673] = entry(2, false); - v->a[674] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[674] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[675] = shift_repeat(1755); v->a[676] = entry(2, false); - v->a[677] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[677] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[678] = shift_repeat(504); v->a[679] = entry(2, false); parse_actions_entries_34(v); @@ -114,19 +114,19 @@ void parse_actions_entries_33(t_parse_actions_entries_array *v) void parse_actions_entries_34(t_parse_actions_entries_array *v) { - v->a[680] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[680] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[681] = shift_repeat(1942); v->a[682] = entry(2, false); - v->a[683] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[683] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[684] = shift_repeat(1704); v->a[685] = entry(2, false); - v->a[686] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[686] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[687] = shift_repeat(50); v->a[688] = entry(2, false); - v->a[689] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[689] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[690] = shift_repeat(66); v->a[691] = entry(2, true); - v->a[692] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[692] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[693] = shift_repeat(717); v->a[694] = entry(2, false); v->a[695] = reduce(aux_sym_for_statement_repeat1, 2, 0, 0); diff --git a/parser/static/parse_actions_entries/parse_actions_entries_8.c b/parser/static/parse_actions_entries/parse_actions_entries_8.c index 599ebe4c..9da1adcb 100644 --- a/parser/static/parse_actions_entries/parse_actions_entries_8.c +++ b/parser/static/parse_actions_entries/parse_actions_entries_8.c @@ -65,7 +65,7 @@ void parse_actions_entries_41(t_parse_actions_entries_array *v) void parse_actions_entries_42(t_parse_actions_entries_array *v) { v->a[840] = entry(2, false); - v->a[841] = reduce(aux_sym_command_repeat2, 2, 0, 22); + v->a[841] = reduce(aux_sym_command_repeat2, 2, 0, 23); v->a[842] = shift_repeat(452); v->a[843] = entry(2, false); v->a[844] = reduce(aux_sym_for_statement_repeat1, 2, 0, 0); diff --git a/parser/static/symbols_metadata/symbols_metadata_0.c b/parser/static/symbols_metadata/symbols_metadata_0.c index 9e2d5a65..bb042c6e 100644 --- a/parser/static/symbols_metadata/symbols_metadata_0.c +++ b/parser/static/symbols_metadata/symbols_metadata_0.c @@ -41,22 +41,22 @@ void symbols_metadata_1(t_symbols_metadata_array *v) { v->a[anon_sym_LBRACE] = sym_metadata(true, false, false); v->a[anon_sym_RBRACE] = sym_metadata(true, false, false); - v->a[anon_sym_AMP_AMP] = sym_metadata(true, false, false); - v->a[anon_sym_PIPE_PIPE] = sym_metadata(true, false, false); + v->a[anon_sym_AMP_AMP] = sym_metadata(true, true, false); + v->a[anon_sym_PIPE_PIPE] = sym_metadata(true, true, false); v->a[anon_sym_BANG] = sym_metadata(true, false, false); v->a[anon_sym_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_LT] = sym_metadata(true, false, false); - v->a[anon_sym_GT] = sym_metadata(true, false, false); - v->a[anon_sym_GT_GT] = sym_metadata(true, false, false); - v->a[anon_sym_AMP_GT] = sym_metadata(true, false, false); - v->a[anon_sym_AMP_GT_GT] = sym_metadata(true, false, false); - v->a[anon_sym_LT_AMP] = sym_metadata(true, false, false); - v->a[anon_sym_GT_AMP] = sym_metadata(true, false, false); - v->a[anon_sym_GT_PIPE] = sym_metadata(true, false, false); - v->a[anon_sym_LT_AMP_DASH] = sym_metadata(true, false, false); - v->a[anon_sym_GT_AMP_DASH] = sym_metadata(true, false, false); - v->a[anon_sym_LT_LT] = sym_metadata(true, false, false); - v->a[anon_sym_LT_LT_DASH] = sym_metadata(true, false, false); + v->a[anon_sym_LT] = sym_metadata(true, true, false); + v->a[anon_sym_GT] = sym_metadata(true, true, false); + v->a[anon_sym_GT_GT] = sym_metadata(true, true, false); + v->a[anon_sym_AMP_GT] = sym_metadata(true, true, false); + v->a[anon_sym_AMP_GT_GT] = sym_metadata(true, true, false); + v->a[anon_sym_LT_AMP] = sym_metadata(true, true, false); + v->a[anon_sym_GT_AMP] = sym_metadata(true, true, false); + v->a[anon_sym_GT_PIPE] = sym_metadata(true, true, false); + v->a[anon_sym_LT_AMP_DASH] = sym_metadata(true, true, false); + v->a[anon_sym_GT_AMP_DASH] = sym_metadata(true, true, false); + v->a[anon_sym_LT_LT] = sym_metadata(true, true, false); + v->a[anon_sym_LT_LT_DASH] = sym_metadata(true, true, false); v->a[aux_sym_heredoc_redirect_token1] = sym_metadata(false, false, false); v->a[anon_sym_PIPE_AMP] = sym_metadata(true, false, false); symbols_metadata_2(v); @@ -66,41 +66,41 @@ void symbols_metadata_2(t_symbols_metadata_array *v) { v->a[anon_sym_DOLLAR_LPAREN_LPAREN] = sym_metadata(true, false, false); v->a[anon_sym_RPAREN_RPAREN] = sym_metadata(true, false, false); - v->a[anon_sym_PLUS_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_DASH_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_STAR_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_SLASH_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_PERCENT_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_LT_LT_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_GT_GT_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_AMP_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_CARET_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_PIPE_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_CARET] = sym_metadata(true, false, false); + v->a[anon_sym_PLUS_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_DASH_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_STAR_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_SLASH_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_PERCENT_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_LT_LT_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_GT_GT_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_AMP_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_CARET_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_PIPE_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_CARET] = sym_metadata(true, true, false); v->a[anon_sym_AMP] = sym_metadata(true, false, false); - v->a[anon_sym_EQ_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_BANG_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_LT_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_GT_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_PLUS] = sym_metadata(true, false, false); - v->a[anon_sym_DASH] = sym_metadata(true, false, false); + v->a[anon_sym_EQ_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_BANG_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_LT_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_GT_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_PLUS] = sym_metadata(true, true, false); + v->a[anon_sym_DASH] = sym_metadata(true, true, false); symbols_metadata_3(v); } void symbols_metadata_3(t_symbols_metadata_array *v) { - v->a[anon_sym_STAR] = sym_metadata(true, false, false); - v->a[anon_sym_SLASH] = sym_metadata(true, false, false); - v->a[anon_sym_PERCENT] = sym_metadata(true, false, false); + v->a[anon_sym_STAR] = sym_metadata(true, true, false); + v->a[anon_sym_SLASH] = sym_metadata(true, true, false); + v->a[anon_sym_PERCENT] = sym_metadata(true, true, false); v->a[anon_sym_QMARK] = sym_metadata(true, false, false); v->a[anon_sym_COLON] = sym_metadata(true, false, false); - v->a[anon_sym_PLUS_PLUS] = sym_metadata(true, false, false); - v->a[anon_sym_DASH_DASH] = sym_metadata(true, false, false); - v->a[anon_sym_DASH2] = sym_metadata(true, false, false); - v->a[anon_sym_PLUS2] = sym_metadata(true, false, false); - v->a[anon_sym_TILDE] = sym_metadata(true, false, false); - v->a[anon_sym_PLUS_PLUS2] = sym_metadata(true, false, false); - v->a[anon_sym_DASH_DASH2] = sym_metadata(true, false, false); + v->a[anon_sym_PLUS_PLUS] = sym_metadata(true, true, false); + v->a[anon_sym_DASH_DASH] = sym_metadata(true, true, false); + v->a[anon_sym_DASH2] = sym_metadata(true, true, false); + v->a[anon_sym_PLUS2] = sym_metadata(true, true, false); + v->a[anon_sym_TILDE] = sym_metadata(true, true, false); + v->a[anon_sym_PLUS_PLUS2] = sym_metadata(true, true, false); + v->a[anon_sym_DASH_DASH2] = sym_metadata(true, true, false); v->a[aux_sym_concatenation_token1] = sym_metadata(true, false, false); v->a[anon_sym_DOLLAR] = sym_metadata(true, false, false); v->a[anon_sym_DQUOTE] = sym_metadata(true, false, false); @@ -108,22 +108,22 @@ void symbols_metadata_3(t_symbols_metadata_array *v) v->a[sym_raw_string] = sym_metadata(true, true, false); v->a[aux_sym_number_token1] = sym_metadata(false, false, false); v->a[aux_sym_number_token2] = sym_metadata(false, false, false); - v->a[anon_sym_POUND] = sym_metadata(true, false, false); + v->a[anon_sym_POUND] = sym_metadata(true, true, false); symbols_metadata_4(v); } void symbols_metadata_4(t_symbols_metadata_array *v) { v->a[anon_sym_DOLLAR_LBRACE] = sym_metadata(true, false, false); - v->a[anon_sym_COLON_DASH] = sym_metadata(true, false, false); - v->a[anon_sym_DASH3] = sym_metadata(true, false, false); - v->a[anon_sym_COLON_EQ] = sym_metadata(true, false, false); - v->a[anon_sym_EQ2] = sym_metadata(true, false, false); - v->a[anon_sym_COLON_QMARK] = sym_metadata(true, false, false); - v->a[anon_sym_QMARK2] = sym_metadata(true, false, false); - v->a[anon_sym_COLON_PLUS] = sym_metadata(true, false, false); - v->a[anon_sym_PLUS3] = sym_metadata(true, false, false); - v->a[anon_sym_PERCENT_PERCENT] = sym_metadata(true, false, false); + v->a[anon_sym_COLON_DASH] = sym_metadata(true, true, false); + v->a[anon_sym_DASH3] = sym_metadata(true, true, false); + v->a[anon_sym_COLON_EQ] = sym_metadata(true, true, false); + v->a[anon_sym_EQ2] = sym_metadata(true, true, false); + v->a[anon_sym_COLON_QMARK] = sym_metadata(true, true, false); + v->a[anon_sym_QMARK2] = sym_metadata(true, true, false); + v->a[anon_sym_COLON_PLUS] = sym_metadata(true, true, false); + v->a[anon_sym_PLUS3] = sym_metadata(true, true, false); + v->a[anon_sym_PERCENT_PERCENT] = sym_metadata(true, true, false); v->a[aux_sym_expansion_regex_token1] = sym_metadata(true, true, false); v->a[anon_sym_DOLLAR_LPAREN] = sym_metadata(true, false, false); v->a[anon_sym_BQUOTE] = sym_metadata(true, false, false); diff --git a/parser/static/symbols_metadata/symbols_metadata_1.c b/parser/static/symbols_metadata/symbols_metadata_1.c index 6bc02269..09fd67bc 100644 --- a/parser/static/symbols_metadata/symbols_metadata_1.c +++ b/parser/static/symbols_metadata/symbols_metadata_1.c @@ -28,7 +28,7 @@ void symbols_metadata_5(t_symbols_metadata_array *v) v->a[sym__expansion_word] = sym_metadata(true, true, false); v->a[sym_extglob_pattern] = sym_metadata(true, true, false); v->a[sym__bare_dollar] = sym_metadata(true, false, false); - v->a[sym__immediate_double_hash] = sym_metadata(true, false, false); + v->a[sym__immediate_double_hash] = sym_metadata(true, true, false); v->a[sym___error_recovery] = sym_metadata(false, true, false); v->a[sym_program] = sym_metadata(true, true, false); v->a[sym__statements] = sym_metadata(false, true, false); diff --git a/parser/static/symbols_names/symbols_names_0.c b/parser/static/symbols_names/symbols_names_0.c index d3cfa288..d3a7cbb3 100644 --- a/parser/static/symbols_names/symbols_names_0.c +++ b/parser/static/symbols_names/symbols_names_0.c @@ -41,22 +41,22 @@ void symbols_names_1(t_symbols_names_array *v) { v->a[anon_sym_LBRACE] = "{"; v->a[anon_sym_RBRACE] = "}"; - v->a[anon_sym_AMP_AMP] = "&&"; - v->a[anon_sym_PIPE_PIPE] = "||"; + v->a[anon_sym_AMP_AMP] = "operator"; + v->a[anon_sym_PIPE_PIPE] = "operator"; v->a[anon_sym_BANG] = "!"; v->a[anon_sym_EQ] = "="; - v->a[anon_sym_LT] = "<"; - v->a[anon_sym_GT] = ">"; - v->a[anon_sym_GT_GT] = ">>"; - v->a[anon_sym_AMP_GT] = "&>"; - v->a[anon_sym_AMP_GT_GT] = "&>>"; - v->a[anon_sym_LT_AMP] = "<&"; - v->a[anon_sym_GT_AMP] = ">&"; - v->a[anon_sym_GT_PIPE] = ">|"; - v->a[anon_sym_LT_AMP_DASH] = "<&-"; - v->a[anon_sym_GT_AMP_DASH] = ">&-"; - v->a[anon_sym_LT_LT] = "<<"; - v->a[anon_sym_LT_LT_DASH] = "<<-"; + v->a[anon_sym_LT] = "operator"; + v->a[anon_sym_GT] = "operator"; + v->a[anon_sym_GT_GT] = "operator"; + v->a[anon_sym_AMP_GT] = "operator"; + v->a[anon_sym_AMP_GT_GT] = "operator"; + v->a[anon_sym_LT_AMP] = "operator"; + v->a[anon_sym_GT_AMP] = "operator"; + v->a[anon_sym_GT_PIPE] = "operator"; + v->a[anon_sym_LT_AMP_DASH] = "operator"; + v->a[anon_sym_GT_AMP_DASH] = "operator"; + v->a[anon_sym_LT_LT] = "operator"; + v->a[anon_sym_LT_LT_DASH] = "operator"; v->a[aux_sym_heredoc_redirect_token1] = "heredoc_redirect_token1"; v->a[anon_sym_PIPE_AMP] = "|&"; symbols_names_2(v); @@ -66,41 +66,41 @@ void symbols_names_2(t_symbols_names_array *v) { v->a[anon_sym_DOLLAR_LPAREN_LPAREN] = "$(("; v->a[anon_sym_RPAREN_RPAREN] = "))"; - v->a[anon_sym_PLUS_EQ] = "+="; - v->a[anon_sym_DASH_EQ] = "-="; - v->a[anon_sym_STAR_EQ] = "*="; - v->a[anon_sym_SLASH_EQ] = "/="; - v->a[anon_sym_PERCENT_EQ] = "%="; - v->a[anon_sym_LT_LT_EQ] = "<<="; - v->a[anon_sym_GT_GT_EQ] = ">>="; - v->a[anon_sym_AMP_EQ] = "&="; - v->a[anon_sym_CARET_EQ] = "^="; - v->a[anon_sym_PIPE_EQ] = "|="; - v->a[anon_sym_CARET] = "^"; + v->a[anon_sym_PLUS_EQ] = "operator"; + v->a[anon_sym_DASH_EQ] = "operator"; + v->a[anon_sym_STAR_EQ] = "operator"; + v->a[anon_sym_SLASH_EQ] = "operator"; + v->a[anon_sym_PERCENT_EQ] = "operator"; + v->a[anon_sym_LT_LT_EQ] = "operator"; + v->a[anon_sym_GT_GT_EQ] = "operator"; + v->a[anon_sym_AMP_EQ] = "operator"; + v->a[anon_sym_CARET_EQ] = "operator"; + v->a[anon_sym_PIPE_EQ] = "operator"; + v->a[anon_sym_CARET] = "operator"; v->a[anon_sym_AMP] = "&"; - v->a[anon_sym_EQ_EQ] = "=="; - v->a[anon_sym_BANG_EQ] = "!="; - v->a[anon_sym_LT_EQ] = "<="; - v->a[anon_sym_GT_EQ] = ">="; - v->a[anon_sym_PLUS] = "+"; - v->a[anon_sym_DASH] = "-"; + v->a[anon_sym_EQ_EQ] = "operator"; + v->a[anon_sym_BANG_EQ] = "operator"; + v->a[anon_sym_LT_EQ] = "operator"; + v->a[anon_sym_GT_EQ] = "operator"; + v->a[anon_sym_PLUS] = "operator"; + v->a[anon_sym_DASH] = "operator"; symbols_names_3(v); } void symbols_names_3(t_symbols_names_array *v) { - v->a[anon_sym_STAR] = "*"; - v->a[anon_sym_SLASH] = "/"; - v->a[anon_sym_PERCENT] = "%"; + v->a[anon_sym_STAR] = "operator"; + v->a[anon_sym_SLASH] = "operator"; + v->a[anon_sym_PERCENT] = "operator"; v->a[anon_sym_QMARK] = "\\\?"; v->a[anon_sym_COLON] = ":"; - v->a[anon_sym_PLUS_PLUS] = "++"; - v->a[anon_sym_DASH_DASH] = "--"; - v->a[anon_sym_DASH2] = "-"; - v->a[anon_sym_PLUS2] = "+"; - v->a[anon_sym_TILDE] = "~"; - v->a[anon_sym_PLUS_PLUS2] = "++"; - v->a[anon_sym_DASH_DASH2] = "--"; + v->a[anon_sym_PLUS_PLUS] = "operator"; + v->a[anon_sym_DASH_DASH] = "operator"; + v->a[anon_sym_DASH2] = "operator"; + v->a[anon_sym_PLUS2] = "operator"; + v->a[anon_sym_TILDE] = "operator"; + v->a[anon_sym_PLUS_PLUS2] = "operator"; + v->a[anon_sym_DASH_DASH2] = "operator"; v->a[aux_sym_concatenation_token1] = "``"; v->a[anon_sym_DOLLAR] = "$"; v->a[anon_sym_DQUOTE] = "\\\""; @@ -108,22 +108,22 @@ void symbols_names_3(t_symbols_names_array *v) v->a[sym_raw_string] = "raw_string"; v->a[aux_sym_number_token1] = "number_token1"; v->a[aux_sym_number_token2] = "number_token2"; - v->a[anon_sym_POUND] = "#"; + v->a[anon_sym_POUND] = "special_variable_name"; symbols_names_4(v); } void symbols_names_4(t_symbols_names_array *v) { v->a[anon_sym_DOLLAR_LBRACE] = "${"; - v->a[anon_sym_COLON_DASH] = ":-"; - v->a[anon_sym_DASH3] = "-"; - v->a[anon_sym_COLON_EQ] = ":="; - v->a[anon_sym_EQ2] = "="; - v->a[anon_sym_COLON_QMARK] = ":\\\?"; - v->a[anon_sym_QMARK2] = "\\\?"; - v->a[anon_sym_COLON_PLUS] = ":+"; - v->a[anon_sym_PLUS3] = "+"; - v->a[anon_sym_PERCENT_PERCENT] = "%%"; + v->a[anon_sym_COLON_DASH] = "operator"; + v->a[anon_sym_DASH3] = "operator"; + v->a[anon_sym_COLON_EQ] = "operator"; + v->a[anon_sym_EQ2] = "operator"; + v->a[anon_sym_COLON_QMARK] = "operator"; + v->a[anon_sym_QMARK2] = "operator"; + v->a[anon_sym_COLON_PLUS] = "operator"; + v->a[anon_sym_PLUS3] = "operator"; + v->a[anon_sym_PERCENT_PERCENT] = "operator"; v->a[aux_sym_expansion_regex_token1] = "regex"; v->a[anon_sym_DOLLAR_LPAREN] = "$("; v->a[anon_sym_BQUOTE] = "`"; diff --git a/parser/static/symbols_names/symbols_names_1.c b/parser/static/symbols_names/symbols_names_1.c index 86faf866..1bcd81e2 100644 --- a/parser/static/symbols_names/symbols_names_1.c +++ b/parser/static/symbols_names/symbols_names_1.c @@ -28,7 +28,7 @@ void symbols_names_5(t_symbols_names_array *v) v->a[sym__expansion_word] = "word"; v->a[sym_extglob_pattern] = "extglob_pattern"; v->a[sym__bare_dollar] = "$"; - v->a[sym__immediate_double_hash] = "##"; + v->a[sym__immediate_double_hash] = "operator"; v->a[sym___error_recovery] = "__error_recovery"; v->a[sym_program] = "program"; v->a[sym__statements] = "_statements"; diff --git a/parser/static/unique_symbols_map/unique_symbols_map_0.c b/parser/static/unique_symbols_map/unique_symbols_map_0.c index 416d88ad..e48a30c5 100644 --- a/parser/static/unique_symbols_map/unique_symbols_map_0.c +++ b/parser/static/unique_symbols_map/unique_symbols_map_0.c @@ -41,22 +41,22 @@ void unique_symbols_map_1(t_unique_symbols_map_array *v) { v->a[anon_sym_LBRACE] = anon_sym_LBRACE; v->a[anon_sym_RBRACE] = anon_sym_RBRACE; - v->a[anon_sym_AMP_AMP] = anon_sym_AMP_AMP; - v->a[anon_sym_PIPE_PIPE] = anon_sym_PIPE_PIPE; + v->a[anon_sym_AMP_AMP] = sym__immediate_double_hash; + v->a[anon_sym_PIPE_PIPE] = sym__immediate_double_hash; v->a[anon_sym_BANG] = anon_sym_BANG; v->a[anon_sym_EQ] = anon_sym_EQ; - v->a[anon_sym_LT] = anon_sym_LT; - v->a[anon_sym_GT] = anon_sym_GT; - v->a[anon_sym_GT_GT] = anon_sym_GT_GT; - v->a[anon_sym_AMP_GT] = anon_sym_AMP_GT; - v->a[anon_sym_AMP_GT_GT] = anon_sym_AMP_GT_GT; - v->a[anon_sym_LT_AMP] = anon_sym_LT_AMP; - v->a[anon_sym_GT_AMP] = anon_sym_GT_AMP; - v->a[anon_sym_GT_PIPE] = anon_sym_GT_PIPE; - v->a[anon_sym_LT_AMP_DASH] = anon_sym_LT_AMP_DASH; - v->a[anon_sym_GT_AMP_DASH] = anon_sym_GT_AMP_DASH; - v->a[anon_sym_LT_LT] = anon_sym_LT_LT; - v->a[anon_sym_LT_LT_DASH] = anon_sym_LT_LT_DASH; + v->a[anon_sym_LT] = sym__immediate_double_hash; + v->a[anon_sym_GT] = sym__immediate_double_hash; + v->a[anon_sym_GT_GT] = sym__immediate_double_hash; + v->a[anon_sym_AMP_GT] = sym__immediate_double_hash; + v->a[anon_sym_AMP_GT_GT] = sym__immediate_double_hash; + v->a[anon_sym_LT_AMP] = sym__immediate_double_hash; + v->a[anon_sym_GT_AMP] = sym__immediate_double_hash; + v->a[anon_sym_GT_PIPE] = sym__immediate_double_hash; + v->a[anon_sym_LT_AMP_DASH] = sym__immediate_double_hash; + v->a[anon_sym_GT_AMP_DASH] = sym__immediate_double_hash; + v->a[anon_sym_LT_LT] = sym__immediate_double_hash; + v->a[anon_sym_LT_LT_DASH] = sym__immediate_double_hash; v->a[aux_sym_heredoc_redirect_token1] = aux_sym_heredoc_redirect_token1; v->a[anon_sym_PIPE_AMP] = anon_sym_PIPE_AMP; unique_symbols_map_2(v); @@ -66,41 +66,41 @@ void unique_symbols_map_2(t_unique_symbols_map_array *v) { v->a[anon_sym_DOLLAR_LPAREN_LPAREN] = anon_sym_DOLLAR_LPAREN_LPAREN; v->a[anon_sym_RPAREN_RPAREN] = anon_sym_RPAREN_RPAREN; - v->a[anon_sym_PLUS_EQ] = anon_sym_PLUS_EQ; - v->a[anon_sym_DASH_EQ] = anon_sym_DASH_EQ; - v->a[anon_sym_STAR_EQ] = anon_sym_STAR_EQ; - v->a[anon_sym_SLASH_EQ] = anon_sym_SLASH_EQ; - v->a[anon_sym_PERCENT_EQ] = anon_sym_PERCENT_EQ; - v->a[anon_sym_LT_LT_EQ] = anon_sym_LT_LT_EQ; - v->a[anon_sym_GT_GT_EQ] = anon_sym_GT_GT_EQ; - v->a[anon_sym_AMP_EQ] = anon_sym_AMP_EQ; - v->a[anon_sym_CARET_EQ] = anon_sym_CARET_EQ; - v->a[anon_sym_PIPE_EQ] = anon_sym_PIPE_EQ; - v->a[anon_sym_CARET] = anon_sym_CARET; + v->a[anon_sym_PLUS_EQ] = sym__immediate_double_hash; + v->a[anon_sym_DASH_EQ] = sym__immediate_double_hash; + v->a[anon_sym_STAR_EQ] = sym__immediate_double_hash; + v->a[anon_sym_SLASH_EQ] = sym__immediate_double_hash; + v->a[anon_sym_PERCENT_EQ] = sym__immediate_double_hash; + v->a[anon_sym_LT_LT_EQ] = sym__immediate_double_hash; + v->a[anon_sym_GT_GT_EQ] = sym__immediate_double_hash; + v->a[anon_sym_AMP_EQ] = sym__immediate_double_hash; + v->a[anon_sym_CARET_EQ] = sym__immediate_double_hash; + v->a[anon_sym_PIPE_EQ] = sym__immediate_double_hash; + v->a[anon_sym_CARET] = sym__immediate_double_hash; v->a[anon_sym_AMP] = anon_sym_AMP; - v->a[anon_sym_EQ_EQ] = anon_sym_EQ_EQ; - v->a[anon_sym_BANG_EQ] = anon_sym_BANG_EQ; - v->a[anon_sym_LT_EQ] = anon_sym_LT_EQ; - v->a[anon_sym_GT_EQ] = anon_sym_GT_EQ; - v->a[anon_sym_PLUS] = anon_sym_PLUS; - v->a[anon_sym_DASH] = anon_sym_DASH; + v->a[anon_sym_EQ_EQ] = sym__immediate_double_hash; + v->a[anon_sym_BANG_EQ] = sym__immediate_double_hash; + v->a[anon_sym_LT_EQ] = sym__immediate_double_hash; + v->a[anon_sym_GT_EQ] = sym__immediate_double_hash; + v->a[anon_sym_PLUS] = sym__immediate_double_hash; + v->a[anon_sym_DASH] = sym__immediate_double_hash; unique_symbols_map_3(v); } void unique_symbols_map_3(t_unique_symbols_map_array *v) { - v->a[anon_sym_STAR] = anon_sym_STAR; - v->a[anon_sym_SLASH] = anon_sym_SLASH; - v->a[anon_sym_PERCENT] = anon_sym_PERCENT; + v->a[anon_sym_STAR] = sym__immediate_double_hash; + v->a[anon_sym_SLASH] = sym__immediate_double_hash; + v->a[anon_sym_PERCENT] = sym__immediate_double_hash; v->a[anon_sym_QMARK] = anon_sym_QMARK; v->a[anon_sym_COLON] = anon_sym_COLON; - v->a[anon_sym_PLUS_PLUS] = anon_sym_PLUS_PLUS; - v->a[anon_sym_DASH_DASH] = anon_sym_DASH_DASH; - v->a[anon_sym_DASH2] = anon_sym_DASH; - v->a[anon_sym_PLUS2] = anon_sym_PLUS; - v->a[anon_sym_TILDE] = anon_sym_TILDE; - v->a[anon_sym_PLUS_PLUS2] = anon_sym_PLUS_PLUS; - v->a[anon_sym_DASH_DASH2] = anon_sym_DASH_DASH; + v->a[anon_sym_PLUS_PLUS] = sym__immediate_double_hash; + v->a[anon_sym_DASH_DASH] = sym__immediate_double_hash; + v->a[anon_sym_DASH2] = sym__immediate_double_hash; + v->a[anon_sym_PLUS2] = sym__immediate_double_hash; + v->a[anon_sym_TILDE] = sym__immediate_double_hash; + v->a[anon_sym_PLUS_PLUS2] = sym__immediate_double_hash; + v->a[anon_sym_DASH_DASH2] = sym__immediate_double_hash; v->a[aux_sym_concatenation_token1] = aux_sym_concatenation_token1; v->a[anon_sym_DOLLAR] = anon_sym_DOLLAR; v->a[anon_sym_DQUOTE] = anon_sym_DQUOTE; @@ -115,15 +115,15 @@ void unique_symbols_map_3(t_unique_symbols_map_array *v) void unique_symbols_map_4(t_unique_symbols_map_array *v) { v->a[anon_sym_DOLLAR_LBRACE] = anon_sym_DOLLAR_LBRACE; - v->a[anon_sym_COLON_DASH] = anon_sym_COLON_DASH; - v->a[anon_sym_DASH3] = anon_sym_DASH; - v->a[anon_sym_COLON_EQ] = anon_sym_COLON_EQ; - v->a[anon_sym_EQ2] = anon_sym_EQ; - v->a[anon_sym_COLON_QMARK] = anon_sym_COLON_QMARK; - v->a[anon_sym_QMARK2] = anon_sym_QMARK; - v->a[anon_sym_COLON_PLUS] = anon_sym_COLON_PLUS; - v->a[anon_sym_PLUS3] = anon_sym_PLUS; - v->a[anon_sym_PERCENT_PERCENT] = anon_sym_PERCENT_PERCENT; + v->a[anon_sym_COLON_DASH] = sym__immediate_double_hash; + v->a[anon_sym_DASH3] = sym__immediate_double_hash; + v->a[anon_sym_COLON_EQ] = sym__immediate_double_hash; + v->a[anon_sym_EQ2] = sym__immediate_double_hash; + v->a[anon_sym_COLON_QMARK] = sym__immediate_double_hash; + v->a[anon_sym_QMARK2] = sym__immediate_double_hash; + v->a[anon_sym_COLON_PLUS] = sym__immediate_double_hash; + v->a[anon_sym_PLUS3] = sym__immediate_double_hash; + v->a[anon_sym_PERCENT_PERCENT] = sym__immediate_double_hash; v->a[aux_sym_expansion_regex_token1] = sym_regex; v->a[anon_sym_DOLLAR_LPAREN] = anon_sym_DOLLAR_LPAREN; v->a[anon_sym_BQUOTE] = anon_sym_BQUOTE; @@ -131,9 +131,9 @@ void unique_symbols_map_4(t_unique_symbols_map_array *v) v->a[sym__comment_word] = sym_word; v->a[aux_sym__simple_variable_name_token1] = sym_variable_name; v->a[aux_sym__multiline_variable_name_token1] = sym_variable_name; - v->a[anon_sym_AT] = anon_sym_AT; - v->a[anon_sym_0] = anon_sym_AT; - v->a[anon_sym__] = anon_sym_AT; + v->a[anon_sym_AT] = anon_sym_POUND; + v->a[anon_sym_0] = anon_sym_POUND; + v->a[anon_sym__] = anon_sym_POUND; unique_symbols_map_5(v); } diff --git a/sources/node/node.c b/sources/node/node.c index 578df8bf..4ecce4cc 100644 --- a/sources/node/node.c +++ b/sources/node/node.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/28 18:36:40 by maiboyer #+# #+# */ -/* Updated: 2024/05/29 14:52:46 by maiboyer ### ########.fr */ +/* Updated: 2024/06/09 20:53:16 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,16 +16,15 @@ #include "parser/api.h" #include -t_node build_node(t_parse_node current, t_const_str input); -t_parse_node ts_node_child(t_parse_node parent, t_usize idx); -t_symbol ts_node_symbol(t_parse_node self); -t_const_str ts_node_type(t_parse_node self); -t_u32 ts_node_start_byte(t_parse_node self); -t_u32 ts_node_end_byte(t_parse_node self); -t_u32 ts_node_child_count(t_parse_node self); t_const_str ts_node_field_name_for_child(t_parse_node self, t_u32 child_index); -t_u64 ts_language_field_id_for_name(t_language *lang, t_const_str name, - t_u64 name_len); +t_const_str ts_node_type(t_parse_node self); +t_node build_node(t_parse_node current, t_const_str input); +t_parse_node ts_node_named_child(t_parse_node parent, t_usize idx); +t_symbol ts_node_symbol(t_parse_node self); +t_u32 ts_node_end_byte(t_parse_node self); +t_u32 ts_node_named_child_count(t_parse_node self); +t_u32 ts_node_start_byte(t_parse_node self); +t_u64 ts_language_field_id_for_name(t_language *lang, t_const_str name, t_u64 name_len); t_language *tree_sitter_bash(void); @@ -41,12 +40,10 @@ t_node *build_childs(t_parse_node parent, t_const_str input, t_usize count) idx = 0; while (idx < count) { - child = ts_node_child(parent, idx); + child = ts_node_named_child(parent, idx); ret[idx] = build_node(child, input); ret[idx].field_str = ts_node_field_name_for_child(parent, idx); - ret[idx].field = ts_language_field_id_for_name( - tree_sitter_bash(), ret[idx].field_str, - str_len(ret[idx].field_str)); + ret[idx].field = ts_language_field_id_for_name(tree_sitter_bash(), ret[idx].field_str, str_len(ret[idx].field_str)); idx++; } return (ret); @@ -63,7 +60,7 @@ t_node build_node(t_parse_node curr, t_const_str input) out.input = input; out.single_str = NULL; out.field_str = NULL; - out.childs_count = ts_node_child_count(curr); + out.childs_count = ts_node_named_child_count(curr); if (out.childs_count == 0) out.childs = NULL; else diff --git a/tree-sitter-sh/grammar.js b/tree-sitter-sh/grammar.js index a825613f..911818de 100644 --- a/tree-sitter-sh/grammar.js +++ b/tree-sitter-sh/grammar.js @@ -249,7 +249,7 @@ module.exports = grammar({ list: $ => prec.left(-1, seq( field('cmd', $._statement), - field('op', choice('&&', '||')), + field('op', alias(choice('&&', '||'), $.operator)), field('cmd', $._statement), )), @@ -300,11 +300,11 @@ module.exports = grammar({ field('fd', optional($.file_descriptor)), choice( seq( - field('op', choice('<', '>', '>>', '&>', '&>>', '<&', '>&', '>|')), + field('op', alias(choice('<', '>', '>>', '&>', '&>>', '<&', '>&', '>|'), $.operator)), field('dest', repeat1($._literal)), ), seq( - field('op', choice('<&-', '>&-')), + field('op', alias(choice('<&-', '>&-'), $.operator)), field('dest', optional($._literal)), ), ), @@ -312,7 +312,7 @@ module.exports = grammar({ heredoc_redirect: $ => seq( field('fd', optional($.file_descriptor)), - field('op', choice('<<', '<<-')), + field('op', alias(choice('<<', '<<-'), $.operator)), $.heredoc_start, optional(choice( alias($._heredoc_pipeline, $.pipeline), @@ -333,7 +333,7 @@ module.exports = grammar({ ), _heredoc_expression: $ => seq( - field('op', choice('||', '&&')), + field('op', alias(choice('||', '&&'), $.operator)), field('right', $._statement), ), @@ -413,7 +413,7 @@ module.exports = grammar({ return choice(...table.map(([operator, precedence]) => prec.left(precedence, seq( field('left', $._arithmetic_expression), - field('op', operator), + field('op', alias(operator, $.operator)), field('right', $._arithmetic_expression), )) )); @@ -429,22 +429,22 @@ module.exports = grammar({ arithmetic_unary_expression: $ => choice( prec(PREC.PREFIX, seq( - field('op', tokenLiterals(1, '++', '--')), + field('op', alias(tokenLiterals(1, '++', '--'), $.operator)), $._arithmetic_expression, )), prec(PREC.UNARY, seq( - field('op', tokenLiterals(1, '-', '+', '~')), + field('op', alias(tokenLiterals(1, '-', '+', '~'), $.operator)), $._arithmetic_expression, )), prec.right(PREC.UNARY, seq( - field('op', '!'), + field('op', alias('!', $.operator)), $._arithmetic_expression, )), ), arithmetic_postfix_expression: $ => prec(PREC.POSTFIX, seq( $._arithmetic_expression, - field('op', choice('++', '--')), + field('op', alias(choice('++', '--'), $.operator)), )), arithmetic_parenthesized_expression: $ => seq('(', $._arithmetic_expression, ')'), @@ -500,8 +500,6 @@ module.exports = grammar({ ), ), - string_expansion: $ => seq('$', $.string), - expansion: $ => seq( '${', optional($._expansion_body), @@ -514,7 +512,7 @@ module.exports = grammar({ expansion_expression: $ => prec(1, seq( - field('op', immediateLiterals(':-', '-', ':=', '=', ':?', '?', ':+', '+',)), + field('op', alias(immediateLiterals(':-', '-', ':=', '=', ':?', '?', ':+', '+'), $.operator)), optional(seq( choice( alias($._concatenation_in_expansion, $.concatenation), @@ -528,7 +526,7 @@ module.exports = grammar({ )), expansion_regex: $ => seq( - field('op', choice('#', alias($._immediate_double_hash, '##'), '%', '%%')), + field('op', alias(choice('#', $._immediate_double_hash, '%', '%%'), $.operator)), repeat(choice( $.regex, alias(')', $.regex),