Puma Reference Manual Puma: Puma::Parser Class Reference



Puma::Parser Class Reference

#include <Puma/Parser.h>

Inheritance diagram for Puma::Parser:

Inheritance graph

List of all members.


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

Public Member Functions

 Parser (Syntax &x, Builder &b, Semantic &s)
 Constructor.
CTranslationUnitparse (Unit &file, CProject &p, int pre_mode=0)
 Parse the given input file.
void configure (Config &c)
 Configure the parser components.


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

CTranslationUnit* Puma::Parser::parse ( Unit file,
CProject p,
int  pre_mode = 0 
)

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).
Returns:
A newly created object containing the parse results. To be destroyed by the caller.

Reimplemented in Puma::CCParser.

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

Configure the parser components.

Calls the corresponding configure methods of the parser components.

Parameters:
c The configuration settings.




Puma Reference Manual. Created on 5 Nov 2008.