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
commit 4673a517f6
Notes: sideshowbarker 2024-07-18 07:18:16 +09:00
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());