Class Tokenizer

java.lang.Object
com.predic8.membrane.core.graphql.Tokenizer

public class Tokenizer extends Object
  • Constructor Details

  • Method Details

    • revert

      public void revert()
      Undo the last advance().

      Note that this can only be used to go *one* token back.

      Also note that when this method has been called, the second-to-last token cannot actually be inspected. This method only serves the purpose to let the next parsing routine call advance() again itself. This can therefore be used to check - again - whether EOF has been reached.

    • mustAdvance

      public void mustAdvance() throws IOException, ParsingException
      Same as advance(), but throw EOFException if EOF is reached instead of returning a boolean.
      Throws:
      IOException
      ParsingException
    • advance

      public boolean advance() throws IOException, ParsingException
      Advances to next token.
      Returns:
      whether another token was found. ('false' signals that EOF has been reached.)
      Throws:
      EOFException - parsing error (EOF while parsing a token, e.g. an unclosed string)
      ParsingException - parsing error (illegal text according to the grammar)
      IOException
    • type

      public Tokenizer.Type type()
    • punctuator

      public int punctuator()
      If type() returned PUNCTUATOR, this will return the value.
    • string

      public String string()
      If type() returned NAME or STRING_VALUE, this will return the value.
    • integer

      public int integer()
    • float_

      public double float_()
    • tokenString

      public String tokenString()
    • position

      public long position()