Package nz.org.riskscape.dsl
Interface TokenMatcher
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface that replaces using Pattern for sometimes easier, more understandable and more
flexible pattern matching during lexing
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic TokenMatcherforChar(char character) Creates a token matcher for a single characterstatic TokenMatcherforIString(String string) Creates a token matcher for a single characterstatic TokenMatcherforLineComment(String startsWith) static TokenMatcherforPattern(String regex) static TokenMatcherforPattern(Pattern pattern) Creates a token matcher for aPatternstatic TokenMatcherCreates a token matcher for a single character
-
Field Details
-
LINE_ENDINGS
-
-
Method Details
-
forChar
Creates a token matcher for a single character
-
forString
Creates a token matcher for a single character
-
forIString
Creates a token matcher for a single character
-
forPattern
-
forPattern
Creates a token matcher for a
Pattern -
match
- Parameters:
source- string to match a token fromposition- place in string where to start matching from- Returns:
- a
Tokenthat is built frompositioninsource, ornullif it doesn't match
-
forLineComment
-
getKeyword
-