Java Doc for ParserBase.java in  » Parser » Rats-Parser-Generators » xtc » 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 » Rats Parser Generators » xtc.parser 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   xtc.parser.ParserBase

All known Subclasses:   xtc.lang.jeannie.DebuggerParser,  xtc.xform.XFormParser,  xtc.typical.TypicalParser,  xtc.lang.jeannie.JeannieParser,  xtc.lang.p2.Parser,  xtc.lang.JavaFiveReader,  xtc.parser.PParser,  xtc.lang.JavaFiveParser,  xtc.lang.JavaReader,  xtc.lang.jeannie.PreJeannieParser,  xtc.lang.JavaParser,  xtc.lang.CFactoryParser,  xtc.lang.TypedLambdaParser,  xtc.lang.JavaRecognizer,  xtc.lang.CParser,  xtc.lang.CReader,  xtc.lang.c4.C4Parser,  xtc.lang.JavaFactoryParser,
ParserBase
abstract public class ParserBase (Code)
The base class for packrat parsers.
author:
   Robert Grimm
version:
   $Revision: 1.17 $


Field Summary
final public static  intFIRST_COLUMN
     The start index for columns.
final public static  intFIRST_LINE
     The start index for lines.
final public static  intINCR_SIZE
     The increment for the arrays storing the memoization table's columns.
final public static  intINIT_SIZE
     The default size for the arrays storing the memoization table's columns.
final public static  StringNEWLINE
     The platform's line separator.
protected  Column[]yyColumns
     The memoization table columns.
protected  intyyCount
     The number of characters consumed from the character stream.
protected  char[]yyData
     The characters consumed so far.
protected  booleanyyEOF
     The flag for whether the end-of-file has been reached.
protected  ReaderyyReader
     The reader for the character stream to be parsed.

Constructor Summary
public  ParserBase(Reader reader, String file)
     Create a new parser base.
public  ParserBase(Reader reader, String file, int size)
     Create a new parser base.

Method Summary
final protected  Tapply(Pair<Action<T>> actions, T seed)
     Apply the specified actions on the specified seed.
final protected  Tapply(Pair<Action<T>> actions, T seed, int index)
     Apply the specified actions on the specified seed while also setting the results' locations.
final protected static  Tcast(Object o)
     Cast the specified object.
final protected static  Pair<T>cast(Pair p)
     Cast the list starting at the specified pair.
final protected  intcharacter(int index)
     Parse a character at the specified index.
Parameters:
  index - The index.
final protected  Columncolumn(int index)
     Get the column at the specified index.
final protected  Stringdifference(int start, int end)
     Get the difference between the specified indices.
Parameters:
  start - The start index.
Parameters:
  end - The end index.
final public  Stringformat(ParseError error)
     Format the specified parse error.
final public  booleanisEOF(int index)
     Determine whether the specified index represents the end-of-file.
Parameters:
  index - The index.
final public  StringlineAt(int index)
     Get the line at the specified index.
Parameters:
  index - The index.
final public  Locationlocation(int index)
     Get the location for the specified index.
Parameters:
  index - The index.
abstract protected  ColumnnewColumn()
     Create a new column.
final protected  Stringpeek(int index)
     Get the next few characters from the specified index.
Parameters:
  index - The index.
final public  voidresetTo(int index)
     Reset this parser to the specified index.
final protected  voidsetLocation(int index, String file, int line, int column)
     Set the location for the specified index.
final public  voidsetLocation(Locatable locatable, int index)
     Set the location for the specified locatable object.
final public  voidsignal(ParseError error)
     Signal the specified parse error as a parse exception.
final public  Objectvalue(Result r)
     Extract the specified result's value.

Field Detail
FIRST_COLUMN
final public static int FIRST_COLUMN(Code)
The start index for columns. Note that this constant mirrors xtc.Constants.FIRST_COLUMN to avoid parsers depending on that class.



FIRST_LINE
final public static int FIRST_LINE(Code)
The start index for lines. Note that this constant mirrors xtc.Constants.FIRST_LINE to avoid parsers depending on that class.



INCR_SIZE
final public static int INCR_SIZE(Code)
The increment for the arrays storing the memoization table's columns.



INIT_SIZE
final public static int INIT_SIZE(Code)
The default size for the arrays storing the memoization table's columns.



NEWLINE
final public static String NEWLINE(Code)
The platform's line separator.



yyColumns
protected Column[] yyColumns(Code)
The memoization table columns.



yyCount
protected int yyCount(Code)
The number of characters consumed from the character stream.



yyData
protected char[] yyData(Code)
The characters consumed so far.



yyEOF
protected boolean yyEOF(Code)
The flag for whether the end-of-file has been reached.



yyReader
protected Reader yyReader(Code)
The reader for the character stream to be parsed.




Constructor Detail
ParserBase
public ParserBase(Reader reader, String file)(Code)
Create a new parser base.
Parameters:
  reader - The reader for the character stream to be parsed.
Parameters:
  file - The name of the file backing the character stream.
throws:
  NullPointerException - Signals a null file name.



ParserBase
public ParserBase(Reader reader, String file, int size)(Code)
Create a new parser base.
Parameters:
  reader - The reader for the character stream to be parsed.
Parameters:
  file - The name of the file backing the character stream.
Parameters:
  size - The length of the character stream.
throws:
  NullPointerException - Signals a null file name.
throws:
  IllegalArgumentException - Signals a negative file size.




Method Detail
apply
final protected T apply(Pair<Action<T>> actions, T seed)(Code)
Apply the specified actions on the specified seed. This method applies all xtc.util.Action actions on the specified list, using the result of the previous action as the argument to the next action. The argument to the first action is the specified seed. If the specified list is empty, this method simply returns the specified seed.
Parameters:
  actions - The actions to apply.
Parameters:
  seed - The initial argument. The result of applying the actions.



apply
final protected T apply(Pair<Action<T>> actions, T seed, int index)(Code)
Apply the specified actions on the specified seed while also setting the results' locations. This method applies all xtc.util.Action actions on the specified list, using the result of the previous action as the argument to the next action. For the result of each application, it also sets the location. The argument to the first action is the specified seed. If the specified list is empty, this method simply returns the specified seed.
Parameters:
  actions - The actions to apply.
Parameters:
  seed - The initial argument.
Parameters:
  index - The index representing the current parser location. The result of applying the actions.



cast
final protected static T cast(Object o)(Code)
Cast the specified object. This method is used to avoid spurious compiler warnings for parsers utilizing generic types.
Parameters:
  o - The object. The cast object.



cast
final protected static Pair<T> cast(Pair p)(Code)
Cast the list starting at the specified pair. This method is used to avoid spurious compiler warnings for parsers utilizing generic types.
Parameters:
  p - The list. The cast list.



character
final protected int character(int index) throws IOException(Code)
Parse a character at the specified index.
Parameters:
  index - The index. The character or -1 if the end-of-file has been reached.
throws:
  IOException - Signals an exceptional condition while accessing the characterstream.



column
final protected Column column(int index)(Code)
Get the column at the specified index. If the column at the specified index has not been created yet, it is created as a side-effect of calling this method.
Parameters:
  index - The index. The corresponding column.
throws:
  IndexOutOfBoundsException - Signals an invalid index.



difference
final protected String difference(int start, int end)(Code)
Get the difference between the specified indices.
Parameters:
  start - The start index.
Parameters:
  end - The end index. The difference as a string.



format
final public String format(ParseError error) throws IOException(Code)
Format the specified parse error. The specified error must have been created by this parser.
Parameters:
  error - The error. The corresponding error message.
throws:
  IOException - Signals an I/O error while creating the errormessage.



isEOF
final public boolean isEOF(int index)(Code)
Determine whether the specified index represents the end-of-file.
Parameters:
  index - The index. true if the specified index represents EOF.



lineAt
final public String lineAt(int index) throws IOException(Code)
Get the line at the specified index.
Parameters:
  index - The index. The corresponding line, without any line terminatingcharacters.
throws:
  IndexOutOfBoundsException - Signals an invalid index.
throws:
  IOException - Signals an I/O error.



location
final public Location location(int index)(Code)
Get the location for the specified index.
Parameters:
  index - The index. The corresponding location.



newColumn
abstract protected Column newColumn()(Code)
Create a new column. A concrete implementation of this method should simply return a new memoization table column. A new memoization table column.



peek
final protected String peek(int index)(Code)
Get the next few characters from the specified index.
Parameters:
  index - The index. The next few characters.



resetTo
final public void resetTo(int index)(Code)
Reset this parser to the specified index. This method discards the input and all memoized intermediate results up to and excluding the specified index. The index should be determined by accessing SemanticValue.index from a previous, successful parse (i.e., the result must be a SemanticValue semantic value ).
Parameters:
  index - The index.
throws:
  IndexOutOfBoundsException - Signals an invalid index.



setLocation
final protected void setLocation(int index, String file, int line, int column)(Code)
Set the location for the specified index. This method updates the internal location based on, for example, a line marker recognized by the parser.

This method must be called before any nodes are created for positions at or beyond the specified index — unless the specified file, line, and column are the same as the internal location for the index. The line number may be one less than the start index for lines ( ParserBase.FIRST_LINE ), to account for a line marker being present in the input. The column number is generally be expected to be the start index for columns ( ParserBase.FIRST_COLUMN ), again accounting for a line marker being present in the input.
Parameters:
  index - The index.
Parameters:
  file - The new file name.
Parameters:
  line - The new line number.
Parameters:
  column - The new column number.
throws:
  NullPointerException - Signals a null file name.
throws:
  IllegalArgumentException - Signals an invalid line orcolumn number.
throws:
  IndexOutOfBoundsException - Signals an invalid index.
throws:
  IllegalStateException - Signals that the index comes at orbefore any memoized results.




setLocation
final public void setLocation(Locatable locatable, int index)(Code)
Set the location for the specified locatable object. This method is equivalent to:
 if ((null != locatable) && (! locatable.hasLocation())) {
 locatable.setLocation(location(index));
 }
 

Parameters:
  locatable - The locatable object.
Parameters:
  index - The index.



signal
final public void signal(ParseError error) throws ParseException, IOException(Code)
Signal the specified parse error as a parse exception. The specified error must have been created by this parser.
Parameters:
  error - The parse error.
throws:
  ParseException - Signals the error.
throws:
  IOException - Signals an I/O error while creating theexception's detail message.



value
final public Object value(Result r) throws ParseException, IOException(Code)
Extract the specified result's value. If the result is a SemanticValue , this method returns the actual value; if it is a ParseError , it signals a parse exception with the corresponding message. The specified result must have been created by this parser.
Parameters:
  r - The result. The corresponding value.
throws:
  ParseException - Signals that the result represents a parseerror.
throws:
  IOException - Signals an I/O error while creating the parseerror's detail message.



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.