EasyLexer-configuration.h (17059B)
1 /* -*- C++ -*- vim: set syntax=cpp: 2 * 3 * (C) 2005-2015 Frank-Rene Schaefer 4 * ABSOLUTELY NO WARRANTY */ 5 #ifndef __QUEX_INCLUDE_GUARD__ANALYZER__CONFIGURATION__QUEX___EASYLEXER 6 #define __QUEX_INCLUDE_GUARD__ANALYZER__CONFIGURATION__QUEX___EASYLEXER 7 /* Additionally to the 'local' include guard, there is an include indicator 8 * 9 * __INCLUDE_INDICATOR_QUEX__CONFIGURATION 10 * 11 * If it is defined, this means, that another lexical analyzer configuration 12 * has been included before this. That in turn means, that multiple lexical 13 * analyzers are used. The configuration settings of the previous analyzer 14 * need to be undefined. And, this happens in "configuration/undefine". 15 * 16 * NOTE: We do undefine without making sure that there is an older definition 17 * from a configuration file. This allows users to define some 18 * configuration options on the command line without being immediately 19 * deleted by "configuration/undefine". */ 20 #ifdef __QUEX_INCLUDE_INDICATOR__ANALYZER__CONFIGURATION 21 # include <quex/code_base/analyzer/configuration/undefine> 22 #else 23 # define __QUEX_INCLUDE_INDICATOR__ANALYZER__CONFIGURATION 24 #endif 25 26 #define QUEX_SETTING_VERSION "0.66.5" 27 #define QUEX_SETTING_BUILD_DATE "Mon Jul 10 22:38:27 2017" 28 #define QUEX_SETTING_ANALYZER_VERSION "0.0.0-pre-release" 29 30 #ifndef __QUEX_OPTION_PLAIN_C 31 #define __QUEX_OPTION_PLAIN_C 32 #endif 33 34 /* Following checks are best done here: 35 * -- Verification of the 'C++/C' version. 36 * -- Assert control by this configuration file. 37 * 38 * Errors would be hard to find if the two checks were made in 39 * -- 'quex/code_base/configuration/validation' or 40 * -- 'quex/code_base/configuration/derived'. */ 41 #if ! defined(__QUEX_OPTION_PLAIN_C) && ! defined(__cplusplus) 42 # error "__QUEX_OPTION_PLAIN_C must be defined if no C++ compiler is used! Call quex with option '--language C'." 43 #endif 44 45 #if defined(__QUEX_INCLUDE_INDICATOR__ASSERTS) 46 # error "Asserts included before configuration file. However, the configuration file MUST control asserts!" 47 #endif 48 # 49 #if defined(QUEX_OPTION_ASSERTS_DISABLED) || defined(NDEBUG) 50 # ifdef QUEX_OPTION_ASSERTS 51 # undef QUEX_OPTION_ASSERTS 52 # endif 53 #else 54 # ifndef QUEX_OPTION_ASSERTS 55 # define QUEX_OPTION_ASSERTS 56 # endif 57 #endif 58 59 #ifndef QUEX_OPTION_COMPUTED_GOTOS 60 /* #define QUEX_OPTION_COMPUTED_GOTOS */ 61 #endif 62 63 #define QUEX_SETTING_CHARACTER_NEWLINE_IN_ENGINE_CODEC ('\n') 64 65 #define __QUEX_SETTING_MAX_MODE_CLASS_N (1) 66 #ifndef __QUEX_SETTING_INITIAL_LEXER_MODE_ID 67 # define __QUEX_SETTING_INITIAL_LEXER_MODE_ID (QUEX_NAME(ModeID_PROGRAM)) 68 #endif 69 /* QUEX_TYPE_TOKEN_ID is later on defined inside the token class header. */ 70 #define __QUEX_SETTING_TOKEN_ID_TERMINATION ((QUEX_TYPE_TOKEN_ID)QUEX_TKN_TERMINATION) 71 #define __QUEX_SETTING_TOKEN_ID_UNINITIALIZED ((QUEX_TYPE_TOKEN_ID)QUEX_TKN_UNINITIALIZED) 72 #define __QUEX_SETTING_TOKEN_ID_INDENT ((QUEX_TYPE_TOKEN_ID)QUEX_TKN_INDENT) 73 #define __QUEX_SETTING_TOKEN_ID_DEDENT ((QUEX_TYPE_TOKEN_ID)QUEX_TKN_DEDENT) 74 #define __QUEX_SETTING_TOKEN_ID_NODENT ((QUEX_TYPE_TOKEN_ID)QUEX_TKN_NODENT) 75 #define __QUEX_SETTING_TOKEN_ID_REPETITION_TEST(TokenID) (false) 76 77 #ifndef __QUEX_OPTION_LITTLE_ENDIAN 78 #define __QUEX_OPTION_LITTLE_ENDIAN 79 #endif 80 #ifndef __QUEX_OPTION_BIG_ENDIAN 81 /* #define __QUEX_OPTION_BIG_ENDIAN */ 82 #endif 83 #ifndef __QUEX_OPTION_SYSTEM_ENDIAN 84 #define __QUEX_OPTION_SYSTEM_ENDIAN 85 #endif 86 87 #if (! defined(QUEX_OPTION_TOKEN_POLICY_QUEUE)) && (! defined(QUEX_OPTION_TOKEN_POLICY_QUEUE)) 88 #ifndef QUEX_OPTION_TOKEN_POLICY_QUEUE 89 #define QUEX_OPTION_TOKEN_POLICY_QUEUE 90 #endif 91 #ifndef QUEX_OPTION_TOKEN_POLICY_SINGLE 92 /* #define QUEX_OPTION_TOKEN_POLICY_SINGLE */ 93 #endif 94 #endif 95 96 #ifndef QUEX_OPTION_USER_MANAGED_TOKEN_MEMORY 97 /* #define QUEX_OPTION_USER_MANAGED_TOKEN_MEMORY */ 98 #endif 99 100 #if defined (QUEX_OPTION_TOKEN_POLICY_QUEUE) 101 # ifndef QUEX_SETTING_TOKEN_QUEUE_SIZE 102 # define QUEX_SETTING_TOKEN_QUEUE_SIZE ((size_t)64) 103 # endif 104 # ifndef QUEX_SETTING_TOKEN_QUEUE_SAFETY_BORDER 105 # define QUEX_SETTING_TOKEN_QUEUE_SAFETY_BORDER ((size_t)16) 106 # endif 107 #endif 108 109 #ifndef QUEX_OPTION_TOKEN_REPETITION_SUPPORT 110 /* #define QUEX_OPTION_TOKEN_REPETITION_SUPPORT */ 111 #endif 112 113 /* OPTIONS: ___________________________________________________________________ 114 * 115 * Activate/Deactivate Options via comment/uncomment. Options without a 116 * double underline '__' at the beginning can be turned off in the created 117 * engine. Options that do start with '__' configure the machine for the 118 * specified behavior. Such options are better not touched. 119 * 120 * -- Line Number / Column Number Counting: 121 * Turning counting off may result in engine speed-up. */ 122 #ifndef QUEX_OPTION_LINE_NUMBER_COUNTING 123 #define QUEX_OPTION_LINE_NUMBER_COUNTING 124 #endif 125 #ifndef QUEX_OPTION_COLUMN_NUMBER_COUNTING 126 #define QUEX_OPTION_COLUMN_NUMBER_COUNTING 127 #endif 128 129 #define QUEX_IF_IS_NEWLINE(X) if( X == '\n' ) 130 131 #ifndef QUEX_OPTION_POST_CATEGORIZER 132 /* #define QUEX_OPTION_POST_CATEGORIZER */ 133 #endif 134 135 /* Mode Transitions: 136 * If the engine was created without the flag '--no-mode-transition-check' 137 * then code for mode transition control is inserted. It can be deactivated 138 * by commenting the following option out. */ 139 #ifndef QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK 140 #define QUEX_OPTION_RUNTIME_MODE_TRANSITION_CHECK 141 #endif 142 143 #ifndef QUEX_SETTING_MODE_STACK_SIZE 144 # define QUEX_SETTING_MODE_STACK_SIZE (size_t)8 145 #endif 146 147 /* Verbosity (uncomment the following, if you want it verbose.) */ 148 /* #define QUEX_OPTION_ASSERTS_WARNING_MESSAGE_DISABLED */ 149 150 /* Include Stack Support */ 151 #ifndef QUEX_OPTION_INCLUDE_STACK 152 #define QUEX_OPTION_INCLUDE_STACK 153 #endif 154 155 /* BLC -- Buffer Limit Code: 156 * 157 * This code is used as a delimiter for buffer borders. When the analyzer 158 * hits a character with such a code, it knows that a border or the 159 * end of file has been reached. 160 * 161 * IT IS NOT SUPPOSED TO APPEAR IN THE NORMAL CHARACTER STREAM. */ 162 #ifndef QUEX_SETTING_BUFFER_LIMIT_CODE 163 # define QUEX_SETTING_BUFFER_LIMIT_CODE ((QUEX_TYPE_LEXATOM)0x0) 164 #endif 165 166 /* PTC -- Path Termination code: 167 * 168 * Only required for path compression (see option '--path-compression' and 169 * '--path-compression-uniform' for quex on the command line). PTC must be 170 * different from the BLC so that the pathwalker does not get confuses if 171 * the input pointer stands on a buffer border and at the same time the 172 * path iterator stands at the end of the path. 173 * 174 * IT IS NOT SUPPOSED TO APPEAR IN THE NORMAL CHARACTER STREAM. */ 175 #ifndef QUEX_SETTING_PATH_TERMINATION_CODE 176 # define QUEX_SETTING_PATH_TERMINATION_CODE ((QUEX_TYPE_LEXATOM)0x1) 177 #endif 178 179 /* NOTE: A cast to 'size_t' would it make impossible to use the macro in 180 * pre-processor comparisons. */ 181 #ifndef QUEX_SETTING_BUFFER_SIZE 182 /* This setting must be defined as plain number, since there might 183 * be some pre-processor comparison operations depending on it. */ 184 # define QUEX_SETTING_BUFFER_SIZE 65536 185 #endif 186 187 #ifndef QUEX_SETTING_BUFFER_FILLER_SEEK_TEMP_BUFFER_SIZE 188 # define QUEX_SETTING_BUFFER_FILLER_SEEK_TEMP_BUFFER_SIZE (512) 189 #endif 190 #ifndef QUEX_SETTING_ICU_PIVOT_BUFFER_SIZE 191 # define QUEX_SETTING_ICU_PIVOT_BUFFER_SIZE (64) 192 #endif 193 194 #ifndef QUEX_OPTION_STRING_ACCUMULATOR 195 #define QUEX_OPTION_STRING_ACCUMULATOR 196 #endif 197 /* Initial size of the character accumulator. */ 198 #ifndef QUEX_SETTING_ACCUMULATOR_INITIAL_SIZE 199 # define QUEX_SETTING_ACCUMULATOR_INITIAL_SIZE (256) 200 #endif 201 202 /* Granularity, if new memory has to be allocated. The new memory will be by 203 * this factor greater than the previous. Example: At start, memory contains 204 * 256 characters; then new allocation becomes necessary; if factor = 0.5, then 205 * the new memory will contain (256 + 128) = 384 characters. The next time, the 206 * new memory of size (384 + 192) = 576 characters. */ 207 208 #ifndef QUEX_SETTING_ACCUMULATOR_GRANULARITY_FACTOR 209 # define QUEX_SETTING_ACCUMULATOR_GRANULARITY_FACTOR (0.8) 210 #endif 211 212 /* If one mode requires indentation support, then the lexical analyser class 213 * must be setup for indentation counting. The following flag is defined or 214 * undefined by the lexical analyser generator quex. */ 215 #define QUEX_OPTION_INDENTATION_TRIGGER 216 #if defined(QUEX_OPTION_INDENTATION_TRIGGER) 217 # ifndef QUEX_SETTING_INDENTATION_STACK_SIZE 218 # define QUEX_SETTING_INDENTATION_STACK_SIZE (64) 219 # endif 220 # ifndef QUEX_TYPE_INDENTATION 221 # define QUEX_TYPE_INDENTATION size_t 222 # endif 223 #endif 224 225 /* Quex can determine whether certain handlers are not used at all. If so, 226 * computation time can be spared and quex comments the following options out. 227 * */ 228 /* #define __QUEX_OPTION_ON_ENTRY_HANDLER_PRESENT */ 229 /* #define __QUEX_OPTION_ON_EXIT_HANDLER_PRESENT */ 230 /* #define QUEX_OPTION_CONVERTER_ICONV */ 231 /* #define QUEX_OPTION_CONVERTER_ICU */ 232 #if defined(QUEX_OPTION_CONVERTER_ICONV) || defined(QUEX_OPTION_CONVERTER_ICU) 233 # ifndef QUEX_SETTING_TRANSLATION_BUFFER_SIZE 234 # define QUEX_SETTING_TRANSLATION_BUFFER_SIZE ((size_t)65536) 235 # endif 236 #else 237 # ifndef QUEX_SETTING_TRANSLATION_BUFFER_SIZE 238 # define QUEX_SETTING_TRANSLATION_BUFFER_SIZE ((size_t)0) 239 # endif 240 #endif 241 /* The call the the 'new' function for the converter, i.e. the function that 242 * allocates the converter and initializes it. If it is 0x0, this means that 243 * the converter pointer is set to 0x0. */ 244 #ifndef QUEX_SETTING_BUFFER_FILLERS_CONVERTER_NEW 245 /* # define QUEX_SETTING_BUFFER_FILLERS_CONVERTER_NEW */ 246 #endif 247 248 /* Begin of line pre-condition requires an extra flag in the buffer 249 * structure. Only out-comment this in case of tough memory restrictions, 250 * if no begin of line pre-condition is required. */ 251 /* #define __QUEX_OPTION_SUPPORT_BEGIN_OF_LINE_PRE_CONDITION */ 252 253 /* Following switch is also set, if a user defined converter is defined. */ 254 #ifndef __QUEX_OPTION_CONVERTER 255 /* #define __QUEX_OPTION_CONVERTER */ 256 #endif 257 #ifndef __QUEX_OPTION_CONVERTER_HELPER 258 /* #define __QUEX_OPTION_CONVERTER_HELPER */ 259 #endif 260 261 /* Type Definitions 262 * 263 * CHARACTER TYPE: Type that represents the number of bytes used in the engine 264 * to store a character. This is independent of the coding (ASCII, WinArabic, 265 * ...) 266 * 267 * Both character types are clearly related, because they are supposed to 268 * relate to the same type of objects in memory. The following example shows, 269 * that 'uint8_t' and 'char' belong together, the lexeme type cannot be 270 * 'uint8_t' because the std-string functions accept 'char*' and not 'uint8_t' 271 * (which is most propperly 'unsigned char'). 272 * 273 * NOTE: If in parallel another engine is built with other bytes per character 274 * settings, then the engines will also include their own header with their own 275 * definition of QUEX_TYPE_LEXATOM. Thus there is no danger at all. 276 * Templatifying the lexer would be possible, but the author has in mind to 277 * bring out a 'pure C' version of the quex generated engine. Thus templating 278 * would make this goal harder achievable. 279 * */ 280 #ifndef QUEX_TYPE_LEXATOM 281 # define QUEX_TYPE_LEXATOM uint8_t 282 # define QUEX_TYPE_LEXATOM_BACKUP uint8_t 283 #endif 284 #ifndef QUEX_SETTING_CHARACTER_SIZE 285 /* Size of a QUEX_TYPE_LEXATOM in bytes. A numeric value is required 286 * here! '-1' stands for 'Cannot be determined at code generation time'. 287 * In this case, it must be relied upon 'sizeof(QUEX_TYPE_LEXATOM)'. */ 288 # define QUEX_SETTING_CHARACTER_SIZE 1 289 #endif 290 #ifndef QUEX_SETTING_CHARACTER_CODEC 291 # define QUEX_SETTING_CHARACTER_CODEC unicode 292 #endif 293 /* The following flag indicates that the engine is running on a specific 294 * codec. Thus no converter is necessary. Use the flag to detect misuse. */ 295 /* #define __QUEX_OPTION_ENGINE_RUNNING_ON_CODEC */ 296 297 #ifndef QUEX_TYPE_ACCEPTANCE_ID 298 # define QUEX_TYPE_ACCEPTANCE_ID int 299 #endif 300 301 /* QUEX_TYPE_X --> Type of X in global namespace 302 * QUEX_TYPE0_X --> Type of X in local namespace (namespace omitted) */ 303 #if defined(__QUEX_OPTION_PLAIN_C) 304 # define QUEX_FUNCTION_PREFIX quex_EasyLexer_ 305 # define QUEX_FUNCTION_DEF_PREFIX quex_EasyLexer_ 306 /* In 'C' there are no namespaces, so namespaces are coded directly 307 * into the type name. Both, global and local names are equal. */ 308 # define QUEX_TYPE0_ANALYZER struct quex_EasyLexer_tag 309 # define QUEX_TYPE_ANALYZER struct quex_EasyLexer_tag 310 # define QUEX_NAME_COMPLETE_ANALYZER quex_EasyLexer 311 # define QUEX_TYPE_DERIVED_ANALYZER struct quex_EasyLexer_tag 312 313 # define QUEX_TYPE0_TOKEN struct quex_Token_tag 314 # define QUEX_TYPE_TOKEN struct quex_Token_tag 315 # define QUEX_NAME_COMPLETE_TOKEN quex_Token 316 317 # define QUEX_NAMESPACE_MAIN quex_EasyLexer 318 # define QUEX_NAMESPACE_MAIN_OPEN 319 # define QUEX_NAMESPACE_MAIN_CLOSE 320 321 # define QUEX_NAMESPACE_TOKEN 322 # define QUEX_NAMESPACE_TOKEN_OPEN 323 # define QUEX_NAMESPACE_TOKEN_CLOSE 324 325 # define QUEX_NAMESPACE_LEXEME_NULL_OPEN 326 # define QUEX_NAMESPACE_LEXEME_NULL_CLOSE 327 # define QUEX_LEXEME_NULL_IN_ITS_NAMESPACE quex_LexemeNullObject 328 # define QUEX_LEXEME_NULL quex_LexemeNullObject 329 330 # define QUEX_NAME(NAME) quex_EasyLexer_ ## NAME 331 # define QUEX_NAME_TOKEN(NAME) quex_Token_ ## NAME 332 # define QUEX_MEMBER(NAME) void /* Undefined, not required */ 333 /* When creating a 'shared token class', macros are temporarily redefined. 334 * This happens to generate converters in the token's namespace. After 335 * that, the original macros need to be restored. Thus: Backup! */ 336 # define QUEX_NAMESPACE_MAIN_OPEN_BACKUP 337 # define QUEX_NAMESPACE_MAIN_CLOSE_BACKUP 338 # define QUEX_FUNCTION_PREFIX_BACKUP quex_EasyLexer_ 339 # define QUEX_FUNCTION_DEF_PREFIX_BACKUP quex_EasyLexer_ 340 341 #else 342 /* Assumption: here is IN the namespace for definition. */ 343 # define QUEX_FUNCTION_DEF_PREFIX 344 # define QUEX_FUNCTION_PREFIX quex:: 345 /* Add namespaces for the global names of the classes of analyzer 346 * and token. */ 347 # define QUEX_TYPE0_ANALYZER EasyLexer 348 # define QUEX_TYPE_ANALYZER quex::EasyLexer 349 # define QUEX_NAME_COMPLETE_ANALYZER quex::EasyLexer 350 # define QUEX_TYPE_DERIVED_ANALYZER EasyLexer 351 352 # define QUEX_TYPE0_TOKEN Token 353 # define QUEX_TYPE_TOKEN quex::Token 354 # define QUEX_NAME_COMPLETE_TOKEN quex::Token 355 356 # define QUEX_NAMESPACE_MAIN quex 357 # define QUEX_NAMESPACE_MAIN_OPEN namespace quex {\ 358 359 # define QUEX_NAMESPACE_MAIN_CLOSE } /* Closing Namespace 'quex' */\ 360 361 362 # define QUEX_NAMESPACE_TOKEN quex 363 # define QUEX_NAMESPACE_TOKEN_OPEN namespace quex {\ 364 365 # define QUEX_NAMESPACE_TOKEN_CLOSE } /* Closing Namespace 'quex' */\ 366 367 368 # define QUEX_NAMESPACE_LEXEME_NULL_OPEN namespace quex {\ 369 370 # define QUEX_NAMESPACE_LEXEME_NULL_CLOSE } /* Closing Namespace 'quex' */\ 371 372 # define QUEX_LEXEME_NULL_IN_ITS_NAMESPACE LexemeNullObject 373 # define QUEX_LEXEME_NULL ::quex::LexemeNullObject 374 375 # define QUEX_NAME(NAME) EasyLexer_ ## NAME 376 # define QUEX_NAME_TOKEN(NAME) Token_ ## NAME 377 # define QUEX_MEMBER(NAME) EasyLexer::NAME 378 /* When creating a 'shared token class', macros are temporarily redefined. 379 * This happens to generate converters in the token's namespace. After 380 * that, the original macros need to be restored. Thus: Backup! */ 381 # define QUEX_NAMESPACE_MAIN_OPEN_BACKUP namespace quex {\ 382 383 # define QUEX_NAMESPACE_MAIN_CLOSE_BACKUP } /* Closing Namespace 'quex' */\ 384 385 # define QUEX_FUNCTION_PREFIX_BACKUP 386 # define QUEX_FUNCTION_DEF_PREFIX_BACKUP quex:: 387 #endif 388 389 #ifndef QUEX_TYPE_TOKEN_ID 390 # define QUEX_TYPE_TOKEN_ID uint32_t 391 #endif 392 #ifndef QUEX_TYPE_TOKEN_LINE_N 393 # define QUEX_TYPE_TOKEN_LINE_N size_t 394 #endif 395 #ifndef QUEX_TYPE_TOKEN_COLUMN_N 396 # define QUEX_TYPE_TOKEN_COLUMN_N size_t 397 #endif 398 399 #include "analyzerConfigDerived" 400 401 #endif /* __QUEX_INCLUDE_GUARD__ANALYZER__CONFIGURATION__QUEX___EASYLEXER */