|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.inxar.syntacs.translator.regexp.RegexpGrammar
Automatically generated by Syntacs Translation Toolkit on Fri Jul 06 12:05:08 PDT 2001
# GRAMMAR DECLARATION this is regexp version 0.1.0; # PROPERTY DEFINITIONS property viz-namespace = "regexp"; property viz-dpa-size = "20,20"; property viz-syntactic = "true"; property author-email = "pcj@inxar.org"; property viz-dpa-concentrate-edges = "true"; property author = "Paul Cody Johnston"; property viz-dpa-hide-loopback-edges = "true"; property compile-interpreter-classname = "com.inxar.syntacs.translator.regexp.RegexpInterpreter"; property viz-sourcepath = "./grammar"; property viz-dfa-size = "12,12"; property viz-lexical = "true"; property compile-namespace = "com.inxar.syntacs.translator.regexp"; property compile-dpa-constructor-method = "LALR1"; property compile-sourcepath = "./src"; # TERMINAL DECLARATIONS terminal WHITESPACE; terminal CHAR; terminal CHAR_CLASS_CHAR; terminal PIPE; terminal STAR; terminal QUESTION; terminal PLUS; terminal OPEN_PAREN; terminal CLOSE_PAREN; terminal OPEN_BRACKET; terminal OPEN_BRACKET_CARET; terminal OPEN_BRACKET_DASH; terminal OPEN_BRACKET_CARET_DASH; terminal CLOSE_BRACKET; terminal CHAR_CLASS_DASH; terminal ESC; terminal ESC_OCTAL; terminal ESC_UNICODE; # TERMINAL DEFINITIONS WHITESPACE matches "(\t|\n|\v|\r|\s)+"; CHAR matches "[^\\|()[\]*+?]"; CHAR_CLASS_CHAR matches "[^-\]\\]"; PIPE matches "\|"; STAR matches "\*"; QUESTION matches "\?"; PLUS matches "\+"; OPEN_PAREN matches "\("; CLOSE_PAREN matches "\)"; OPEN_BRACKET matches "(\[(\t|\n|\v|\r|\s)*)"; OPEN_BRACKET_CARET matches "(\[(\t|\n|\v|\r|\s)*^)"; OPEN_BRACKET_DASH matches "(\[(\t|\n|\v|\r|\s)*-)"; OPEN_BRACKET_CARET_DASH matches "(\[(\t|\n|\v|\r|\s)*^(\t|\n|\v|\r|\s)*-)"; CLOSE_BRACKET matches "\]"; CHAR_CLASS_DASH matches "(-)"; ESC matches " \\ [^\t\n\v\r\s] "; ESC_OCTAL matches "(\\0[0-3][0-7][0-7])"; ESC_UNICODE matches "(\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])"; # NONTERMINAL DECLARATIONS nonterminal Goal; nonterminal Union; nonterminal Concat; nonterminal Term; nonterminal Quantifier; nonterminal Atom; nonterminal CharClass; nonterminal CharClassBegin; nonterminal CharClassTermList; nonterminal CharClassTerm; nonterminal CharClassAtom; # NONTERMINAL DEFINITIONS reduce Goal when Union; reduce Union when Concat; reduce Union when Union PIPE Concat; reduce Concat when Term; reduce Concat when Concat Term; reduce Term when Atom; reduce Term when Atom Quantifier; reduce Quantifier when STAR; reduce Quantifier when PLUS; reduce Quantifier when QUESTION; reduce Atom when CHAR; reduce Atom when ESC; reduce Atom when ESC_OCTAL; reduce Atom when ESC_UNICODE; reduce Atom when CharClass; reduce Atom when OPEN_PAREN Union CLOSE_PAREN; reduce CharClass when CharClassBegin CharClassTermList CLOSE_BRACKET; reduce CharClass when OPEN_BRACKET_CARET_DASH CLOSE_BRACKET; reduce CharClassBegin when OPEN_BRACKET; reduce CharClassBegin when OPEN_BRACKET_CARET; reduce CharClassBegin when OPEN_BRACKET_DASH; reduce CharClassBegin when OPEN_BRACKET_CARET_DASH; reduce CharClassTermList when CharClassTerm; reduce CharClassTermList when CharClassTermList CharClassTerm; reduce CharClassTerm when CharClassAtom; reduce CharClassTerm when CharClassAtom CHAR_CLASS_DASH CharClassAtom; reduce CharClassAtom when CHAR_CLASS_CHAR; reduce CharClassAtom when ESC; reduce CharClassAtom when ESC_OCTAL; reduce CharClassAtom when ESC_UNICODE; accept when Goal; # CONTEXT DECLARATIONS context default; context charclass; # CONTEXT DEFINITIONS default includes WHITESPACE, CHAR, PIPE, STAR, QUESTION, PLUS, OPEN_PAREN, CLOSE_PAREN, ESC, ESC_OCTAL, ESC_UNICODE, OPEN_BRACKET shifts charclass, OPEN_BRACKET_CARET shifts charclass, OPEN_BRACKET_DASH shifts charclass, OPEN_BRACKET_CARET_DASH shifts charclass; charclass includes WHITESPACE, CHAR_CLASS_CHAR, CHAR_CLASS_DASH, ESC, ESC_OCTAL, ESC_UNICODE, CLOSE_BRACKET unshifts; start in context default;
Field Summary | |
static int |
C_charclass
Constant ID for charclass |
static int |
C_default
Constant ID for default |
static int |
N_Atom
NonTerminal ID for Atom |
static int |
N_CharClass
NonTerminal ID for CharClass |
static int |
N_CharClassAtom
NonTerminal ID for CharClassAtom |
static int |
N_CharClassBegin
NonTerminal ID for CharClassBegin |
static int |
N_CharClassTerm
NonTerminal ID for CharClassTerm |
static int |
N_CharClassTermList
NonTerminal ID for CharClassTermList |
static int |
N_Concat
NonTerminal ID for Concat |
static int |
N_Goal
NonTerminal ID for Goal |
static int |
N_Quantifier
NonTerminal ID for Quantifier |
static int |
N_Term
NonTerminal ID for Term |
static int |
N_Union
NonTerminal ID for Union |
static int |
P_Atom__CHAR
Production ID for Atom__CHAR |
static int |
P_Atom__CharClass
Production ID for Atom__CharClass |
static int |
P_Atom__ESC
Production ID for Atom__ESC |
static int |
P_Atom__ESC_OCTAL
Production ID for Atom__ESC_OCTAL |
static int |
P_Atom__ESC_UNICODE
Production ID for Atom__ESC_UNICODE |
static int |
P_Atom__OPEN_PAREN_Union_CLOSE_PAREN
Production ID for Atom__OPEN_PAREN_Union_CLOSE_PAREN |
static int |
P_CharClass__CharClassBegin_CharClassTermList_CLOSE_BRACKET
Production ID for CharClass__CharClassBegin_CharClassTermList_CLOSE_BRACKET |
static int |
P_CharClass__OPEN_BRACKET_CARET_DASH_CLOSE_BRACKET
Production ID for CharClass__OPEN_BRACKET_CARET_DASH_CLOSE_BRACKET |
static int |
P_CharClassAtom__CHAR_CLASS_CHAR
Production ID for CharClassAtom__CHAR_CLASS_CHAR |
static int |
P_CharClassAtom__ESC
Production ID for CharClassAtom__ESC |
static int |
P_CharClassAtom__ESC_OCTAL
Production ID for CharClassAtom__ESC_OCTAL |
static int |
P_CharClassAtom__ESC_UNICODE
Production ID for CharClassAtom__ESC_UNICODE |
static int |
P_CharClassBegin__OPEN_BRACKET
Production ID for CharClassBegin__OPEN_BRACKET |
static int |
P_CharClassBegin__OPEN_BRACKET_CARET
Production ID for CharClassBegin__OPEN_BRACKET_CARET |
static int |
P_CharClassBegin__OPEN_BRACKET_CARET_DASH
Production ID for CharClassBegin__OPEN_BRACKET_CARET_DASH |
static int |
P_CharClassBegin__OPEN_BRACKET_DASH
Production ID for CharClassBegin__OPEN_BRACKET_DASH |
static int |
P_CharClassTerm__CharClassAtom
Production ID for CharClassTerm__CharClassAtom |
static int |
P_CharClassTerm__CharClassAtom_CHAR_CLASS_DASH_CharClassAtom
Production ID for CharClassTerm__CharClassAtom_CHAR_CLASS_DASH_CharClassAtom |
static int |
P_CharClassTermList__CharClassTerm
Production ID for CharClassTermList__CharClassTerm |
static int |
P_CharClassTermList__CharClassTermList_CharClassTerm
Production ID for CharClassTermList__CharClassTermList_CharClassTerm |
static int |
P_Concat__Concat_Term
Production ID for Concat__Concat_Term |
static int |
P_Concat__Term
Production ID for Concat__Term |
static int |
P_Goal__Union
Production ID for Goal__Union |
static int |
P_Quantifier__PLUS
Production ID for Quantifier__PLUS |
static int |
P_Quantifier__QUESTION
Production ID for Quantifier__QUESTION |
static int |
P_Quantifier__STAR
Production ID for Quantifier__STAR |
static int |
P_Term__Atom
Production ID for Term__Atom |
static int |
P_Term__Atom_Quantifier
Production ID for Term__Atom_Quantifier |
static int |
P_Union__Concat
Production ID for Union__Concat |
static int |
P_Union__Union_PIPE_Concat
Production ID for Union__Union_PIPE_Concat |
static int |
T_CHAR
Terminal ID for CHAR |
static int |
T_CHAR_CLASS_CHAR
Terminal ID for CHAR_CLASS_CHAR |
static int |
T_CHAR_CLASS_DASH
Terminal ID for CHAR_CLASS_DASH |
static int |
T_CLOSE_BRACKET
Terminal ID for CLOSE_BRACKET |
static int |
T_CLOSE_PAREN
Terminal ID for CLOSE_PAREN |
static int |
T_ESC
Terminal ID for ESC |
static int |
T_ESC_OCTAL
Terminal ID for ESC_OCTAL |
static int |
T_ESC_UNICODE
Terminal ID for ESC_UNICODE |
static int |
T_OPEN_BRACKET
Terminal ID for OPEN_BRACKET |
static int |
T_OPEN_BRACKET_CARET
Terminal ID for OPEN_BRACKET_CARET |
static int |
T_OPEN_BRACKET_CARET_DASH
Terminal ID for OPEN_BRACKET_CARET_DASH |
static int |
T_OPEN_BRACKET_DASH
Terminal ID for OPEN_BRACKET_DASH |
static int |
T_OPEN_PAREN
Terminal ID for OPEN_PAREN |
static int |
T_PIPE
Terminal ID for PIPE |
static int |
T_PLUS
Terminal ID for PLUS |
static int |
T_QUESTION
Terminal ID for QUESTION |
static int |
T_STAR
Terminal ID for STAR |
static int |
T_WHITESPACE
Terminal ID for WHITESPACE |
Fields inherited from interface org.inxar.syntacs.translator.lr.LRTranslatorGrammar |
ACTION_PEEK, ACTION_PEEL, ACTION_POP, ACTION_POUNCE, ACTION_PUSH, UNDEFINED, UNDEFINED_CONTEXT, UNDEFINED_NONTERMINAL, UNDEFINED_PRODUCTION, UNDEFINED_SYMBOL, UNDEFINED_TERMINAL |
Constructor Summary | |
RegexpGrammar()
|
Method Summary | |
String |
getContext(int ID)
Returns the name of the context having the given ID or null if no such ID is known. |
int |
getContextAction(int cID,
int tID)
Returns the action defined for the given grammar symbol in the given context as one of the ACTION_XXX constants
in this interface. |
int |
getContextRegister(int cID,
int tID)
Returns an integer stored at the value of the given contextID and symbolID . |
IntArray |
getContexts()
Returns the list of context ID numbers as an IntArray . |
IntArray |
getContextTerminals(int ID)
Returns a list of terminals defined within the context having the given ID or null if no such ID is known. |
int |
getGoalNonTerminal()
Returns the ID of the goal symbol (a nonterminal) or UNDEFINED_NONTERMINAL is no such goal symbol has
been set. |
String |
getName()
Returns the name of the Translator . |
String |
getNonTerminal(int ID)
Returns the name of the nonterminal having the given ID or null if no such ID is known. |
IntArray |
getNonTerminals()
Returns the list of nonterminal ID numbers as an IntArray . |
String |
getProduction(int ID)
Returns the name of the production having the given ID or null if no such ID is known. |
int |
getProductionLength(int ID)
Returns the length of the list of grammar symbols of the right-hand-side of the production having the given ID or UNDEFINED_PRODUCTION if no such ID is known. |
int |
getProductionNonTerminal(int ID)
Returns the ID of the nonterminal obtained by reduction of the given productionID or
UNDEFINED_PRODUCTION if no such production is known. |
IntArray |
getProductions()
Returns the list of production ID numbers as an IntArray . |
IntArray |
getProductionSymbols(int ID)
Returns the list of grammar symbols of the right-hand-side of the production having the given ID as an IntArray
or null if no such ID is known. |
int |
getStartContext()
Returns the ID of the initial context. |
String |
getTerminal(int ID)
Returns the name of the terminal having the given ID or null if no such ID is known. |
IntArray |
getTerminalContexts(int ID)
Returns a list of contexts in which this terminal is defined. |
Object |
getTerminalRegexp(int ID)
Returns the regular expression String for the
terminal having the given ID or null if no such ID
is known. |
IntArray |
getTerminals()
Returns the list of terminal ID numbers as an IntArray . |
String |
getVersion()
Returns the version number given to this grammar. |
Translator |
newTranslator()
Returns a new Translator for this
TranslatorGrammar having some default set of
properties. |
Translator |
newTranslator(Properties p)
Returns a new Translator for this
TranslatorGrammar using the given
Properties . |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int C_default
public static final int C_charclass
public static final int T_WHITESPACE
public static final int T_CHAR
public static final int T_CHAR_CLASS_CHAR
public static final int T_PIPE
public static final int T_STAR
public static final int T_QUESTION
public static final int T_PLUS
public static final int T_OPEN_PAREN
public static final int T_CLOSE_PAREN
public static final int T_OPEN_BRACKET
public static final int T_OPEN_BRACKET_CARET
public static final int T_OPEN_BRACKET_DASH
public static final int T_OPEN_BRACKET_CARET_DASH
public static final int T_CLOSE_BRACKET
public static final int T_CHAR_CLASS_DASH
public static final int T_ESC
public static final int T_ESC_OCTAL
public static final int T_ESC_UNICODE
public static final int N_Goal
public static final int N_Union
public static final int N_Concat
public static final int N_Term
public static final int N_Quantifier
public static final int N_Atom
public static final int N_CharClass
public static final int N_CharClassBegin
public static final int N_CharClassTermList
public static final int N_CharClassTerm
public static final int N_CharClassAtom
public static final int P_Goal__Union
public static final int P_Union__Concat
public static final int P_Union__Union_PIPE_Concat
public static final int P_Concat__Term
public static final int P_Concat__Concat_Term
public static final int P_Term__Atom
public static final int P_Term__Atom_Quantifier
public static final int P_Quantifier__STAR
public static final int P_Quantifier__PLUS
public static final int P_Quantifier__QUESTION
public static final int P_Atom__CHAR
public static final int P_Atom__ESC
public static final int P_Atom__ESC_OCTAL
public static final int P_Atom__ESC_UNICODE
public static final int P_Atom__CharClass
public static final int P_Atom__OPEN_PAREN_Union_CLOSE_PAREN
public static final int P_CharClass__CharClassBegin_CharClassTermList_CLOSE_BRACKET
public static final int P_CharClass__OPEN_BRACKET_CARET_DASH_CLOSE_BRACKET
public static final int P_CharClassBegin__OPEN_BRACKET
public static final int P_CharClassBegin__OPEN_BRACKET_CARET
public static final int P_CharClassBegin__OPEN_BRACKET_DASH
public static final int P_CharClassBegin__OPEN_BRACKET_CARET_DASH
public static final int P_CharClassTermList__CharClassTerm
public static final int P_CharClassTermList__CharClassTermList_CharClassTerm
public static final int P_CharClassTerm__CharClassAtom
public static final int P_CharClassTerm__CharClassAtom_CHAR_CLASS_DASH_CharClassAtom
public static final int P_CharClassAtom__CHAR_CLASS_CHAR
public static final int P_CharClassAtom__ESC
public static final int P_CharClassAtom__ESC_OCTAL
public static final int P_CharClassAtom__ESC_UNICODE
Constructor Detail |
public RegexpGrammar()
Method Detail |
public String getContext(int ID)
LRTranslatorGrammar
null
if no such ID is known.getContext
in interface LRTranslatorGrammar
public int getContextAction(int cID, int tID)
LRTranslatorGrammar
ACTION_XXX
constants
in this interface. If the contextID or symbolID is not known,
UNDEFINED_CONTEXT
or UNDEFINED_SYMBOL
will be returned. Note: If UNDEFINED_SYMBOL is returned the ID
may still be a valid terminal or nonterminal, but it not a
member of the given context.getContextAction
in interface LRTranslatorGrammar
public int getContextRegister(int cID, int tID)
LRTranslatorGrammar
contextID
and symbolID
. This is used
in conjunction with getContextAction(int, int)
such that the second member in the tuple (action, register) is
returned. If the contextID or symbolID is not known,
UNDEFINED_CONTEXT
or UNDEFINED_SYMBOL
will be returned.getContextRegister
in interface LRTranslatorGrammar
public IntArray getContextTerminals(int ID)
LRTranslatorGrammar
null
if no such ID is known.getContextTerminals
in interface LRTranslatorGrammar
public IntArray getContexts()
LRTranslatorGrammar
IntArray
.getContexts
in interface LRTranslatorGrammar
public int getGoalNonTerminal()
LRTranslatorGrammar
UNDEFINED_NONTERMINAL
is no such goal symbol has
been set.getGoalNonTerminal
in interface LRTranslatorGrammar
public String getName()
TranslatorGrammar
Translator
.getName
in interface TranslatorGrammar
public String getNonTerminal(int ID)
LRTranslatorGrammar
null
if no such ID is known.getNonTerminal
in interface LRTranslatorGrammar
public IntArray getNonTerminals()
LRTranslatorGrammar
IntArray
.getNonTerminals
in interface LRTranslatorGrammar
public String getProduction(int ID)
LRTranslatorGrammar
null
if no such ID is known. The
String
has the format "nonterminal: sym1
sym2 sym3
" such that the nonterminal name is the first
part of the string, followed by a colon, followed by a space
delimited list of symbols.getProduction
in interface LRTranslatorGrammar
public int getProductionLength(int ID)
LRTranslatorGrammar
UNDEFINED_PRODUCTION
if no such ID is known.getProductionLength
in interface LRTranslatorGrammar
public int getProductionNonTerminal(int ID)
LRTranslatorGrammar
productionID
or
UNDEFINED_PRODUCTION
if no such production is known.getProductionNonTerminal
in interface LRTranslatorGrammar
public IntArray getProductionSymbols(int ID)
LRTranslatorGrammar
IntArray
or null
if no such ID is known.getProductionSymbols
in interface LRTranslatorGrammar
public IntArray getProductions()
LRTranslatorGrammar
IntArray
.getProductions
in interface LRTranslatorGrammar
public int getStartContext()
LRTranslatorGrammar
getStartContext
in interface LRTranslatorGrammar
public String getTerminal(int ID)
LRTranslatorGrammar
null
if no such ID is known.getTerminal
in interface LRTranslatorGrammar
public IntArray getTerminalContexts(int ID)
LRTranslatorGrammar
getTerminalContexts
in interface LRTranslatorGrammar
public Object getTerminalRegexp(int ID)
LRTranslatorGrammar
String
for the
terminal having the given ID or null
if no such ID
is known. If the terminal ID is valid but no definition has
been provided for that terminal, the empty string
""
will be returned.getTerminalRegexp
in interface LRTranslatorGrammar
public IntArray getTerminals()
LRTranslatorGrammar
IntArray
.getTerminals
in interface LRTranslatorGrammar
public String getVersion()
TranslatorGrammar
getVersion
in interface TranslatorGrammar
public Translator newTranslator()
TranslatorGrammar
Translator
for this
TranslatorGrammar
having some default set of
properties.newTranslator
in interface TranslatorGrammar
public Translator newTranslator(Properties p)
TranslatorGrammar
Translator
for this
TranslatorGrammar
using the given
Properties
. The names and values of the elements
in the Properties
may be used to modify or
communicate with the internals of the Translator
instance (such as turning on debugging). The specifics
reagarding the names and values of the properties are specific
to the translator itself and need be documented elsewhere.newTranslator
in interface TranslatorGrammar
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |