Xmipp  v3.23.11-Nereus
Public Member Functions | Public Attributes | List of all members
SectionDef Class Reference

#include <argsparser.h>

Inheritance diagram for SectionDef:
Inheritance graph
[legend]
Collaboration diagram for SectionDef:
Collaboration graph
[legend]

Public Member Functions

 SectionDef (ArgLexer *lexer, ASTNode *parent)
 
 ~SectionDef ()
 
virtual bool parse ()
 
virtual void check (std::stringstream &errors)
 
void addParamDef (ParamDef *param)
 Add a param to the section. More...
 
- Public Member Functions inherited from ASTNode
 ASTNode (ArgLexer *lexer=NULL, ASTNode *parent=NULL)
 
virtual ~ASTNode ()
 
virtual bool consume (ArgTokenType type)
 
ArgTokenType lookahead () const
 
bool lookahead (ArgTokenType type) const
 
ArgTokencurrentToken () const
 
void nextToken ()
 
bool parseCommentList (CommentList &comments)
 
void error (String msg)
 
void unexpectedToken (String msg="")
 

Public Attributes

CommentList comments
 
std::vector< ParamDef * > params
 All params defined for the program. More...
 
- Public Attributes inherited from ASTNode
ASTNodeparent
 
ArgLexerpLexer
 
ArgToken token
 
String name
 
int visible
 

Detailed Description

Definition at line 220 of file argsparser.h.

Constructor & Destructor Documentation

◆ SectionDef()

SectionDef::SectionDef ( ArgLexer lexer,
ASTNode parent 
)

Definition at line 773 of file argsparser.cpp.

773  :
774  ASTNode(lexer, parent)
775 {}
ASTNode(ArgLexer *lexer=NULL, ASTNode *parent=NULL)
Definition: argsparser.cpp:349

◆ ~SectionDef()

SectionDef::~SectionDef ( )

Definition at line 777 of file argsparser.cpp.

778 {
779  for (size_t i = 0; i < params.size(); ++i)
780  delete params[i];
781 }
#define i
std::vector< ParamDef * > params
All params defined for the program.
Definition: argsparser.h:224

Member Function Documentation

◆ addParamDef()

void SectionDef::addParamDef ( ParamDef param)

Add a param to the section.

Definition at line 762 of file argsparser.cpp.

763 {
765  if (prog->findParam(param->name) == NULL)
766  {
767  prog->addParamName(param->name, param);
768  param->parent = this;
769  params.push_back(param);
770  }
771 }
String name
Definition: argsparser.h:152
ParamDef * findParam(const String &param)
Definition: argsparser.cpp:905
ASTNode * parent
Definition: argsparser.h:147
ProgTransformDimRed * prog
void addParamName(const String &name, ParamDef *param)
Definition: argsparser.cpp:912
std::vector< ParamDef * > params
All params defined for the program.
Definition: argsparser.h:224

◆ check()

virtual void SectionDef::check ( std::stringstream &  errors)
inlinevirtual

Implements ASTNode.

Definition at line 229 of file argsparser.h.

230  {
231  }

◆ parse()

bool SectionDef::parse ( )
virtual

Implements ASTNode.

Definition at line 783 of file argsparser.cpp.

784 {
785  if (lookahead(TOK_SECTION))
786  {
788  name = token.lexeme;
791  }
792 
793  //OL -> params OD ODL | SD ODL | e
794  ArgTokenType t = lookahead();
795 
796  if (!(t == TOK_OPT || t == TOK_OR || t == TOK_LBRA))
797  unexpectedToken("parsing section, expecting param definition");
798 
799  while (t == TOK_OPT || t == TOK_OR || t == TOK_LBRA)
800  {
801  ParamDef * param = new ParamDef(pLexer, this);
802  param->parse();
803  params.push_back(param);
804  t = lookahead();
805  }
806 
807  return true;
808 }
virtual bool consume(ArgTokenType type)
Definition: argsparser.cpp:376
String name
Definition: argsparser.h:152
bool parseCommentList(CommentList &comments)
Definition: argsparser.cpp:392
CommentList comments
Definition: argsparser.h:223
int visibility
Definition: argsparser.h:83
ArgLexer * pLexer
Definition: argsparser.h:150
ArgTokenType
Definition: argsparser.h:43
int visible
Definition: argsparser.h:153
virtual bool parse()
Definition: argsparser.cpp:558
struct _parameter * param
std::vector< ParamDef * > params
All params defined for the program.
Definition: argsparser.h:224
ArgToken token
Definition: argsparser.h:151
void unexpectedToken(String msg="")
Definition: argsparser.cpp:413
String lexeme
the string literal value of the token
Definition: argsparser.h:76
ArgTokenType lookahead() const
Definition: argsparser.cpp:356

Member Data Documentation

◆ comments

CommentList SectionDef::comments

Definition at line 223 of file argsparser.h.

◆ params

std::vector<ParamDef*> SectionDef::params

All params defined for the program.

Definition at line 224 of file argsparser.h.


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