| 1 | package Inline::C::Parser::Pegex::Grammar; | ||
| 2 | |||
| 3 | 2 | ▶ | use Pegex::Base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | extends 'Pegex::Grammar'; | |
| 5 | |||
| 6 | # Actual Pegex grammar text is in this file: | ||
| 7 | 2 | ▶ | use constant file => 'ext/inline-c-pgx/inline-c.pgx'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | # This method is autocompiled using: | ||
| 10 | # | ||
| 11 | # `perl -Ilib -MInline::C::Parser::Pegex::Grammar=compile` | ||
| 12 | # | ||
| 13 | sub make_tree { # Generated/Inlined by Pegex::Grammar (0.58) | ||
| 14 | { | ||
| 15 | 24 | ▶ | '+grammar' => 'inline-c', |
|
Subroutine
make_tree: called CC=1 SCAR=0.0
Pod
documented
| |||
| 16 | '+toprule' => 'code', | ||
| 17 | '+version' => '0.0.1', | ||
| 18 | 'ALL' => { | ||
| 19 | '.rgx' => qr/\G[\s\S]/ | ||
| 20 | }, | ||
| 21 | 'COMMA' => { | ||
| 22 | '.rgx' => qr/\G,/ | ||
| 23 | }, | ||
| 24 | 'LPAREN' => { | ||
| 25 | '.rgx' => qr/\G\(/ | ||
| 26 | }, | ||
| 27 | '_' => { | ||
| 28 | '.rgx' => qr/\G\s*/ | ||
| 29 | }, | ||
| 30 | 'anything_else' => { | ||
| 31 | '.rgx' => qr/\G.*(?:\r?\n|\z)/ | ||
| 32 | }, | ||
| 33 | 'arg' => { | ||
| 34 | '.rgx' => qr/\G(?:\s*(?:(?:(?:unsigned|long|extern|const)\b\s*)*((?:\w+))\s*(\**)|(?:(?:unsigned|long|extern|const)\b\s*)*\**)\s*\s*((?:\w+))|(\.\.\.))/ | ||
| 35 | }, | ||
| 36 | 'arg_decl' => { | ||
| 37 | '.rgx' => qr/\G(\s*(?:(?:(?:unsigned|long|extern|const)\b\s*)*((?:\w+))\s*(\**)|(?:(?:unsigned|long|extern|const)\b\s*)*\**)\s*\s*(?:\w+)*|\.\.\.)/ | ||
| 38 | }, | ||
| 39 | 'code' => { | ||
| 40 | '+min' => 1, | ||
| 41 | '.ref' => 'part' | ||
| 42 | }, | ||
| 43 | 'comment' => { | ||
| 44 | '.any' => [ | ||
| 45 | { | ||
| 46 | '.rgx' => qr/\G\s*\/\/[^\n]*\n/ | ||
| 47 | }, | ||
| 48 | { | ||
| 49 | '.rgx' => qr/\G\s*\/\*(?:[^\*]+|\*(?!\/))*\*\/([\t]*)?/ | ||
| 50 | } | ||
| 51 | ] | ||
| 52 | }, | ||
| 53 | 'function_declaration' => { | ||
| 54 | '.all' => [ | ||
| 55 | { | ||
| 56 | '.ref' => 'rtype' | ||
| 57 | }, | ||
| 58 | { | ||
| 59 | '.rgx' => qr/\G((?:\w+))/ | ||
| 60 | }, | ||
| 61 | { | ||
| 62 | '.ref' => '_' | ||
| 63 | }, | ||
| 64 | { | ||
| 65 | '.ref' => 'LPAREN' | ||
| 66 | }, | ||
| 67 | { | ||
| 68 | '+max' => 1, | ||
| 69 | '.all' => [ | ||
| 70 | { | ||
| 71 | '.ref' => 'arg_decl' | ||
| 72 | }, | ||
| 73 | { | ||
| 74 | '+min' => 0, | ||
| 75 | '-flat' => 1, | ||
| 76 | '.all' => [ | ||
| 77 | { | ||
| 78 | '.ref' => 'COMMA' | ||
| 79 | }, | ||
| 80 | { | ||
| 81 | '.ref' => 'arg_decl' | ||
| 82 | } | ||
| 83 | ] | ||
| 84 | } | ||
| 85 | ] | ||
| 86 | }, | ||
| 87 | { | ||
| 88 | '.rgx' => qr/\G\s*\)\s*;\s*/ | ||
| 89 | } | ||
| 90 | ] | ||
| 91 | }, | ||
| 92 | 'function_definition' => { | ||
| 93 | '.all' => [ | ||
| 94 | { | ||
| 95 | '.ref' => 'rtype' | ||
| 96 | }, | ||
| 97 | { | ||
| 98 | '.rgx' => qr/\G((?:\w+))/ | ||
| 99 | }, | ||
| 100 | { | ||
| 101 | '.ref' => '_' | ||
| 102 | }, | ||
| 103 | { | ||
| 104 | '.ref' => 'LPAREN' | ||
| 105 | }, | ||
| 106 | { | ||
| 107 | '+max' => 1, | ||
| 108 | '.all' => [ | ||
| 109 | { | ||
| 110 | '.ref' => 'arg' | ||
| 111 | }, | ||
| 112 | { | ||
| 113 | '+min' => 0, | ||
| 114 | '-flat' => 1, | ||
| 115 | '.all' => [ | ||
| 116 | { | ||
| 117 | '.ref' => 'COMMA' | ||
| 118 | }, | ||
| 119 | { | ||
| 120 | '.ref' => 'arg' | ||
| 121 | } | ||
| 122 | ] | ||
| 123 | } | ||
| 124 | ] | ||
| 125 | }, | ||
| 126 | { | ||
| 127 | '.rgx' => qr/\G\s*\)\s*\{\s*/ | ||
| 128 | } | ||
| 129 | ] | ||
| 130 | }, | ||
| 131 | 'part' => { | ||
| 132 | '.all' => [ | ||
| 133 | { | ||
| 134 | '+asr' => 1, | ||
| 135 | '.ref' => 'ALL' | ||
| 136 | }, | ||
| 137 | { | ||
| 138 | '.any' => [ | ||
| 139 | { | ||
| 140 | '.ref' => 'comment' | ||
| 141 | }, | ||
| 142 | { | ||
| 143 | '.ref' => 'function_definition' | ||
| 144 | }, | ||
| 145 | { | ||
| 146 | '.ref' => 'function_declaration' | ||
| 147 | }, | ||
| 148 | { | ||
| 149 | '.ref' => 'anything_else' | ||
| 150 | } | ||
| 151 | ] | ||
| 152 | } | ||
| 153 | ] | ||
| 154 | }, | ||
| 155 | 'rtype' => { | ||
| 156 | '.rgx' => qr/\G\s*(?:(?:(?:unsigned|long|extern|const)\b\s*)*((?:\w+))\s*(\**)|(?:(?:unsigned|long|extern|const)\b\s*)+\**)\s*/ | ||
| 157 | } | ||
| 158 | } | ||
| 159 | } | ||
| 160 | |||
| 161 | 2 | 1; | |