OMNeT++ NEDXML  6.0.3
NedParser Class Reference

#include <nedparser.h>

Description

Parses NED files into an AST.

Elements of the tree are subclassed from ASTNode; ASTNodeFactory is used to actually create the objects. Internally this class uses a bison/flex grammar and SourceDocument.

Public Member Functions

 NedParser (ErrorStore *e)
 
 ~NedParser ()
 
void setStoreSource (bool b)
 
bool getStoreSourceFlag ()
 
ASTNodeparseNedFile (const char *osfname, const char *fname=nullptr)
 
ASTNodeparseNedText (const char *nedtext, const char *fname=nullptr)
 
bool isValidNedExpression (const char *expr)
 

Static Public Member Functions

static const char * getBuiltInDeclarations ()
 

Public Attributes

ParseContext np
 

Protected Member Functions

bool loadFile (const char *osfname, const char *fname)
 
bool loadText (const char *nedtext, const char *fname)
 
ASTNodeparseNed ()
 

Constructor & Destructor Documentation

◆ NedParser()

Constructor.

◆ ~NedParser()

~NedParser ( )

Destructor.

Member Function Documentation

◆ loadFile()

bool loadFile ( const char *  osfname,
const char *  fname 
)
protected

◆ loadText()

bool loadText ( const char *  nedtext,
const char *  fname 
)
protected

◆ parseNed()

ASTNode* parseNed ( )
protected

◆ getBuiltInDeclarations()

static const char* getBuiltInDeclarations ( )
static

Returns a NED source which contains declarations of built-in NED types.

◆ setStoreSource()

void setStoreSource ( bool  b)
inline

Affects operation of parseFile() and parseText(), specifies whether sourceCode attributes in ASTNodes should be filled out. Default is false.

References ParseContext::storesrc.

◆ getStoreSourceFlag()

bool getStoreSourceFlag ( )
inline

Returns the "store source code" flag; see setStoreSource().

References ParseContext::storesrc.

◆ parseNedFile()

ASTNode* parseNedFile ( const char *  osfname,
const char *  fname = nullptr 
)

Parses the given NED file (osfname), and returns the result tree. Returns nullptr or partial tree if there was an error. The fname parameter will be used to fill in the source location attributes; it defaults to osfname.

◆ parseNedText()

ASTNode* parseNedText ( const char *  nedtext,
const char *  fname = nullptr 
)

Parse the given NED source and return the result tree. Returns nullptr or partial tree if there was an error. The fname parameter will be used to fill in the source location attributes; it defaults to "buffer".

◆ isValidNedExpression()

bool isValidNedExpression ( const char *  expr)

Returns true if the given string is a syntactically valid NED expression (corresponds to the grammar), and false otherwise.

Member Data Documentation

◆ np


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