modify somethinig

This commit is contained in:
Tan, Kian-ting 2023-10-10 22:16:13 +08:00
parent df1419e45c
commit d4dfd2e99f
2 changed files with 6 additions and 8 deletions

View file

@ -100,12 +100,12 @@ import you as john;
臺中市\\\@ 臺中市\\\@
政府 公園
@2+2==4; @1+2==3;
console.log("122");@ console.log("122");@
人民 山頂
`; `;
const PROG = p.rule(); const PROG = p.rule();
const SEGMENT = p.rule(); const SEGMENT = p.rule();
@ -202,6 +202,5 @@ SEGMENT.setPattern(p.alt(p.apply(p.rep_sc(NOT_AT_TEXT), applyText), p.apply(p.se
* CONTENT : SEGMENT* * CONTENT : SEGMENT*
*/ */
CONTENT.setPattern(p.apply(p.rep(SEGMENT), applyContent)); CONTENT.setPattern(p.apply(p.rep(SEGMENT), applyContent));
console.log(repr(lexer.parse(inputTxt)));
let tree = p.expectSingleResult(p.expectEOF(PROG.parse(lexer.parse(inputTxt)))); let tree = p.expectSingleResult(p.expectEOF(PROG.parse(lexer.parse(inputTxt))));
console.log("RESULT=" + tkTreeToSExp(tree)); console.log("RESULT=" + tkTreeToSExp(tree));

View file

@ -88,12 +88,12 @@ import you as john;
\\\@ \\\@
@2+2==4; @1+2==3;
console.log("122");@ console.log("122");@
`; `;
@ -258,7 +258,6 @@ CONTENT.setPattern(
); );
console.log(repr(lexer.parse(inputTxt)));
let tree = p.expectSingleResult(p.expectEOF(PROG.parse(lexer.parse(inputTxt)))); let tree = p.expectSingleResult(p.expectEOF(PROG.parse(lexer.parse(inputTxt))));