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>
This commit is contained in:
Adrien Duermael 2025-02-24 16:25:57 -08:00 committed by GitHub
parent c1e2f650db
commit 6a21dba682
Signed by: DevComp
GPG key ID: B5690EEEBB952194

View file

@ -187,6 +187,11 @@ public:
static bool fixupQuotedString(std::string& data);
static void fixupMultilineString(std::string& data);
unsigned int getOffset() const
{
return offset;
}
private:
char peekch() const;
char peekch(unsigned int lookahead) const;