Language Processing
v2.0

pj2
Class Utils

Object
  extended by Utils
Direct Known Subclasses:
Launcher, Parser, Visitor

public abstract class Utils
extends Object

useful functions for parsers.

Version:
2.2.1

Field Summary
protected  boolean error
          true if there was an error.
 
Constructor Summary
Utils()
           
 
Method Summary
static String className(Object o)
          return simplified class name.
protected  void error(int position, String message)
          writes error message with (nonzero) position.
protected  void error(Parser.Node node, String message)
          writes error message with (nonzero) position from node.
protected  void error(String message)
          writes error message, sets error.
static String fromString(String s)
          return internal representation of the characters of an external string.
 boolean getError()
           
protected  void message(String message)
          should be overwritten to redirect all messages.
static String toChars(Object o)
          return external representation of the characters of a string.
static String toString(String s, char delim)
          return external representation of a string (enclosed in quotes).
protected  void warning(int position, String message)
          writes warning message with (nonzero) position.
protected  void warning(Parser.Node node, String message)
          writes warning message with (nonzero) position from node.
protected  void warning(String message)
          writes warning message.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

error

protected boolean error
true if there was an error.

See Also:
error(java.lang.String)
Constructor Detail

Utils

public Utils()
Method Detail

getError

public boolean getError()

toString

public static String toString(String s,
                              char delim)
return external representation of a string (enclosed in quotes).

Parameters:
delim - single or double quote to surround the result.

toChars

public static String toChars(Object o)
return external representation of the characters of a string.


fromString

public static String fromString(String s)
return internal representation of the characters of an external string.


className

public static String className(Object o)
return simplified class name.


message

protected void message(String message)
should be overwritten to redirect all messages.


error

protected void error(String message)
writes error message, sets error.

See Also:
message(java.lang.String)

error

protected void error(int position,
                     String message)
writes error message with (nonzero) position.


error

protected void error(Parser.Node node,
                     String message)
writes error message with (nonzero) position from node.


warning

protected void warning(String message)
writes warning message.

See Also:
message(java.lang.String)

warning

protected void warning(int position,
                       String message)
writes warning message with (nonzero) position.


warning

protected void warning(Parser.Node node,
                       String message)
writes warning message with (nonzero) position from node.



(c) 2008 Axel T. Schreiner