summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibCpp/Parser.cpp13
-rw-r--r--Userland/Libraries/LibCpp/Parser.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp
index 0eee97958a..c4b913ef6a 100644
--- a/Userland/Libraries/LibCpp/Parser.cpp
+++ b/Userland/Libraries/LibCpp/Parser.cpp
@@ -961,6 +961,19 @@ void Parser::print_tokens() const
}
}
+Vector<String> Parser::get_todo_entries() const
+{
+ Vector<String> ret;
+ for (auto& token : m_tokens) {
+ if (token.type() == Token::Type::Comment) {
+ if (token.text().contains("TODO")) {
+ ret.append(token.text());
+ }
+ }
+ }
+ return ret;
+}
+
NonnullRefPtr<StringLiteral> Parser::parse_string_literal(ASTNode& parent)
{
ScopeLogger<CPP_DEBUG> logger;
diff --git a/Userland/Libraries/LibCpp/Parser.h b/Userland/Libraries/LibCpp/Parser.h
index 22e294fbf0..1ac0226151 100644
--- a/Userland/Libraries/LibCpp/Parser.h
+++ b/Userland/Libraries/LibCpp/Parser.h
@@ -35,6 +35,7 @@ public:
void print_tokens() const;
const Vector<String>& errors() const { return m_state.errors; }
const Preprocessor::Definitions& preprocessor_definitions() const { return m_preprocessor_definitions; }
+ Vector<String> get_todo_entries() const;
struct TokenAndPreprocessorDefinition {
Token token;