Package net.fauxpark.stringes
Class Lexer.RuleMatchValueGenerator<U>
- java.lang.Object
-
- net.fauxpark.stringes.Lexer.RuleMatchValueGenerator<U>
-
-
Constructor Summary
Constructors Constructor Description RuleMatchValueGenerator(Function<MatchResult,U> generator)
Constructs a new RuleMatchValueGenerator with a function that generates token identifiers.RuleMatchValueGenerator(U id)
Constructs a new RuleMatchValueGenerator with a token identifier.
-
-
-
Constructor Detail
-
RuleMatchValueGenerator
public RuleMatchValueGenerator(U id)
Constructs a new RuleMatchValueGenerator with a token identifier.- Parameters:
id
- The token identifier to use.
-
RuleMatchValueGenerator
public RuleMatchValueGenerator(Function<MatchResult,U> generator)
Constructs a new RuleMatchValueGenerator with a function that generates token identifiers.- Parameters:
generator
- The generator function to use.
-
-
Method Detail
-
getId
public U getId(MatchResult m)
Returns the token identifier.- Parameters:
m
- The regex match result to apply the generator to.- Returns:
- The token identifier, or the result of the function against the supplied MatchResult if there is no constant value.
-
-