-
Notifications
You must be signed in to change notification settings - Fork 0
Section
xtay2 edited this page Feb 15, 2023
·
5 revisions
The Section class is a terminal that matches any section enclosed in two symbols. This can get used for comments or strings.
-
Section(char open, char close): Initializes a new instance of the Section class with the specified open and close characters but without an escape-symbol. -
Section(char open, char close, char escape): Initializes a new instance of the Section class with the specified open and close characters, and the escape character.
-
matches(String input): boolean: Returns true if the input string is completely surrounded by an unescaped open- and close-symbol. -
maxMatchLength(String input): int: Returns the length of the longest substring of the input string that matches the section. -
firstMatch(String input): int: Returns the first index of the first match of the section in the input string.
new Section('[', ']', '/');Matches
"[]"
"[some content]"
"[other /]content]"Fails
"[]]"
"]["
"/[]"