condor.classad
Class Parser

Object
  extended bycondor.classad.Parser

class Parser
extends Object

This is the internal classad parser generated by byacc. From outside this package, it should be accessed through the wrapper class ClassAdParser.

Version:
2.0
Author:
Marvin Solomon
See Also:
ClassAdParser

Field Summary
(package private)  boolean acceptPrefix
          If true, accept when a prefix of the input matches.
static short ERROR
          Internal code for a token.
(package private)  PrintStream errs
          Place to send error messages.
static short FALSE
          Internal code for a token.
static short IDENTIFIER
          Internal code for a token.
static short INTEGER
          Internal code for a token.
static short LEX_ERROR
          Internal code for a token.
static short OP_EQ
          Internal code for a token.
static short OP_GE
          Internal code for a token.
static short OP_IS
          Internal code for a token.
static short OP_ISNT
          Internal code for a token.
static short OP_LAND
          Internal code for a token.
static short OP_LE
          Internal code for a token.
static short OP_LOR
          Internal code for a token.
static short OP_NE
          Internal code for a token.
static short OP_SHL
          Internal code for a token.
static short OP_SHR
          Internal code for a token.
static short OP_SHRR
          Internal code for a token.
static short REAL
          Internal code for a token.
static short STRING
          Internal code for a token.
(package private)  boolean tracing
          Set to true if parsing actions should be traced.
static short TRUE
          Internal code for a token.
static short UNARY
          Internal code for a token.
static short UNDEFINED
          Internal code for a token.
(package private)  int verbosity
          Verbosity for error messages.
 
Constructor Summary
Parser(InputStream str)
          Create a parser for parsing input from an InputStream.
Parser(Reader rdr)
          Create a parser for parsing input from a Reader.
Parser(String str)
          Create a parser for parsing a String.
 
Method Summary
 int curColumn()
          Returns the current input column.
 int curLine()
          Returns the current input line.
 boolean enableTracing(boolean on)
          Turn debug tracing on or off.
 int getNextToken()
          Get and remove the "lookahead" token: the first token not yet consumed by the parser.
 int nextToken()
          Get the "lookahead" token: the first token not yet consumed by the parser.
 Object nextValue()
          Get the value associated with the "lookahead" token: the first token not yet consumed by the parser.
 Object parse()
          Check whether the the unconsumed input is a syntactically valid phrase according to the grammar.
 Object parse(boolean acceptPrefix)
          Check whether the the unconsumed input is a syntactically valid phrase according to the grammar.
(package private)  void printMessage(String msg)
          Print a message, decorated with the current line and column number.
 void reset(InputStream str)
          Supply a new source of input to this Parser.
 void reset(Reader rdr)
          Supply a new source of input to this Parser.
 void reset(String str)
          Supply a new source of input to this Parser.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR

public static final short ERROR
Internal code for a token.

See Also:
Constant Field Values

FALSE

public static final short FALSE
Internal code for a token.

See Also:
Constant Field Values

IDENTIFIER

public static final short IDENTIFIER
Internal code for a token.

See Also:
Constant Field Values

INTEGER

public static final short INTEGER
Internal code for a token.

See Also:
Constant Field Values

LEX_ERROR

public static final short LEX_ERROR
Internal code for a token.

See Also:
Constant Field Values

REAL

public static final short REAL
Internal code for a token.

See Also:
Constant Field Values

STRING

public static final short STRING
Internal code for a token.

See Also:
Constant Field Values

TRUE

public static final short TRUE
Internal code for a token.

See Also:
Constant Field Values

UNDEFINED

public static final short UNDEFINED
Internal code for a token.

See Also:
Constant Field Values

OP_LOR

public static final short OP_LOR
Internal code for a token.

See Also:
Constant Field Values

OP_LAND

public static final short OP_LAND
Internal code for a token.

See Also:
Constant Field Values

OP_EQ

public static final short OP_EQ
Internal code for a token.

See Also:
Constant Field Values

OP_NE

public static final short OP_NE
Internal code for a token.

See Also:
Constant Field Values

OP_IS

public static final short OP_IS
Internal code for a token.

See Also:
Constant Field Values

OP_ISNT

public static final short OP_ISNT
Internal code for a token.

See Also:
Constant Field Values

OP_LE

public static final short OP_LE
Internal code for a token.

See Also:
Constant Field Values

OP_GE

public static final short OP_GE
Internal code for a token.

See Also:
Constant Field Values

OP_SHL

public static final short OP_SHL
Internal code for a token.

See Also:
Constant Field Values

OP_SHR

public static final short OP_SHR
Internal code for a token.

See Also:
Constant Field Values

OP_SHRR

public static final short OP_SHRR
Internal code for a token.

See Also:
Constant Field Values

UNARY

public static final short UNARY
Internal code for a token.

See Also:
Constant Field Values

tracing

boolean tracing
Set to true if parsing actions should be traced.


acceptPrefix

boolean acceptPrefix
If true, accept when a prefix of the input matches.


verbosity

int verbosity
Verbosity for error messages. Values are: 0 - no messages 1 - only show message and line number 2 - also echo line in question 3 - also list tokens expected


errs

PrintStream errs
Place to send error messages. Default is System.err.

Constructor Detail

Parser

public Parser(Reader rdr)
Create a parser for parsing input from a Reader.

Parameters:
rdr - the source of the input characters.

Parser

public Parser(InputStream str)
Create a parser for parsing input from an InputStream.

Parameters:
str - the source of the input characters.

Parser

public Parser(String str)
Create a parser for parsing a String.

Parameters:
str - the source of the input characters.
Method Detail

parse

public Object parse(boolean acceptPrefix)
Check whether the the unconsumed input is a syntactically valid phrase according to the grammar. Parsing stops at the end of the input, or the first token that cannot be included in a prefix of a valid phrase according to the grammar. If "acceptPrefix" is false and an invalid token is encountered before the end of the input, an error occurs. An error is also signaled if "acceptPrefix" is true but the input preceding the invalid token is not a valid phrase according the the grammar.

If the input is already at end of file when this method is called, it silently returns null. If an error occurs, a message is printed by calling the user-supplied method error(String) and the result is null. On success, the return value is the "semantic value" assigned by semantic routines to the start symbol.

Parameters:
acceptPrefix - if true, the input does not to be completely consumed.
Returns:
the "semantic value" corresponding to the phrase found or null for errors or end-of-file.

parse

public Object parse()
Check whether the the unconsumed input is a syntactically valid phrase according to the grammar. This method is equivalent to parse(true).

Returns:
the "semantic value" corresponding to the phrase found or null for errors or end-of-file.

enableTracing

public boolean enableTracing(boolean on)
Turn debug tracing on or off. Debugging output goes to System.out.

Parameters:
on - if true, turn tracing on; otherwise turn it off.
Returns:
the previous value.

reset

public void reset(Reader rdr)
Supply a new source of input to this Parser.

Parameters:
rdr - the new source of input.

reset

public void reset(InputStream str)
Supply a new source of input to this Parser.

Parameters:
str - the new source of input.

reset

public void reset(String str)
Supply a new source of input to this Parser.

Parameters:
str - the new source of input.

curLine

public int curLine()
Returns the current input line.

Returns:
the current line number.

curColumn

public int curColumn()
Returns the current input column.

Returns:
the current line number.

nextToken

public int nextToken()
Get the "lookahead" token: the first token not yet consumed by the parser. The token is not removed from the input stream.

Returns:
the code for the next token.
See Also:
getNextToken()

nextValue

public Object nextValue()
Get the value associated with the "lookahead" token: the first token not yet consumed by the parser. The token is not removed from the input stream.

Returns:
the value associated with the next token.
See Also:
nextToken()

getNextToken

public int getNextToken()
Get and remove the "lookahead" token: the first token not yet consumed by the parser. The token is removed from the input stream.

Returns:
the code for the next token.
See Also:
getNextToken()

printMessage

void printMessage(String msg)
Print a message, decorated with the current line and column number.

Parameters:
msg - the message to print.