parse: lex: add missing lex ctx members

This commit is contained in:
2026-05-12 22:54:17 +01:00
parent 39457aa7e6
commit 64903c821c
+12
View File
@@ -8,6 +8,8 @@
#include <fx/string.h>
#include <fx/stringstream.h>
#define LEX_STATE_MAX_TERMINATORS 16
struct line_source;
enum lex_flags {
@@ -22,6 +24,12 @@ enum lex_token_flags {
* expression. a statement that encounters this token as its first char
* will switch to arithmetic mode */
LEX_TOKEN_UNARY_ARITHMETIC = 0x02u,
/* if a token has this flag defined, the lexer will
* switch to command mode after encountering it. */
LEX_TOKEN_COMMAND_MODE = 0x08u,
/* if a token has this flag defined, the lexer will
* switch to statement mode after encountering it. */
LEX_TOKEN_STATEMENT_MODE = 0x10u,
};
enum lex_state_type_id {
@@ -30,6 +38,7 @@ enum lex_state_type_id {
LEX_STATE_ARITHMETIC = 0x04u,
LEX_STATE_STRING = 0x08u,
LEX_STATE_WORD = 0x10u,
LEX_STATE_HASHTABLE = 0x20u,
};
struct lex_token_def {
@@ -50,6 +59,8 @@ struct lex_symbol_node {
struct lex_state {
const struct lex_state_type *s_type;
unsigned int s_terminators[LEX_STATE_MAX_TERMINATORS];
unsigned int s_nr_terminators;
unsigned int s_paren_depth;
fx_queue_entry s_entry;
fx_string *s_tempstr;
@@ -64,6 +75,7 @@ struct lex_ctx {
fx_string *lex_tmp;
fx_wchar lex_ch;
fx_queue lex_state;
enum token_type lex_prev_token;
struct char_cell lex_cursor, lex_start, lex_end;
struct lex_symbol_node *lex_sym_tree;
enum bshell_status lex_status;