jml2b.exceptions
Class TokenException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjml2b.exceptions.Jml2bException
              extended byjml2b.exceptions.ParseException
                  extended byjml2b.exceptions.TokenException
All Implemented Interfaces:
java.io.Serializable

public class TokenException
extends ParseException

A specialisation of the ParseException class that is used when unexpected tokens are encountered.

They usually indicate errors in the Jack parser.

Author:
A. Requet
See Also:
Serialized Form

Constructor Summary
TokenException(JmlFile f, jml.LineAST tree, java.lang.String method, int expected, int got)
          Creates a new TokenException instance.
TokenException(JmlFile f, jml.LineAST tree, java.lang.String method, java.lang.String expected, int got)
          Creates a new TokenException instance.
TokenException(JmlFile f, jml.LineAST tree, java.lang.String method, java.lang.String expected, java.lang.String got)
          Creates a new TokenException instance.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TokenException

public TokenException(JmlFile f,
                      jml.LineAST tree,
                      java.lang.String method,
                      java.lang.String expected,
                      java.lang.String got)
Creates a new TokenException instance.

Note that the method correspond to the Jack method performing the parsing.

Parameters:
f - that contains the unexpected token.
tree - the AST containing the unexpected token.
method - the name of the method that throwed the exception.
expected - the name of the token(s) that was (were) expected.
got - the name of the token that has been encountered.

TokenException

public TokenException(JmlFile f,
                      jml.LineAST tree,
                      java.lang.String method,
                      java.lang.String expected,
                      int got)
Creates a new TokenException instance.

Note that the method correspond to the Jack method performing the parsing.

Parameters:
f - that contains the unexpected token.
tree - the AST containing the unexpected token.
method - the name of the method that throwed the exception.
expected - the name of the token(s) that was (were) expected.
got - the value of the token that has been encountered.

TokenException

public TokenException(JmlFile f,
                      jml.LineAST tree,
                      java.lang.String method,
                      int expected,
                      int got)
Creates a new TokenException instance.

Note that the method correspond to the Jack method performing the parsing.

Parameters:
f - that contains the unexpected token.
tree - the AST containing the unexpected token.
method - the name of the method that throwed the exception.
expected - the value of the token that was expected.
got - the value of the token that has been encountered.