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

@ -134,14 +134,14 @@ void test_complete_includes()
add_file(filedb, "sample_header.h");
CppComprehensionEngine autocomplete(filedb);
auto suggestions = autocomplete.get_suggestions("complete_includes.cpp", { 0, 23 });
auto suggestions = autocomplete.get_suggestions("complete_includes.cpp", { 0, 22 });
if (suggestions.size() != 1)
FAIL(project include - bad size);
if (suggestions[0].completion != "sample_header.h")
FAIL("project include - wrong results");
suggestions = autocomplete.get_suggestions("complete_includes.cpp", { 1, 19 });
suggestions = autocomplete.get_suggestions("complete_includes.cpp", { 1, 18 });
if (suggestions.size() != 1)
FAIL(global include - bad size);