public final class Encoder extends Object
Encoder
can be used
to encode syntactic regular expressions
in tagged regular expressions.
All regular expressions encoded within the same instance
share a common pool of character sets, which can be
retrieved via getCharacterSets()
.
Constructor and Description |
---|
Encoder(boolean optimisation) |
Modifier and Type | Method and Description |
---|---|
TRegular |
encode(Regular regular,
Set<String> charVars,
int action) |
static TLexer |
encodeLexer(Lexer lexer,
boolean optimisation) |
List<CSet> |
getCharacterSets() |
public Encoder(boolean optimisation)
optimisation
- whether optimisation should be applied
Returns a freshly initialized encoderpublic List<CSet> getCharacterSets()
this
public TRegular encode(Regular regular, Set<String> charVars, int action)
regular
- the regular expression to encodecharVars
- bound variables guaranteed to be matching single charactersaction
- the semantic action associated to this regular expressionregular
. Character
sets in the resulting expression are encoded in this
encodergetCharacterSets()