xtc.parser
Class PParserState

java.lang.Object
  extended by xtc.parser.PParserState
All Implemented Interfaces:
State

public class PParserState
extends java.lang.Object
implements State

Parser state for parsing Rats! grammars. Note that this class supports only a single state-modifying transaction. In other words, calls to start(), commit(), and abort() cannot be nested within each other.

Version:
$Revision: 1.5 $
Author:
Robert Grimm

Constructor Summary
PParserState()
          Create a new packrat parser state object.
 
Method Summary
 void abort()
          Abort a state-modifying transaction.
 void close()
          Record a closing brace.
 void commit()
          Commit a state-modifying transaction.
 void content()
          Record any character besides spaces.
 java.util.List<java.lang.Integer> indentations()
          Retrieve the list of indentation levels.
 void newline()
          Record a newline.
 void open()
          Record an opening brace.
 void reset(java.lang.String file)
          Reset the global state object.
 void start()
          Start a new state-modifying transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PParserState

public PParserState()
Create a new packrat parser state object.

Method Detail

reset

public void reset(java.lang.String file)
Description copied from interface: State
Reset the global state object. This method is called at the beginning of each method representing a production with the resetting attribute.

Specified by:
reset in interface State
Parameters:
file - The file name.

start

public void start()
Description copied from interface: State
Start a new state-modifying transaction. This method is called at the beginning of each method representing a production with the stateful attribute.

Specified by:
start in interface State

commit

public void commit()
Description copied from interface: State
Commit a state-modifying transaction. This method is called on a successful parse before returning from a method representing a production with the stateful attribute.

Specified by:
commit in interface State

abort

public void abort()
Description copied from interface: State
Abort a state-modifying transaction. This method is called on an erroneous parse before returning from a method representing a production with the stateful attribute.

Specified by:
abort in interface State

open

public void open()
Record an opening brace.


content

public void content()
Record any character besides spaces.


newline

public void newline()
Record a newline.


close

public void close()
Record a closing brace.


indentations

public java.util.List<java.lang.Integer> indentations()
Retrieve the list of indentation levels. The list contains one entry per invocation of newline() since the last invocation of start().

Returns:
The list of indentation levels.


Copyright © 2012. All Rights Reserved.