Class JavaScriptLexer

All Implemented Interfaces:
JFlexJointLexer, JFlexLexer, JFlexStackingLexer, Resettable, ScanningSymbolMatcher, SymbolMatchedPublisher
Direct Known Subclasses:
JavaScriptSymbolTokenizer, JavaScriptXref, TypeScriptSymbolTokenizer, TypeScriptXref

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

    • JavaScriptLexer

      public JavaScriptLexer()
  • Method Details

    • reset

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

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

      protected void substitutionOp()
      Resets the substitution brace counter to 1.
    • notInTemplateOrSubstitutionDoesNotEnd

      protected boolean notInTemplateOrSubstitutionDoesNotEnd(String capture) throws IOException
      Determine if template substitution should end based on the first character of capture, and also recognizing tokens that increase the nesting level alternatively.

      Calling this method has side effects to possibly modify nEndBrace.

      Returns:
      true if the substitution state does not end
      Throws:
      IOException
    • pushData

      protected void pushData()
    • COMMENT

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

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