私は次のようなものに一致するPEG.js用の簡単な文法を書き込もうとしています。
some text;
arbitrary other text that can also have µnicode; different expression;
let's escape the \; semicolon, and \not recognized escapes are not a problem;
possibly last expression not ending with semicolon
つまり、基本的にこれらはセミコロンで区切られたいくつかのテキストです。私の簡略化された文法は次のようになります。
start
= flow:Flow
Flow
= instructions:Instruction*
Instruction
= Empty / Text
TextCharacter
= "\\;" /
.
Text
= text:TextCharacter+ ';' {return text.join('')}
Empty
= Semicolon
Semicolon "semicolon"
= ';'
問題は、入力にセミコロン以外のものを入力すると、次のようになることです。
SyntaxError: Expected ";", "\\;" or any character but end of input found.
これを解決する方法は?PEG.jsが入力の終わりと一致しないことを読みました。