-
Notifications
You must be signed in to change notification settings - Fork 0
Section
xtay2 edited this page Mar 15, 2023
·
5 revisions
The Section
is a terminal that matches any section enclosed in two symbols. This can get used for comments or strings.
-
Section(char open, char close)
:- Matches a section without an escape-symbol.
- tokenize() Produces a TerminalToken when matched
-
Section(char open, char close, char escape)
:- Matches a section with an escape-symbol.
- tokenize() Produces a TerminalToken when matched
-
Section(Function<String, TerminalToken> tokenFactory, char open, char close)
:- Matches a section without an escape-symbol.
- tokenize() calls the tokenFactory when matched
-
Section(Function<String, TerminalToken> tokenFactory, char open, char close, char escape)
:- Matches a section with an escape-symbol.
- tokenize() calls the tokenFactory when matched
new Section('[', ']', '/');
Matches
"[]"
"[some content]"
"[other /]content]"
Fails
"[]]"
"]["
"/[]"