Add p_input_index()

This commit is contained in:
josh committed 2026-07-11 22:58:26 -04:00
1 parent c0016f6d58
commit 2ebdeaa995
8 files changed
+173

No files matched your search

+14
View File
@@ -1363,6 +1363,20 @@ void <%= @grammar.prefix %>set_position(<%= @grammar.prefix %>context_t * contex
context->text_position = position;
}
/**
* Get the current input text byte offset.
*
* @param context
* Lexer/parser context structure.
*
* @return Current input text byte offset (measured from the start of the
* input text passed to <%= @grammar.prefix %>context_new()).
*/
size_t <%= @grammar.prefix %>input_index(<%= @grammar.prefix %>context_t * context)
{
return context->input_index;
}
/**
* Get the user terminate code.
*
+14
View File
@@ -1442,6 +1442,20 @@ public void <%= @grammar.prefix %>set_position(<%= @grammar.prefix %>context_t *
context.text_position = position;
}
/**
* Get the current input text byte offset.
*
* @param context
* Lexer/parser context structure.
*
* @return Current input text byte offset (measured from the start of the
* input text passed to <%= @grammar.prefix %>context_new()).
*/
public size_t <%= @grammar.prefix %>input_index(<%= @grammar.prefix %>context_t * context)
{
return context.input_index;
}
/**
* Get the user terminate code.
*
+2
View File
@@ -239,6 +239,8 @@ void <%= @grammar.prefix %>tree_delete_<%= start_rule %>(<%= @grammar.tree_prefi
void <%= @grammar.prefix %>set_position(<%= @grammar.prefix %>context_t * context, <%= @grammar.prefix %>position_t position);
size_t <%= @grammar.prefix %>input_index(<%= @grammar.prefix %>context_t * context);
size_t <%= @grammar.prefix %>user_terminate_code(<%= @grammar.prefix %>context_t * context);
<%= @grammar.prefix %>token_t <%= @grammar.prefix %>token(<%= @grammar.prefix %>context_t * context);