edu.stanford.slac.aida.lib.util.common
Class AQSLex

java.lang.Object
  extended by edu.stanford.slac.aida.lib.util.common.AQSLex

public class AQSLex
extends java.lang.Object

Analyses AQS (AIDA Query Strings) and returns AQSTokens corresponding to the characters read. Succesive calls to the getToken() method will return the next token mark() and rollback(mark) are supported with the respective methods unGetToken() rollsback to the last token

Version:
26-Feb-2007, Bob Hall (rdh): Added new method getInstanceToken.
Author:
George McIntyre
See Also:
AQSToken

Constructor Summary
AQSLex(java.lang.String target)
          Creates a new instance of AQSLex AQS lexical analyser
 
Method Summary
 AQSToken getInstanceToken()
          Gets the next Token until end of target for instance names.
 AQSToken getToken()
          Gets the next Token until end of target.
 int mark()
          Mark current point in input stream for latter rollback.
 void rollback(int mark)
          Rollback to given mark.
 void unGetToken()
          Unget token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AQSLex

public AQSLex(java.lang.String target)
Creates a new instance of AQSLex AQS lexical analyser

Parameters:
target - AQS target string specification to be lexically analysed
Method Detail

getInstanceToken

public AQSToken getInstanceToken()
Gets the next Token until end of target for instance names. This method was created to allow instance names that have non-leading parsing tokens, such as "+" and "-".

Returns:
AQSToken object containing the next token parsed from the target string or pulled from the lookahead stack
See Also:
AQSToken

getToken

public AQSToken getToken()
Gets the next Token until end of target.

Returns:
AQSToken object containing the next token parsed from the target string or pulled from the lookahead stack
See Also:
AQSToken

unGetToken

public void unGetToken()
Unget token. Pushes the last token onto the readahead stack and continues.

See Also:
stack

mark

public int mark()
Mark current point in input stream for latter rollback.

Returns:
The mark ID. This is the ID to be passed to the rollback function to rollback the context to this point. In this implementation it is simply the size of the forwardStack.
See Also:
stack, forwardStack

rollback

public void rollback(int mark)
Rollback to given mark.

Parameters:
mark - Mark ID. This is a valid mark identifier returned from a call to mark(). It is used to locate the desired rollback context.