Skip to content

Commit 68c97ce

Browse files
committed
Edited the comments issue
1 parent 118edc9 commit 68c97ce

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/analyzer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default function analyze(match) {
7474
}
7575

7676
const builder = match.matcher.grammar.createSemantics().addOperation("rep", {
77-
Program(globalRanges, _newLines, _moreNewlines, statements) {
77+
Program(_newLines, globalRanges, _newLines1, _moreNewlines, statements) {
7878
return core.program(
7979
globalRanges.rep().length ? globalRanges.rep() : null,
8080
statements.asIteration().children.map((statement) => statement?.rep())

src/funktion.ohm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Funktion {
2-
Program = (GlobalRange "\n")? "\n"* ListOf<(Statement | FuncDef | ""), ("\n"+ | space+)>
2+
Program = "\n"* (GlobalRange "\n")? "\n"* ListOf<(Statement | FuncDef | ""), ("\n"+ | space+)>
33

44
FuncDef = id "(" id ")" "=" "\n"? SliceExpr (";" (FuncDef | SliceExpr))*
55
FuncCall = id "(" Expr ")"
@@ -66,5 +66,5 @@ Funktion {
6666
keyword = input | print | step
6767

6868
space := ~"\n" "\x00".."\x20"
69-
| "//" (~"\n" any)* ("\n" | end) -- comment
69+
| "//" (~"\n" any)* -- comment
7070
}

src/generator.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ export default function generate(program) {
9999
}
100100
`);
101101
p.statements.forEach(gen);
102-
output.push(`rl.close()`);
102+
output.push(`rl.close();`);
103103
output.unshift(...inputCode);
104104
},
105105

106106
FuncDef(d) {
107107
const funcName = targetName(d.name);
108108
const param = targetName(d.param);
109-
const body = gen(d.body);
109+
// const body = gen(d.body);
110110

111111
// check for slices in the body of the function
112112
if (d.body.kind === "SliceExpr") {
@@ -215,13 +215,13 @@ export default function generate(program) {
215215
return `${gen(e.id)}.values.slice(0, ${gen(e.timeValue)})`;
216216
},
217217

218-
// InputStmt(e) {
219-
// inputCode.push(`
220-
// console.log(${gen(e.prompt[0])});
221-
// const inputVar__${inputIndex} = await rl.question("Input: ");
222-
// `);
223-
// return `inputVar__${inputIndex++}`
224-
// },
218+
InputStmt(e) {
219+
inputCode.push(`
220+
console.log(${gen(e.prompt[0])});
221+
const inputVar__${inputIndex} = await rl.question("Input: ");
222+
`);
223+
return `inputVar__${inputIndex++}`
224+
},
225225

226226
num(n) {
227227
return n.value;

0 commit comments

Comments
 (0)