| java.lang.Object xtc.parser.Result xtc.parser.PackratParser
PackratParser | abstract public class PackratParser extends Result (Code) | | The superclass of all packrat parsers. Note that packrat parsers
also are
Result results . However, this is purely a
performance optimization and a packrat parser may only be treated
as a result if it is returned from the
PackratParser.character() method.
author: Robert Grimm version: $Revision: 1.1 $ |
Field Summary | |
final public static PackratParser | DUMMY The dummy packrat parser. | protected int | yyColumn The current column. | final protected int | yyCount The current index into the character stream. | protected String | yyFile The file name. | protected int | yyLine The current line. | final protected Reader | yyReader The reader for the character stream to be parsed. | protected boolean | yySeenCR The flag for whether the previous character was a carriage
return. |
DUMMY | final public static PackratParser DUMMY(Code) | | The dummy packrat parser. The dummy packrat parser must
not be used for parsing anything. Its sole purpose is to
enable the creation of a
ParseError.DUMMY dummy parseerror .
|
yyColumn | protected int yyColumn(Code) | | The current column. This field is not final as to allow parsers,
such as the C preprocessor, to adjust the column number while
parsing.
|
yyCount | final protected int yyCount(Code) | | The current index into the character stream.
|
yyFile | protected String yyFile(Code) | | The file name. This field is not final as to allow parsers, such
as the C preprocessor, to adjust the file name while parsing.
|
yyLine | protected int yyLine(Code) | | The current line. This field is not final as to allow parsers,
such as the C preprocessor, to adjust the line number while
parsing.
|
yyReader | final protected Reader yyReader(Code) | | The reader for the character stream to be parsed.
|
yySeenCR | protected boolean yySeenCR(Code) | | The flag for whether the previous character was a carriage
return. This flag is needed to correctly track line and column
numbers.
|
PackratParser | public PackratParser(Reader reader, String file)(Code) | | Create a new packrat parser.
Parameters: reader - The reader for the character stream to be parsed. Parameters: file - The name of the file backing the character stream. |
PackratParser | protected PackratParser(PackratParser previous)(Code) | | Create a new packrat parser, moving ahead one character. The
specified packrat parser must represent a valid character; i.e.,
its
PackratParser.hasValue() method must return true .
Parameters: previous - The previous packrat parser. |
charValue | public char charValue()(Code) | | |
character | final protected Result character() throws IOException(Code) | | Parse a character. This method returns the result of parsing the
next character offered by this parser's character stream. If
there is another character, the result is this parser; otherwise,
it is a
ParseError .
The corresponding result. throws: IOException - Signals an exceptional condition whileaccessing the character stream. |
column | final public int column()(Code) | | Get the current column number.
The column number. |
file | final public String file()(Code) | | Get the current file name.
The file name. |
getDifference | final protected String getDifference(PackratParser o)(Code) | | Get the difference between this parser and the specified parser.
Both parsers must parse the same character stream.
Parameters: o - The other parser. The difference as a string. |
hasValue | public boolean hasValue()(Code) | | |
line | final public int line()(Code) | | Get the current line number.
The line number. |
location | final public Location location()(Code) | | Get the current location.
The location. |
next | abstract protected PackratParser next()(Code) | | Get the parser for the next character. A concrete implementation
of this method should simply return the parser object created by
using the
PackratParser.PackratParser(PackratParser) constructor with
this as the argument.
The parser for the next character. |
|
|