Class CommonTokenFactory

java.lang.Object
org.antlr.v4.runtime.CommonTokenFactory
All Implemented Interfaces:
TokenFactory

public class CommonTokenFactory extends Object implements TokenFactory
This default implementation of TokenFactory creates CommonToken objects.
  • Field Details

  • Constructor Details

    • CommonTokenFactory

      public CommonTokenFactory(boolean copyText)
      Constructs a CommonTokenFactory with the specified value for copyText.

      When copyText is false, the DEFAULT instance should be used instead of constructing a new instance.

      Parameters:
      copyText - The value for copyText.
    • CommonTokenFactory

      public CommonTokenFactory()
      Constructs a CommonTokenFactory with copyText set to false.

      The DEFAULT instance should be used instead of calling this directly.

  • Method Details

    • create

      public CommonToken create(Tuple2<? extends TokenSource,CharStream> source, int type, String text, int channel, int start, int stop, int line, int charPositionInLine)
      Description copied from interface: TokenFactory
      This is the method used to create tokens in the lexer and in the error handling strategy. If text!=null, than the start and stop positions are wiped to -1 in the text override is set in the CommonToken.
      Specified by:
      create in interface TokenFactory
    • create

      public CommonToken create(int type, String text)
      Description copied from interface: TokenFactory
      Generically useful
      Specified by:
      create in interface TokenFactory