Add token_node and token_user_fields grammar statements

This commit is contained in:
josh committed 2026-02-14 21:00:53 -05:00
1 parent 78adf86103
commit 9f2fe6f84b
6 files changed
+45 -14

No files matched your search

+2
View File
@@ -694,6 +694,7 @@ typedef struct
<% end %>
} state_value_t;
<% if @grammar.tree %>
/** Common tree node structure. */
typedef struct TreeNode_s
{
@@ -703,6 +704,7 @@ typedef struct TreeNode_s
uint8_t is_token;
struct TreeNode_s * fields[];
} TreeNode;
<% end %>
/** Parser shift table. */
static const shift_t parser_shift_table[] = {
+2 -1
View File
@@ -103,6 +103,7 @@ public struct <%= @grammar.tree_prefix %>Token<%= @grammar.tree_suffix %>
/* TreeNode fields must be present in the same order here. */
<%= @grammar.prefix %>position_t position;
<%= @grammar.prefix %>position_t end_position;
<%= @grammar.token_user_fields %>
<%= @grammar.prefix %>token_t token;
<%= @grammar.prefix %>value_t pvalue;
}
@@ -184,7 +185,7 @@ public struct <%= @grammar.prefix %>context_t
/** User terminate code. */
size_t user_terminate_code;
<%= @grammar.context_user_code %>
<%= @grammar.context_user_fields %>
}
/**************************************************************************
+2 -1
View File
@@ -80,6 +80,7 @@ typedef struct <%= @grammar.tree_prefix %>Token<%= @grammar.tree_suffix %>
<%= @grammar.prefix %>position_t end_position;
uint16_t n_fields;
uint8_t is_token;
<%= @grammar.token_user_fields %>
<%= @grammar.prefix %>token_t token;
<%= @grammar.prefix %>value_t pvalue;
} <%= @grammar.tree_prefix %>Token<%= @grammar.tree_suffix %>;
@@ -173,7 +174,7 @@ typedef struct
/** User terminate code. */
size_t user_terminate_code;
<%= @grammar.context_user_code %>
<%= @grammar.context_user_fields %>
} <%= @grammar.prefix %>context_t;
/**************************************************************************