CS 536 Fall 2007, Project 5

Class Err

Object
  extended by Err

public class Err
extends Object

Functions for printing error messages. Computer Sciences 536.


Method Summary
static void badArgType(int line, int column, String text)
          Prints an error message concerning an argument type mismatch.
static void badIntLiteral(int line, int column, String text)
          Prints an error message concerning an invalid integer literal (one whose value is larger than Integer.MAX_VALUE).
static void badReturnType(int line, int column, String text)
          Prints an error message concerning a bad type of return expression.
static void complexExpression(int line, int column)
          Prints an error message concerning an expression that is too complex to compile.
static void duplicateDeclaration(int line, int column, String text)
          Prints an error message concerning a multiply declared identifier.
static int errors()
          Returns a count of the total number of errors thus far.
static void functionOutParam(int line, int column, String text)
          Prints an error message concerning an "out" or "in out" parameter in a function.
static void invalidAssignment(int line, int column)
          Prints an error message concerning an attempt to assign incompatible types.
static void invalidBound(int line, int column, String text)
          Prints an error message concerning an invalid lower or upper bound in and array declaration.
static void invalidCharacter(int line, int column, String text)
          Prints an error message concerning an invalid input character.
static void invalidRead(int line, int column)
          Prints an error message concerning an attempt to read a string.
static void missingReturn(int line, int column, String text)
          Prints an error message concerning a missing return value.
static void nonBooleanExpression(int line, int column)
          Prints an error message concerning a non-boolean expression used where a boolean expression is required.
static void nonIntegerBound(int line, int column, String text)
          Prints an error message concerning a non-integer bound in a for statement.
static void nonIntegerSubscript(int line, int column, String text)
          Prints an error message concerning a non-integer expression used as a subscript.
static void nonIntegerVariable(int line, int column)
          Prints an error message concerning a non-integer variable in a for statement.
static void nonLValueArg(int line, int column, ProcDeclNode.Mode mode, String text)
          Prints an error message concerning a non-lvalue passed to an "out" or "in out" parameter.
static void nonLValueLHS(int line, int column)
          Prints an error message concerning a non-lvalue on the left-hand side of an assignment statement.
static void nonProcedureCall(int line, int column, String text)
          Prints an error message concerning a statement that looks like a procedure call but does not name a valid procedure.
static void nonVoidReturn(int line, int column, String text)
          Prints an error message concerning a return value for a procedure.
static void operandType(int line, int column, String lr, ASTNode.Opcode op)
          Prints an error message concerning an invalid operand type.
static void parseError(int line, int column, String text)
          Prints an error message concerning a syntax error.
static void setFile(String fname)
          Indicates the name of the input file.
static void subscriptedScalar(int line, int column, String text)
          Prints an error message concerning parentheses following an identifier that does not represent a function, procedure, or array.
static void undeclaredIdentifier(int line, int column, String text)
          Prints an error message concerning an undeclared identifier.
static void unterminatedString(int line, int column, String text)
          Prints an error message concerning a non-terminated string literal.
static void wrongNumberArgs(int line, int column, String text)
          Prints an error message concerning a call with the wrong number of args.
static void wrongNumberSubscripts(int line, int column, String text)
          Prints an error message concerning an array reference that does not have a single subscript.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

errors

public static int errors()
Returns a count of the total number of errors thus far.

Returns:
the number of calls to other methods of this class.

setFile

public static void setFile(String fname)
Indicates the name of the input file.

Parameters:
fname - the name of the input file

invalidCharacter

public static void invalidCharacter(int line,
                                    int column,
                                    String text)
Prints an error message concerning an invalid input character.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - a one-character String containing the invalid character.

unterminatedString

public static void unterminatedString(int line,
                                      int column,
                                      String text)
Prints an error message concerning a non-terminated string literal.

Parameters:
line - the line number where the error occurred.
column - the position on the line of the first character of the string literal appeared.
text - the entire non-terminated string.

badIntLiteral

public static void badIntLiteral(int line,
                                 int column,
                                 String text)
Prints an error message concerning an invalid integer literal (one whose value is larger than Integer.MAX_VALUE).

Parameters:
line - the line number where the error occurred.
column - the position on the line of the first character of the integer literal appeared.
text - the entire invalid integer literal.

parseError

public static void parseError(int line,
                              int column,
                              String text)
Prints an error message concerning a syntax error.

Parameters:
line - the line number where the error occurred.
column - the position on the line of the first character of the integer literal appeared.
text - the error message from the parser.

duplicateDeclaration

public static void duplicateDeclaration(int line,
                                        int column,
                                        String text)
Prints an error message concerning a multiply declared identifier.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the identifier being declared.

undeclaredIdentifier

public static void undeclaredIdentifier(int line,
                                        int column,
                                        String text)
Prints an error message concerning an undeclared identifier.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the undeclared identifier.

subscriptedScalar

public static void subscriptedScalar(int line,
                                     int column,
                                     String text)
Prints an error message concerning parentheses following an identifier that does not represent a function, procedure, or array.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the name being used as a function name.

wrongNumberArgs

public static void wrongNumberArgs(int line,
                                   int column,
                                   String text)
Prints an error message concerning a call with the wrong number of args.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the function being called.

wrongNumberSubscripts

public static void wrongNumberSubscripts(int line,
                                         int column,
                                         String text)
Prints an error message concerning an array reference that does not have a single subscript.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the function being called.

badArgType

public static void badArgType(int line,
                              int column,
                              String text)
Prints an error message concerning an argument type mismatch.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the name of the mismatched format parameter.

nonIntegerSubscript

public static void nonIntegerSubscript(int line,
                                       int column,
                                       String text)
Prints an error message concerning a non-integer expression used as a subscript.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the identifier being subscripted.

missingReturn

public static void missingReturn(int line,
                                 int column,
                                 String text)
Prints an error message concerning a missing return value.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the name of the function.

nonVoidReturn

public static void nonVoidReturn(int line,
                                 int column,
                                 String text)
Prints an error message concerning a return value for a procedure.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the name of the function.

badReturnType

public static void badReturnType(int line,
                                 int column,
                                 String text)
Prints an error message concerning a bad type of return expression.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the name of the function.

operandType

public static void operandType(int line,
                               int column,
                               String lr,
                               ASTNode.Opcode op)
Prints an error message concerning an invalid operand type.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
lr - "left" or "right"
op - the operator

nonBooleanExpression

public static void nonBooleanExpression(int line,
                                        int column)
Prints an error message concerning a non-boolean expression used where a boolean expression is required.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.

nonProcedureCall

public static void nonProcedureCall(int line,
                                    int column,
                                    String text)
Prints an error message concerning a statement that looks like a procedure call but does not name a valid procedure.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the name of the supposed procedure.

invalidAssignment

public static void invalidAssignment(int line,
                                     int column)
Prints an error message concerning an attempt to assign incompatible types.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.

invalidRead

public static void invalidRead(int line,
                               int column)
Prints an error message concerning an attempt to read a string. types.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.

invalidBound

public static void invalidBound(int line,
                                int column,
                                String text)
Prints an error message concerning an invalid lower or upper bound in and array declaration.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - either "lower" or "upper".

nonIntegerBound

public static void nonIntegerBound(int line,
                                   int column,
                                   String text)
Prints an error message concerning a non-integer bound in a for statement.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - either "lower" or "upper".

nonIntegerVariable

public static void nonIntegerVariable(int line,
                                      int column)
Prints an error message concerning a non-integer variable in a for statement.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.

nonLValueLHS

public static void nonLValueLHS(int line,
                                int column)
Prints an error message concerning a non-lvalue on the left-hand side of an assignment statement.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.

nonLValueArg

public static void nonLValueArg(int line,
                                int column,
                                ProcDeclNode.Mode mode,
                                String text)
Prints an error message concerning a non-lvalue passed to an "out" or "in out" parameter.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
mode - either OUT or INOUT.
text - the name of the formal parameter.

functionOutParam

public static void functionOutParam(int line,
                                    int column,
                                    String text)
Prints an error message concerning an "out" or "in out" parameter in a function.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.
text - the name of the function.

complexExpression

public static void complexExpression(int line,
                                     int column)
Prints an error message concerning an expression that is too complex to compile.

Parameters:
line - the line number where the error occurred.
column - the position on the line where the error occurred.

CS 536 Fall 2007, Project 5