summaryrefslogtreecommitdiffstats
path: root/Source/LexerParser
Commit message (Collapse)AuthorAgeFilesLines
* math(EXPR): Implement ~(exp_NOT) expression as documentedGabor Bencze2019-07-232-57/+71
| | | | Fixes: #19252
* LexerParser: Regenerate parsers with bison 3.3Brad King2019-07-228-1225/+1273
| | | | Run `Utilities/Scripts/regenerate-parsers.bash`.
* Modernize: Enable modernize-raw-string-literal in clang-tidyArtur Ryt2019-04-021-1/+1
|
* cmListFileLexer: Add missing include to avoid possible pointer truncationZsolt Parragi2019-02-132-2/+2
| | | | | | | The `cmsys/Enconding.h` include had a typo in its surrounding ifdef, possibly causing a missing function declaration (`cmsysEncoding_DupToWide`). As this is C code, this resulted in the code compiling, but with a truncated return value, possibly causing crashes.
* Fix most clang -Wextra-semi-stmt warnings in C++ filesSean McBride2019-01-1512-12/+12
| | | | Suppress one in code generated by flex.
* Source/LexerParser: Suppress "Use of zero-allocated memory" warningKyle Edwards2019-01-148-0/+40
| | | | | | | clang scan-build warns about YY_CURRENT_BUFFER_LVALUE being zero- allocated, but the whole point of the macro is to know that it's not zero. Wrap the entire file in an "#ifndef __clang_analyzer__" block in order to suppress the warning.
* Fortran: Fix module dependency scanning with upper-case SUBMODULEBrad King2018-11-202-114/+114
| | | | | | | | The lexical token expression added by commit v3.7.0-rc1~73^2~1 (Fortran: Add support for submodule syntax in dependency scanning, 2016-09-05) has a typo and does not match upper-case `B` in `SUBMODULE`. Fix it. Fixes: #18595
* LexerParser: Suppress GCC -Wconversion warningsBrad King2018-07-319-880/+904
| | | | | GCC 8 warns about some of the conversions in bison-generated code. Suppress the warnings.
* math: Restore toleration of unexpected characters in an expressionBrad King2018-07-165-73/+67
| | | | | | | | Prior to commit 7c4c13ffef (math: Reject unexpected expression input explicitly, 2018-05-18) we ignored unexpected characters in an expression that otherwise can be parsed. In order to preserve compatibility with projects that accidentally used this, convert the error to a warning.
* Merge topic 'math-hex'Brad King2018-07-055-120/+159
|\ | | | | | | | | | | | | | | | | | | | | 5dbee9d2d0 math: Add options to calculate and format output as hexadecimal 8661e7052c math: Diagnose divide-by-zero 7c4c13ffef math: Reject unexpected expression input explicitly 5b0f73a15a math: Use 64-bit integer type for computation 963b8d9f6c math: Add RunCMake.math test to prepare for error cases Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2056
| * math: Add options to calculate and format output as hexadecimalDaniel Franke2018-07-032-51/+62
| |
| * math: Diagnose divide-by-zeroDaniel Franke2018-06-262-51/+59
| |
| * math: Reject unexpected expression input explicitlyDaniel Franke2018-06-265-116/+136
| | | | | | | | | | Switch to C++ exceptions for lexer/parser error handling. Teach the lexer/parser to fail on unexpected input.
* | ListFileLexer: Do not match null bytes in inputBrad King2018-06-262-103/+99
|/ | | | | | | | | | | Extend the fix from commit v3.10.0-rc1~188^2 (ListFileLexer: fix heap-buffer-overflow on malicious input, 2017-08-26) to apply to all lexer token matches. Replace all `.` with `[^\0\n]`. Update all `[^...]` match expressions to not match `\0`. We cannot safely process null bytes in strings. Fixes: #18124
* Fortran: Add support for submodule dependenciesBrad King2018-04-202-4/+4
| | | | | | | | | | | | | | | | | | | | | Since commit v3.7.0-rc1~73^2~1 (Fortran: Add support for submodule syntax in dependency scanning, 2016-09-05) we support parsing Fortran sources that use submodule syntax, but it left addition of `.smod` dependencies to future work. Add it now. The syntax submodule (module_name) submodule_name means the current source requires `module_name.mod` and provides `module_name@submodule_name.smod`. The syntax submodule (module_name:submodule_name) nested_submodule_name means the current source requires `module_name@submodule_name.smod` provides `module_name@nested_submodule_name.smod`. Fixes: #17017
* cmCommandArgumentParser: remove the variable tokens from the classRolf Eike Beer2017-10-252-14/+28
| | | | Make them local constants in the lexer file.
* ListFileLexer: fix heap-buffer-overflow on malicious inputMatthias Maennich2017-08-302-98/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | In case a list file contains a null terminated string that is continued until a later space, the lexer token information got inconsistent: e.g. an argument "TEST\0FOOBAR" is passed by the lexer as a token char* = "TEST\0FOOBAR" and length 11 ^^ note: ascii 0x00 Using strdup in cmListFileLexer leads lexer->token.text to be allocated with size 5 and lexer->token.length to be set to 11 A subsequent call to this function with an argument of 5 < length <= 11 wrongly assumed a sufficiently sized buffer and therefore corrupted the heap buffer. The program might crash due to this corruption. The case "NullTerminatedArgument" is intentionally using a quite large 'rest' to increase the chance to actually hit the issue. It will reliably crash with address sanitizer enabled though. This fix addresses all rules where arbitrary characters are matched to ignore \0 in order to fall through to the rule that matches an arbitrary character as BadCharacter. Signed-off-by: Matthias Maennich <matthias@maennich.net>
* cmFortranLexer: regenerate with flex 2.6.4 (previously 2.6.1)Matthias Maennich2017-08-283-497/+950
| | | | | | | | | | | | | | | | | | | | | | | | flex 2.6.3 introduces symbol remapping through macro definitions. hence the change appears bigger than one would expect from a minor version upgrade. In addition some manual cleanup that had to be done previously is now obsolete. namely: - the size_t cast of _yybytes_len in yy_scan_bytes (i is now also defined int and not size_t anymore) - the redefinition of yyl within yy_find_action (yyl is now already defined as int) Line number preprocessor directives (#line) were previously generated into the c source file. This actually breaks debugging as debuggers have a hard time finding the original cmFortranLexer.in.l and mapping the current instruction to a meaningful location within that file. The prefix "cmFortran_yy" can already be set as %option directly. For convenience also provide a sed command for all the manual steps that need to be done after generating. Signed-off-by: Matthias Maennich <matthias@maennich.net>
* cmExprLexer: regenerate with flex 2.6.4 (previously 2.6.1)Matthias Maennich2017-08-283-298/+824
| | | | | | | | | | | | | | | | | | | | | | | | flex 2.6.3 introduces symbol remapping through macro definitions. hence the change appears bigger than one would expect from a minor version upgrade. In addition some manual cleanup that had to be done previously is now obsolete. namely: - the size_t cast of _yybytes_len in yy_scan_bytes (i is now also defined int and not size_t anymore) - the redefinition of yyl within yy_find_action (yyl is now already defined as int) Line number preprocessor directives (#line) were previously generated into the c source file. This actually breaks debugging as debuggers have a hard time finding the original cmExprLexer.in.l and mapping the current instruction to a meaningful location within that file. The prefix "cmExpr_yy" can already be set as %option directly. For convenience also provide a sed command for all the manual steps that need to be done after generating. Signed-off-by: Matthias Maennich <matthias@maennich.net>
* cmDependsJavaLexer: regenerate with flex 2.6.4 (previously 2.6.1)Matthias Maennich2017-08-283-395/+824
| | | | | | | | | | | | | | | | | | | | | | | | flex 2.6.3 introduces symbol remapping through macro definitions. hence the change appears bigger than one would expect from a minor version upgrade. In addition some manual cleanup that had to be done previously is now obsolete. namely: - the size_t cast of _yybytes_len in yy_scan_bytes (i is now also defined int and not size_t anymore) - the redefinition of yyl within yy_find_action (yyl is now already defined as int) Line number preprocessor directives (#line) were previously generated into the c source file. This actually breaks debugging as debuggers have a hard time finding the original cmDependsJavaLexer.in.l and mapping the current instruction to a meaningful location within that file. The prefix "cmDependsJava_yy" can already be set as %option directly. For convenience also provide a sed command for all the manual steps that need to be done after generating. Signed-off-by: Matthias Maennich <matthias@maennich.net>
* cmCommandArgumentLexer: regenerate with flex 2.6.4 (previously 2.6.1)Matthias Maennich2017-08-283-300/+823
| | | | | | | | | | | | | | | | | | | | | | | | flex 2.6.3 introduces symbol remapping through macro definitions. hence the change appears bigger than one would expect from a minor version upgrade. In addition some manual cleanup that had to be done previously is now obsolete. namely: - the size_t cast of _yybytes_len in yy_scan_bytes (i is now also defined int and not size_t anymore) - the redefinition of yyl within yy_find_action (yyl is now already defined as int) Line number preprocessor directives (#line) were previously generated into the c source file. This actually breaks debugging as debuggers have a hard time finding the original cmCommandArgumentLexer.in.l and mapping the current instruction to a meaningful location within that file. The prefix "cmCommandArgument_yy" can already be set as %option directly. For convenience also provide a sed command for all the manual steps that need to be done after generating. Signed-off-by: Matthias Maennich <matthias@maennich.net>
* cmListFileLexer: regenerate with flex 2.6.4 (previously 2.6.1)Matthias Maennich2017-08-252-276/+429
| | | | | | | | | | | | | | | | | | | | | | | | flex 2.6.3 introduces symbol remapping through macro definitions. hence the change appears bigger than one would expect from a minor version upgrade. In addition some manual cleanup that had to be done previously is now obsolete. namely: - the size_t cast of _yybytes_len in yy_scan_bytes (i is now also defined int and not size_t anymore) - the redefinition of yyl within yy_find_action (yyl is now already defined as int) Line number preprocessor directives (#line) were previously generated into the c source file. This actually breaks debugging as debuggers have a hard time finding the original cmListFileLexer.in.l and mapping the current instruction to a meaningful location within that file. The prefix "cmListFileLexer_yy" can already be set as %option directly. For convenience also provide a sed command for all the manual steps that need to be done after generating. Signed-off-by: Matthias Maennich <matthias@maennich.net>
* cmListFileLexer: fix 'bail out on seek-errors' also in original fileMatthias Maennich2017-08-251-2/+6
| | | | | | | | | The commit v3.9.0-rc1~502^2 (cmListFileLexer: bail out on seek-errors, 2017-02-19) for bug # 16607 was only applied to the generated file. Also apply the fix now to the original. Signed-off-by: Matthias Maennich <matthias@maennich.net>
* LexerParser: disable clang-tidy checksDaniel Pfeifer2017-04-281-0/+6
|
* LexerParser: move to custom directoryDaniel Pfeifer2017-04-2827-0/+30750