27 #ifndef FCML_PARSER_HPP_    28 #define FCML_PARSER_HPP_    63             _throwExceptionOnError(true),
    64             _ignoreUndefinedSymbols(false),
    65             _disableSymbolsDeclaration(true),
    66             _overrideLabels(false),
    67             _allocSymbolTableIfNeeded(false),
    68             _enableErrorMessages(true) {
    73         return _allocSymbolTableIfNeeded;
    78         _allocSymbolTableIfNeeded = allocSymbolTableIfNeeded;
    83         return _disableSymbolsDeclaration;
    88         _disableSymbolsDeclaration = disableSymbolsDeclaration;
    93         return _enableErrorMessages;
    98         _enableErrorMessages = enableErrorMessages;
   103         return _ignoreUndefinedSymbols;
   108         _ignoreUndefinedSymbols = ignoreUndefinedSymbols;
   113         return _overrideLabels;
   118         _overrideLabels = overrideLabels;
   127         return _throwExceptionOnError;
   138         _throwExceptionOnError = throwExceptionOnError;
   142     bool _throwExceptionOnError;
   143     bool _ignoreUndefinedSymbols;
   144     bool _disableSymbolsDeclaration;
   145     bool _overrideLabels;
   146     bool _allocSymbolTableIfNeeded;
   147     bool _enableErrorMessages;
   163             _ip(ip), _symbolTable(NULL) {
   175             _ip(ip), _symbolTable(symbolTable) {
   258         _symbolTable = symbolTable;
   320         _symbol.setNotNull(
false);
   321         _symbol.setValue(
Symbol());
   343         _instruction = instruction;
   419                 (symbolTable) ? extractSymbolTable(*symbolTable) : NULL;
   420         context.
dialect = extractDialect(_dialect);
   427             parserResult.
clean();
   431                     instruction.c_str(), &parser_result);
   434             ErrorTypeConverter::convert(parser_result.
errors, errorContainer);
   446                         errorContainer.prepareErrorMessage(
   447                                 FCML_TEXT(
"Parsing failed")), errorContainer,
   454                 TypeConverter::convert(*(parser_result.
instruction),
   461                                         parser_result.
symbol->value) :
   468         } 
catch (std::exception &exc) {
 fcml_st_instruction * instruction
Parsed instruction as generic instruction model. 
Definition: fcml_parser.h:109
SymbolTable * getSymbolTable()
Gets the symbol table associated with the context. 
Definition: fcml_parser.hpp:247
ParserResult()
Creates an empty parser result. 
Definition: fcml_parser.hpp:282
Something failed while parsing. 
Definition: fcml_parser.hpp:43
void incrementIP(fcml_ip ip)
Increments instruction pointer by given number of bytes. 
Definition: fcml_parser.hpp:227
Parser wrapper. 
Definition: fcml_parser.hpp:387
void setEnableErrorMessages(bool enableErrorMessages)
Definition: fcml_parser.hpp:97
C++ wrappers common classes. 
bool isAllocSymbolTableIfNeeded() const
Definition: fcml_parser.hpp:72
fcml_bool override_labels
Set to true in order to allow overriding existing labels. 
Definition: fcml_parser.h:59
fcml_st_symbol_table symbol_table
Symbol table. 
Definition: fcml_parser.h:95
std::basic_string< fcml_char > fcml_cstring
By using this type definition here, it will be definitely much easier to support UNICODE in future re...
Definition: fcml_common.hpp:53
bool isDisableSymbolsDeclaration() const
Definition: fcml_parser.hpp:82
bool isEnableErrorMessages() const
Definition: fcml_parser.hpp:92
fcml_st_symbol * symbol
Defined symbol if there is any. 
Definition: fcml_parser.h:107
fcml_bool enable_error_messages
Enables textual error messages. 
Definition: fcml_parser.h:72
Wrapper for nullable value types. 
Definition: fcml_common.hpp:120
#define FCML_TEXT(x)
Used to code literal strings. 
Definition: fcml_types.h:61
void setSymbol(const Nullable< Symbol > &symbol)
Sets symbol. 
Definition: fcml_parser.hpp:351
Base class for all exceptions that are aware of ErrorContainer. 
Definition: fcml_errors.hpp:347
Parser(const Dialect &dialect)
Creates a parser instance for the given dialect. 
Definition: fcml_parser.hpp:396
ParserContext(SymbolTable *symbolTable, fcml_ip ip=0)
Creates a parser context for given symbol table and optional instruction pointer. ...
Definition: fcml_parser.hpp:174
ParserContext(fcml_ip ip=0)
Creates a parser context instance for optional instruction pointer. 
Definition: fcml_parser.hpp:162
Definition: fcml_assembler.hpp:39
fcml_ceh_error parse(ParserContext &ctx, const fcml_cstring &instruction, ParserResult &parserResult)
Parses instruction given in the parameters. 
Definition: fcml_parser.hpp:410
Parser configuration. 
Definition: fcml_parser.h:46
Parser configuration. 
Definition: fcml_parser.hpp:55
void setErrors(const ErrorContainer &errors)
Sets error container for the context. 
Definition: fcml_parser.hpp:333
Inherit from this class in order to get access to the native FCML dialect structure. 
Definition: fcml_dialect.hpp:98
Parser result. 
Definition: fcml_parser.hpp:275
fcml_st_dialect * dialect
Dialect to be used by parser. 
Definition: fcml_parser.h:78
void setInstruction(const Instruction &instruction)
Sets an instruction for the container. 
Definition: fcml_parser.hpp:342
bool isOverrideLabels() const
Definition: fcml_parser.hpp:112
ParserConfig & getConfig()
Gets the parser configuration associated with the context. 
Definition: fcml_parser.hpp:196
void setIgnoreUndefinedSymbols(bool ignoreUndefinedSymbols)
Definition: fcml_parser.hpp:107
Derive from this class if you really need access to the native symbol table. 
Definition: fcml_symbols.hpp:251
Reusable result holder. 
Definition: fcml_parser.h:99
bool isIgnoreUndefinedSymbols() const
Definition: fcml_parser.hpp:102
fcml_int64_t fcml_ip
General instruction pointer holder. 
Definition: fcml_common.h:96
C++ wrapper for the base dialect. 
void setAllocSymbolTableIfNeeded(bool allocSymbolTableIfNeeded)
Definition: fcml_parser.hpp:77
void setDisableSymbolsDeclaration(bool disableSymbolsDeclaration)
Definition: fcml_parser.hpp:87
fcml_bool ignore_undefined_symbols
Set to true in order to ignore all undefined symbols. 
Definition: fcml_parser.h:50
Structures and functions declarations related to FCML parsers. 
LIB_EXPORT void LIB_CALL fcml_fn_parser_result_prepare(fcml_st_parser_result *result)
Prepares reusable result holder for parser. 
const ParserConfig & getConfig() const
Gets the parser configuration associated with the context. 
Definition: fcml_parser.hpp:186
const Instruction & getInstruction() const
Gets the parsed instruction. 
Definition: fcml_parser.hpp:301
const ErrorContainer & getErrors() const
Gets errors container with parsing errors. 
Definition: fcml_parser.hpp:291
void setSymbolTable(SymbolTable *symbolTable)
Sets a symbol table for the instruction. 
Definition: fcml_parser.hpp:257
Represents one named symbol with associated value. 
Definition: fcml_symbols.hpp:41
const Nullable< Symbol > & getSymbol() const
Gets declared symbol is there is any. 
Definition: fcml_parser.hpp:310
Wraps multiple errors into one component. 
Definition: fcml_errors.hpp:148
const SymbolTable * getSymbolTable() const
Gets the symbol table associated with the context. 
Definition: fcml_parser.hpp:237
An internal error occurred. 
Definition: fcml_errors.h:49
fcml_st_parser_config configuration
Parser configuration. 
Definition: fcml_parser.h:80
void setThrowExceptionOnError(bool throwExceptionOnError)
Sets exception on error flag. 
Definition: fcml_parser.hpp:137
Describes an instruction. 
Definition: fcml_common.hpp:7185
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_parse(fcml_st_parser_context *context, const fcml_string instruction, fcml_st_parser_result *result)
Parses given instruction into the generic instruction model. 
fcml_ip getIp() const
Gets the instruction pointer. 
Definition: fcml_parser.hpp:206
Operation succeed. 
Definition: fcml_errors.h:42
fcml_bool disable_symbols_declaration
Disables symbols support. 
Definition: fcml_parser.h:54
void clean()
Cleans the parser result. 
Definition: fcml_parser.hpp:318
Parser context. 
Definition: fcml_parser.hpp:153
void setOverrideLabels(bool overrideLabels)
Definition: fcml_parser.hpp:117
Parser runtime context. 
Definition: fcml_parser.h:76
fcml_st_ceh_error_container errors
Parsing errors and warnings going here. 
Definition: fcml_parser.h:101
An abstract dialect. 
Definition: fcml_dialect.hpp:41
Definition: fcml_symbols.hpp:143
C++ API for symbols handling. 
LIB_EXPORT void LIB_CALL fcml_fn_parser_result_free(fcml_st_parser_result *result)
Cleans result holder. 
ErrorContainerAwareException(const fcml_cstring &msg, const ErrorContainer &errorContainer, fcml_ceh_error error=FCML_CEH_GEC_NO_ERROR)
Creates an error container aware exception instance and sets basic information for it...
Definition: fcml_errors.hpp:357
bool isThrowExceptionOnError() const
Gets true if exception should be thrown in case of error. 
Definition: fcml_parser.hpp:126
fcml_uint16_t fcml_ceh_error
All error codes should be held in variables of this type. 
Definition: fcml_errors.h:156
Converts objects to their structures counterparts. 
Definition: fcml_parser.hpp:371
fcml_ip ip
Instruction pointer. 
Definition: fcml_parser.h:85
void setIp(fcml_ip ip)
Gets a new instruction pointer. 
Definition: fcml_parser.hpp:216
C++ wrapper for the FCML errors handling. 
fcml_bool alloc_symbol_table_if_needed
By default parser ignores all symbol declarations if there is no symbol table provided in the parser ...
Definition: fcml_parser.h:69
ParserConfig()
Default constructor. 
Definition: fcml_parser.hpp:62