File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 - [ Extensions] ( lexextensions.md )
88 - [ Hand-written lexers] ( manuallexer.md )
99 - [ Start States] ( start_states.md )
10+ - [ Syntax] ( lexsyntax.md )
1011- [ Parsing] ( parsing.md )
1112 - [ Yacc compatibility] ( yacccompatibility.md )
1213 - [ Extensions] ( yaccextensions.md )
Original file line number Diff line number Diff line change 1+ The syntax of the lrlex ` .l ` format, aims to be familiar to the format used by posix lex.
2+ It uses the same basic structure as lex.
3+
4+ ```
5+ Definitions
6+ %%
7+ Rules
8+ %%
9+ User Subroutines
10+ ```
11+
12+ ## Definitions
13+
14+ Within the definitions section, you can add an option ` %grmtools ` section
15+ documented in [ extensions] ( ./lexextensions.md )
16+
17+ ## Rules
18+
19+ Each rule is given by the following elements in sequence:
20+
21+ 1 . Optional Start State, a name given between angle brackets for example ` <Start_State> ` documented in [ Start States] ( ./start_states.md )
22+ 2 . Regex, syntax defined by the rust [ regex] ( https://docs.rs/regex ) crate with optional escaping for any character.
23+ 3 . Separator space, any horizontal space character in the unicode ` Pattern_White_Space ` character set
24+ 4 . Optional State operator, given between angle brackets documented in [ Start States] ( ./start_states.md )
25+ + ` <+STATE> ` Push the state given by ` STATE ` to the top of the stack.
26+ + ` <-STATE> ` Pop the state off the top of the stack.
27+ + ` <STATE> ` Replace the state stack with the state ` STATE `
28+ 5 . Token Name, for example ` "token" ` any non-space character between double quotes, including double quotes.
29+ 6 . End of line, finishes each rule.
30+
31+ ## User Subroutines
32+
33+ Since lrlex doesn't support user actions, it doesn't support User Subroutines either.
You can’t perform that action at this time.
0 commit comments