Closed ghost closed 6 years ago
Try with this rules:
Rule1 < (Keyword / Identifier)*
Keyword <- ("is" / "as") !Identifier
Identifier <~ [a-zA-Z_] [a-zA-Z0-9_]*
Three changes :
https://run.dlang.io/is/f2A4Ws
(Man, this run.dlang.io site is quite cool!)
On Tue, May 8, 2018 at 4:05 PM, BBasile notifications@github.com wrote:
This is more a "help wanted" issue than a bug report. The problem is that when i exclude keywords from the identifiers an identifier cannot start with a keyword:
/+dub.sdl:dependency "pegged" version="~>0.4.2"+/import pegged.grammar;import std.stdio; mixin(grammar(
Test: Rule1 < (Identifier / Keyword)* Identifier <~ !Keyword [a-zA-Z_] [a-zA-Z0-9_]* Keyword < "is" / "as"
)); void main() { enum parseTree1 = Test("is isChecked as"); pragma(msg, parseTree1.matches); assert(parseTree1.matches == ["is", "isChecked", "as"]); writeln(parseTree1); }https://run.dlang.io/is/VGae1P
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PhilippeSigaud/Pegged/issues/245, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjYpx4T5lGq-mVu8ys7J23yuW-PVLhSks5twaYmgaJpZM4T2tS1 .
Thanks, adding !Identifier to the Keyword in the real stuff works.
This is more a "help wanted" issue than a bug report. The problem is that when i exclude keywords from the identifiers an identifier cannot start with a keyword:
https://run.dlang.io/is/VGae1P