The default action for a regular expression terminal is to convert its internal data type to String.
For example, consider the grammar below:
S: A;
terminals
A: /\d+/;
The action of terminal A is to convert A's internal data type Token to type A, which is a String.
pub type A = String;
pub fn a(_ctx: &Ctx, token: Token) -> A {
token.value.into()
}Note that token.value is of type Input, which is also defined in the action file:
pub type Input = str;On the other hand, string terminals have no actions.
➡️ Next: Default Actions For Grammar Rules
📘 Back: Table of contents