wip
This commit is contained in:
parent
48b4033ef2
commit
cdb6294f1f
@ -549,17 +549,17 @@ alias rule_id_t = <%= get_type_for(@grammar.rules.size) %>;
|
||||
alias shift_id_t = <%= get_type_for(@parser.shift_table.size) %>;
|
||||
|
||||
/** Shift table entry. */
|
||||
struct shift_t
|
||||
typedef struct
|
||||
{
|
||||
/** Token or rule set ID. */
|
||||
symbol_id_t symbol_id;
|
||||
|
||||
/** Parser state to shift to. */
|
||||
parser_state_id_t state_id;
|
||||
}
|
||||
} shift_t;
|
||||
|
||||
/** Reduce table entry. */
|
||||
struct reduce_t
|
||||
typedef struct
|
||||
{
|
||||
/** Lookahead token. */
|
||||
<%= @grammar.prefix %>token_t token;
|
||||
@ -587,10 +587,10 @@ struct reduce_t
|
||||
* reduce action.
|
||||
*/
|
||||
parser_state_id_t n_states;
|
||||
}
|
||||
} reduce_t;
|
||||
|
||||
/** Parser state entry. */
|
||||
struct parser_state_t
|
||||
typedef struct
|
||||
{
|
||||
/** First shift table entry for this parser state. */
|
||||
shift_id_t shift_table_index;
|
||||
@ -603,26 +603,21 @@ struct parser_state_t
|
||||
|
||||
/** Number of reduce table entries for this parser state. */
|
||||
reduce_id_t n_reduce_entries;
|
||||
}
|
||||
} parser_state_t;
|
||||
|
||||
/**
|
||||
* Structure to hold a state ID and value pair.
|
||||
*
|
||||
* A stack of these structures makes up the parse stack.
|
||||
*/
|
||||
struct state_value_t
|
||||
typedef struct
|
||||
{
|
||||
/** Parser state ID. */
|
||||
size_t state_id;
|
||||
|
||||
/** Parser value from this state. */
|
||||
<%= @grammar.prefix %>value_t pvalue;
|
||||
|
||||
this(size_t state_id)
|
||||
{
|
||||
this.state_id = state_id;
|
||||
}
|
||||
}
|
||||
} state_value_t;
|
||||
|
||||
/** Parser shift table. */
|
||||
static immutable shift_t[] parser_shift_table = [
|
||||
@ -645,6 +640,26 @@ static immutable parser_state_t[] parser_state_table = [
|
||||
<% end %>
|
||||
];
|
||||
|
||||
/* state_values linked list functionality */
|
||||
|
||||
typedef struct state_values_list_entry_s
|
||||
{
|
||||
/** State value object. */
|
||||
state_value_t state_value;
|
||||
|
||||
/** Linked list previous entry. */
|
||||
struct state_values_list_entry_s * prev;
|
||||
|
||||
/** Linked list next entry. */
|
||||
struct state_values_list_entry_s * next;
|
||||
} state_values_list_entry_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t length;
|
||||
state_values_list_entry_t * first;
|
||||
state_values_list_entry_t * last;
|
||||
} state_values_list_t;
|
||||
/**
|
||||
* Execute user code associated with a parser rule.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user