NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
CMacroParser Class Reference

Search Toolkit Book for CMacroParser

Class provides macro language interface for bulk bio-editing. More...

#include <gui/objutils/macro_parse.hpp>

+ Collaboration diagram for CMacroParser:

Public Types

enum  EParsingErrReportType { eErrorLineAndColumn , eErrorAbsolutePos }
 
typedef CQueryParseTree::TFunctionNames TFunctionNamesList
 Type for the list of functions in Where/Do clauses. More...
 

Public Member Functions

 CMacroParser ()
 Constructor. More...
 
virtual ~CMacroParser ()
 Destructor. More...
 
void SetFunctionNames (const TFunctionNamesList &wh_funcs, const TFunctionNamesList &do_funcs)
 initializes lists of known functions that should be recognized by the parser when going through WHERE and DO clauses More...
 
const TFunctionNamesListGetWhereFunctions () const
 get list of where functions More...
 
const TFunctionNamesListGetDoFunctions () const
 get list of do functions More...
 
void SetSource (const char *sMacroText)
 Reset the parser and sets macro text to be parsed. More...
 
bool Parse (bool bSingleMacroMode=true, CQueryExec *exec=NULL)
 Parse the macro and build its representation Function throws CMacroException if parsing is unsuccessful. More...
 
CMacroRepDetachMacroRep ()
 Detach macro representation for futher processing Caller is responsible for deletion of returned object ! maybe use CRef instead [?]. More...
 
void SetErrLocReportType (EParsingErrReportType type)
 Get the error location from the most recent parsing. More...
 

Static Public Attributes

static const char * sm_Automatic = "automatic"
 

Private Member Functions

void x_InitParser ()
 Resets parser to initial state. More...
 
void x_ParseScript ()
 Entry point to parse whole script. More...
 
void x_ParseVariables ()
 Entry point to parse vars section. More...
 
void x_ParseChoice ()
 Entry point to parse choice section. More...
 
void x_ParseRange ()
 Entry point to parse range. More...
 
void x_ParseThreadCount ()
 Entry point to parse number of threads to be used. More...
 
void x_ParseBody ()
 Entry point to parse body section. More...
 
void x_ParseWhere ()
 Entry point to parse where clause. More...
 
void x_ParseFunctionWhere ()
 Entry point to parse where clause in function call. More...
 
void x_ParseDo ()
 Entry point to parse DO-DONE section. More...
 
void x_ParseFunctionCall (CQueryParseTree::TNode *assignmentNode)
 Entry point to parse function call. More...
 
void x_ParseMetaData ()
 
int x_ParseSign ()
 
void x_ParseNumericVarValue (const string &var_name, int sign)
 Entry point to parse numeric var value. More...
 
void x_ParseNumericChoiceValue (int sign)
 Parses numeric value of a choice variable. More...
 
void x_ParseNumericParameterValue (int sign, CScanner::SLocation start)
 Parses numeric value of a function parameter. More...
 
bool x_IsFunction (const string &name) const
 Checks whether its parameter is a name of the registered functions. More...
 
void x_GetWhereClause (Int4 istart, Int4 iend, string &result) const
 Extracts where clause as a string. More...
 
CQueryParseTreex_QParseWhere (const string &str, unsigned line, unsigned linePos) const
 Translates Where clause into a tree. More...
 
void x_SortParseTree (CQueryParseTree::TNode &node) const
 Sorts the nodes according to a weight function for faster tree evaluation. More...
 
void x_InternalParseWhere (const CScanner::EToken terminator, string &str, CQueryParseTree *&tree)
 Extracts Where clause string and builds Where clause tree; it uses terminator token to determine the end of Where clause. More...
 
void x_UpdateErrorLocation ()
 
string x_GetErrorLocation () const
 
string x_GetError ()
 
 CMacroParser (const CMacroParser &)
 Prohibit copy constructor and assignment operator. More...
 
CMacroParseroperator= (const CMacroParser &)
 

Private Attributes

const char * m_StrMacro
 string to be parsed More...
 
CScanner m_Scanner
 scanner for extracting tokens and meta info More...
 
TFunctionNamesList m_WhereFunctionsList
 list of functions available for Where clause More...
 
TFunctionNamesList m_DoFunctionsList
 list of functions available for Do clause More...
 
set< stringm_RTVars
 list of run-time variables met in the left side of assignment in DO clause More...
 
CMacroRepm_MacroRep
 binary representation of macro while parsing More...
 
CScanner::SLocation m_ErrorLocation
 error location More...
 
EParsingErrReportType m_ErrorReportType
 Specifies the type of error reporting. More...
 

Detailed Description

Class provides macro language interface for bulk bio-editing.

Parses text containing macro(s) into binary macro representation (instance of CMacroRep). While parsing it uses CScanner for extracting lexems from a string and it uses QParse library (util/qparse) for parsing Where-clause of a macro

Definition at line 243 of file macro_parse.hpp.


The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:57:09 2024 by modify_doxy.py rev. 669887