Created
May 8, 2023 16:53
-
-
Save agocke/77e8fcf2b3797c25e2c39bb9f632907a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ref struct Lexer | |
{ | |
private Span<char> _buffer; | |
private int _loc; | |
public Lexer(Span<char> buffer) | |
{ | |
_buffer = buffer; | |
_loc = 0; | |
} | |
/// Move past the next token, incrementing _loc | |
public void EatToken() { ... } | |
} | |
public static LexHelpers | |
{ | |
public static EatHelper(ref Lexer lex) => lex.EatToken(); // Pass by ref to preserve mutation | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment