Created
August 15, 2013 14:16
-
-
Save txus/6241155 to your computer and use it in GitHub Desktop.
Lexer structure
This file contains hidden or 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
class Lani::Parser | |
macro | |
# our macros go here | |
rule | |
# our rules go here | |
inner | |
# here we put any ruby code we want to extend our lexer with. | |
# for example, our own tokenize method. | |
def tokenize(code) | |
scan_setup(code) | |
tokens = [] | |
while token = next_token | |
tokens << token | |
end | |
tokens | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment