| java.lang.Object fri.patterns.interpreter.parsergenerator.builder.SerializedObject fri.patterns.interpreter.parsergenerator.builder.SerializedTables
SerializedTables | public class SerializedTables extends SerializedObject (Code) | | Buffering ParserTables. SerializedParserTables will build the ParserTables from scratch
only the first time. Every following call will load the serialized ParserTables
from filesystem.
The time to build parser tables from scratch is less or equal to deserializing it
for little syntaxes. Use it only for big tables (e.g. for Java syntax).
Mind that this factory accepts a parser syntax, NOT a syntax where parser and lexer rules were mixed!
Example (with syntax input from a file):
File syntaxInput = ...;
ParserTables tables = new SerializedTables().get(syntaxInput);
or (syntax input from a Reader):
Reader syntaxInput = ...;
ParserTables tables = new SerializedTables().get(syntaxInput, "MyTables.ser");
author: (c) 2000, Fritz Ritzberger |
Constructor Summary | |
public | SerializedTables() Create a ParserTables factory that buffers created parser tables. | public | SerializedTables(boolean production) Create a ParserTables factory that buffers tables once created. |
Method Summary | |
public AbstractParserTables | buildAndStoreParserTables(Class parserType, Syntax parserSyntax, Object syntaxInput, String baseName) | public AbstractParserTables | get(Object syntaxInput) Creates parser tables for passed syntax input from scratch or loads serialized tables from filesystem.
LALRParserTables.class wil be the type of created parser tables.
Parameters: syntaxInput - the Parser syntax as File, InputStream, List of Lists, String [][] or Syntax. | public AbstractParserTables | get(Object syntaxInput, String baseName) Creates parser tables for passed syntax input from scratch or loads serialized tables from filesystem. | public AbstractParserTables | get(Class parserType, Object syntaxInput, String baseName) Creates parser tables for passed syntax input from scratch or loads serialized tables from filesystem.
Parameters: parserType - the ParserTables class, e.g. | public static void | main(String[] args) Test main. | public AbstractParserTables | readParserTables(Object syntaxInput, String baseName) |
SerializedTables | public SerializedTables()(Code) | | Create a ParserTables factory that buffers created parser tables.
|
SerializedTables | public SerializedTables(boolean production)(Code) | | Create a ParserTables factory that buffers tables once created. @param production when false the tables will not be buffered.
|
get | public AbstractParserTables get(Object syntaxInput) throws Exception(Code) | | Creates parser tables for passed syntax input from scratch or loads serialized tables from filesystem.
LALRParserTables.class wil be the type of created parser tables.
Parameters: syntaxInput - the Parser syntax as File, InputStream, List of Lists, String [][] or Syntax. deserialized ParserTables, or one built from scratch that gets written to filesystem. |
get | public AbstractParserTables get(Object syntaxInput, String baseName) throws Exception(Code) | | Creates parser tables for passed syntax input from scratch or loads serialized tables from filesystem.
LALRParserTables.class will be the type of created parser tables.
Parameters: syntaxInput - the Parser syntax as File, InputStream, List of Lists, String [][] or Syntax. Parameters: baseName - name of serialization file, can be null when syntaxInput is a File deserialized ParserTables, or one built from scratch that gets written to filesystem. |
get | public AbstractParserTables get(Class parserType, Object syntaxInput, String baseName) throws Exception(Code) | | Creates parser tables for passed syntax input from scratch or loads serialized tables from filesystem.
Parameters: parserType - the ParserTables class, e.g. SLRParserTables.class. Parameters: syntaxInput - the Parser syntax as File, InputStream, List of Lists, String [][] or Syntax. Parameters: baseName - name of serialization file, can be null when syntaxInput is a File deserialized ParserTables, or one built from scratch that gets written to filesystem. |
main | public static void main(String[] args)(Code) | | Test main. Building serialized ParserTables takes 170, building from scratch takes 59 millis !!!
|
|
|