xtc.parser
Class Module

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

public class Module
extends Node

A grammar module.

Version:
$Revision: 1.19 $
Author:
Robert Grimm

Field Summary
 java.util.List<Attribute> attributes
          The optional attribute list.
 Action body
          The optional main action code.
 java.util.List<ModuleDependency> dependencies
          The optional list of Module dependencies.
 Comment documentation
          The option documentation comment.
 Action footer
          The optional final action code.
 Action header
          The optional initial action code.
 ModuleModification modification
          The auxiliary field referencing this module's module modification, if the list of dependencies contains it.
 ModuleName name
          The module name.
 ModuleList parameters
          The optional list of parameters.
 java.util.List<Production> productions
          The list of productions.
 
Constructor Summary
Module()
          Create a new grammar module.
Module(Comment documentation, ModuleName name, ModuleList parameters, java.util.List<ModuleDependency> dependencies, Action header, Action body, Action footer, java.util.List<Attribute> attributes, java.util.List<Production> productions)
          Create a new grammar module.
 
Method Summary
 java.lang.Object getAttributeValue(java.lang.String name)
          Get the value of the attribute with the specified name.
 java.lang.String getClassName()
          Get the class name for this grammar module.
 boolean hasAttribute(Attribute att)
          Determine whether this module has the specified attribute.
 boolean hasAttribute(java.lang.String name)
          Determine whether this module has an attribute with the specified name.
 
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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

documentation

public Comment documentation
The option documentation comment.


name

public ModuleName name
The module name.


parameters

public ModuleList parameters
The optional list of parameters.


dependencies

public java.util.List<ModuleDependency> dependencies
The optional list of Module dependencies.


modification

public ModuleModification modification
The auxiliary field referencing this module's module modification, if the list of dependencies contains it.


header

public Action header
The optional initial action code.


body

public Action body
The optional main action code.


footer

public Action footer
The optional final action code.


attributes

public java.util.List<Attribute> attributes
The optional attribute list. Note that while a module's attributes are represented as a list, they should be treated as a set.


productions

public java.util.List<Production> productions
The list of productions.

Constructor Detail

Module

public Module()
Create a new grammar module.


Module

public Module(Comment documentation,
              ModuleName name,
              ModuleList parameters,
              java.util.List<ModuleDependency> dependencies,
              Action header,
              Action body,
              Action footer,
              java.util.List<Attribute> attributes,
              java.util.List<Production> productions)
Create a new grammar module.

Parameters:
documentation - The documentation.
name - The module name.
parameters - The list of parameters.
dependencies - The list of dependencies.
header - The header.
body - The body.
footer - The footer.
attributes - The list of attributes.
productions - The list of productions.
Method Detail

hasAttribute

public boolean hasAttribute(Attribute att)
Determine whether this module has the specified attribute.

Parameters:
att - The attribute.
Returns:
true if this module has the specified attribute.

hasAttribute

public boolean hasAttribute(java.lang.String name)
Determine whether this module has an attribute with the specified name.

Parameters:
name - The name.
Returns:
true if this module has an attribute with the specified name.

getAttributeValue

public java.lang.Object getAttributeValue(java.lang.String name)
Get the value of the attribute with the specified name.

Parameters:
name - The name.
Returns:
The corresponding attribute's value.

getClassName

public java.lang.String getClassName()
Get the class name for this grammar module. If this grammar module has a parser attribute, the class name is the value of that attribute. Otherwise, it is the module name.

Returns:
The class name.


Copyright © 2012. All Rights Reserved.