-/** fac = single ["(" single ")"]? | single */
-let fac1Appliee = circumfix((x) => thenDo(thenDo(thenDo(tk.toSome(x), tLParen), tInt), tRParen), "fac1");
+/** callees = "(" args ")" | "(" ")" */
+let callees1 = circumfix((x) => thenDo(thenDo(thenDo(tk.toSome(x), tLParen), tInt), tRParen), "callees1");
+let callees2 = (x) => {
+ let ret = thenDo(thenDo(tk.toSome(x), tLParen), tRParen);
+ if (ret._tag == "Some") {
+ let new_ast = [[]];
+ ret.value.ast = new_ast;
+ }
+ return ret;
+};
+let callees = orDo(callees1, callees2);
+/** %apply R combinating token */
+let applyToken = {
+ text: "%apply",
+ type: tk.TokenType.ID,
+ col: 0,
+ ln: 0,
+};
+/** facAux = callees facAux | callees */
+let facAux1 = (x) => {
+ var ret = thenDo(thenDo(tk.toSome(x), callees), facAux);
+ if (ret._tag == "Some") {
+ console.log("1232345" + repr(tkTreeToSExp(ret.value.ast[ret.value.ast.length - 1])));
+ let last1 = ret.value.ast[ret.value.ast.length - 1];
+ let last2 = ret.value.ast[ret.value.ast.length - 2];
+ let b = [applyToken];
+ ret.value.ast = [b.concat([last2, last1])];
+ console.log("11111" + repr(tkTreeToSExp(ret.value.ast)));
+ }
+ ;
+ return ret;
+};
+let facAux2 = callees;
+let facAux = orDo(facAux1, facAux2);
+/** fac = single facAux | single
+ * Issue1 to be fixed.
+ */