Class StringLexerSource

All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<Token>

public class StringLexerSource extends LexerSource
A Source for lexing a String. This class is used by token pasting, but can be used by user code.
  • Constructor Details

    • StringLexerSource

      public StringLexerSource(String string, String name, boolean ppvalid)
      Creates a new Source for lexing the given String.
      Parameters:
      string - The input string to lex.
      name - The name of this source.
      ppvalid - true if preprocessor directives are to be honoured within the string.
    • StringLexerSource

      public StringLexerSource(String string)
      Creates a new Source for lexing the given String. Equivalent to calling new StringLexerSource(string, false). By default, preprocessor directives are not honoured within the string.
      Parameters:
      string - The input string to lex.
    • StringLexerSource

      public StringLexerSource(String string, boolean ppvalid)
      Creates a new Source for lexing the given String. Equivalent to calling new StringLexerSource(string, "string literal", ppvalid).
      Parameters:
      string - The input string to lex.
      ppvalid - true if preprocessor directives are to be honoured within the string.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getName

      public String getName()
      Description copied from class: Source
      Returns the human-readable name of the current Source.
      Overrides:
      getName in class Source