-
Notifications
You must be signed in to change notification settings - Fork 2
Parser Actions
When Parser Rules match and are "run", they can execute some basic actions.
-
Changing the
token.Tokens
token type from that given during Lexing -- the parser can provide more accurate, detailed classification of the types of things, which then provides a better syntax highlighting. -
Adding / editing Parser Symbols -- Symbols are types, variables, methods, etc of general interest in a program. A Symbol has a
token.Tokens
Kind field indicating what kind of thing it is, and pointers into the code where it is defined. IDE's lookup these symbols for completion, etc. -
Adding Parser Types -- the Type system provides a more systematic representation of the semantics of types -- these are sufficiently complicated and language-specific that it makes sense to fill in the details on types by processing the Parser Ast output in a language-specific way (see Go example), but the rule actions can at least create the list of type names and pointers into the Ast tree where they are defined. This is done with the
AddType
action.
To add / edit actions, just click on the Acts
field of the parser.Rule
struct.