org.millscript.millscript.syntax
Interface Parser

All Superinterfaces:
org.millscript.commons.alert.AlertOrigin, Tokenizer
All Known Implementing Classes:
ConfigurationParserImpl, ParserImpl, SpiceClassParserDelegate

public interface Parser
extends Tokenizer

This defines the MillScript parser interface.


Field Summary
static int ARITH_PREC
          Constant value for arithmetic precedence.
static int COMMA_PREC
          Constant value for comma precedence.
static int COMMA_PREC1
          Constant value for slightly tighter than comma precedence.
static int LOW_PREC
          Constant value for low precedence.
static int NOT_PREC
          Constant value for not syntax precedence.
static int RELOP_PREC
          Constant value for relation operator precedence.
static int TIGHT_PREC
          Constant value for tight precedence.
 
Method Summary
 NameExpr getEnclosingClass()
          Returns the enclosing class for this parser.
 Expr makeInterpolatedExpr()
          Returns the current string, as an application of the format function with the current interpolation map values as arguments.
 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.
 
Methods inherited from interface org.millscript.millscript.syntax.Tokenizer
checkWhere, dropToken, getAttributeName, getErrorString, getInt, getLineNumber, getName, getOrigin, getQuoteChar, getString, getStringNoQuotes, getStringNoQuotes, getTagName, makePattern, markReader, mustRead, nextToken, peekRead, peekToken, resetReader, setWhere, tryRead
 
Methods inherited from interface org.millscript.commons.alert.AlertOrigin
setContext, setLineNumber, setOrigin
 

Field Detail

LOW_PREC

static final int LOW_PREC
Constant value for low precedence.

See Also:
Constant Field Values

COMMA_PREC

static final int COMMA_PREC
Constant value for comma precedence.

See Also:
Constant Field Values

COMMA_PREC1

static final int COMMA_PREC1
Constant value for slightly tighter than comma precedence. This would be used to read up to the next comma precedence item.

See Also:
Constant Field Values

RELOP_PREC

static final int RELOP_PREC
Constant value for relation operator precedence.

See Also:
Constant Field Values

NOT_PREC

static final int NOT_PREC
Constant value for not syntax precedence.

See Also:
Constant Field Values

ARITH_PREC

static final int ARITH_PREC
Constant value for arithmetic precedence.

See Also:
Constant Field Values

TIGHT_PREC

static final int TIGHT_PREC
Constant value for tight precedence.

See Also:
Constant Field Values
Method Detail

getEnclosingClass

NameExpr getEnclosingClass()
Returns the enclosing class for this parser.

Returns:
a NameExpr for the enclosing class

makeInterpolatedExpr

Expr makeInterpolatedExpr()
Returns the current string, as an application of the format function with the current interpolation map values as arguments. The values in the interpolation map will be parsed into expressions.

Returns:
an ApplyExpr, applying the format function to format the current string
See Also:
TokenizerImpl.interpolationMap, FormatFunction

readAttributeName

java.lang.String readAttributeName()
Reads the next token from the source as an attribute name and returns it. An alert will be generated if the next token is not a name.

Returns:
a String containing a tag name

readBlock

Expr readBlock()
Reads a sequence of expressions from the source as a Block.

Returns:
a Block wrapping the sequence of expressions read
See Also:
readStmnts()

readBlockTo

Expr readBlockTo(java.lang.String sym)
Reads a sequence of expressions, followed by the specified symbol, from the source as a Block.

Parameters:
sym - the symbol which must follow the block
Returns:
a Block wrapping the sequence of expressions read
See Also:
readStmntsTo(String)

readExpr

Expr readExpr()
Reads the next expression from the source.

Returns:
an Expr for the next token in the source

readExprComma

Expr readExprComma()
Reads the next expression from the source at the COMMA_PREC1 precedence level. Hence this will read up to the next comma.

Returns:
an Expr for the next token in the source

readExprPrec

Expr readExprPrec(int prec)
Reads the next expression from the source at the specified precedence level.

Parameters:
prec - the precedence level to read the next expression at
Returns:
an Expr for the next token in the source

readExprTo

Expr readExprTo(java.lang.String sym)
Reads the next expression from the source, which must be followed by the specified symbol.

Parameters:
sym - the symbol which must follow the expression
Returns:
an Expr for the next token in the source

readName

NameExpr readName()
Reads the next token from the source as a name and returns a name expression for it. A name is a symbol that is not a keyword. An alert will be generated if the next token is a built in identifier.

Returns:
a NameExpr for the next token

readOptExpr

Expr readOptExpr()
Reads the optional next expression from the source. Optional means that there doesn't have to be another expression in the source.

Returns:
an Expr for the next token in the source

readOptExprPrec

Expr readOptExprPrec(int prec)
Reads the optional next expression from the source at the specified precedence level. Optional means that there doesn't have to be another expression in the source.

Parameters:
prec - the precedence level to read the next expression at
Returns:
an Expr for the next token in the source

readOptPrimary

Expr readOptPrimary()
Reads the next token from the source as the optional primary expression in a potential sequence of expressions.

Returns:
an Expr for the next token in the source

readPrimary

Expr readPrimary()
Reads the next token from the source as the primary expression in a potential sequence of expressions.

Returns:
an Expr for the next token in the source

readStmnts

Expr readStmnts()
Reads a sequence of expressions from the source. The sequence of expressions are wrapped as a comma expression. This method will read up to the end of file, or a built-in keyword.

Returns:
an Expr for the sequence of expressions read

readStmntsTo

Expr readStmntsTo(java.lang.String sym)
Reads a sequence of expressions from the source, which must be followed by the specified symbol.

Parameters:
sym - the symbol which must follow the statements
Returns:
an Expr for the sequence of expressions read
See Also:
readStmnts()

readSymbol

java.lang.String readSymbol()
Reads the next token from the source as a symbol and returns it. An alert will be generated if the next token is not a name.

Returns:
a String containing the next symbol

readTagName

java.lang.String readTagName()
Reads the next token from the source as a tag name and returns it. An alert will be generated if the next token is not a name.

Returns:
a String containing a tag name


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.