1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibCpp: Do lexing in the Preprocessor

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.
This commit is contained in:
Itamar 2021-08-06 10:29:57 +03:00 committed by Andreas Kling
parent bf7262681e
commit 4673a517f6
9 changed files with 42 additions and 39 deletions

View file

@ -43,7 +43,8 @@ TEST_CASE(test_regression)
auto target_ast = read_all(ast_file_path);
StringView source_view(source);
::Cpp::Parser parser(source_view, file_path);
Cpp::Preprocessor preprocessor(file_path, source_view);
Cpp::Parser parser(preprocessor.process_and_lex(), file_path);
auto root = parser.parse();
EXPECT(parser.errors().is_empty());