pull/1110/head
Zef Hemel 2024-09-30 12:50:54 +02:00
parent a5c4bcc43b
commit c0a248daba
11 changed files with 1070 additions and 1075 deletions

View File

@ -1,6 +1,5 @@
import { parse } from "$common/space_lua/parse.ts";
Deno.test("Test Lua parser", () => {
// Basic block test
parse(`

View File

@ -185,9 +185,7 @@ function parseStatement(t: ParseTree): LuaStatement {
case "Assign":
return {
type: "Assignment",
variables: t.children![0].children!.filter((t) =>
t.type !== ","
).map(
variables: t.children![0].children!.filter((t) => t.type !== ",").map(
parseLValue,
),
expressions: parseExpList(t.children![2]),
@ -203,9 +201,7 @@ function parseStatement(t: ParseTree): LuaStatement {
to: t.to,
};
case "ReturnStatement": {
const expressions = t.children![1]
? parseExpList(t.children![1])
: [];
const expressions = t.children![1] ? parseExpList(t.children![1]) : [];
return { type: "Return", expressions, from: t.from, to: t.to };
}
case "break":