Class HCLLexer

All Implemented Interfaces:
JFlexJointLexer, JFlexLexer, JFlexStackingLexer, Resettable, ScanningSymbolMatcher, SymbolMatchedPublisher
Direct Known Subclasses:
HCLSymbolTokenizer, HCLXref, TerraformSymbolTokenizer, TerraformXref

public abstract class HCLLexer extends JFlexSymbolMatcher implements JFlexJointLexer, Resettable
Represents an abstract base class for HCL lexers.
  • Constructor Details

    • HCLLexer

      protected HCLLexer()
  • Method Details

    • reset

      public void reset()
      Resets the instance to an initial state.
      Specified by:
      reset in interface Resettable
      Overrides:
      reset in class JFlexStateStacker
    • hereOp

      public void hereOp(String capture) throws IOException
      Parses a Here-document declaration, and takes the capture using JFlexJointLexer.offer(String). If the declaration is valid, hereSettings will have been appended.
      Throws:
      IOException
    • maybeHereStart

      public boolean maybeHereStart() throws IOException
      Pushes the first Here-document state if any declarations were parsed, or else does nothing.
      Returns:
      true if a Here state was pushed
      Throws:
      IOException
    • maybeHereEnd

      public boolean maybeHereEnd(String capture) throws IOException
      Process the capture, possibly ending the Here-document state just beforehand.
      Returns:
      true if the Here state ended
      Throws:
      IOException
    • interpOp

      public void interpOp()
      Resets the interpolation counter to 1.
    • maybeInterpolationEnd

      public boolean maybeInterpolationEnd(String capture) throws IOException
      Determine if the interpolation should end based on the first character of capture, recognizing tokens that increase the nesting level instead.

      Calling this method has side effects to possibly modify numEndBrace.

      Returns:
      true if the interpolation state ended
      Throws:
      IOException
    • chkLOC

      public void chkLOC()
      Calls JFlexJointLexer.phLOC() if the yystate is not COMMENT or SCOMMENT.
    • pushData

      public void pushData()
      Push the lexer state data on the stack, and initialize a new state.
    • popData

      public void popData()
      Discard the current lexer state, and pop state off the stack.
    • COMMENT

      public abstract int COMMENT()
      Subclasses must override to get the constant value created by JFlex to represent COMMENT.
    • SCOMMENT

      public abstract int SCOMMENT()
      Subclasses must override to get the constant value created by JFlex to represent SCOMMENT.
    • HERE

      public abstract int HERE()
      Subclasses must override to get the constant value created by JFlex to represent HERE.
    • HEREin

      public abstract int HEREin()
      Subclasses must override to get the constant value created by JFlex to represent HEREin.