public final class Optimiser extends Object
The various optimisations remove tags whose positions in any successful matching can be deduced statically, with respect to either the start of the matched string, its end, or any other tag in the regular expression. Removed tags are recorded in an interpretation map, which for each such tag gives its relative position to some other marker.
Modifier and Type | Class and Description |
---|---|
static class |
Optimiser.Allocated
This structure represents the result of optimising a tagged
regular expression: it packs together the resulting tagged
expression, the list of
Optimiser.IdentInfo for each possible
bound variable in the original regular expression, and the
overall number of different memory cells needed to store
all markers at run-time. |
static class |
Optimiser.IdentInfo
Structure which represents how an indentifier in
a regular expression is realized in optimised tagged
regular expressions, i.e. provides tag
addresses for the start and end of the expression bound
to the identifier, and whether it is optional or not.
|
static class |
Optimiser.TagAddr
The relative address of a tag, either with
respect to some memory cell, i.e. some actual
storage for a tag, or to the
Optimiser.TagAddr.START
or Optimiser.TagAddr.END of the input. |
static class |
Optimiser.TagKey
Similar to
TRegular.TagInfo , but without the
semantic action. |
Modifier and Type | Method and Description |
---|---|
Map<Optimiser.TagKey,Optimiser.TagAddr> |
getTagEnvironment() |
static Optimiser.Allocated |
optimise(Regulars.VarsInfo varsInfo,
boolean optimisation,
TRegular regular) |
protected TRegular |
simpleBackward(TRegular r) |
protected TRegular |
simpleForward(TRegular r) |
public Map<Optimiser.TagKey,Optimiser.TagAddr> getTagEnvironment()
public static Optimiser.Allocated optimise(Regulars.VarsInfo varsInfo, boolean optimisation, TRegular regular)
varsInfo
- variable analysis for regular
optimisation
- whether optimisation of tags with respect to the
start or end of input should be appliedregular
- Optimiser.Allocated