condor.classad
Class ClassAdParser

java.lang.Object
  |
  +--condor.classad.ClassAdParser

public class ClassAdParser
extends Object

A factory for creating classad expressions (instances of Expr), by parsing a textual representation. Input can come from a String, a Reader, or an InputStream.

See Also:
ClassAd

Constructor Summary
ClassAdParser(InputStream str)
          Create a parser to parse input from an InputStream.
ClassAdParser(Reader rdr)
          Create a parser to parse input from a Reader.
ClassAdParser(String s)
          Create a parser to parse a string.
 
Method Summary
 boolean enableTracing(boolean on)
          Control whether the actions of the parser are traced.
 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()
          The the "value" of the lookahead token.
 Expr parse()
          Parse a classsad Expr from the current input stream.
 Query parseQuery()
          Parse a Query from the current input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassAdParser

public ClassAdParser(String s)
Create a parser to parse a string.
Parameters:
s - the string to be parsed.

ClassAdParser

public ClassAdParser(Reader rdr)
Create a parser to parse input from a Reader.
Parameters:
rdr - the reader that supplies the input.

ClassAdParser

public ClassAdParser(InputStream str)
Create a parser to parse input from an InputStream.
Parameters:
str - the InputStream that supplies the input.
Method Detail

parse

public Expr parse()
Parse a classsad Expr from the current input stream. The longest possible substring of the input representing a valid expression is parsed. The stream is left positioned so that the next token to be read is the first token (if any) not part of the expression parsed. For example, if the input stream contains
    a + b c
 
The first call to parse() will return "a+b" and a subsequent call will return "c".
Returns:
the parsed Expr or null on EOF or error.
See Also:
nextToken()

parseQuery

public Query parseQuery()
Parse a Query from the current input stream.
Returns:
the query

nextToken

public int nextToken()
Get the "lookahead" token: the first token not yet consumed by the parser. The result is an internal code. In the case of one-charcter tokens, the code is the same as the integer value of the character. The code 0 means end-of-file. The token is not removed from the input stream.
Returns:
the code for the next token.
See Also:
getNextToken()

nextValue

public Object nextValue()
The the "value" of the lookahead token.
Returns:
the value
See Also:
nextToken()

getNextToken

public int getNextToken()
Get and remove the "lookahead" token: the first token not yet consumed by the parser. The result is an internal code. In the case of one-charcter tokens, the code is the same as the integer value of the character. The code 0 means end-of-file. The token is removed from the input stream.
Returns:
the code for the next token.
See Also:
getNextToken()

enableTracing

public boolean enableTracing(boolean on)
Control whether the actions of the parser are traced. The default is not to trace.
Parameters:
on - if true, turn on tracing; if false, turn it off.
Returns:
the previous value of the tracing flag.