add parser support for expression lines.

This commit is contained in:
trans_soup 2023-11-06 16:42:35 +01:00
parent 1c0090e644
commit fa4d1b8cc9
1 changed files with 11 additions and 4 deletions

View File

@ -46,12 +46,19 @@ export function parse_line (line) {
};
}
return parse_binding(line);
const tokens = line.split(/\s+/g).filter(t => t.length > 0);
if (tokens.length >= 3 && tokens[1] === "=") {
return parse_binding(tokens);
}
return {
type: Line.Expression,
value: parse_expression(tokens),
};
}
function parse_binding (code) {
const tokens = code.split(/\s+/g).filter(t => t.length > 0);
function parse_binding (tokens) {
function invalid () {
return {
type: Line.Invalid,