deno fmt
parent
a5c4bcc43b
commit
c0a248daba
|
@ -1,6 +1,5 @@
|
|||
import { parse } from "$common/space_lua/parse.ts";
|
||||
|
||||
|
||||
Deno.test("Test Lua parser", () => {
|
||||
// Basic block test
|
||||
parse(`
|
||||
|
|
|
@ -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":
|
||||
|
|
Loading…
Reference in New Issue