summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCpp/Preprocessor.h
AgeCommit message (Collapse)Author
2021-12-03LibCpp: Add "ignore invalid statements" option to PreprocessorItamar
When we run the Preprocessor from the CppComprehensionEngine of the language server, we don't want the preprocessor to crash if it encounters an invalid preprocessor statement (for example, an #endif statement without an accompanying previous #if statement). To achieve this, this commit adds an "ignore_invalid_statements" flag to the preprocessor which is set by the CppComprehensionEngine. Fixes #11064.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-08-21LibCpp: Lex before processing the source in the PreprocessorItamar
Previously, the preprocessor first split the source into lines, and then processed and lexed each line separately. This patch makes the preprocessor first lex the source, and then do the processing on the tokenized representation. This generally simplifies the code, and also fixes an issue we previously had with multiline comments (we did not recognize them correctly when processing each line separately).
2021-08-14LibCpp: Evaluate function-like macro callsItamar
2021-08-14LibCpp: Understand preprocessor macro definition and invocationItamar
The preprocessor now understands when a function-like macro is defined, and can also parse calls to such macros. The actual evaluation of function-like macros will be done in a separate commit.
2021-08-07LibCpp: Do macro substitution in the preprocessor instead of the parserItamar
After this change, the parser is completely separated from preprocessor concepts.
2021-08-07LibCpp: Import definitions from headers while processingItamar
When the preprocessor encounters an #include statement it now adds the preprocessor definitions that exist in the included header to its own set of definitions. We previously only aggregated the definitions from headers after processing the source, which was less correct. (For example, there could be an #ifdef that depends on a definition from another header).
2021-08-07LibCpp: Do lexing in the PreprocessorItamar
We now call Preprocessor::process_and_lex() and pass the result to the parser. Doing the lexing in the preprocessor will allow us to maintain the original position information of tokens after substituting definitions.
2021-06-23HackStudio: Make TODO entries clickableFederico Guerinoni
Now you can click a TODO entry to set focus on that position of that file.
2021-05-22LibCpp: Add option in Preprocessor to keep #include's in processed textItamar
2021-05-22LibCpp: Make Preprocessor::handle_preprocessor_line return keywordItamar
This also moves most of the logic that was in handle_preprocessor_line into handle_preprocessor_keyword.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-18LibCpp: Add preprocessor option to ignore unsupported keywordsVyacheslav Pukhanov
Under some circumstances we need to ignore unsupported preprocessor keywords instead of crashing the processing, for example during live parsing in HackStudio.
2021-03-13LanguageServers/Cpp: Support jumping to declaration of preprocessorItamar
.. definitions.
2021-03-13LanguageServers/Cpp: Complete Preprocessor definitionsItamar
Preprocessor definitions now appear in the AutoComplete suggestions box as well as in the Locator.
2021-03-13LibCpp: Replace defined preprocessor values when parsingItamar
2021-02-08LibCpp: Start working on a C preprocessorItamar
We currently handle basic #define statements as well as ifdef and else branches.