Java Doc for lalr_item.java in  » Parser » CUP-develop » java_cup » 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 » CUP develop » java_cup 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java_cup.lr_item_core
      java_cup.lalr_item

lalr_item
public class lalr_item extends lr_item_core (Code)
This class represents an LALR item. Each LALR item consists of a production, a "dot" at a position within that production, and a set of lookahead symbols (terminal). (The first two of these parts are provide by the super class). An item is designed to represent a configuration that the parser may be in. For example, an item of the form:
 [A ::= B * C d E  , {a,b,c}]
 
indicates that the parser is in the middle of parsing the production
 A ::= B C d E
 
that B has already been parsed, and that we will expect to see a lookahead of either a, b, or c once the complete RHS of this production has been found.

Items may initially be missing some items from their lookahead sets. Links are maintained from each item to the set of items that would need to be updated if symbols are added to its lookahead set. During "lookahead propagation", we add symbols to various lookahead sets and propagate these changes across these dependency links as needed.
See Also:   java_cup.lalr_item_set
See Also:   java_cup.lalr_state
version:
   last updated: 11/25/95
author:
   Scott Hudson



Field Summary
protected  terminal_set_lookahead
     The lookahead symbols of the item.
protected  Stack_propagate_items
     Links to items that the lookahead needs to be propagated to.
protected  booleanneeds_propagation
     Flag to indicate that this item needs to propagate its lookahead (whether it has changed or not).

Constructor Summary
public  lalr_item(production prod, int pos, terminal_set look)
     Full constructor.
public  lalr_item(production prod, terminal_set look)
     Constructor with default position (dot at start).
public  lalr_item(production prod)
     Constructor with default position and empty lookahead set.

Method Summary
public  voidadd_propagate(lalr_item prop_to)
     Add a new item to the set of items we propagate to.
public  terminal_setcalc_lookahead(terminal_set lookahead_after)
     Calculate lookahead representing symbols that could appear after the symbol that the dot is currently in front of.
public  booleanequals(lalr_item other)
     Equality comparison -- here we only require the cores to be equal since we need to do sets of items based only on core equality (ignoring lookahead sets).
public  booleanequals(Object other)
     Generic equality comparison.
public  inthashCode()
     Return a hash code -- here we only hash the core since we only test core matching in LALR items.
public  terminal_setlookahead()
     The lookahead symbols of the item.
public  booleanlookahead_visible()
     Determine if everything from the symbol one beyond the dot all the way to the end of the right hand side is nullable.
public  Stackpropagate_items()
    
public  voidpropagate_lookaheads(terminal_set incoming)
     Propagate incoming lookaheads through this item to others need to be changed.
public  lalr_itemshift()
     Produce the new lalr_item that results from shifting the dot one position to the right.
public  StringtoString()
     Convert to string.

Field Detail
_lookahead
protected terminal_set _lookahead(Code)
The lookahead symbols of the item.



_propagate_items
protected Stack _propagate_items(Code)
Links to items that the lookahead needs to be propagated to.



needs_propagation
protected boolean needs_propagation(Code)
Flag to indicate that this item needs to propagate its lookahead (whether it has changed or not).




Constructor Detail
lalr_item
public lalr_item(production prod, int pos, terminal_set look) throws internal_error(Code)
Full constructor.
Parameters:
  prod - the production for the item.
Parameters:
  pos - the position of the "dot" within the production.
Parameters:
  look - the set of lookahead symbols.



lalr_item
public lalr_item(production prod, terminal_set look) throws internal_error(Code)
Constructor with default position (dot at start).
Parameters:
  prod - the production for the item.
Parameters:
  look - the set of lookahead symbols.



lalr_item
public lalr_item(production prod) throws internal_error(Code)
Constructor with default position and empty lookahead set.
Parameters:
  prod - the production for the item.




Method Detail
add_propagate
public void add_propagate(lalr_item prop_to)(Code)
Add a new item to the set of items we propagate to.



calc_lookahead
public terminal_set calc_lookahead(terminal_set lookahead_after) throws internal_error(Code)
Calculate lookahead representing symbols that could appear after the symbol that the dot is currently in front of. Note: this routine must not be invoked before first sets and nullability has been calculated for all non terminals.



equals
public boolean equals(lalr_item other)(Code)
Equality comparison -- here we only require the cores to be equal since we need to do sets of items based only on core equality (ignoring lookahead sets).



equals
public boolean equals(Object other)(Code)
Generic equality comparison.



hashCode
public int hashCode()(Code)
Return a hash code -- here we only hash the core since we only test core matching in LALR items.



lookahead
public terminal_set lookahead()(Code)
The lookahead symbols of the item.



lookahead_visible
public boolean lookahead_visible() throws internal_error(Code)
Determine if everything from the symbol one beyond the dot all the way to the end of the right hand side is nullable. This would indicate that the lookahead of this item must be included in the lookaheads of all items produced as a closure of this item. Note: this routine should not be invoked until after first sets and nullability have been calculated for all non terminals.



propagate_items
public Stack propagate_items()(Code)
Links to items that the lookahead needs to be propagated to



propagate_lookaheads
public void propagate_lookaheads(terminal_set incoming) throws internal_error(Code)
Propagate incoming lookaheads through this item to others need to be changed.



shift
public lalr_item shift() throws internal_error(Code)
Produce the new lalr_item that results from shifting the dot one position to the right.



toString
public String toString()(Code)
Convert to string.



Fields inherited from java_cup.lr_item_core
protected int _core_hash_cache(Code)(Java Doc)
protected int _dot_pos(Code)(Java Doc)
protected symbol _symbol_after_dot(Code)(Java Doc)
protected production _the_production(Code)(Java Doc)

Methods inherited from java_cup.lr_item_core
public boolean core_equals(lr_item_core other)(Code)(Java Doc)
public int core_hashCode()(Code)(Java Doc)
public boolean dot_at_end()(Code)(Java Doc)
public non_terminal dot_before_nt()(Code)(Java Doc)
public int dot_pos()(Code)(Java Doc)
public boolean equals(lr_item_core other)(Code)(Java Doc)
public boolean equals(Object other)(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
protected int obj_hash()(Code)(Java Doc)
public lr_item_core shift_core() throws internal_error(Code)(Java Doc)
public symbol symbol_after_dot()(Code)(Java Doc)
public production the_production()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public String to_simple_string() throws internal_error(Code)(Java Doc)

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.