Java Doc for SerializedParser.java in  » Parser » runcc » fri » patterns » interpreter » parsergenerator » builder » 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 » runcc » fri.patterns.interpreter.parsergenerator.builder 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   fri.patterns.interpreter.parsergenerator.builder.SerializedObject
      fri.patterns.interpreter.parsergenerator.builder.SerializedParser

SerializedParser
public class SerializedParser extends SerializedObject (Code)
This class is definitely the shortest way to construct a Parser (with Lexer) for a Syntax. It uses all serialization utils in this package to quickly build a parsing environment. This factory accepts a syntax where parser and lexer rules were mixed.

Example (syntax input from a file):

 File ebnfFile = new File("MySyntax.syntax");
 Parser parser = new SerializedParser().get(ebnfFile);
 
or (syntax input from a Reader, must pass a filename):
 Reader ebnfReader = new InputStreamReader(MySyntaxSemantic.class.getResourceAsStream("MySyntax.syntax"));
 Parser parser = new SerializedParser().get(ebnfReader, "MySyntax");
 

author:
   (c) 2002, Fritz Ritzberger


Field Summary
final public static  StringPARSERFILE_SUFFIX
     The suffix for serialized Parser files.
protected  booleanPRODUCTION
    

Constructor Summary
public  SerializedParser()
     Create a Parser factory that caches built Lexers.
public  SerializedParser(boolean production)
     Create a Parser factory that caches built Lexers.

Method Summary
public  Parserget(Object syntaxInput)
     Builds the Parser from scratch if not found its parts in filesystem, else loads all serialized parts.
Parameters:
  syntaxInput - the mixed lexer/parser syntax as File, InputStream, List of Lists, String [][] or Syntax.
public  Parserget(Object syntaxInput, String baseName)
     Builds the Parser from scratch if not found its parts in filesystem, else loads all serialized parts.
public  Parserget(Class parserType, Object syntaxInput)
     Builds the Parser from scratch if not found its parts in filesystem, else loads all serialized parts.
Parameters:
  parserType - the class of ParserTables to create for the syntax (LALRParserTables.class is default).
Parameters:
  syntaxInput - the mixed lexer/parser syntax as File, InputStream, List of Lists, String [][] or Syntax.
public  Parserget(Class parserType, Object syntaxInput, String baseName)
     Builds the parsing environment from scratch if not found its parts in filesystem, else loads all serialized parts.
public static  voidmain(String[] args)
     Test main.
protected  SerializedLexernewSerializedLexer()
     To be overridden when a modified SerializedLexer is needed.

Field Detail
PARSERFILE_SUFFIX
final public static String PARSERFILE_SUFFIX(Code)
The suffix for serialized Parser files.



PRODUCTION
protected boolean PRODUCTION(Code)




Constructor Detail
SerializedParser
public SerializedParser()(Code)
Create a Parser factory that caches built Lexers.



SerializedParser
public SerializedParser(boolean production)(Code)
Create a Parser factory that caches built Lexers. @param production when false the Parser will not be serialized.




Method Detail
get
public Parser get(Object syntaxInput) throws Exception(Code)
Builds the Parser from scratch if not found its parts in filesystem, else loads all serialized parts.
Parameters:
  syntaxInput - the mixed lexer/parser syntax as File, InputStream, List of Lists, String [][] or Syntax. Parser, built from scratch or loaded from filesystem.



get
public Parser get(Object syntaxInput, String baseName) throws Exception(Code)
Builds the Parser from scratch if not found its parts in filesystem, else loads all serialized parts.
Parameters:
  syntaxInput - the mixed lexer/parser syntax as File, InputStream, List of Lists, String [][] or Syntax.
Parameters:
  baseName - basename for serialization, can be null Parser, built from scratch or loaded from filesystem.



get
public Parser get(Class parserType, Object syntaxInput) throws Exception(Code)
Builds the Parser from scratch if not found its parts in filesystem, else loads all serialized parts.
Parameters:
  parserType - the class of ParserTables to create for the syntax (LALRParserTables.class is default).
Parameters:
  syntaxInput - the mixed lexer/parser syntax as File, InputStream, List of Lists, String [][] or Syntax. Parser, built from scratch or loaded from filesystem.



get
public Parser get(Class parserType, Object syntaxInput, String baseName) throws Exception(Code)
Builds the parsing environment from scratch if not found its parts in filesystem, else loads all serialized parts.
Parameters:
  parserType - the class of ParserTables to create for the syntax (LALRParserTables.class is default).
Parameters:
  syntaxInput - the mixed lexer/parser syntax as File, InputStream, List of Lists, String [][] or Syntax.
Parameters:
  baseName - basename for serialization, can be null Parser, built from scratch or loaded from filesystem.



main
public static void main(String[] args)(Code)
Test main. Building serialized Java Parser takes 740, building from scratch takes 4000 millis.



newSerializedLexer
protected SerializedLexer newSerializedLexer() throws Exception(Code)
To be overridden when a modified SerializedLexer is needed.



Methods inherited from fri.patterns.interpreter.parsergenerator.builder.SerializedObject
public static String baseNameFromSyntax(Object syntaxInput)(Code)(Java Doc)
protected String ensureDirectory(String fileName)(Code)(Java Doc)
protected String makeFilePath(String fileName)(Code)(Java Doc)
protected Object read(String fileName)(Code)(Java Doc)
public static Syntax toSyntax(Object syntaxInput) throws Exception(Code)(Java Doc)
protected boolean write(String fileName, Object o)(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.