xtc.parser
Class Grammar

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

public class Grammar
extends Node

A grammar represented as a collection of modules.

Version:
$Revision: 1.26 $
Author:
Robert Grimm

Field Summary
 java.util.List<Module> modules
          The list of modules.
 
Constructor Summary
Grammar(java.util.List<Module> modules)
          Create a new grammar.
 
Method Summary
 void remove(Module module)
          Remove the specified module from this grammar.
 void replace(Module oldModule, Module newModule)
          Replace the specified module.
 
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

modules

public java.util.List<Module> modules
The list of modules. The first module in this list is the grammar's main module and the following modules are all the dependent modules.

Constructor Detail

Grammar

public Grammar(java.util.List<Module> modules)
Create a new grammar.

Parameters:
modules - The list of modules.
Method Detail

remove

public void remove(Module module)
Remove the specified module from this grammar. This method uses reference equality to locate the module to replace.

Parameters:
module - The module.
Throws:
java.lang.IllegalArgumentException - Signals that the specified module is not part of this grammar.

replace

public void replace(Module oldModule,
                    Module newModule)
Replace the specified module. This method uses reference equality to locate the module to replace.

Parameters:
oldModule - The old module.
newModule - The new module.
Throws:
java.lang.IllegalArgumentException - Signals that the specified old module is not part of this grammar.


Copyright © 2012. All Rights Reserved.