Parser Class Reference
YCP parser A YCP parser read a characters stream and outputs a sequence of YCP values. Three properties of the YCP grammar are important:.
More...
#include <Parser.h>
List of all members.
Detailed Description
YCP parser A YCP parser read a characters stream and outputs a sequence of YCP values. Three properties of the YCP grammar are important:.
1. The syntactical representation of a YCP value uniquely defines its type.
2. The interpretation of the syntactical representation of a YCP value is not dependend on the leading context.
3. The interpretation of the syntactical representation of a YCP value is not dependend on the trailing context other than one trailing white space.
Property 1 allows you to call the parser without the specification, which type of value you expect. This allows a YCP protocol block to be of any YCP value.
Property 2 allows the parser class to be free of variables that must be kept between to parses.
Property 3 is especially important, because it allows the parser to determine the end of a value without having to look ahead more that one character.
Constructor & Destructor Documentation
|
Creates a new YCP parser. Afterwards you must set an input source with a call to setInput |
Parser::Parser |
( |
FILE * |
file, |
|
|
const char * |
filename = 0 |
|
) |
|
|
|
Creates a new YCP parser - Parameters:
-
| filename | If you have the name of the file you parse available, pass it here in order to get nice error location messages in case of a parse error. |
|
Parser::Parser |
( |
const char * |
buf |
) |
|
|
Parser::Parser |
( |
int |
fd, |
|
|
const char * |
filename = 0 |
|
) |
|
|
|
Creates a new YCP parser - Parameters:
-
| filename | If you have the name of the file you parse available, pass it here in order to get nice error location messages in case of a parse error. |
|
Member Function Documentation
|
report EOF state. If parse() returns 0 the caller should check atEOF() in order to distinguish between a syntax error and end-of-file. |
bool Parser::depends |
( |
|
) |
const |
|
|
Initialize the internal state of the parser. |
|
Reads in as many bytes from the input stream as are neccessary to parse a YCP file. - Returns:
- the parsed value. Returns 0, if no value could be parsed (due to a parse error or the end of the input stream). The value must be deleted after use.
If gTable and lTable are set, they're used instead of local ones. This is used for include files using the symbol tables of the including block. see: Scanner::initTables() |
void Parser::setBuffered |
( |
|
) |
|
|
|
Makes the scanner use buffering, i.e. read more than one character at once. |
void Parser::setDepends |
( |
|
) |
|
|
|
Just output dependencies. |
void Parser::setInput |
( |
int |
fd, |
|
|
const char * |
filename = 0 |
|
) |
|
|
|
Parse a value from a file descriptor - Parameters:
-
| filename | If you have the name of the file you parse available, pass it here in order to get nice error location messages in case of a parse error. |
|
void Parser::setInput |
( |
const char * |
buf |
) |
|
|
|
use buf for further parsing |
void Parser::setInput |
( |
FILE * |
file, |
|
|
const char * |
filename = 0 |
|
) |
|
|
|
use file for further parsing. - Parameters:
-
| filename | If you have the name of the file you parse available, pass it here in order to get nice error location messages in case of a parse error. |
|
void Parser::setScanner |
( |
Scanner * |
|
) |
|
|
|
Sets the scanner. For scannerstack use, this should be encapsulated better. |
Member Data Documentation
|
If true, the scanner reached EOF. |
|
integer number for the depth of the current block |
|
Is true, if the input can be buffered, i.e. more than one character may be read at once in order to gain performance. |
|
pointer to the currently parsed block |
|
Is true, if just imported modules and included files are to be checked (make depends) |
|
Copied from struct parserret |
|
Loop nesting level. Detects break outside a loop. Was a static variable in parser.yy |
|
Errors during one parse. Was a static variable in parser.yy |
|
Copied from struct parserret Does not need to be deleted by us |
|
This is where the parser gets its input from. |
|
Scanners used for include parsing |
The documentation for this class was generated from the following files:
Generated on Fri Jun 16 18:07:46 2006 for yast2-core by
1.4.6