Class Navigate.CharSetCalc

Enclosing class:
Navigate

public static class Navigate.CharSetCalc extends SinglePhase
Expand all character set expressions from the d2d definition language to an extensional representation as CharSet. Cache the results locally.

Under a CharBinary operator, all refs and defs and operators MUST be of character type. Otherwise (esp. under a star or plus operator) the top expression MAY be of character set type, which is indicated by a result!=null.

  • Field Details

  • Constructor Details

  • Method Details

    • memorize

      protected void memorize(Expression exp)
      Put to cache.
    • lookUp

      protected boolean lookUp(Expression exp)
      Copy the cached value to the result register.
      Returns:
      whether the cache contains a value.
    • find

      public CharSet find(Expression exp)
      Evaluate the expression: Either return the cached result or invoke visiting.
    • xerror

      protected void xerror(Location<XMLDocumentIdentifier> loc, String txt)
      Emit an error message.
    • action

      public void action(Reference ref)
      Only considered to be a character set when under a character set operator.
      Overrides:
      action in class SinglePhase
    • action

      public void action(Definition x)
      All definitions which are not CharsRegExp are NOT a character set.
      Overrides:
      action in class SinglePhase
    • action

      public void action(ParseParticle x)
      Any parse particle is NOT a character set.
      Overrides:
      action in class SinglePhase
    • action

      public void action(CharsRegExp x)
      Visit the defined expressions.
      Overrides:
      action in class SinglePhase
    • action

      public void action(Insertion ins)
      Visit the expression defined by the inserted reference.
      Overrides:
      action in class SinglePhase
    • action

      public void action(CharSetConst x)
      A character set constant directly evaluates to itself.
      Overrides:
      action in class SinglePhase
    • action

      public void action(StringConst x)
      A string constant of length==1 is treated as a character set constant.
      Overrides:
      action in class SinglePhase
    • rangeerror

      protected void rangeerror(Expression exp, String pos)
      Range operator between non-singleton sets.
    • makeRange

      @Opt protected @Opt CharSet makeRange(CharSet from, CharSet to, CharBinary rangeExpr)
      Construct the range between two singleton sets.
    • reportError

      protected boolean reportError(CharBinary x, String pos)
      Report the case that a char set binary operator is wrongly applied.
    • operation

      protected void operation(CharBinary x, char code)
      Evaluate the arguments of the binary expression and construct the result.
    • action

      public void action(CharJoin x)
      Evaluate the arguments of the binary expression and construct the result.
      Overrides:
      action in class SinglePhase
    • action

      public void action(CharCut x)
      Evaluate the arguments of the binary expression and construct the result.
      Overrides:
      action in class SinglePhase
    • action

      public void action(CharMinus x)
      Evaluate the arguments of the binary expression and construct the result.
      Overrides:
      action in class SinglePhase
    • action

      public void action(CharRange x)
      Evaluate the arguments of the binary expression and construct the result.
      Overrides:
      action in class SinglePhase
    • action

      public void action(Expression x)
      All other expressions are not character expressions.
      Overrides:
      action in class SinglePhase