mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05:00
LibCpp: Add Preprocessor:unprocessed_token()
This commit is contained in:
parent
4a8afd6b4e
commit
bed60b2d49
2 changed files with 6 additions and 0 deletions
|
@ -24,11 +24,14 @@ Vector<Token> Preprocessor::process_and_lex()
|
|||
lexer.set_ignore_whitespace(true);
|
||||
auto tokens = lexer.lex();
|
||||
|
||||
m_unprocessed_tokens = tokens;
|
||||
|
||||
for (size_t token_index = 0; token_index < tokens.size(); ++token_index) {
|
||||
auto& token = tokens[token_index];
|
||||
m_current_line = token.start().line;
|
||||
if (token.type() == Token::Type::PreprocessorStatement) {
|
||||
handle_preprocessor_statement(token.text());
|
||||
m_processed_tokens.append(tokens[token_index]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ public:
|
|||
|
||||
Function<Definitions(StringView)> definitions_in_header_callback { nullptr };
|
||||
|
||||
Vector<Token> const& unprocessed_tokens() const { return m_unprocessed_tokens; }
|
||||
|
||||
private:
|
||||
void handle_preprocessor_statement(StringView);
|
||||
void handle_include_statement(StringView);
|
||||
|
@ -72,6 +74,7 @@ private:
|
|||
String m_filename;
|
||||
String m_program;
|
||||
|
||||
Vector<Token> m_unprocessed_tokens;
|
||||
Vector<Token> m_processed_tokens;
|
||||
Definitions m_definitions;
|
||||
Vector<Substitution> m_substitutions;
|
||||
|
|
Loading…
Add table
Reference in a new issue