-
Notifications
You must be signed in to change notification settings - Fork 0
Literal
xtay2 edited this page Feb 15, 2023
·
7 revisions
The Literal represents a terminal string in an EBNF which is a symbol that cannot be further decomposed into smaller sections. To initialise it, call the constructor with a literal String.
-
matches(String input): boolean: returns true if the input string matches the literal string, ignoring leading and trailing whitespaces. -
maxMatchLength(String input): int: returns the length of the longest substring of the input string that matches the literal string, counting leading whitespaces. If there is no match, returns 0. -
firstMatch(String input): int: returns the index of the first occurrence of the literal string in the input string, ignoring leading and trailing whitespaces. If there is no match, returns the length of the input string.
new Literal("abc");"abc"
" abc "
" abc"