org.codehaus.groovy.syntax.parser
Class ExpressionStack

java.lang.Object
  extended byorg.codehaus.groovy.syntax.parser.ExpressionStack

public class ExpressionStack
extends Object

A combination stack and helper class for parsing groovy expression.

Expressions are a little trickier to parse than the statements above. As a result, we are now doing a hybrid LL/LR parse at the expression level.

Author:
Chris Poirier

Method Summary
 boolean canComplete()
          Returns true if the stack can be completed without further shifts.
 boolean isComplete()
          Returns true if the stack is in a state that can be considered a complete expression, provided lookahead is amenable, of course.
 String toString()
          Creates a string representation of the stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

isComplete

public boolean isComplete()
Returns true if the stack is in a state that can be considered a complete expression, provided lookahead is amenable, of course.


canComplete

public boolean canComplete()
Returns true if the stack can be completed without further shifts. Used by Parser.la(ExpressionStack) to determine when ambiguous tokens can't be read across a newline. The algorithm will guess true if it isn't sure. If it returns false, you can rely on that analysis.


toString

public String toString()
Creates a string representation of the stack.



Copyright © 2003-2005 The Codehaus. All Rights Reserved.