Java Doc for Analyzer.java in  » Parser » grammatica » net » percederberg » grammatica » parser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Parser » grammatica » net.percederberg.grammatica.parser 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.percederberg.grammatica.parser.Analyzer

All known Subclasses:   net.percederberg.grammatica.GrammarAnalyzer,  net.percederberg.grammatica.test.ArithmeticAnalyzer,  net.percederberg.grammatica.test.RegexpAnalyzer,  net.percederberg.grammatica.TreePrinter,
Analyzer
public class Analyzer (Code)
A parse tree analyzer. This class provides callback methods that may be used either during parsing, or for a parse tree traversal. This class should be subclassed to provide adequate handling of the parse tree nodes. The general contract for the analyzer class does not guarantee a strict call order for the callback methods. Depending on the type of parser, the enter() and exit() methods for production nodes can be called either in a top-down or a bottom-up fashion. The only guarantee provided by this API, is that the calls for any given node will always be in the order enter(), child(), and exit(). If various child() calls are made, they will be made from left to right as child nodes are added (to the right).
author:
   Per Cederberg,
version:
   1.1



Constructor Summary
public  Analyzer()
     Creates a new parse tree analyzer.

Method Summary
public  Nodeanalyze(Node node)
     Analyzes a parse tree node by traversing all it's child nodes.
protected  voidchild(Production node, Node child)
     Called when adding a child to a parse tree node.
protected  voidenter(Node node)
     Called when entering a parse tree node.
protected  Nodeexit(Node node)
     Called when exiting a parse tree node.
protected  NodegetChildAt(Node node, int pos)
     Returns a child at the specified position.
protected  ArrayListgetChildValues(Node node)
     Returns all the node values for all child nodes.
protected  NodegetChildWithId(Node node, int id)
     Returns the first child with the specified id.
protected  intgetIntValue(Node node, int pos)
     Returns the node integer value at the specified position.
protected  StringgetStringValue(Node node, int pos)
     Returns the node string value at the specified position.
protected  ObjectgetValue(Node node, int pos)
     Returns the node value at the specified position.


Constructor Detail
Analyzer
public Analyzer()(Code)
Creates a new parse tree analyzer.




Method Detail
analyze
public Node analyze(Node node) throws ParserLogException(Code)
Analyzes a parse tree node by traversing all it's child nodes. The tree traversal is depth-first, and the appropriate callback methods will be called. If the node is a production node, a new production node will be created and children will be added by recursively processing the children of the specified production node. This method is used to process a parse tree after creation.
Parameters:
  node - the parse tree node to process the resulting parse tree node
throws:
  ParserLogException - if the node analysis discovered errors



child
protected void child(Production node, Node child) throws ParseException(Code)
Called when adding a child to a parse tree node. By default this method adds the child to the production node. A subclass can override this method to handle each node separately. Note that the child node may be null if the corresponding exit() method returned null.
Parameters:
  node - the parent node
Parameters:
  child - the child node, or null
throws:
  ParseException - if the node analysis discovered errors



enter
protected void enter(Node node) throws ParseException(Code)
Called when entering a parse tree node. By default this method does nothing. A subclass can override this method to handle each node separately.
Parameters:
  node - the node being entered
throws:
  ParseException - if the node analysis discovered errors



exit
protected Node exit(Node node) throws ParseException(Code)
Called when exiting a parse tree node. By default this method returns the node. A subclass can override this method to handle each node separately. If no parse tree should be created, this method should return null.
Parameters:
  node - the node being exited the node to add to the parse tree, ornull if no parse tree should be created
throws:
  ParseException - if the node analysis discovered errors



getChildAt
protected Node getChildAt(Node node, int pos) throws ParseException(Code)
Returns a child at the specified position. If either the node or the child node is null, this method will throw a parse exception with the internal error type.
Parameters:
  node - the parent node
Parameters:
  pos - the child position the child node
throws:
  ParseException - if either the node or the child node was null



getChildValues
protected ArrayList getChildValues(Node node)(Code)
Returns all the node values for all child nodes.
Parameters:
  node - the parse tree node a list with all the child node values
since:
   1.3



getChildWithId
protected Node getChildWithId(Node node, int id) throws ParseException(Code)
Returns the first child with the specified id. If the node is null, or no child with the specified id could be found, this method will throw a parse exception with the internal error type.
Parameters:
  node - the parent node
Parameters:
  id - the child node id the child node
throws:
  ParseException - if the node was null, or a child node couldn't be found



getIntValue
protected int getIntValue(Node node, int pos) throws ParseException(Code)
Returns the node integer value at the specified position. If either the node is null, or the value is not an instance of the Integer class, this method will throw a parse exception with the internal error type.
Parameters:
  node - the parse tree node
Parameters:
  pos - the child position the value object
throws:
  ParseException - if either the node was null, or the value wasn't an integer



getStringValue
protected String getStringValue(Node node, int pos) throws ParseException(Code)
Returns the node string value at the specified position. If either the node is null, or the value is not an instance of the String class, this method will throw a parse exception with the internal error type.
Parameters:
  node - the parse tree node
Parameters:
  pos - the child position the value object
throws:
  ParseException - if either the node was null, or the value wasn't a string



getValue
protected Object getValue(Node node, int pos) throws ParseException(Code)
Returns the node value at the specified position. If either the node or the value is null, this method will throw a parse exception with the internal error type.
Parameters:
  node - the parse tree node
Parameters:
  pos - the child position the value object
throws:
  ParseException - if either the node or the value was null



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.