Ver Fonte

LibCpp: Support initializing the lexer with a "start line"

Itamar há 4 anos atrás
pai
commit
bf7262681e

+ 3 - 1
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 }
 {
 }
 

+ 1 - 1
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();