PUMA Library Reference Manual
|
#include <Puma/Parser.h>
Generic parser abstraction.
Setups the parser components ready to be used for parsing an input file (see class Puma::Syntax, Puma::Builder, and Puma::Semantic).
The result of parsing a source file is the so-called translation unit (see class Puma::CTranslationUnit). It encapsulates the result of the syntactic and semantic analyses (syntax tree, semantic information database, preprocessor tree).
Public Member Functions | |
Parser (Syntax &x, Builder &b, Semantic &s) | |
Constructor. | |
CTranslationUnit * | parse (Unit &file, CProject &p, int pre_mode=0, std::ostream &os=std::cout) |
Parse the given input file. | |
void | configure (Config &c) |
Configure the parser components. | |
Constructor.
x | The syntax analysis component. |
b | The syntax tree builder. |
s | The semantic analysis component. |
void Puma::Parser::configure | ( | Config & | c | ) |
Configure the parser components.
Calls the corresponding configure methods of the parser components.
c | The configuration settings. |
CTranslationUnit * Puma::Parser::parse | ( | Unit & | file, |
CProject & | p, | ||
int | pre_mode = 0, | ||
std::ostream & | os = std::cout ) |
Parse the given input file.
Supports different preprocessing modes. 0 means to pass the preprocessed tokens to the parser. 1 means to print the preprocessed tokens on stdout and to not parse at all. Mode 2 means the same as mode 1 except that the preprocessed tokens are not printed to stdout.
file | The input file. |
p | The source project information. |
pre_mode | The preprocessing mode (0-2). |
os | Preprocessor output stream if mode is 1. |