Skip to content

Instantly share code, notes, and snippets.

@ingydotnet
Created September 18, 2011 20:15
Show Gist options
  • Save ingydotnet/1225503 to your computer and use it in GitHub Desktop.
Save ingydotnet/1225503 to your computer and use it in GitHub Desktop.
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:
bracketed_group:
- 1: ''
- rule_group:
all_group:
- rule_part:
- rule_item:
rule_reference:
1: .
2: comment
3: '*'
- []
-
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_definition
3: ''
- []
- 1: +
- []
-
-
- rule_part:
- rule_item:
rule_reference:
1: .
2: comment
3: '*'
- []
- rule_definition:
- rule_name:
1: rule_definition
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: <WS>*
- []
-
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_name
3: ''
- []
-
- rule_part:
- rule_item:
regular_expression:
1: <BLANK>*<COLON><WS>*
- []
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_group
3: ''
- []
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_ending
3: ''
- []
- rule_definition:
- rule_name:
1: rule_group
- rule_group:
any_group:
- rule_part:
- rule_item:
rule_reference:
1: ''
2: any_group
3: ''
- []
-
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: all_group
3: ''
- []
- rule_definition:
- rule_name:
1: all_group
- rule_group:
all_group:
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_part
3: ''
- []
-
-
- rule_part:
- rule_item:
bracketed_group:
- 1: ''
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: <WS>*
- []
-
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_part
3: ''
- []
- 1: '*'
- []
- rule_definition:
- rule_name:
1: any_group
- rule_group:
all_group:
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_part
3: ''
- []
-
-
- rule_part:
- rule_item:
bracketed_group:
- 1: ''
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: <WS>*<PIPE><WS>*
- []
-
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_part
3: ''
- []
- 1: +
- []
- rule_definition:
- rule_name:
1: rule_part
- rule_group:
all_group:
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_item
3: ''
- []
-
-
- rule_part:
- rule_item:
bracketed_group:
- 1: ''
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: <WS>+<STAR><STAR><WS>+
- []
-
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_item
3: ''
- []
- 1: '?'
- []
- rule_definition:
- rule_name:
1: rule_item
- rule_group:
any_group:
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_reference
3: ''
- []
-
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: regular_expression
3: ''
- []
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: bracketed_group
3: ''
- []
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: error_message
3: ''
- []
- rule_definition:
- rule_name:
1: rule_reference
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: (<rule_modifier>?)<LANGLE><rule_name><RANGLE>(<rule_quantifier>?)
- []
- []
- rule_definition:
- rule_name:
1: regular_expression
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: '<SLASH>([^<SLASH><DOS>]*)<SLASH>'
- []
- []
- rule_definition:
- rule_name:
1: bracketed_group
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: '([<DOT>]?)<LSQUARE><WS>*'
- []
-
-
- rule_part:
- rule_item:
rule_reference:
1: ''
2: rule_group
3: ''
- []
-
- rule_part:
- rule_item:
regular_expression:
1: <WS>*<RSQUARE>(<rule_quantifier>?)
- []
- rule_definition:
- rule_name:
1: error_message
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: '<GRAVE>([^<GRAVE><DOS>]*)<GRAVE>'
- []
- []
- rule_definition:
- rule_name:
1: rule_modifier
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: '[<BANG><EQUAL><DASH><DOT>]'
- []
- []
- rule_definition:
- rule_name:
1: rule_quantifier
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: '[<STAR><PLUS><QMARK>]'
- []
- []
- rule_definition:
- rule_name:
1: rule_name
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: (<ALPHA><WORD>*)
- []
- []
- rule_definition:
- rule_name:
1: rule_ending
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: <WS>*?(?:<BREAK><WS>*|<SEMI><WS>*|<EOS>)
- []
- []
- rule_definition:
- rule_name:
1: comment
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: (?:<blank_line>|<comment_line>)
- []
- []
- rule_definition:
- rule_name:
1: blank_line
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: '<BLANK>*<EOL>'
- []
- []
- rule_definition:
- rule_name:
1: comment_line
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: '<HASH><line>'
- []
- []
- rule_definition:
- rule_name:
1: line
- rule_group:
all_group:
- rule_part:
- rule_item:
regular_expression:
1: '<ANY>*<EOL>'
- []
- []
...
at -e line 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment