update
This commit is contained in:
parent
d16b39091a
commit
ff1670e264
15 changed files with 435 additions and 243 deletions
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include "ast/forward.h"
|
||||
#include "me/types.h"
|
||||
#include <iso646.h>
|
||||
|
||||
/// @brief Node types enumeration
|
||||
/// @details This enumeration is used to identify the type of a node
|
||||
|
|
@ -36,6 +35,7 @@ enum e_ast_type
|
|||
TY_COMMAND_BACKTICKS,
|
||||
TY_COMMAND_SUBSTITUTION,
|
||||
TY_COMPOUND_LIST,
|
||||
TY_DOUBLE_QUOTE_STRING,
|
||||
TY_ELIF_CLAUSE,
|
||||
TY_ELSE_CLAUSE,
|
||||
TY_FOR_COMMAND,
|
||||
|
|
@ -200,9 +200,9 @@ struct s_not
|
|||
|
||||
struct s_pipe_list
|
||||
{
|
||||
t_ast_type type;
|
||||
t_command *cmds;
|
||||
t_usize cmds_len;
|
||||
t_ast_type type;
|
||||
t_ast_node **cmds;
|
||||
t_usize cmds_len;
|
||||
};
|
||||
|
||||
union u_command_inner {
|
||||
|
|
@ -433,7 +433,7 @@ struct s_assignment
|
|||
struct s_ast_string
|
||||
{
|
||||
t_ast_type type;
|
||||
t_str *value;
|
||||
t_str value;
|
||||
};
|
||||
|
||||
struct s_name
|
||||
|
|
@ -490,6 +490,14 @@ union u_expension {
|
|||
t_arithmetic_expansion *arithmetic_expansion;
|
||||
t_command_substitution *command_substitution;
|
||||
t_command_backticks *command_backticks;
|
||||
t_double_quote_string *double_quote_string;
|
||||
};
|
||||
|
||||
struct s_double_quote_string
|
||||
{
|
||||
t_ast_type type;
|
||||
t_expension_or_string *parts;
|
||||
t_usize parts_len;
|
||||
};
|
||||
|
||||
struct s_parameter_expansion
|
||||
|
|
@ -498,7 +506,7 @@ struct s_parameter_expansion
|
|||
t_op_in op_pre;
|
||||
t_ast_string *param;
|
||||
t_op_in op_in;
|
||||
t_ast_string *_Nullable word;
|
||||
t_word *_Nullable word;
|
||||
};
|
||||
|
||||
struct s_arithmetic_expansion
|
||||
|
|
@ -536,6 +544,7 @@ union u_ast_node {
|
|||
t_command_backticks command_backticks;
|
||||
t_command_substitution command_substitution;
|
||||
t_compound_list compound_list;
|
||||
t_double_quote_string double_quote_string;
|
||||
t_elif_clause elif_clause;
|
||||
t_else_clause else_clause;
|
||||
t_for_command for_command;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ typedef struct s_command_backticks t_command_backticks;
|
|||
typedef struct s_command_substitution t_command_substitution;
|
||||
typedef struct s_command t_command;
|
||||
typedef struct s_compound_list t_compound_list;
|
||||
typedef struct s_double_quote_string t_double_quote_string;
|
||||
typedef struct s_elif_clause t_elif_clause;
|
||||
typedef struct s_else_clause t_else_clause;
|
||||
typedef struct s_for_command t_for_command;
|
||||
|
|
@ -55,7 +56,7 @@ typedef struct s_simple_command t_simple_command;
|
|||
typedef struct s_subshell_command t_subshell_command;
|
||||
typedef struct s_until_command t_until_command;
|
||||
typedef struct s_while_command t_while_command;
|
||||
typedef struct s_word t_word;
|
||||
typedef struct s_word t_word;
|
||||
|
||||
typedef union u_and_list_body t_and_list_body;
|
||||
typedef union u_and_or_list_body t_and_or_list_body;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#ifndef FROM_PROGRAM_C
|
||||
#define FROM_PROGRAM_C
|
||||
|
||||
#include "forward.h"
|
||||
#include "me/types.h"
|
||||
|
||||
#include "app/node.h"
|
||||
|
|
@ -90,6 +91,11 @@ t_command *build_command(t_node *node, t_usize size);
|
|||
/// @note can be null in case of error
|
||||
t_compound_list *build_compound_list(t_node *node, t_usize size);
|
||||
|
||||
/// @param node a pointer to an array of `t_node` of size `size`
|
||||
/// @param size the size of the nodes
|
||||
/// @note can be null in case of error
|
||||
t_double_quote_string *build_double_quote_string(t_node *node, t_usize size);
|
||||
|
||||
/// @param node a pointer to an array of `t_node` of size `size`
|
||||
/// @param size the size of the nodes
|
||||
/// @note can be null in case of error
|
||||
|
|
@ -190,7 +196,6 @@ t_while_command *build_while_command(t_node *node, t_usize size);
|
|||
/// @note can be null in case of error
|
||||
t_word *build_word(t_node *node, t_usize size);
|
||||
|
||||
|
||||
/// @param node a pointer to an array of `t_node` of size `size`
|
||||
/// @param size the size of the nodes
|
||||
/// @note can be null in case of error
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
build_ast
|
||||
from_node
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* build_ast.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/25 20:41:33 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/25 20:41:48 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ast/ast.h"
|
||||
|
|
@ -6,10 +6,11 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/28 13:18:44 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/29 00:51:19 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/29 13:41:57 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "me/str/str.h"
|
||||
#include "me/types.h"
|
||||
|
||||
#include "app/node.h"
|
||||
|
|
@ -17,6 +18,15 @@
|
|||
#include "gmr/symbols.h"
|
||||
#include <stdio.h>
|
||||
|
||||
t_ast_node *alloc_node(t_ast_type ty)
|
||||
{
|
||||
t_ast_node *ptr;
|
||||
|
||||
ptr = mem_alloc(sizeof(*ptr));
|
||||
ptr->type = ty;
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
t_ast_node *build_comment(t_node *node, t_usize size)
|
||||
{
|
||||
t_ast_node *ptr;
|
||||
|
|
@ -24,8 +34,153 @@ t_ast_node *build_comment(t_node *node, t_usize size)
|
|||
(void)(node);
|
||||
(void)(size);
|
||||
|
||||
ptr = mem_alloc(sizeof(*ptr));
|
||||
ptr->type = TY_EMPTY;
|
||||
ptr = alloc_node(TY_EMPTY);
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
t_and_list *build_and_list(t_node *node, t_usize size)
|
||||
{
|
||||
t_and_list *ptr;
|
||||
t_usize i;
|
||||
t_usize j;
|
||||
|
||||
(void)(size);
|
||||
if (node == NULL || node->kind != sym_list || size == 0 ||
|
||||
node->childs_count <= 1)
|
||||
me_abort("Invalid arguments to build ast!");
|
||||
ptr = (void *)alloc_node(TY_AND_LIST);
|
||||
ptr->cmds = mem_alloc_array(sizeof(t_ast_node *), node->childs_count);
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (i < node->childs_count)
|
||||
{
|
||||
if ((node->childs[i].kind == anon_sym_AMP_AMP ||
|
||||
node->childs[i].kind == anon_sym_PIPE_PIPE) &&
|
||||
(i++, true))
|
||||
continue;
|
||||
ptr->cmds[j++].cmd = (void *)from_node(&node->childs[i]);
|
||||
i++;
|
||||
}
|
||||
ptr->cmds_len = j;
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
t_or_list *build_or_list(t_node *node, t_usize size)
|
||||
{
|
||||
t_or_list *ptr;
|
||||
t_usize i;
|
||||
t_usize j;
|
||||
|
||||
(void)(size);
|
||||
if (node == NULL || node->kind != sym_list || size == 0 ||
|
||||
node->childs_count <= 1)
|
||||
me_abort("Invalid arguments to build ast!");
|
||||
ptr = (void *)alloc_node(TY_OR_LIST);
|
||||
ptr->cmds = mem_alloc_array(sizeof(t_ast_node *), node->childs_count);
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (i < node->childs_count)
|
||||
{
|
||||
if ((node->childs[i].kind == anon_sym_AMP_AMP ||
|
||||
node->childs[i].kind == anon_sym_PIPE_PIPE) &&
|
||||
(i++, true))
|
||||
continue;
|
||||
|
||||
ptr->cmds[j++].cmd = (void *)from_node(&node->childs[i]);
|
||||
i++;
|
||||
}
|
||||
ptr->cmds_len = j;
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
t_ast_string *build_ast_string(t_node *node, t_usize size)
|
||||
{
|
||||
t_ast_string *ptr;
|
||||
|
||||
(void)(size);
|
||||
if (node == NULL ||
|
||||
(node->kind != sym_string_content && node->kind != sym_raw_string &&
|
||||
node->kind == sym_ansi_c_string) ||
|
||||
size == 0)
|
||||
me_abort("Invalid arguments to build ast!");
|
||||
|
||||
ptr = (void *)alloc_node(TY_AST_STRING);
|
||||
ptr->value = str_clone(node_getstr(node));
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
t_and_or_list *build_and_or_list(t_node *node, t_usize size)
|
||||
{
|
||||
t_and_or_list *ptr;
|
||||
|
||||
(void)(node);
|
||||
(void)(size);
|
||||
|
||||
if (node == NULL || node->kind != sym_list || size == 0 ||
|
||||
node->childs_count <= 1)
|
||||
me_abort("Invalid arguments to build ast!");
|
||||
ptr = (void *)alloc_node(TY_AND_OR_LIST);
|
||||
if (node->childs[1].kind == anon_sym_PIPE_PIPE)
|
||||
ptr->cmds.or_list = build_or_list(node, 1);
|
||||
else if (node->childs[1].kind == anon_sym_AMP_AMP)
|
||||
ptr->cmds.and_list = build_and_list(node, 1);
|
||||
else
|
||||
return (mem_free(ptr), NULL);
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
t_pipe_list *build_pipe_list(t_node *node, t_usize size)
|
||||
{
|
||||
t_pipe_list *ptr;
|
||||
t_usize i;
|
||||
t_usize j;
|
||||
|
||||
(void)(size);
|
||||
if (node == NULL || node->kind != sym_pipeline || size == 0 ||
|
||||
node->childs_count <= 1)
|
||||
me_abort("Invalid arguments to build ast!");
|
||||
ptr = (void *)alloc_node(TY_PIPE_LIST);
|
||||
ptr->cmds = mem_alloc_array(sizeof(t_ast_node *), node->childs_count);
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (i < node->childs_count)
|
||||
{
|
||||
if (node->childs[i].kind == anon_sym_PIPE)
|
||||
i++;
|
||||
ptr->cmds[j++] = from_node(&node->childs[i]);
|
||||
i++;
|
||||
}
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
t_double_quote_string *build_double_qoute_string(t_node *node, t_usize size)
|
||||
{
|
||||
t_double_quote_string *ptr;
|
||||
t_usize i;
|
||||
t_usize j;
|
||||
|
||||
(void)(size);
|
||||
if (node == NULL || node->kind != sym_string || size == 0)
|
||||
me_abort("Invalid arguments to build ast!");
|
||||
ptr = (void *)alloc_node(TY_DOUBLE_QUOTE_STRING);
|
||||
ptr->parts = mem_alloc_array(sizeof(*ptr->parts), node->childs_count);
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (i < node->childs_count)
|
||||
ptr->parts[j++].expension->type = (void *)from_node(&node->childs[i++]);
|
||||
ptr->parts_len = j;
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
t_not *build_not(t_node *node, t_usize size)
|
||||
{
|
||||
t_not *ptr;
|
||||
|
||||
(void)(size);
|
||||
if (node == NULL || node->kind != sym_negated_command || size == 0)
|
||||
me_abort("Invalid arguments to build ast!");
|
||||
ptr = (void *)alloc_node(TY_NOT);
|
||||
ptr->cmd.type = (void *)from_node(&node->childs[1]);
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
|
|
@ -36,9 +191,10 @@ t_ast_node *from_node(t_node *node)
|
|||
if (node->kind == sym_program)
|
||||
return ((t_ast_node *)build_program(node, 1));
|
||||
|
||||
if (node->kind == sym_word)
|
||||
return ((t_ast_node *)build_word(node, 1));
|
||||
if (node->kind == sym_string)
|
||||
return ((t_ast_node *)build_double_quote_string(node, 1));
|
||||
|
||||
if (node->kind == sym_word)
|
||||
return ((t_ast_node *)build_word(node, 1));
|
||||
if (node->kind == sym_concatenation)
|
||||
return ((t_ast_node *)build_word(node, 1));
|
||||
|
|
@ -81,6 +237,12 @@ t_ast_node *from_node(t_node *node)
|
|||
return ((t_ast_node *)build_command(node, 1));
|
||||
if (node->kind == sym_command)
|
||||
return ((t_ast_node *)build_command(node, 1));
|
||||
if (node->kind == sym_test_command)
|
||||
return ((t_ast_node *)build_command(node, 1));
|
||||
if (node->kind == sym_declaration_command)
|
||||
return ((t_ast_node *)build_command(node, 1));
|
||||
if (node->kind == sym_unset_command)
|
||||
return ((t_ast_node *)build_command(node, 1));
|
||||
|
||||
if (node->kind == sym_file_redirect)
|
||||
return ((t_ast_node *)build_redirect_file(node, 1));
|
||||
|
|
@ -100,6 +262,35 @@ t_ast_node *from_node(t_node *node)
|
|||
if (node->kind == sym_brace_expression)
|
||||
return ((t_ast_node *)build_brace_command(node, 1));
|
||||
|
||||
if (node->kind == sym_compound_statement)
|
||||
return ((t_ast_node *)build_compound_list(node, 1));
|
||||
|
||||
if (node->kind == sym_if_statement)
|
||||
return ((t_ast_node *)build_if_command(node, 1));
|
||||
|
||||
if (node->kind == sym_else_clause)
|
||||
return ((t_ast_node *)build_else_clause(node, 1));
|
||||
|
||||
if (node->kind == sym_elif_clause)
|
||||
return ((t_ast_node *)build_elif_clause(node, 1));
|
||||
|
||||
if (node->kind == sym_case_statement)
|
||||
return ((t_ast_node *)build_case_command(node, 1));
|
||||
|
||||
if (node->kind == sym_case_item)
|
||||
return ((t_ast_node *)build_case_item(node, 1));
|
||||
if (node->kind == sym_last_case_item)
|
||||
return ((t_ast_node *)build_case_item(node, 1));
|
||||
|
||||
if (node->kind == sym_while_statement)
|
||||
return ((t_ast_node *)build_while_command(node, 1));
|
||||
|
||||
if (node->kind == sym_for_statement)
|
||||
return ((t_ast_node *)build_for_command(node, 1));
|
||||
|
||||
if (node->kind == sym_function_definition)
|
||||
return ((t_ast_node *)build_function_definition(node, 1));
|
||||
|
||||
printf("unknown node of kind '%s'\n", node->kind_str);
|
||||
|
||||
return (NULL);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/28 18:35:22 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/09 16:23:54 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/05/29 14:46:20 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,9 +19,11 @@
|
|||
typedef struct s_node
|
||||
{
|
||||
t_u64 kind;
|
||||
const char *kind_str;
|
||||
const char *input;
|
||||
char *single_str;
|
||||
t_const_str kind_str;
|
||||
t_const_str field_str;
|
||||
t_u64 field;
|
||||
t_const_str input;
|
||||
t_str single_str;
|
||||
t_usize start;
|
||||
t_usize end;
|
||||
t_usize childs_count;
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
#include "me/mem/mem.h"
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "me/char/char.h"
|
||||
|
||||
#define ts_builtin_sym_error_repeat (ts_builtin_sym_error - 1)
|
||||
#define LANGUAGE_VERSION_WITH_PRIMARY_STATES 14
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ typedef struct s_iterator
|
|||
} t_iterator;
|
||||
|
||||
static t_iterator iterator_new(t_tree_cursor *cursor, const t_subtree *tree,
|
||||
const t_language *language)
|
||||
const t_language *language)
|
||||
{
|
||||
array_clear(&cursor->stack);
|
||||
array_push(&cursor->stack, ((t_tree_cursor_entry){
|
||||
|
|
@ -395,7 +395,7 @@ typedef enum e_iterator_comparison
|
|||
} t_iterator_comparison;
|
||||
|
||||
static t_iterator_comparison iterator_compare(const t_iterator *old_iter,
|
||||
const t_iterator *new_iter)
|
||||
const t_iterator *new_iter)
|
||||
{
|
||||
t_subtree old_tree = NULL_SUBTREE;
|
||||
t_subtree new_tree = NULL_SUBTREE;
|
||||
|
|
@ -487,7 +487,8 @@ unsigned ts_subtree_get_changed_ranges(
|
|||
#endif
|
||||
|
||||
// Compare the old and new subtrees.
|
||||
t_iterator_comparison comparison = iterator_compare(&old_iter, &new_iter);
|
||||
t_iterator_comparison comparison =
|
||||
iterator_compare(&old_iter, &new_iter);
|
||||
|
||||
// Even if the two subtrees appear to be identical, they could differ
|
||||
// internally if they contain a range of text that was previously
|
||||
|
|
@ -1403,7 +1404,7 @@ static inline bool ts_node_child_iterator_done(t_node_child_iterator *self)
|
|||
}
|
||||
|
||||
static inline bool ts_node_child_iterator_next(t_node_child_iterator *self,
|
||||
t_parse_node *result)
|
||||
t_parse_node *result)
|
||||
{
|
||||
if (!self->parent.ptr || ts_node_child_iterator_done(self))
|
||||
return false;
|
||||
|
|
@ -1485,8 +1486,8 @@ static inline t_parse_node ts_node__child(t_parse_node self,
|
|||
{
|
||||
did_descend = false;
|
||||
|
||||
t_parse_node child;
|
||||
uint32_t index = 0;
|
||||
t_parse_node child;
|
||||
uint32_t index = 0;
|
||||
t_node_child_iterator iterator = ts_node_iterate_children(&result);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
|
|
@ -1552,7 +1553,7 @@ static inline t_parse_node ts_node__prev_sibling(t_parse_node self,
|
|||
bool earlier_child_is_relevant = false;
|
||||
bool found_child_containing_target = false;
|
||||
|
||||
t_parse_node child;
|
||||
t_parse_node child;
|
||||
t_node_child_iterator iterator = ts_node_iterate_children(&node);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
|
|
@ -1632,7 +1633,7 @@ static inline t_parse_node ts_node__next_sibling(t_parse_node self,
|
|||
bool later_child_is_relevant = false;
|
||||
t_parse_node child_containing_target = ts_node__null();
|
||||
|
||||
t_parse_node child;
|
||||
t_parse_node child;
|
||||
t_node_child_iterator iterator = ts_node_iterate_children(&node);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
|
|
@ -1701,7 +1702,7 @@ static inline t_parse_node ts_node__first_child_for_byte(t_parse_node self,
|
|||
{
|
||||
did_descend = false;
|
||||
|
||||
t_parse_node child;
|
||||
t_parse_node child;
|
||||
t_node_child_iterator iterator = ts_node_iterate_children(&node);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
|
|
@ -1736,7 +1737,7 @@ static inline t_parse_node ts_node__descendant_for_byte_range(
|
|||
{
|
||||
did_descend = false;
|
||||
|
||||
t_parse_node child;
|
||||
t_parse_node child;
|
||||
t_node_child_iterator iterator = ts_node_iterate_children(&node);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
|
|
@ -1779,7 +1780,7 @@ static inline t_parse_node ts_node__descendant_for_point_range(
|
|||
{
|
||||
did_descend = false;
|
||||
|
||||
t_parse_node child;
|
||||
t_parse_node child;
|
||||
t_node_child_iterator iterator = ts_node_iterate_children(&node);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
|
|
@ -2009,7 +2010,7 @@ recur:
|
|||
return ts_node__null();
|
||||
}
|
||||
|
||||
t_parse_node child;
|
||||
t_parse_node child;
|
||||
t_node_child_iterator iterator = ts_node_iterate_children(&self);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
|
|
@ -2099,8 +2100,8 @@ const char *ts_node_field_name_for_child(t_parse_node self,
|
|||
{
|
||||
did_descend = false;
|
||||
|
||||
t_parse_node child;
|
||||
uint32_t index = 0;
|
||||
t_parse_node child;
|
||||
uint32_t index = 0;
|
||||
t_node_child_iterator iterator = ts_node_iterate_children(&result);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
|
|
@ -2286,7 +2287,7 @@ struct s_first_parser
|
|||
t_subtree_array trailing_extras;
|
||||
t_subtree_array trailing_extras2;
|
||||
t_subtree_array scratch_trees;
|
||||
t_token_cache token_cache;
|
||||
t_token_cache token_cache;
|
||||
t_reusable_node reusable_node;
|
||||
void *external_scanner_payload;
|
||||
t_parser_clock end_clock;
|
||||
|
|
@ -2422,7 +2423,8 @@ static void ts_parser__breakdown_lookahead(t_first_parser *self,
|
|||
}
|
||||
|
||||
static t_error_comparaison ts_parser__compare_versions(t_first_parser *self,
|
||||
t_error_status a, t_error_status b)
|
||||
t_error_status a,
|
||||
t_error_status b)
|
||||
{
|
||||
(void)self;
|
||||
if (!a.is_in_error && b.is_in_error)
|
||||
|
|
@ -2481,7 +2483,7 @@ static t_error_comparaison ts_parser__compare_versions(t_first_parser *self,
|
|||
}
|
||||
|
||||
static t_error_status ts_parser__version_status(t_first_parser *self,
|
||||
t_stack_version version)
|
||||
t_stack_version version)
|
||||
{
|
||||
unsigned cost = ts_stack_error_cost(self->stack, version);
|
||||
bool is_paused = ts_stack_is_paused(self->stack, version);
|
||||
|
|
@ -2505,7 +2507,7 @@ static bool ts_parser__better_version_exists(t_first_parser *self,
|
|||
return true;
|
||||
}
|
||||
|
||||
t_length position = ts_stack_position(self->stack, version);
|
||||
t_length position = ts_stack_position(self->stack, version);
|
||||
t_error_status status = {
|
||||
.cost = cost,
|
||||
.is_in_error = is_in_error,
|
||||
|
|
@ -2643,10 +2645,11 @@ static bool ts_parser__can_reuse_first_leaf(t_first_parser *self,
|
|||
return current_lex_mode.external_lex_state == 0 && table_entry->is_reusable;
|
||||
}
|
||||
|
||||
const t_external_scanner_state *ts_subtree_external_scanner_state(t_subtree self)
|
||||
const t_external_scanner_state *ts_subtree_external_scanner_state(
|
||||
t_subtree self)
|
||||
{
|
||||
static const t_external_scanner_state empty_state = {{.short_data = {0}},
|
||||
.length = 0};
|
||||
.length = 0};
|
||||
if (self.ptr && !self.data.is_inline && self.ptr->has_external_tokens &&
|
||||
self.ptr->child_count == 0)
|
||||
{
|
||||
|
|
@ -4493,10 +4496,10 @@ typedef struct s_symbol_table
|
|||
typedef Array(uint8_t) t_capture_quantifiers;
|
||||
|
||||
/*
|
||||
* t_pattern_entry - Information about the starting point for matching a particular
|
||||
* pattern. These entries are stored in a 'pattern map' - a sorted array that
|
||||
* makes it possible to efficiently lookup patterns based on the symbol for
|
||||
* their first step. The entry consists of the following fields:
|
||||
* t_pattern_entry - Information about the starting point for matching a
|
||||
* particular pattern. These entries are stored in a 'pattern map' - a sorted
|
||||
* array that makes it possible to efficiently lookup patterns based on the
|
||||
* symbol for their first step. The entry consists of the following fields:
|
||||
* - `pattern_index` - the index of the pattern within the query
|
||||
* - `step_index` - the index of the pattern's first step in the shared `steps`
|
||||
* array
|
||||
|
|
@ -4567,10 +4570,10 @@ typedef struct s_query_state
|
|||
typedef Array(t_query_capture) t_capture_list;
|
||||
|
||||
/*
|
||||
* t_capture_list_pool - A collection of *lists* of captures. Each query state needs
|
||||
* to maintain its own list of captures. To avoid repeated allocations, this
|
||||
* struct maintains a fixed set of capture lists, and keeps track of which ones
|
||||
* are currently in use by a query state.
|
||||
* t_capture_list_pool - A collection of *lists* of captures. Each query state
|
||||
* needs to maintain its own list of captures. To avoid repeated allocations,
|
||||
* this struct maintains a fixed set of capture lists, and keeps track of which
|
||||
* ones are currently in use by a query state.
|
||||
*/
|
||||
typedef struct s_capture_list_pool
|
||||
{
|
||||
|
|
@ -4588,9 +4591,10 @@ typedef struct s_capture_list_pool
|
|||
} t_capture_list_pool;
|
||||
|
||||
/*
|
||||
* t_analysis_state - The state needed for walking the parse table when analyzing
|
||||
* a query pattern, to determine at which steps the pattern might fail to match.
|
||||
*/
|
||||
* t_analysis_state - The state needed for walking the parse table when
|
||||
* analyzing a query pattern, to determine at which steps the pattern might fail
|
||||
* to match.
|
||||
*/
|
||||
typedef struct s_analysis_state_entry
|
||||
{
|
||||
t_state_id parse_state;
|
||||
|
|
@ -4603,9 +4607,9 @@ typedef struct s_analysis_state_entry
|
|||
typedef struct s_analysis_state
|
||||
{
|
||||
t_analysis_state_entry stack[MAX_ANALYSIS_STATE_DEPTH];
|
||||
uint16_t depth;
|
||||
uint16_t step_index;
|
||||
t_symbol root_symbol;
|
||||
uint16_t depth;
|
||||
uint16_t step_index;
|
||||
t_symbol root_symbol;
|
||||
} t_analysis_state;
|
||||
|
||||
typedef Array(t_analysis_state *) t_analysis_state_set;
|
||||
|
|
@ -4645,9 +4649,9 @@ typedef struct s_analysis_subgraph
|
|||
typedef Array(t_analysis_subgraph) t_analysis_subgraph_array;
|
||||
|
||||
/*
|
||||
* t_state_predecessor_map - A map that stores the predecessors of each parse state.
|
||||
* This is used during query analysis to determine which parse states can lead
|
||||
* to which reduce actions.
|
||||
* t_state_predecessor_map - A map that stores the predecessors of each parse
|
||||
* state. This is used during query analysis to determine which parse states can
|
||||
* lead to which reduce actions.
|
||||
*/
|
||||
typedef struct s_state_predecessor_map
|
||||
{
|
||||
|
|
@ -4686,17 +4690,17 @@ struct s_query_cursor
|
|||
Array(t_query_state) states;
|
||||
Array(t_query_state) finished_states;
|
||||
t_capture_list_pool capture_list_pool;
|
||||
uint32_t depth;
|
||||
uint32_t max_start_depth;
|
||||
uint32_t start_byte;
|
||||
uint32_t end_byte;
|
||||
t_point start_point;
|
||||
t_point end_point;
|
||||
uint32_t next_state_id;
|
||||
bool on_visible_node;
|
||||
bool ascending;
|
||||
bool halted;
|
||||
bool did_exceed_match_limit;
|
||||
uint32_t depth;
|
||||
uint32_t max_start_depth;
|
||||
uint32_t start_byte;
|
||||
uint32_t end_byte;
|
||||
t_point start_point;
|
||||
t_point end_point;
|
||||
uint32_t next_state_id;
|
||||
bool on_visible_node;
|
||||
bool ascending;
|
||||
bool halted;
|
||||
bool did_exceed_match_limit;
|
||||
};
|
||||
|
||||
static const t_query_error PARENT_DONE = -1;
|
||||
|
|
@ -4756,7 +4760,7 @@ static void stream_skip_whitespace(t_stream *self)
|
|||
{
|
||||
for (;;)
|
||||
{
|
||||
if (isspace(self->next))
|
||||
if (me_isspace(self->next))
|
||||
{
|
||||
stream_advance(self);
|
||||
}
|
||||
|
|
@ -4779,7 +4783,7 @@ static void stream_skip_whitespace(t_stream *self)
|
|||
|
||||
static bool stream_is_ident_start(t_stream *self)
|
||||
{
|
||||
return isalnum(self->next) || self->next == '_' || self->next == '-';
|
||||
return me_isalnum(self->next) || self->next == '_' || self->next == '-';
|
||||
}
|
||||
|
||||
static void stream_scan_identifier(t_stream *stream)
|
||||
|
|
@ -4787,7 +4791,7 @@ static void stream_scan_identifier(t_stream *stream)
|
|||
do
|
||||
{
|
||||
stream_advance(stream);
|
||||
} while (isalnum(stream->next) || stream->next == '_' ||
|
||||
} while (me_isalnum(stream->next) || stream->next == '_' ||
|
||||
stream->next == '-' || stream->next == '.' ||
|
||||
stream->next == '?' || stream->next == '!');
|
||||
}
|
||||
|
|
@ -4830,8 +4834,8 @@ static void capture_list_pool_delete(t_capture_list_pool *self)
|
|||
array_delete(&self->list);
|
||||
}
|
||||
|
||||
static const t_capture_list *capture_list_pool_get(const t_capture_list_pool *self,
|
||||
uint16_t id)
|
||||
static const t_capture_list *capture_list_pool_get(
|
||||
const t_capture_list_pool *self, uint16_t id)
|
||||
{
|
||||
if (id >= self->list.size)
|
||||
return &self->empty_list;
|
||||
|
|
@ -4839,7 +4843,7 @@ static const t_capture_list *capture_list_pool_get(const t_capture_list_pool *se
|
|||
}
|
||||
|
||||
static t_capture_list *capture_list_pool_get_mut(t_capture_list_pool *self,
|
||||
uint16_t id)
|
||||
uint16_t id)
|
||||
{
|
||||
assert(id < self->list.size);
|
||||
return &self->list.contents[id];
|
||||
|
|
@ -5088,7 +5092,7 @@ static void capture_quantifiers_replace(t_capture_quantifiers *self,
|
|||
|
||||
// Return capture quantifier for the given capture id
|
||||
static t_quantifier capture_quantifier_for_id(const t_capture_quantifiers *self,
|
||||
uint16_t id)
|
||||
uint16_t id)
|
||||
{
|
||||
return (self->size <= id) ? TSQuantifierZero
|
||||
: (t_quantifier)*array_get(self, id);
|
||||
|
|
@ -5126,7 +5130,7 @@ static void capture_quantifiers_add_all(t_capture_quantifiers *self,
|
|||
|
||||
// Join the given quantifier with the current values
|
||||
static void capture_quantifiers_mul(t_capture_quantifiers *self,
|
||||
t_quantifier quantifier)
|
||||
t_quantifier quantifier)
|
||||
{
|
||||
for (uint16_t id = 0; id < (uint16_t)self->size; id++)
|
||||
{
|
||||
|
|
@ -5178,8 +5182,8 @@ static void symbol_table_delete(t_symbol_table *self)
|
|||
array_delete(&self->slices);
|
||||
}
|
||||
|
||||
static int symbol_table_id_for_name(const t_symbol_table *self, const char *name,
|
||||
uint32_t length)
|
||||
static int symbol_table_id_for_name(const t_symbol_table *self,
|
||||
const char *name, uint32_t length)
|
||||
{
|
||||
for (unsigned i = 0; i < self->slices.size; i++)
|
||||
{
|
||||
|
|
@ -5221,7 +5225,7 @@ static uint16_t symbol_table_insert_name(t_symbol_table *self, const char *name,
|
|||
************/
|
||||
|
||||
static t_query_step query_step__new(t_symbol symbol, uint16_t depth,
|
||||
bool is_immediate)
|
||||
bool is_immediate)
|
||||
{
|
||||
t_query_step step = {
|
||||
.symbol = symbol,
|
||||
|
|
@ -5297,8 +5301,8 @@ static inline void state_predecessor_map_delete(t_state_predecessor_map *self)
|
|||
}
|
||||
|
||||
static inline void state_predecessor_map_add(t_state_predecessor_map *self,
|
||||
t_state_id state,
|
||||
t_state_id predecessor)
|
||||
t_state_id state,
|
||||
t_state_id predecessor)
|
||||
{
|
||||
size_t index = (size_t)state * (MAX_STATE_PREDECESSOR_COUNT + 1);
|
||||
t_state_id *count = &self->contents[index];
|
||||
|
|
@ -5340,8 +5344,8 @@ static unsigned analysis_state__recursion_depth(const t_analysis_state *self)
|
|||
return result;
|
||||
}
|
||||
|
||||
static inline int analysis_state__compare_position(t_analysis_state *const *self,
|
||||
t_analysis_state *const *other)
|
||||
static inline int analysis_state__compare_position(
|
||||
t_analysis_state *const *self, t_analysis_state *const *other)
|
||||
{
|
||||
for (unsigned i = 0; i < (*self)->depth; i++)
|
||||
{
|
||||
|
|
@ -5385,7 +5389,8 @@ static inline int analysis_state__compare(t_analysis_state *const *self,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline t_analysis_state_entry *analysis_state__top(t_analysis_state *self)
|
||||
static inline t_analysis_state_entry *analysis_state__top(
|
||||
t_analysis_state *self)
|
||||
{
|
||||
if (self->depth == 0)
|
||||
{
|
||||
|
|
@ -5395,7 +5400,7 @@ static inline t_analysis_state_entry *analysis_state__top(t_analysis_state *self
|
|||
}
|
||||
|
||||
static inline bool analysis_state__has_supertype(t_analysis_state *self,
|
||||
t_symbol symbol)
|
||||
t_symbol symbol)
|
||||
{
|
||||
for (unsigned i = 0; i < self->depth; i++)
|
||||
{
|
||||
|
|
@ -5409,8 +5414,8 @@ static inline bool analysis_state__has_supertype(t_analysis_state *self,
|
|||
* t_analysis_state_set
|
||||
******************/
|
||||
|
||||
// Obtains an `t_analysis_state` instance, either by consuming one from this set's
|
||||
// object pool, or by cloning one from scratch.
|
||||
// Obtains an `t_analysis_state` instance, either by consuming one from this
|
||||
// set's object pool, or by cloning one from scratch.
|
||||
static inline t_analysis_state *analysis_state_pool__clone_or_reuse(
|
||||
t_analysis_state_set *self, t_analysis_state *borrowed_item)
|
||||
{
|
||||
|
|
@ -5603,9 +5608,9 @@ static inline bool ts_query__pattern_map_search(const t_parse_query *self,
|
|||
|
||||
// Insert a new pattern's start index into the pattern map, maintaining
|
||||
// the pattern map's ordering invariant.
|
||||
static inline void ts_query__pattern_map_insert(t_parse_query *self,
|
||||
t_symbol symbol,
|
||||
t_pattern_entry new_entry)
|
||||
static inline void ts_query__pattern_map_insert(t_parse_query *self,
|
||||
t_symbol symbol,
|
||||
t_pattern_entry new_entry)
|
||||
{
|
||||
uint32_t index;
|
||||
ts_query__pattern_map_search(self, symbol, &index);
|
||||
|
|
@ -5633,9 +5638,9 @@ static inline void ts_query__pattern_map_insert(t_parse_query *self,
|
|||
|
||||
// Walk the subgraph for this non-terminal, tracking all of the possible
|
||||
// sequences of progress within the pattern.
|
||||
static void ts_query__perform_analysis(t_parse_query *self,
|
||||
const t_analysis_subgraph_array *subgraphs,
|
||||
t_query_analysis *analysis)
|
||||
static void ts_query__perform_analysis(
|
||||
t_parse_query *self, const t_analysis_subgraph_array *subgraphs,
|
||||
t_query_analysis *analysis)
|
||||
{
|
||||
unsigned recursion_depth_limit = 0;
|
||||
unsigned prev_final_step_count = 0;
|
||||
|
|
@ -6275,7 +6280,7 @@ static bool ts_query__analyze_patterns(t_parse_query *self,
|
|||
// For each non-terminal pattern, determine if the pattern can successfully
|
||||
// match, and identify all of the possible children within the pattern where
|
||||
// matching could fail.
|
||||
bool all_patterns_are_valid = true;
|
||||
bool all_patterns_are_valid = true;
|
||||
t_query_analysis analysis = query_analysis__new();
|
||||
for (unsigned i = 0; i < parent_step_indices.size; i++)
|
||||
{
|
||||
|
|
@ -6526,7 +6531,7 @@ static bool ts_query__analyze_patterns(t_parse_query *self,
|
|||
for (unsigned j = 0; j < subgraphs.size; j++)
|
||||
{
|
||||
t_analysis_subgraph *subgraph = &subgraphs.contents[j];
|
||||
t_symbol_metadata metadata =
|
||||
t_symbol_metadata metadata =
|
||||
ts_language_symbol_metadata(self->language, subgraph->symbol);
|
||||
if (metadata.visible || metadata.named)
|
||||
continue;
|
||||
|
|
@ -6667,7 +6672,7 @@ static void ts_query__add_negated_fields(t_parse_query *self,
|
|||
}
|
||||
|
||||
static t_query_error ts_query__parse_string_literal(t_parse_query *self,
|
||||
t_stream *stream)
|
||||
t_stream *stream)
|
||||
{
|
||||
const char *string_start = stream->input;
|
||||
if (stream->next != '"')
|
||||
|
|
@ -6926,8 +6931,8 @@ static t_query_error ts_query__parse_pattern(
|
|||
// current end of the steps.
|
||||
for (unsigned i = 0; i < branch_step_indices.size - 1; i++)
|
||||
{
|
||||
uint32_t step_index = branch_step_indices.contents[i];
|
||||
uint32_t next_step_index = branch_step_indices.contents[i + 1];
|
||||
uint32_t step_index = branch_step_indices.contents[i];
|
||||
uint32_t next_step_index = branch_step_indices.contents[i + 1];
|
||||
t_query_step *start_step = &self->steps.contents[step_index];
|
||||
t_query_step *end_step = &self->steps.contents[next_step_index - 1];
|
||||
start_step->alternative_index = next_step_index;
|
||||
|
|
@ -6952,7 +6957,7 @@ static t_query_error ts_query__parse_pattern(
|
|||
// grouped sequence.
|
||||
if (stream->next == '(' || stream->next == '"' || stream->next == '[')
|
||||
{
|
||||
bool child_is_immediate = is_immediate;
|
||||
bool child_is_immediate = is_immediate;
|
||||
t_capture_quantifiers child_capture_quantifiers =
|
||||
capture_quantifiers_new();
|
||||
for (;;)
|
||||
|
|
@ -7071,10 +7076,10 @@ static t_query_error ts_query__parse_pattern(
|
|||
}
|
||||
|
||||
// Parse the child patterns
|
||||
bool child_is_immediate = false;
|
||||
uint16_t last_child_step_index = 0;
|
||||
uint16_t negated_field_count = 0;
|
||||
t_field_id negated_field_ids[MAX_NEGATED_FIELD_COUNT];
|
||||
bool child_is_immediate = false;
|
||||
uint16_t last_child_step_index = 0;
|
||||
uint16_t negated_field_count = 0;
|
||||
t_field_id negated_field_ids[MAX_NEGATED_FIELD_COUNT];
|
||||
t_capture_quantifiers child_capture_quantifiers =
|
||||
capture_quantifiers_new();
|
||||
for (;;)
|
||||
|
|
@ -7240,7 +7245,7 @@ static t_query_error ts_query__parse_pattern(
|
|||
return TSQueryErrorField;
|
||||
}
|
||||
|
||||
uint32_t step_index = starting_step_index;
|
||||
uint32_t step_index = starting_step_index;
|
||||
t_query_step *step = &self->steps.contents[step_index];
|
||||
for (;;)
|
||||
{
|
||||
|
|
@ -7496,8 +7501,8 @@ t_parse_query *ts_query_new(const t_language *language, const char *source,
|
|||
ts_query__pattern_map_insert(
|
||||
self, step->symbol,
|
||||
(t_pattern_entry){.step_index = start_step_index,
|
||||
.pattern_index = pattern_index,
|
||||
.is_rooted = is_rooted});
|
||||
.pattern_index = pattern_index,
|
||||
.is_rooted = is_rooted});
|
||||
if (step->symbol == WILDCARD_SYMBOL)
|
||||
{
|
||||
self->wildcard_root_pattern_count++;
|
||||
|
|
@ -7873,7 +7878,8 @@ static bool ts_query_cursor__first_in_progress_capture(
|
|||
(node_start_byte == *byte_offset &&
|
||||
state->pattern_index < *pattern_index))
|
||||
{
|
||||
t_query_step *step = &self->query->steps.contents[state->step_index];
|
||||
t_query_step *step =
|
||||
&self->query->steps.contents[state->step_index];
|
||||
if (root_pattern_guaranteed)
|
||||
{
|
||||
*root_pattern_guaranteed = step->root_pattern_guaranteed;
|
||||
|
|
@ -7915,8 +7921,8 @@ int ts_query_cursor__compare_nodes(t_parse_node left, t_parse_node right)
|
|||
|
||||
// Determine if either state contains a superset of the other state's captures.
|
||||
void ts_query_cursor__compare_captures(t_query_cursor *self,
|
||||
t_query_state *left_state,
|
||||
t_query_state *right_state,
|
||||
t_query_state *left_state,
|
||||
t_query_state *right_state,
|
||||
bool *left_contains_right,
|
||||
bool *right_contains_left)
|
||||
{
|
||||
|
|
@ -7980,11 +7986,11 @@ void ts_query_cursor__compare_captures(t_query_cursor *self,
|
|||
}
|
||||
}
|
||||
|
||||
static void ts_query_cursor__add_state(t_query_cursor *self,
|
||||
static void ts_query_cursor__add_state(t_query_cursor *self,
|
||||
const t_pattern_entry *pattern)
|
||||
{
|
||||
t_query_step *step = &self->query->steps.contents[pattern->step_index];
|
||||
uint32_t start_depth = self->depth - step->depth;
|
||||
uint32_t start_depth = self->depth - step->depth;
|
||||
|
||||
// Keep the states array in ascending order of start_depth and
|
||||
// pattern_index, so that it can be processed more efficiently elsewhere.
|
||||
|
|
@ -8047,7 +8053,8 @@ static void ts_query_cursor__add_state(t_query_cursor *self,
|
|||
// the pool, this will steal the capture list from another existing state, and
|
||||
// mark that other state as 'dead'.
|
||||
static t_capture_list *ts_query_cursor__prepare_to_capture(
|
||||
t_query_cursor *self, t_query_state *state, unsigned state_index_to_preserve)
|
||||
t_query_cursor *self, t_query_state *state,
|
||||
unsigned state_index_to_preserve)
|
||||
{
|
||||
if (state->capture_list_id == NONE)
|
||||
{
|
||||
|
|
@ -8067,7 +8074,8 @@ static t_capture_list *ts_query_cursor__prepare_to_capture(
|
|||
{
|
||||
LOG(" abandon state. index:%u, pattern:%u, offset:%u.\n",
|
||||
state_index, pattern_index, byte_offset);
|
||||
t_query_state *other_state = &self->states.contents[state_index];
|
||||
t_query_state *other_state =
|
||||
&self->states.contents[state_index];
|
||||
state->capture_list_id = other_state->capture_list_id;
|
||||
other_state->capture_list_id = NONE;
|
||||
other_state->dead = true;
|
||||
|
|
@ -8117,11 +8125,11 @@ static void ts_query_cursor__capture(t_query_cursor *self, t_query_state *state,
|
|||
// after the given state in the `states` array. Ensures that the given state
|
||||
// reference is still valid, even if the states array is reallocated.
|
||||
static t_query_state *ts_query_cursor__copy_state(t_query_cursor *self,
|
||||
t_query_state **state_ref)
|
||||
t_query_state **state_ref)
|
||||
{
|
||||
const t_query_state *state = *state_ref;
|
||||
uint32_t state_index = (uint32_t)(state - self->states.contents);
|
||||
t_query_state copy = *state;
|
||||
uint32_t state_index = (uint32_t)(state - self->states.contents);
|
||||
t_query_state copy = *state;
|
||||
copy.capture_list_id = NONE;
|
||||
|
||||
// If the state has captures, copy its capture list.
|
||||
|
|
@ -8156,7 +8164,8 @@ static inline bool ts_query_cursor__should_descend(t_query_cursor *self,
|
|||
{
|
||||
t_query_state *state = &self->states.contents[i];
|
||||
;
|
||||
t_query_step *next_step = &self->query->steps.contents[state->step_index];
|
||||
t_query_step *next_step =
|
||||
&self->query->steps.contents[state->step_index];
|
||||
if (next_step->depth != PATTERN_DONE_MARKER &&
|
||||
state->start_depth + next_step->depth > self->depth)
|
||||
{
|
||||
|
|
@ -8874,11 +8883,11 @@ bool ts_query_cursor_next_capture(t_query_cursor *self, t_query_match *match,
|
|||
// Then find the earliest capture in a finished match. It must occur
|
||||
// before the first capture in an *unfinished* match.
|
||||
t_query_state *first_finished_state = NULL;
|
||||
uint32_t first_finished_capture_byte = first_unfinished_capture_byte;
|
||||
uint32_t first_finished_capture_byte = first_unfinished_capture_byte;
|
||||
uint32_t first_finished_pattern_index = first_unfinished_pattern_index;
|
||||
for (unsigned i = 0; i < self->finished_states.size;)
|
||||
{
|
||||
t_query_state *state = &self->finished_states.contents[i];
|
||||
t_query_state *state = &self->finished_states.contents[i];
|
||||
const t_capture_list *captures = capture_list_pool_get(
|
||||
&self->capture_list_pool, state->capture_list_id);
|
||||
|
||||
|
|
@ -8987,15 +8996,15 @@ typedef struct s_stack_node t_stack_node;
|
|||
typedef struct s_stack_link
|
||||
{
|
||||
t_stack_node *node;
|
||||
t_subtree subtree;
|
||||
bool is_pending;
|
||||
t_subtree subtree;
|
||||
bool is_pending;
|
||||
} t_stack_link;
|
||||
|
||||
struct s_stack_node
|
||||
{
|
||||
t_state_id state;
|
||||
t_length position;
|
||||
t_stack_link links[MAX_LINK_COUNT];
|
||||
t_stack_link links[MAX_LINK_COUNT];
|
||||
short unsigned int link_count;
|
||||
uint32_t ref_count;
|
||||
unsigned error_cost;
|
||||
|
|
@ -9005,7 +9014,7 @@ struct s_stack_node
|
|||
|
||||
typedef struct s_stack_iterator
|
||||
{
|
||||
t_stack_node *node;
|
||||
t_stack_node *node;
|
||||
t_subtree_array subtrees;
|
||||
uint32_t subtree_count;
|
||||
bool is_pending;
|
||||
|
|
@ -9022,12 +9031,12 @@ typedef enum e_stack_status
|
|||
|
||||
typedef struct s_stack_head
|
||||
{
|
||||
t_stack_node *node;
|
||||
t_stack_node *node;
|
||||
t_stack_summary *summary;
|
||||
unsigned node_count_at_last_error;
|
||||
t_subtree last_external_token;
|
||||
t_subtree lookahead_when_paused;
|
||||
t_stack_status status;
|
||||
t_stack_status status;
|
||||
} t_stack_head;
|
||||
|
||||
struct s_stack
|
||||
|
|
@ -9035,9 +9044,9 @@ struct s_stack
|
|||
Array(t_stack_head) heads;
|
||||
t_stack_slice_array slices;
|
||||
Array(t_stack_iterator) iterators;
|
||||
t_stack_node_array node_pool;
|
||||
t_stack_node *base_node;
|
||||
t_subtree_pool *subtree_pool;
|
||||
t_stack_node_array node_pool;
|
||||
t_stack_node *base_node;
|
||||
t_subtree_pool *subtree_pool;
|
||||
};
|
||||
|
||||
typedef unsigned t_stack_action;
|
||||
|
|
@ -9117,9 +9126,9 @@ static uint32_t stack__subtree_node_count(t_subtree subtree)
|
|||
return count;
|
||||
}
|
||||
|
||||
static t_stack_node *stack_node_new(t_stack_node *previous_node, t_subtree subtree,
|
||||
bool is_pending, t_state_id state,
|
||||
t_stack_node_array *pool)
|
||||
static t_stack_node *stack_node_new(t_stack_node *previous_node,
|
||||
t_subtree subtree, bool is_pending,
|
||||
t_state_id state, t_stack_node_array *pool)
|
||||
{
|
||||
t_stack_node *node =
|
||||
pool->size > 0 ? array_pop(pool) : malloc(sizeof(t_stack_node));
|
||||
|
|
@ -9281,7 +9290,7 @@ static void stack_head_delete(t_stack_head *self, t_stack_node_array *pool,
|
|||
|
||||
static t_stack_version ts_stack__add_version(t_stack *self,
|
||||
t_stack_version original_version,
|
||||
t_stack_node *node)
|
||||
t_stack_node *node)
|
||||
{
|
||||
t_stack_head head = {
|
||||
.node = node,
|
||||
|
|
@ -9326,7 +9335,7 @@ static t_stack_slice_array stack__iter(t_stack *self, t_stack_version version,
|
|||
array_clear(&self->slices);
|
||||
array_clear(&self->iterators);
|
||||
|
||||
t_stack_head *head = array_get(&self->heads, version);
|
||||
t_stack_head *head = array_get(&self->heads, version);
|
||||
t_stack_iterator new_iterator = {
|
||||
.node = head->node,
|
||||
.subtrees = array_new(),
|
||||
|
|
@ -9350,11 +9359,11 @@ static t_stack_slice_array stack__iter(t_stack *self, t_stack_version version,
|
|||
for (uint32_t i = 0, size = self->iterators.size; i < size; i++)
|
||||
{
|
||||
t_stack_iterator *iterator = &self->iterators.contents[i];
|
||||
t_stack_node *node = iterator->node;
|
||||
t_stack_node *node = iterator->node;
|
||||
|
||||
t_stack_action action = callback(payload, iterator);
|
||||
bool should_pop = action & StackActionPop;
|
||||
bool should_stop =
|
||||
bool should_pop = action & StackActionPop;
|
||||
bool should_stop =
|
||||
action & StackActionStop || node->link_count == 0;
|
||||
|
||||
if (should_pop)
|
||||
|
|
@ -9383,7 +9392,7 @@ static t_stack_slice_array stack__iter(t_stack *self, t_stack_version version,
|
|||
for (uint32_t j = 1; j <= node->link_count; j++)
|
||||
{
|
||||
t_stack_iterator *next_iterator;
|
||||
t_stack_link link;
|
||||
t_stack_link link;
|
||||
if (j == node->link_count)
|
||||
{
|
||||
link = node->links[0];
|
||||
|
|
@ -9511,7 +9520,7 @@ void ts_stack_set_last_external_token(t_stack *self, t_stack_version version,
|
|||
unsigned ts_stack_error_cost(const t_stack *self, t_stack_version version)
|
||||
{
|
||||
t_stack_head *head = array_get(&self->heads, version);
|
||||
unsigned result = head->node->error_cost;
|
||||
unsigned result = head->node->error_cost;
|
||||
if (head->status == StackStatusPaused ||
|
||||
(head->node->state == ERROR_STATE && !head->node->links[0].subtree.ptr))
|
||||
{
|
||||
|
|
@ -9542,8 +9551,8 @@ void ts_stack_push(t_stack *self, t_stack_version version, t_subtree subtree,
|
|||
head->node = new_node;
|
||||
}
|
||||
|
||||
static inline t_stack_action pop_count_callback(void *payload,
|
||||
const t_stack_iterator *iterator)
|
||||
static inline t_stack_action pop_count_callback(
|
||||
void *payload, const t_stack_iterator *iterator)
|
||||
{
|
||||
unsigned *goal_subtree_count = payload;
|
||||
if (iterator->subtree_count == *goal_subtree_count)
|
||||
|
|
@ -9562,8 +9571,8 @@ t_stack_slice_array ts_stack_pop_count(t_stack *self, t_stack_version version,
|
|||
return stack__iter(self, version, pop_count_callback, &count, (int)count);
|
||||
}
|
||||
|
||||
static inline t_stack_action pop_pending_callback(void *payload,
|
||||
const t_stack_iterator *iterator)
|
||||
static inline t_stack_action pop_pending_callback(
|
||||
void *payload, const t_stack_iterator *iterator)
|
||||
{
|
||||
(void)payload;
|
||||
if (iterator->subtree_count >= 1)
|
||||
|
|
@ -9595,8 +9604,8 @@ t_stack_slice_array ts_stack_pop_pending(t_stack *self, t_stack_version version)
|
|||
return pop;
|
||||
}
|
||||
|
||||
static inline t_stack_action pop_error_callback(void *payload,
|
||||
const t_stack_iterator *iterator)
|
||||
static inline t_stack_action pop_error_callback(
|
||||
void *payload, const t_stack_iterator *iterator)
|
||||
{
|
||||
if (iterator->subtrees.size > 0)
|
||||
{
|
||||
|
|
@ -9642,8 +9651,8 @@ t_subtree_array ts_stack_pop_error(t_stack *self, t_stack_version version)
|
|||
return (t_subtree_array){.size = 0};
|
||||
}
|
||||
|
||||
static inline t_stack_action pop_all_callback(void *payload,
|
||||
const t_stack_iterator *iterator)
|
||||
static inline t_stack_action pop_all_callback(void *payload,
|
||||
const t_stack_iterator *iterator)
|
||||
{
|
||||
(void)payload;
|
||||
return iterator->node->link_count == 0 ? StackActionPop : StackActionNone;
|
||||
|
|
@ -9664,8 +9673,8 @@ static inline t_stack_action summarize_stack_callback(
|
|||
void *payload, const t_stack_iterator *iterator)
|
||||
{
|
||||
t_summarize_stack_session *session = payload;
|
||||
t_state_id state = iterator->node->state;
|
||||
unsigned depth = iterator->subtree_count;
|
||||
t_state_id state = iterator->node->state;
|
||||
unsigned depth = iterator->subtree_count;
|
||||
if (depth > session->max_depth)
|
||||
return StackActionStop;
|
||||
for (unsigned i = session->summary->size - 1; i + 1 > 0; i--)
|
||||
|
|
@ -9687,8 +9696,8 @@ static inline t_stack_action summarize_stack_callback(
|
|||
void ts_stack_record_summary(t_stack *self, t_stack_version version,
|
||||
unsigned max_depth)
|
||||
{
|
||||
t_summarize_stack_session session = {.summary = malloc(sizeof(t_stack_summary)),
|
||||
.max_depth = max_depth};
|
||||
t_summarize_stack_session session = {
|
||||
.summary = malloc(sizeof(t_stack_summary)), .max_depth = max_depth};
|
||||
array_init(session.summary);
|
||||
stack__iter(self, version, summarize_stack_callback, &session, -1);
|
||||
t_stack_head *head = &self->heads.contents[version];
|
||||
|
|
@ -9886,7 +9895,7 @@ bool ts_stack_print_dot_graph(t_stack *self, const t_language *language,
|
|||
}
|
||||
|
||||
typedef struct s_edit
|
||||
{
|
||||
{
|
||||
t_length start;
|
||||
t_length old_end;
|
||||
t_length new_end;
|
||||
|
|
@ -10674,8 +10683,8 @@ t_subtree ts_subtree_edit(t_subtree self, const t_input_edit *input_edit,
|
|||
while (stack.size)
|
||||
{
|
||||
t_edit_entry entry = array_pop(&stack);
|
||||
t_edit edit = entry.edit;
|
||||
bool is_noop = edit.old_end.bytes == edit.start.bytes &&
|
||||
t_edit edit = entry.edit;
|
||||
bool is_noop = edit.old_end.bytes == edit.start.bytes &&
|
||||
edit.new_end.bytes == edit.start.bytes;
|
||||
bool is_pure_insertion = edit.old_end.bytes == edit.start.bytes;
|
||||
bool invalidate_first_row = ts_subtree_depends_on_column(*entry.tree);
|
||||
|
|
@ -11291,9 +11300,9 @@ void ts_tree_cursor_delete(t_tree_cursor *_self)
|
|||
t_tree_cursor_step ts_tree_cursor_goto_first_child_internal(
|
||||
t_tree_cursor *_self)
|
||||
{
|
||||
t_tree_cursor *self = (t_tree_cursor *)_self;
|
||||
bool visible;
|
||||
t_tree_cursor_entry entry;
|
||||
t_tree_cursor *self = (t_tree_cursor *)_self;
|
||||
bool visible;
|
||||
t_tree_cursor_entry entry;
|
||||
t_cursor_child_iterator iterator = ts_tree_cursor_iterate_children(self);
|
||||
while (ts_tree_cursor_child_iterator_next(&iterator, &entry, &visible))
|
||||
{
|
||||
|
|
@ -11330,9 +11339,9 @@ bool ts_tree_cursor_goto_first_child(t_tree_cursor *self)
|
|||
|
||||
t_tree_cursor_step ts_tree_cursor_goto_last_child_internal(t_tree_cursor *_self)
|
||||
{
|
||||
t_tree_cursor *self = (t_tree_cursor *)_self;
|
||||
bool visible;
|
||||
t_tree_cursor_entry entry;
|
||||
t_tree_cursor *self = (t_tree_cursor *)_self;
|
||||
bool visible;
|
||||
t_tree_cursor_entry entry;
|
||||
t_cursor_child_iterator iterator = ts_tree_cursor_iterate_children(self);
|
||||
if (!iterator.parent.ptr || iterator.parent.ptr->child_count == 0)
|
||||
return TreeCursorStepNone;
|
||||
|
|
@ -11390,9 +11399,10 @@ static inline int64_t ts_tree_cursor_goto_first_child_for_byte_and_point(
|
|||
{
|
||||
did_descend = false;
|
||||
|
||||
bool visible;
|
||||
t_tree_cursor_entry entry;
|
||||
t_cursor_child_iterator iterator = ts_tree_cursor_iterate_children(self);
|
||||
bool visible;
|
||||
t_tree_cursor_entry entry;
|
||||
t_cursor_child_iterator iterator =
|
||||
ts_tree_cursor_iterate_children(self);
|
||||
while (ts_tree_cursor_child_iterator_next(&iterator, &entry, &visible))
|
||||
{
|
||||
t_length entry_end =
|
||||
|
|
@ -11453,8 +11463,9 @@ t_tree_cursor_step ts_tree_cursor_goto_sibling_internal(
|
|||
|
||||
while (self->stack.size > 1)
|
||||
{
|
||||
t_tree_cursor_entry entry = array_pop(&self->stack);
|
||||
t_cursor_child_iterator iterator = ts_tree_cursor_iterate_children(self);
|
||||
t_tree_cursor_entry entry = array_pop(&self->stack);
|
||||
t_cursor_child_iterator iterator =
|
||||
ts_tree_cursor_iterate_children(self);
|
||||
iterator.child_index = entry.child_index;
|
||||
iterator.structural_child_index = entry.structural_child_index;
|
||||
iterator.position = entry.position;
|
||||
|
|
@ -11610,9 +11621,10 @@ void ts_tree_cursor_goto_descendant(t_tree_cursor *_self,
|
|||
do
|
||||
{
|
||||
did_descend = false;
|
||||
bool visible;
|
||||
t_tree_cursor_entry entry;
|
||||
t_cursor_child_iterator iterator = ts_tree_cursor_iterate_children(self);
|
||||
bool visible;
|
||||
t_tree_cursor_entry entry;
|
||||
t_cursor_child_iterator iterator =
|
||||
ts_tree_cursor_iterate_children(self);
|
||||
if (iterator.descendant_index > goal_descendant_index)
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -6,13 +6,14 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/29 11:35:51 by rparodi #+# #+# */
|
||||
/* Updated: 2024/05/19 14:51:28 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/29 16:39:24 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../includes/minishell.h"
|
||||
#include "app/env.h"
|
||||
#include "me/hashmap/hashmap_env.h"
|
||||
#include "me/mem/mem.h"
|
||||
|
||||
|
||||
void ts_parser_delete(t_first_parser *self);
|
||||
|
|
@ -20,7 +21,7 @@ void ts_parser_delete(t_first_parser *self);
|
|||
void ft_free(void *ptr)
|
||||
{
|
||||
if (!ptr)
|
||||
free(ptr);
|
||||
mem_free(ptr);
|
||||
}
|
||||
|
||||
void ft_free_strs(t_str *strs)
|
||||
|
|
@ -36,7 +37,7 @@ void ft_free_strs(t_str *strs)
|
|||
void ft_free_utils(t_utils *s)
|
||||
{
|
||||
if (s->str_input)
|
||||
free(s->str_input);
|
||||
mem_free(s->str_input);
|
||||
if (s->path)
|
||||
ft_free_strs(s->path);
|
||||
if (s->env)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
|
||||
/* Updated: 2024/05/21 14:53:26 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/29 16:40:26 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,12 +18,13 @@
|
|||
#include "gmr/symbols.h"
|
||||
#include "me/hashmap/hashmap_env.h"
|
||||
#include "me/str/str.h"
|
||||
#include "me/str/str.h"
|
||||
#include "me/types.h"
|
||||
#include "minishell.h"
|
||||
#include "parser/api.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "ast/from_node.h"
|
||||
|
||||
#undef free
|
||||
#undef malloc
|
||||
#undef realloc
|
||||
|
|
@ -87,7 +88,6 @@ t_error handle_node_getstr(t_node *self, t_utils *shcat, t_str *out)
|
|||
*out = NULL;
|
||||
if (self->kind == sym_word)
|
||||
{
|
||||
printf("word!!!\n");
|
||||
*out = node_getstr(self);
|
||||
return (NO_ERROR);
|
||||
}
|
||||
|
|
@ -102,7 +102,11 @@ void print_node_data(t_node *t, t_usize depth)
|
|||
t_usize idx;
|
||||
|
||||
idx = 0;
|
||||
while (idx++ < depth)
|
||||
if (t->kind == 7)
|
||||
return;
|
||||
printf("\x1b[%im[%s](%lu)\x1b[0m", t->field_str == NULL ? 90 : 32,
|
||||
t->field_str == NULL ? "nil" : t->field_str, t->field);
|
||||
while (idx++ < depth + 1)
|
||||
printf("\t");
|
||||
idx = 0;
|
||||
printf("%s(%lu) = %s\n", t->kind_str, t->kind, node_getstr(t));
|
||||
|
|
@ -122,31 +126,12 @@ t_node parse_to_nodes(t_first_parser *parser, t_const_str input)
|
|||
ts_tree_delete(tree);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
t_node parse_str(t_parser *parser, t_const_str input)
|
||||
{
|
||||
return (parse_to_nodes(parser->parser, input));
|
||||
}
|
||||
|
||||
// void ft_check(t_utils *shcat, char **input)
|
||||
// {
|
||||
// t_usize i;
|
||||
// t_usize prev_i;
|
||||
//
|
||||
// i = 0;
|
||||
// prev_i = 0;
|
||||
// while (input[i] != NULL)
|
||||
// {
|
||||
// if (ft_strcmp(input[i], "exit") == 0)
|
||||
// ft_exit(shcat, 0);
|
||||
// else if (ft_strcmp(input[i], "pwd") == 0)
|
||||
// ft_pwd();
|
||||
// else
|
||||
// ft_other_cmd(shcat, i, prev_i);
|
||||
// prev_i = i;
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
|
||||
t_error handle_concat(t_node *self, t_utils *shcat, t_str *ret);
|
||||
|
||||
void print_node_concat(t_node *self)
|
||||
|
|
@ -171,7 +156,7 @@ void exec_shcat(t_utils *shcat)
|
|||
{
|
||||
t_i32 ret;
|
||||
|
||||
// print_node_data(&shcat->current_node, 0);
|
||||
print_node_data(&shcat->current_node, 0);
|
||||
handle_program(&shcat->current_node, shcat, &ret);
|
||||
free_node(shcat->current_node);
|
||||
(void)ret;
|
||||
|
|
@ -179,16 +164,20 @@ void exec_shcat(t_utils *shcat)
|
|||
|
||||
void ft_take_args(t_utils *shcat)
|
||||
{
|
||||
t_str cmd;
|
||||
|
||||
while (1)
|
||||
{
|
||||
shcat->str_input = readline((t_const_str)shcat->name_shell);
|
||||
if (!shcat->str_input)
|
||||
shcat->str_input = NULL;
|
||||
cmd = readline((t_const_str)shcat->name_shell);
|
||||
if (cmd == NULL)
|
||||
ft_exit(shcat, 0);
|
||||
shcat->str_input = str_clone(cmd);
|
||||
free(cmd);
|
||||
shcat->current_node = parse_str(&shcat->parser, shcat->str_input);
|
||||
exec_shcat(shcat);
|
||||
add_history(shcat->str_input);
|
||||
free(shcat->str_input);
|
||||
mem_free(shcat->str_input);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -231,4 +220,5 @@ t_i32 main(t_i32 argc, t_str argv[], t_str envp[])
|
|||
"\001\x1B[0m\002"
|
||||
"$ ";
|
||||
ft_take_args(&utils);
|
||||
// (void)from_node(NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* create_node.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/28 18:29:36 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/28 18:31:36 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "parser/api.h"
|
||||
|
|
@ -6,13 +6,12 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/28 18:36:40 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/18 16:14:55 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/29 14:52:46 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "app/node.h"
|
||||
#include "me/mem/mem.h"
|
||||
#include "me/mem/mem.h"
|
||||
#include "me/str/str.h"
|
||||
#include "parser/api.h"
|
||||
#include <stdio.h>
|
||||
|
|
@ -24,6 +23,11 @@ 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_language *tree_sitter_bash(void);
|
||||
|
||||
t_node *build_childs(t_parse_node parent, t_const_str input, t_usize count)
|
||||
{
|
||||
|
|
@ -39,6 +43,10 @@ t_node *build_childs(t_parse_node parent, t_const_str input, t_usize count)
|
|||
{
|
||||
child = ts_node_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));
|
||||
idx++;
|
||||
}
|
||||
return (ret);
|
||||
|
|
@ -54,6 +62,7 @@ t_node build_node(t_parse_node curr, t_const_str input)
|
|||
out.end = ts_node_end_byte(curr);
|
||||
out.input = input;
|
||||
out.single_str = NULL;
|
||||
out.field_str = NULL;
|
||||
out.childs_count = ts_node_child_count(curr);
|
||||
if (out.childs_count == 0)
|
||||
out.childs = NULL;
|
||||
|
|
|
|||
1
src.list
1
src.list
|
|
@ -14,6 +14,5 @@ ft_echo.c
|
|||
ft_exit.c
|
||||
ft_pwd.c
|
||||
main.c
|
||||
node/create_node.c
|
||||
node/node.c
|
||||
signal_handler.c
|
||||
|
|
|
|||
34
symbols_list
34
symbols_list
|
|
@ -1,18 +1,28 @@
|
|||
sym_ansi_c_string
|
||||
sym_arithmetic_expansion
|
||||
sym_brace_expression
|
||||
sym_case_item
|
||||
sym_case_statement
|
||||
sym_command
|
||||
sym_command_name
|
||||
sym_command_substitution
|
||||
sym_comment
|
||||
sym_compound_statement
|
||||
sym_concatenation
|
||||
sym_declaration_command
|
||||
sym_elif_clause
|
||||
sym_else_clause
|
||||
sym_expansion
|
||||
sym_file_redirect
|
||||
sym_for_statement
|
||||
sym_function_definition
|
||||
sym_heredoc_body
|
||||
sym_heredoc_content
|
||||
sym_heredoc_end
|
||||
sym_heredoc_redirect
|
||||
sym_heredoc_start
|
||||
sym_if_statement
|
||||
sym_last_case_item
|
||||
sym_list
|
||||
sym_negated_command
|
||||
sym_pipeline
|
||||
|
|
@ -23,15 +33,19 @@
|
|||
sym_string
|
||||
sym_string_content
|
||||
sym_subshell
|
||||
sym_test_command
|
||||
sym_translated_string
|
||||
sym_unset_command
|
||||
sym_variable_assignment
|
||||
sym_variable_assignments
|
||||
sym_variable_name
|
||||
sym_while_statement
|
||||
sym_word
|
||||
#sym_do_group
|
||||
#sym_extglob_pattern
|
||||
__sym_array
|
||||
__sym_binary_expression
|
||||
__sym_c_style_for_statement
|
||||
__sym_do_group
|
||||
__sym_file_descriptor
|
||||
__sym_herestring_redirect
|
||||
__sym_number
|
||||
|
|
@ -42,19 +56,5 @@ __sym_regex
|
|||
__sym_simple_heredoc_body
|
||||
__sym_subscript
|
||||
__sym_ternary_expression
|
||||
sym_case_item
|
||||
sym_case_statement
|
||||
sym_compound_statement
|
||||
sym_declaration_command
|
||||
sym_elif_clause
|
||||
sym_else_clause
|
||||
sym_extglob_pattern
|
||||
sym_for_statement
|
||||
sym_function_definition
|
||||
sym_if_statement
|
||||
sym_last_case_item
|
||||
sym_test_command
|
||||
sym_test_operator
|
||||
sym_unary_expression
|
||||
sym_unset_command
|
||||
sym_while_statement
|
||||
__sym_test_operator
|
||||
__sym_unary_expression
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue