|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.millscript.millscript.syntax.SpiceClassParserDelegate
public final class SpiceClassParserDelegate
This class provides a parser for use when parsing a Spice class.
| Field Summary |
|---|
| Fields inherited from interface org.millscript.millscript.syntax.Parser |
|---|
ARITH_PREC, COMMA_PREC, COMMA_PREC1, LOW_PREC, NOT_PREC, RELOP_PREC, TIGHT_PREC |
| Constructor Summary | |
|---|---|
SpiceClassParserDelegate(Parser p,
NameExpr name)
Constructs a new SpiceClassParserDelegate to parse a class with the specified name, using the specified parser. |
|
| Method Summary | |
|---|---|
boolean |
checkWhere(char ch)
Check if the tokenzier is using the specified strategy for reading names and strings. |
void |
dropToken()
Drops the current token, ready to read the next one. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getAttributeName()
Returns the current token, checking it is a valid XML element attribute name. |
NameExpr |
getEnclosingClass()
Returns the enclosing class for this parser. |
java.lang.String |
getErrorString()
Returns the current token for use as an error message. |
int |
getInt()
Returns the current token as an int. |
int |
getLineNumber()
Returns the line number of the current token. |
java.lang.String |
getName()
Returns the current token as a name, or interned string. |
java.lang.String |
getOrigin()
Returns the origin of this tokenizers character source. |
char |
getQuoteChar()
Returns the first character of the current token, which will be the quote character for a string token. |
java.lang.String |
getString()
Returns the current token as a string. |
java.lang.String |
getStringNoQuotes()
Returns the current token as a string, without the surrounding quotes. |
java.lang.String |
getStringNoQuotes(int a,
int b)
Returns the current token as a string, with the specified number of characters removed from the start and end. |
java.lang.String |
getTagName()
Returns the current token, checking it is a valid XML element name. |
int |
hashCode()
|
Expr |
makeInterpolatedExpr()
Returns the current string, as an application of the format function with the current interpolation map values as arguments. |
java.util.regex.Pattern |
makePattern()
Returns a new tradition regular expression Pattern, made
from the contents of the current buffer. |
void |
markReader()
Marks the current position in the reader, so we can jump back to the marked position if required. |
void |
mustRead(java.lang.String sym)
Tests if the next token is the same as the specified string. |
TokenType |
nextToken()
Returns the type of the next token. |
boolean |
peekRead(java.lang.String sym)
Peeks a look at the next token and compares it to the specified value. |
TokenType |
peekToken()
Peeks a look at the type of the next token to be returned by nextToken. |
java.lang.String |
readAttributeName()
Reads the next token from the source as an attribute name and returns it. |
Expr |
readBlock()
Reads a sequence of expressions from the source as a Block. |
Expr |
readBlockTo(java.lang.String sym)
Reads a sequence of expressions, followed by the specified symbol, from the source as a Block. |
Expr |
readExpr()
Reads the next expression from the source. |
Expr |
readExprComma()
Reads the next expression from the source at the COMMA_PREC1 precedence level. |
Expr |
readExprPrec(int prec)
Reads the next expression from the source at the specified precedence level. |
Expr |
readExprTo(java.lang.String sym)
Reads the next expression from the source, which must be followed by the specified symbol. |
NameExpr |
readName()
Reads the next token from the source as a name and returns a name expression for it. |
Expr |
readOptExpr()
Reads the optional next expression from the source. |
Expr |
readOptExprPrec(int prec)
Reads the optional next expression from the source at the specified precedence level. |
Expr |
readOptPrimary()
Reads the next token from the source as the optional primary expression in a potential sequence of expressions. |
Expr |
readPrimary()
Reads the next token from the source as the primary expression in a potential sequence of expressions. |
Expr |
readStmnts()
Reads a sequence of expressions from the source. |
Expr |
readStmntsTo(java.lang.String sym)
Reads a sequence of expressions from the source, which must be followed by the specified symbol. |
java.lang.String |
readSymbol()
Reads the next token from the source as a symbol and returns it. |
java.lang.String |
readTagName()
Reads the next token from the source as a tag name and returns it. |
void |
resetReader()
Resets the reader to the previously marked position. |
void |
setContext(java.lang.String s,
int n)
|
void |
setLineNumber(int n)
|
void |
setOrigin(java.lang.String o)
|
void |
setWhere(char ch)
Sets the tokenizers current strategy for reading names and strings. |
java.lang.String |
toString()
|
boolean |
tryRead(java.lang.String sym)
Tests if the next token is the same as the specified string. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SpiceClassParserDelegate(Parser p,
NameExpr name)
p - the parser to delegatename - the name of the class we are parsing| Method Detail |
|---|
public boolean checkWhere(char ch)
Tokenizer
checkWhere in interface Tokenizerch - the test strategy
true if the test and current strategy are the same,
otherwise falseTokenizer.checkWhere(char)public void dropToken()
Tokenizer
dropToken in interface TokenizerTokenizer.dropToken()public boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(java.lang.Object)public java.lang.String getAttributeName()
Tokenizer
getAttributeName in interface TokenizerTokenizer.getAttributeName()public NameExpr getEnclosingClass()
Parser
getEnclosingClass in interface ParserParser.getEnclosingClass()public java.lang.String getErrorString()
Tokenizer
getErrorString in interface TokenizerTokenizer.getErrorString()public int getInt()
Tokenizer
getInt in interface TokenizerTokenizer.getInt()public int getLineNumber()
Tokenizer
getLineNumber in interface org.millscript.commons.alert.AlertOrigingetLineNumber in interface TokenizerTokenizer.getLineNumber()public java.lang.String getName()
Tokenizer
getName in interface TokenizerTokenizer.getName()public java.lang.String getOrigin()
Tokenizer
getOrigin in interface org.millscript.commons.alert.AlertOrigingetOrigin in interface TokenizerTokenizer.getOrigin()public char getQuoteChar()
Tokenizer
getQuoteChar in interface TokenizerTokenizer.getQuoteChar()public java.lang.String getString()
Tokenizer
getString in interface TokenizerTokenizer.getString()public java.lang.String getStringNoQuotes()
Tokenizer
getStringNoQuotes in interface TokenizerTokenizer.getStringNoQuotes()
public java.lang.String getStringNoQuotes(int a,
int b)
Tokenizer
getStringNoQuotes in interface Tokenizera - the number of character to remove from the start of the current
tokenb - the number of character to remove from the end of the current
token
Tokenizer.getStringNoQuotes(int, int)public java.lang.String getTagName()
Tokenizer
getTagName in interface TokenizerTokenizer.getTagName()public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public Expr makeInterpolatedExpr()
Parser
makeInterpolatedExpr in interface ParserParser.makeInterpolatedExpr()public java.util.regex.Pattern makePattern()
TokenizerPattern, made
from the contents of the current buffer. It looks for the last
/ in the string to see if there are any flags specified.
makePattern in interface TokenizerPattern for the current bufferTokenizer.makePattern()public void markReader()
Tokenizer
markReader in interface TokenizerTokenizer.markReader()public void mustRead(java.lang.String sym)
Tokenizer
mustRead in interface Tokenizersym - the token we want to try and readTokenizer.mustRead(String)public TokenType nextToken()
Tokenizer
nextToken in interface TokenizerTokenType of the next tokenTokenizer.nextToken()public boolean peekRead(java.lang.String sym)
Tokenizer
peekRead in interface Tokenizersym - the token we want to try and read
true if the next token is the same as the one
specified, false otherwiseTokenizer.peekRead(String)public TokenType peekToken()
TokenizernextToken.
peekToken in interface TokenizerTokenType of the next token to be returned by a
call to Tokenizer.nextToken()Tokenizer.peekToken()public java.lang.String readAttributeName()
Parser
readAttributeName in interface ParserParser.readAttributeName()public Expr readBlock()
Parser
readBlock in interface ParserParser.readBlock()public Expr readBlockTo(java.lang.String sym)
Parser
readBlockTo in interface Parsersym - the symbol which must follow the block
Parser.readBlockTo(String)public Expr readExpr()
Parser
readExpr in interface ParserParser.readExpr()public Expr readExprComma()
ParserCOMMA_PREC1 precedence level. Hence this will read up to
the next comma.
readExprComma in interface ParserParser.readExprComma()public Expr readExprPrec(int prec)
Parser
readExprPrec in interface Parserprec - the precedence level to read the next expression at
Parser.readExprPrec(int)public Expr readExprTo(java.lang.String sym)
Parser
readExprTo in interface Parsersym - the symbol which must follow the expression
Parser.readExprTo(String)public NameExpr readName()
Parser
readName in interface ParserParser.readName()public Expr readOptExpr()
Parser
readOptExpr in interface ParserParser.readOptExpr()public Expr readOptExprPrec(int prec)
Parser
readOptExprPrec in interface Parserprec - the precedence level to read the next expression at
Parser.readOptExprPrec(int)public Expr readOptPrimary()
Parser
readOptPrimary in interface ParserParser.readOptPrimary()public Expr readPrimary()
Parser
readPrimary in interface ParserParser.readPrimary()public Expr readStmnts()
Parser
readStmnts in interface ParserParser.readStmnts()public Expr readStmntsTo(java.lang.String sym)
Parser
readStmntsTo in interface Parsersym - the symbol which must follow the statements
Parser.readStmntsTo(String)public java.lang.String readSymbol()
Parser
readSymbol in interface ParserParser.readSymbol()public java.lang.String readTagName()
Parser
readTagName in interface ParserParser.readTagName()public void resetReader()
Tokenizer
resetReader in interface TokenizerTokenizer.resetReader()
public void setContext(java.lang.String s,
int n)
setContext in interface org.millscript.commons.alert.AlertOriginAlertOrigin.setContext(java.lang.String, int)public void setLineNumber(int n)
setLineNumber in interface org.millscript.commons.alert.AlertOriginAlertOrigin.setLineNumber(int)public void setOrigin(java.lang.String o)
setOrigin in interface org.millscript.commons.alert.AlertOriginAlertOrigin.setOrigin(java.lang.String)public void setWhere(char ch)
Tokenizer
setWhere in interface Tokenizerch - the new strategyTokenizer.setWhere(char)public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public boolean tryRead(java.lang.String sym)
Tokenizer
tryRead in interface Tokenizersym - the token we want to try and read
true if the next token is the same as the one
specified, false otherwiseTokenizer.tryRead(String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||