summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-08-06 10:16:53 +0300
committerAndreas Kling <kling@serenityos.org>2021-08-07 21:24:11 +0200
commitbf7262681e89d81ff4b58a6c6052a1f797e963fa (patch)
tree2f184754da63e8750c61062afd9abb65e4ecf865 /Userland
parent5fda8a6c3605d5c98d68270c40b31d9044f3840e (diff)
downloadserenity-bf7262681e89d81ff4b58a6c6052a1f797e963fa.zip
LibCpp: Support initializing the lexer with a "start line"
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibCpp/Lexer.cpp4
-rw-r--r--Userland/Libraries/LibCpp/Lexer.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibCpp/Lexer.cpp b/Userland/Libraries/LibCpp/Lexer.cpp
index d3703db829..56ab1afd6c 100644
--- a/Userland/Libraries/LibCpp/Lexer.cpp
+++ b/Userland/Libraries/LibCpp/Lexer.cpp
@@ -12,8 +12,10 @@
namespace Cpp {
-Lexer::Lexer(StringView const& input)
+Lexer::Lexer(StringView const& input, size_t start_line)
: m_input(input)
+ , m_previous_position { start_line, 0 }
+ , m_position { start_line, 0 }
{
}
diff --git a/Userland/Libraries/LibCpp/Lexer.h b/Userland/Libraries/LibCpp/Lexer.h
index 1f8c1d8a93..bbee2bbf9f 100644
--- a/Userland/Libraries/LibCpp/Lexer.h
+++ b/Userland/Libraries/LibCpp/Lexer.h
@@ -14,7 +14,7 @@ namespace Cpp {
class Lexer {
public:
- Lexer(StringView const&);
+ explicit Lexer(StringView const&, size_t start_line = 0);
Vector<Token> lex();