Doxygen
Loading...
Searching...
No Matches
ConstExpressionParser Class Reference

constant expression parser used for the C preprocessor More...

#include <src/constexp.h>

Classes

struct  Private
 

Public Member Functions

 ConstExpressionParser ()
 
 ~ConstExpressionParser ()
 
bool parse (const char *fileName, int line, const std::string &expression, const std::string &orgExpression)
 

Private Attributes

std::unique_ptr< Privatep
 

Detailed Description

constant expression parser used for the C preprocessor

Definition at line 25 of file constexp.h.

Constructor & Destructor Documentation

◆ ConstExpressionParser()

ConstExpressionParser::ConstExpressionParser ( )

Definition at line 129 of file constexp.l.

129 : p(std::make_unique<Private>())
130{
131 constexpYYlex_init_extra(&p->constexpYY_extra, &p->yyscanner);
132}
std::unique_ptr< Private > p
Definition constexp.h:34

References p.

◆ ~ConstExpressionParser()

ConstExpressionParser::~ConstExpressionParser ( )

Definition at line 134 of file constexp.l.

135{
136 constexpYYlex_destroy(p->yyscanner);
137}

References p.

Member Function Documentation

◆ parse()

bool ConstExpressionParser::parse ( const char * fileName,
int line,
const std::string & expression,
const std::string & orgExpression )

Definition at line 139 of file constexp.l.

140{
141 struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
142
143#ifdef FLEX_DEBUG
144 constexpYYset_debug(Debug::isFlagSet(Debug::Lex_constexp)?1:0,p->yyscanner);
145#endif
146
147 yyextra->constExpFileName = fileName;
148 yyextra->constExpLineNr = lineNr;
149 yyextra->orgString = orgStr;
150 yyextra->inputString = s;
151 yyextra->inputPosition = 0;
152 constexpYYrestart( yyin, p->yyscanner );
153
154 DebugLex debugLex(Debug::Lex_constexp, __FILE__, fileName);
155 //printf("Expression: '%s'\n",qPrint(s));
156
157 constexpYYparse(p->yyscanner);
158
159 //printf("Result: %ld\n",(long)g_resultValue);
160 bool result = static_cast<long>(yyextra->resultValue)!=0;
161
162 return result;
163}
@ Lex_constexp
Definition debug.h:55
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:135
int constexpYYparse(yyscan_t)

References constexpYYparse(), Debug::isFlagSet(), Debug::Lex_constexp, and p.

Member Data Documentation

◆ p

std::unique_ptr<Private> ConstExpressionParser::p
private

Definition at line 34 of file constexp.h.

Referenced by ConstExpressionParser(), parse(), and ~ConstExpressionParser().


The documentation for this class was generated from the following files: