Skip to content

Commit 6a21dba

Browse files
authored
Lexer: add offset getter (#1688)
Added a getter for the Lexer's private `offset` to track its cursor position in the buffer. This helps me index tokens by buffer address in a project where I'm rendering Luau code with [Dear ImGui](https://github.com/ocornut/imgui). Would love this merged so I can use official Luau releases again! Co-authored-by: Adrian Duermael <adrien@cu.bzh>
1 parent c1e2f65 commit 6a21dba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Ast/include/Luau/Lexer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ class Lexer
187187
static bool fixupQuotedString(std::string& data);
188188
static void fixupMultilineString(std::string& data);
189189

190+
unsigned int getOffset() const
191+
{
192+
return offset;
193+
}
194+
190195
private:
191196
char peekch() const;
192197
char peekch(unsigned int lookahead) const;

0 commit comments

Comments
 (0)