xtc.parser
Class Action

java.lang.Object
  extended by xtc.tree.Node
      extended by xtc.parser.Element
          extended by xtc.parser.Action
All Implemented Interfaces:
java.lang.Iterable<java.lang.Object>, Locatable

public class Action
extends Element

A semantic action.

Version:
$Revision: 1.22 $
Author:
Robert Grimm

Nested Class Summary
 
Nested classes/interfaces inherited from class xtc.parser.Element
Element.Tag
 
Field Summary
 java.util.List<java.lang.String> code
          The list of source lines for the semantic action.
 java.util.List<java.lang.Integer> indent
          The list of indentation levels, one per line of code.
 
Constructor Summary
Action(java.util.List<java.lang.String> code, java.util.List<java.lang.Integer> indent)
          Create a new action with the specified code.
Action(java.lang.String s, java.util.List<java.lang.Integer> indent)
          Create a new action with the specified code.
 
Method Summary
 void add(Action a)
          Add the specified action to this action.
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean setsValue()
          Determine whether this action sets the semantic value.
 Element.Tag tag()
          Get this element's tag.
 
Methods inherited from class xtc.tree.Node
add, add, addAll, addAll, addAll, addAll, addAllTo, addNode, contains, get, getBoolean, getBooleanProperty, getGeneric, getList, getLocation, getName, getNode, getProperty, getString, getStringProperty, getTokenText, hasLocation, hasName, hasProperty, hasTraversal, hasVariable, indexOf, isAnnotation, isEmpty, isGeneric, isList, isToken, iterator, lastIndexOf, properties, remove, removeProperty, set, setLocation, setLocation, setProperty, size, strip, toAnnotation, toList, toString, toToken, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

code

public final java.util.List<java.lang.String> code
The list of source lines for the semantic action. Note that each source line is a string without the terminating end-of-line character(s).


indent

public final java.util.List<java.lang.Integer> indent
The list of indentation levels, one per line of code. Note that this list must be at least as long as the list of source lines.

Constructor Detail

Action

public Action(java.lang.String s,
              java.util.List<java.lang.Integer> indent)
Create a new action with the specified code. The specified string is broken up into individual lines, removing all end-of-line characters along the way.

Parameters:
s - The code as a string.
indent - The list of indentation levels, one per line in the specified string.
Throws:
java.lang.IllegalArgumentException - Signals that indent is too short.

Action

public Action(java.util.List<java.lang.String> code,
              java.util.List<java.lang.Integer> indent)
Create a new action with the specified code.

Parameters:
code - The code as a list source lines.
indent - The corresponding indentation levels.
Throws:
java.lang.IllegalArgumentException - Signals that the number of code lines is inconsistent with the number of indentation levels.
Method Detail

tag

public Element.Tag tag()
Description copied from class: Element
Get this element's tag.

Specified by:
tag in class Element
Returns:
The tag.

add

public void add(Action a)
Add the specified action to this action.

Parameters:
a - The action to add.

setsValue

public boolean setsValue()
Determine whether this action sets the semantic value. This method implements a conservative approximation by searching for occurrences of the corresponding variable name.

Returns:
true if this action sets the semantic value.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright © 2012. All Rights Reserved.