#include <Parser.h>
Public Member Functions | |
| void | init () |
| Parser () | |
| Parser (FILE *file, const char *filename=0) | |
| Parser (const char *buf) | |
| Parser (int fd, const char *filename=0) | |
| ~Parser () | |
| YCodePtr | parse (SymbolTable *gTable=0, SymbolTable *lTable=0) |
| Scanner * | scanner () |
| void | setScanner (Scanner *) |
| bool | atEOF () |
| void | setInput (FILE *file, const char *filename=0) |
| void | setInput (const char *buf) |
| void | setInput (int fd, const char *filename=0) |
| void | setBuffered () |
| void | setDepends () |
| bool | depends () const |
Public Attributes | |
| YCodePtr | m_result |
| int | m_lineno |
| int | m_loop_count |
| int | m_parser_errors |
| blockstack_t * | m_block_stack |
| switchstack_t * | m_switch_stack |
| scannerstack_t * | m_scanner_stack |
| YBlockPtr | m_current_block |
| int | m_blockstack_depth |
Private Attributes | |
| Scanner * | m_scanner |
| bool | m_buffered |
| bool | m_depends |
| bool | m_at_eof |
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.
| Parser::Parser | ( | ) |
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
| 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 | ) |
Creates a new YCP parser
| Parser::Parser | ( | int | fd, | |
| const char * | filename = 0 | |||
| ) |
Creates a new YCP parser
| 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 | ( | ) |
Cleans up.
| void Parser::init | ( | ) |
Initialize the internal state of the parser.
| YCodePtr Parser::parse | ( | SymbolTable * | gTable = 0, |
|
| SymbolTable * | lTable = 0 | |||
| ) |
Reads in as many bytes from the input stream as are neccessary to parse a YCP file.
| Scanner * Parser::scanner | ( | ) |
Accesses the scanner
| void Parser::setScanner | ( | Scanner * | ) |
Sets the scanner. For scannerstack use, this should be encapsulated better.
| bool Parser::atEOF | ( | ) |
| void Parser::setInput | ( | FILE * | file, | |
| const char * | filename = 0 | |||
| ) |
use file for further parsing.
| 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 | ( | int | fd, | |
| const char * | filename = 0 | |||
| ) |
Parse a value from a file descriptor
| 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::setBuffered | ( | ) |
Makes the scanner use buffering, i.e. read more than one character at once.
| void Parser::setDepends | ( | ) |
Just output dependencies.
| bool Parser::depends | ( | ) | const |
Only dependencies ?
Scanner* Parser::m_scanner [private] |
This is where the parser gets its input from.
bool Parser::m_buffered [private] |
Is true, if the input can be buffered, i.e. more than one character may be read at once in order to gain performance.
bool Parser::m_depends [private] |
Is true, if just imported modules and included files are to be checked (make depends)
bool Parser::m_at_eof [private] |
If true, the scanner reached EOF.
| YCodePtr Parser::m_result |
Copied from struct parserret Does not need to be deleted by us
| int Parser::m_lineno |
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
Stack of parsed blocks
Stack of parsed switches
Scanners used for include parsing
| YBlockPtr Parser::m_current_block |
pointer to the currently parsed block
integer number for the depth of the current block
1.5.0