Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.trapezium.vrml.grammar
Class VRML97parser  view VRML97parser download VRML97parser.java

java.lang.Object
  extended bycom.trapezium.vrml.grammar.VRML97parser

public class VRML97parser
extends java.lang.Object

Main class for parsing a VRML 2.0 file. A Scene is the root of a VRML element hierarchy. This is a simple hierarchy where each VrmlElement may or may not have children. Much of the additional functionality required is implemented by using the "Visitor Pattern" on this hierarchy. This pattern encapsulates features in the visitor objects. Within the SceneRule factory, the above parameters eventually turn into a Token enumerator, and the Scene is constructed as follows: TokenEnumerator tokenEnumerator = ... Scene scene = new Scene( fileUrl, tokenEnumerator ); VRML97parser parser = new VRML97parser(); parser.Build( tokenEnumerator, scene ); The convention followed by this and all other grammar rules is that a static public "Build" method is used to add children to an object. The SceneRule handles the following portion of the grammar from the VRML 2.0 spec: vrmlScene ::= statements ; statements ::= statement | statement statements | empty ;

Since:
1.0
Version:
1.12, 2 April 1998, allow inclusion of first token in parsing, 1.1, 21 Jan 1998

Field Summary
(package private)  NodeRule nodeRule
           
static VRML97parser singleton
           
(package private)  StatementRule statementRule
           
 
Constructor Summary
VRML97parser()
          Parser with no DEFNameFactory and no error reporting limits
VRML97parser(DEFNameFactory defNameFactory)
          Parser with an optional DEFNameFactory for generating DEF names.
 
Method Summary
 void Build(com.trapezium.parse.TokenEnumerator v, com.trapezium.vrml.Scene scene)
          Apply the SceneRule to update the Scene.
 void Build(com.trapezium.parse.TokenEnumerator v, com.trapezium.vrml.Scene scene, int startToken)
          Build Scene, startToken needed for dynamic generation.
(package private)  void Build(com.trapezium.parse.TokenEnumerator v, com.trapezium.vrml.Scene scene, com.trapezium.vrml.VrmlElement parent, java.lang.String terminator)
          Build either an embedded Scene (for PROTOs), or a Scene from a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeRule

NodeRule nodeRule

statementRule

StatementRule statementRule

singleton

public static VRML97parser singleton
Constructor Detail

VRML97parser

public VRML97parser()
Parser with no DEFNameFactory and no error reporting limits


VRML97parser

public VRML97parser(DEFNameFactory defNameFactory)
Parser with an optional DEFNameFactory for generating DEF names. If the "Build" method gets called with a Scene that also has a DEFNameFactory, that DEFNameFactory will replace the VRML97parser DEFNameFactory.

Method Detail

Build

public void Build(com.trapezium.parse.TokenEnumerator v,
                  com.trapezium.vrml.Scene scene)
Apply the SceneRule to update the Scene.


Build

public void Build(com.trapezium.parse.TokenEnumerator v,
                  com.trapezium.vrml.Scene scene,
                  int startToken)
Build Scene, startToken needed for dynamic generation. Normally this is 0, which is the header, which is not ignored by the parsing. For dynamically generated Nodes, with no header, this is set to -1 so that first token is not ignored in parsing.


Build

void Build(com.trapezium.parse.TokenEnumerator v,
           com.trapezium.vrml.Scene scene,
           com.trapezium.vrml.VrmlElement parent,
           java.lang.String terminator)
Build either an embedded Scene (for PROTOs), or a Scene from a file. If the "terminator" is a "}", we are building an embedded Scene.