Class IdentifierTokenMatcher
java.lang.Object
com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher
com.singularsys.jep.configurableparser.matchers.IdentifierTokenMatcher
- All Implemented Interfaces:
TokenBuilder,TokenMatcher,Serializable
Matches identifiers: variables or function names.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIdentifierTokenMatcher(Pattern pattern) IdentifierTokenMatcher(String regex) Construct and identifier matcher. -
Method Summary
Modifier and TypeMethodDescriptionstatic IdentifierTokenMatcherMatches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores.buildToken(String s) Create the token, if the name matches a function name return a FunctionToken otherwise return an IdentifierToken.static IdentifierTokenMatcherMatches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores or .voidInitialize the matcher when the Jep instance is known.Methods inherited from class com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher
match
-
Constructor Details
-
IdentifierTokenMatcher
-
IdentifierTokenMatcher
Construct and identifier matcher.- Parameters:
regex- a regular expression specifying the allowed identifier names.- See Also:
-
-
Method Details
-
buildToken
Create the token, if the name matches a function name return a FunctionToken otherwise return an IdentifierToken.- Specified by:
buildTokenin interfaceTokenBuilder- Specified by:
buildTokenin classRegExpTokenMatcher- Parameters:
s- String representing the completed matched token- Returns:
- the appropriate type of token.
-
basicIdentifierMatcher
Matches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores. Correctly spelled version- Returns:
- the matcher
- Since:
- 3.5
-
dottedIdentifierMatcher
Matches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores or . characters. Correctly spelled version- Returns:
- the matcher
- Since:
- 3.5
-
init
Description copied from interface:TokenMatcherInitialize the matcher when the Jep instance is known.- Parameters:
j- Jep instance
-