This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ingy@thinkingy:~$ perl -MXXX -MPegex -e '$Pegex::Parser::Debug=1;XXX pegex("src/testml-pgx/testml.pgx")->parse("A = 1;\n&^%B = 2;\n")' | |
try_testml_document >A = 1;\n&^%B = 2;\n< | |
try_code_section >A = 1;\n&^%B = 2;\n< | |
try_assignment_statement >A = 1;\n&^%B = 2;\n< | |
try_variable_name >A = 1;\n&^%B = 2;\n< | |
got_variable_name | |
try_code_expression >1;\n&^%B = 2;\n< | |
try_code_object >1;\n&^%B = 2;\n< | |
try_function_object >1;\n&^%B = 2;\n< | |
try_function_signature >1;\n&^%B = 2;\n< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ingy@thinkingy:~/src/pegex-pgx$ perl -MXXX -MPegex -e 'XXX pegex("pegex.pgx")->parse("pegex.pgx")' | |
--- | |
grammar: | |
- rule_definition: | |
- rule_name: | |
1: grammar | |
- rule_group: | |
all_group: | |
- rule_part: | |
- rule_item: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18:46 < ingy> I am finding the ** syntax less and less usefu :( | |
18:46 < ingy> useful | |
18:47 < ingy> it seems I never want just a ** b | |
18:48 < ingy> I want [a ** b]? or a [ b a ]+ | |
18:50 < soh_cah_toa> ingy: you're saying the ** quantifier doesn't work inside non-capturing groups? | |
18:52 < ingy> no | |
18:53 < ingy> I'm saying that matching one or more a's separated by b's is not useful to me yet | |
18:53 < ingy> I seem to want 0 or more or 2 or more | |
18:54 < ingy> so the special ** syntax for one or more feels yagni at the moment | |
18:54 < ingy> I'm sure ** is more generalized in p6 than what I am using it for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13:50 < phenny> ingy: 14:57Z <TimToady> tell ingy that if your grammar assumes ^ $ you can never use a grammar to parse a portion of a string, such as an | |
embedded block in a different language | |
13:51 < ingy> TimToady: I'm not certain of that | |
13:52 < ingy> I can invoke a parse with any start rule | |
13:53 < ingy> which means that I can have actions that do launch entire new parses | |
13:53 -!- mj41 [[email protected]] has quit [Ping timeout: 260 seconds] | |
13:53 < ingy> and then put the result of the sub parse into the ast that triggered them |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# one or more words separated by commas | |
rule: /(<WORD>+)/ ** /~<COMMA>~/ | |
text: | |
- "I, like, pie" | |
- "I" | |
# zero or more words separated by commas | |
rule: /(<WORD>+)/ ?** /~<COMMA>~/ | |
text: | |
- "I, like, pie" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ingy@thinkingy:~/src/pegex-pgx$ perl -MXXX -MPegex -e 'XXX pegex("pegex.pgx")->parse("pegex.pgx")' | |
--- | |
grammar: | |
- rule_definition: | |
- rule_name: grammar | |
- rule_group: | |
all_group: | |
- rule_part: | |
- rule_item: | |
bracketed_group: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ingy@thinkingy:~/src/pegex-pgx$ perl -MXXX -MPegex -e 'XXX pegex("pegex.pgx",{wrap=>0})->parse("pegex.pgx")' | |
--- | |
- | |
- grammar | |
- | |
- | |
- | |
- '' | |
- | |
- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ingy@thinkingy:~$ cat foo.pl;perl foo.pl | |
package Foo; | |
use Moo; | |
package main; | |
print Foo->can('new'), \&Moo::Object::new; | |
CODE(0x968ae30)CODE(0x968ae30) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp bin/mo-inline blib/script/mo-inline | |
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/mo-inline | |
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t xt/*.t | |
t/build.t ............ ok | |
t/extends.t .......... ok | |
t/has.t .............. ok | |
t/object.t ........... ok | |
t/strict.t ........... ok | |
t/test.t ............. ok | |
xt/inline.t .......... ok |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pegex rules are of the form: | |
name: /foo/ [ <bar> | `baz` ] | |
/foo/ - is a pcre regex. | |
<bar> - is a named subrule. | |
`baz` - is an error msg | |
[ ] - is a sub group | |
Some of the above can have prefixes and suffixes: |