Puma Reference Manual Puma: Puma::Parser Class Reference



Puma::Parser Class Reference

Generic parser abstraction. More...

#include <Puma/Parser.h>

Inherited by Puma::CCParser, and Puma::CParser.

List of all members.

Public Member Functions

 Parser (Syntax &x, Builder &b, Semantic &s)
 Constructor.
CTranslationUnitparse (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.

Detailed Description

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).


Constructor & Destructor Documentation

Puma::Parser::Parser ( Syntax x,
Builder b,
Semantic s 
) [inline]

Constructor.

Parameters:
x The syntax analysis component.
b The syntax tree builder.
s The semantic analysis component.

Member Function Documentation

void Puma::Parser::configure ( Config c  ) 

Configure the parser components.

Calls the corresponding configure methods of the parser components.

Parameters:
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.

Parameters:
file The input file.
p The source project information.
pre_mode The preprocessing mode (0-2).
os Preprocessor output stream if mode is 1.
Returns:
A newly created object containing the parse results. To be destroyed by the caller.

Reimplemented in Puma::CCParser.




Puma Reference Manual. Created on 11 Sep 2009.