forked from NeoFlock/noom
lexer, parser: pass around lua version
This commit is contained in:
@@ -33,14 +33,14 @@ void print_node(noomP_Node* node, noom_uint_t depth) {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// uhh uhhh uhhhhh
|
||||
const char* code = "local a, b";
|
||||
const char* code = "local a, b = true, false\nif a == b then elseif a or b then end";
|
||||
noom_uint_t pos = 0;
|
||||
|
||||
printf("LEX OUTPUT:\n");
|
||||
|
||||
noomL_Token token;
|
||||
while (1) {
|
||||
noomL_lex(code, pos, &token);
|
||||
noomL_lex(code, pos, &token, NOOM_VERSION_51);
|
||||
|
||||
printf("%s ", noomL_formatTokenType(token.type));
|
||||
for (noom_uint_t i = 0; i < token.length; i++) putchar((code + token.offset)[i]);
|
||||
@@ -57,7 +57,7 @@ int main(int argc, char** argv) {
|
||||
noomP_Node *program;
|
||||
noomP_Node *last_node;
|
||||
|
||||
int success = noomP_parse(code, "shitass", &program, &last_node);
|
||||
int success = noomP_parse(code, "shitass", NOOM_VERSION_54, &program, &last_node);
|
||||
if (success != 0) return success;
|
||||
|
||||
print_node(program, 0);
|
||||
|
||||
Reference in New Issue
Block a user