| 1 | package TestML1::Compiler::Pegex::Grammar; | ||
| 2 | |||
| 3 | 22 | ▶ | use TestML1::Base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 22 | extends 'Pegex::Grammar'; | |
| 5 | |||
| 6 | 22 | ▶ | use constant file => 'ext/testml-pgx/testml.pgx'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 21 | ▶ | sub make_tree { # Generated/Inlined by Pegex::Grammar (0.43) |
|
Subroutine
make_tree: called CC=1 SCAR=0.0
Pod
documented
| |||
| 9 | { | ||
| 10 | 21 | '+grammar' => 'testml', | |
| 11 | '+include' => 'atom', | ||
| 12 | '+toprule' => 'testml_document', | ||
| 13 | '+version' => '0.0.1', | ||
| 14 | '__' => { | ||
| 15 | '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)+/ | ||
| 16 | }, | ||
| 17 | 'assertion_call' => { | ||
| 18 | '.any' => [ | ||
| 19 | { | ||
| 20 | '-wrap' => 1, | ||
| 21 | '.ref' => 'assertion_eq' | ||
| 22 | }, | ||
| 23 | { | ||
| 24 | '-wrap' => 1, | ||
| 25 | '.ref' => 'assertion_ok' | ||
| 26 | }, | ||
| 27 | { | ||
| 28 | '-wrap' => 1, | ||
| 29 | '.ref' => 'assertion_has' | ||
| 30 | } | ||
| 31 | ] | ||
| 32 | }, | ||
| 33 | 'assertion_call_test' => { | ||
| 34 | '.rgx' => qr/\G(?:\.(?:[\ \t]|\r?\n|\#.*\r?\n)*|(?:[\ \t]|\r?\n|\#.*\r?\n)*\.)(?:EQ|OK|HAS)/ | ||
| 35 | }, | ||
| 36 | 'assertion_eq' => { | ||
| 37 | '.any' => [ | ||
| 38 | { | ||
| 39 | '-wrap' => 1, | ||
| 40 | '.ref' => 'assertion_operator_eq' | ||
| 41 | }, | ||
| 42 | { | ||
| 43 | '-wrap' => 1, | ||
| 44 | '.ref' => 'assertion_function_eq' | ||
| 45 | } | ||
| 46 | ] | ||
| 47 | }, | ||
| 48 | 'assertion_function_eq' => { | ||
| 49 | '.all' => [ | ||
| 50 | { | ||
| 51 | '.rgx' => qr/\G(?:\.(?:[\ \t]|\r?\n|\#.*\r?\n)*|(?:[\ \t]|\r?\n|\#.*\r?\n)*\.)EQ\(/ | ||
| 52 | }, | ||
| 53 | { | ||
| 54 | '.ref' => 'code_expression' | ||
| 55 | }, | ||
| 56 | { | ||
| 57 | '.rgx' => qr/\G\)/ | ||
| 58 | } | ||
| 59 | ] | ||
| 60 | }, | ||
| 61 | 'assertion_function_has' => { | ||
| 62 | '.all' => [ | ||
| 63 | { | ||
| 64 | '.rgx' => qr/\G(?:\.(?:[\ \t]|\r?\n|\#.*\r?\n)*|(?:[\ \t]|\r?\n|\#.*\r?\n)*\.)HAS\(/ | ||
| 65 | }, | ||
| 66 | { | ||
| 67 | '.ref' => 'code_expression' | ||
| 68 | }, | ||
| 69 | { | ||
| 70 | '.rgx' => qr/\G\)/ | ||
| 71 | } | ||
| 72 | ] | ||
| 73 | }, | ||
| 74 | 'assertion_function_ok' => { | ||
| 75 | '.rgx' => qr/\G(?:\.(?:[\ \t]|\r?\n|\#.*\r?\n)*|(?:[\ \t]|\r?\n|\#.*\r?\n)*\.)(OK)(?:\((?:[\ \t]|\r?\n|\#.*\r?\n)*\))?/ | ||
| 76 | }, | ||
| 77 | 'assertion_has' => { | ||
| 78 | '.any' => [ | ||
| 79 | { | ||
| 80 | '-wrap' => 1, | ||
| 81 | '.ref' => 'assertion_operator_has' | ||
| 82 | }, | ||
| 83 | { | ||
| 84 | '-wrap' => 1, | ||
| 85 | '.ref' => 'assertion_function_has' | ||
| 86 | } | ||
| 87 | ] | ||
| 88 | }, | ||
| 89 | 'assertion_ok' => { | ||
| 90 | '.ref' => 'assertion_function_ok' | ||
| 91 | }, | ||
| 92 | 'assertion_operator_eq' => { | ||
| 93 | '.all' => [ | ||
| 94 | { | ||
| 95 | '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)+==(?:[\ \t]|\r?\n|\#.*\r?\n)+/ | ||
| 96 | }, | ||
| 97 | { | ||
| 98 | '.ref' => 'code_expression' | ||
| 99 | } | ||
| 100 | ] | ||
| 101 | }, | ||
| 102 | 'assertion_operator_has' => { | ||
| 103 | '.all' => [ | ||
| 104 | { | ||
| 105 | '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)+\~\~(?:[\ \t]|\r?\n|\#.*\r?\n)+/ | ||
| 106 | }, | ||
| 107 | { | ||
| 108 | '.ref' => 'code_expression' | ||
| 109 | } | ||
| 110 | ] | ||
| 111 | }, | ||
| 112 | 'assignment_statement' => { | ||
| 113 | '.all' => [ | ||
| 114 | { | ||
| 115 | '.ref' => 'variable_name' | ||
| 116 | }, | ||
| 117 | { | ||
| 118 | '.rgx' => qr/\G\s+=\s+/ | ||
| 119 | }, | ||
| 120 | { | ||
| 121 | '.ref' => 'code_expression' | ||
| 122 | }, | ||
| 123 | { | ||
| 124 | '.ref' => 'ending' | ||
| 125 | } | ||
| 126 | ] | ||
| 127 | }, | ||
| 128 | 'blank_line' => { | ||
| 129 | '.rgx' => qr/\G[\ \t]*\r?\n/ | ||
| 130 | }, | ||
| 131 | 'blanks' => { | ||
| 132 | '.rgx' => qr/\G[\ \t]+/ | ||
| 133 | }, | ||
| 134 | 'block_header' => { | ||
| 135 | '.all' => [ | ||
| 136 | { | ||
| 137 | '.ref' => 'block_marker' | ||
| 138 | }, | ||
| 139 | { | ||
| 140 | '+max' => 1, | ||
| 141 | '.all' => [ | ||
| 142 | { | ||
| 143 | '.ref' => 'blanks' | ||
| 144 | }, | ||
| 145 | { | ||
| 146 | '.ref' => 'block_label' | ||
| 147 | } | ||
| 148 | ] | ||
| 149 | }, | ||
| 150 | { | ||
| 151 | '.ref' => 'blank_line' | ||
| 152 | } | ||
| 153 | ] | ||
| 154 | }, | ||
| 155 | 'block_label' => { | ||
| 156 | '.ref' => 'unquoted_string' | ||
| 157 | }, | ||
| 158 | 'block_marker' => { | ||
| 159 | '.rgx' => qr/\G===/ | ||
| 160 | }, | ||
| 161 | 'block_point' => { | ||
| 162 | '.any' => [ | ||
| 163 | { | ||
| 164 | '.ref' => 'lines_point' | ||
| 165 | }, | ||
| 166 | { | ||
| 167 | '.ref' => 'phrase_point' | ||
| 168 | } | ||
| 169 | ] | ||
| 170 | }, | ||
| 171 | 'call_argument' => { | ||
| 172 | '.ref' => 'code_expression' | ||
| 173 | }, | ||
| 174 | 'call_argument_list' => { | ||
| 175 | '.all' => [ | ||
| 176 | { | ||
| 177 | '.rgx' => qr/\G\((?:[\ \t]|\r?\n|\#.*\r?\n)*/ | ||
| 178 | }, | ||
| 179 | { | ||
| 180 | '+max' => 1, | ||
| 181 | '.all' => [ | ||
| 182 | { | ||
| 183 | '.ref' => 'call_argument' | ||
| 184 | }, | ||
| 185 | { | ||
| 186 | '+min' => 0, | ||
| 187 | '-flat' => 1, | ||
| 188 | '.all' => [ | ||
| 189 | { | ||
| 190 | '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*,(?:[\ \t]|\r?\n|\#.*\r?\n)*/ | ||
| 191 | }, | ||
| 192 | { | ||
| 193 | '.ref' => 'call_argument' | ||
| 194 | } | ||
| 195 | ] | ||
| 196 | } | ||
| 197 | ] | ||
| 198 | }, | ||
| 199 | { | ||
| 200 | '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*\)/ | ||
| 201 | } | ||
| 202 | ] | ||
| 203 | }, | ||
| 204 | 'call_call' => { | ||
| 205 | '.all' => [ | ||
| 206 | { | ||
| 207 | '+asr' => -1, | ||
| 208 | '.ref' => 'assertion_call_test' | ||
| 209 | }, | ||
| 210 | { | ||
| 211 | '.ref' => 'call_indicator' | ||
| 212 | }, | ||
| 213 | { | ||
| 214 | '.ref' => 'code_object' | ||
| 215 | } | ||
| 216 | ] | ||
| 217 | }, | ||
| 218 | 'call_indicator' => { | ||
| 219 | '.rgx' => qr/\G(?:\.(?:[\ \t]|\r?\n|\#.*\r?\n)*|(?:[\ \t]|\r?\n|\#.*\r?\n)*\.)/ | ||
| 220 | }, | ||
| 221 | 'call_name' => { | ||
| 222 | '.any' => [ | ||
| 223 | { | ||
| 224 | '.ref' => 'user_call' | ||
| 225 | }, | ||
| 226 | { | ||
| 227 | '.ref' => 'core_call' | ||
| 228 | } | ||
| 229 | ] | ||
| 230 | }, | ||
| 231 | 'call_object' => { | ||
| 232 | '.all' => [ | ||
| 233 | { | ||
| 234 | '.ref' => 'call_name' | ||
| 235 | }, | ||
| 236 | { | ||
| 237 | '+max' => 1, | ||
| 238 | '.ref' => 'call_argument_list' | ||
| 239 | } | ||
| 240 | ] | ||
| 241 | }, | ||
| 242 | 'code_expression' => { | ||
| 243 | '.all' => [ | ||
| 244 | { | ||
| 245 | '.ref' => 'code_object' | ||
| 246 | }, | ||
| 247 | { | ||
| 248 | '+min' => 0, | ||
| 249 | '.ref' => 'call_call' | ||
| 250 | } | ||
| 251 | ] | ||
| 252 | }, | ||
| 253 | 'code_object' => { | ||
| 254 | '.any' => [ | ||
| 255 | { | ||
| 256 | '.ref' => 'function_object' | ||
| 257 | }, | ||
| 258 | { | ||
| 259 | '.ref' => 'point_object' | ||
| 260 | }, | ||
| 261 | { | ||
| 262 | '.ref' => 'string_object' | ||
| 263 | }, | ||
| 264 | { | ||
| 265 | '.ref' => 'number_object' | ||
| 266 | }, | ||
| 267 | { | ||
| 268 | '.ref' => 'call_object' | ||
| 269 | } | ||
| 270 | ] | ||
| 271 | }, | ||
| 272 | 'code_section' => { | ||
| 273 | '+min' => 0, | ||
| 274 | '.any' => [ | ||
| 275 | { | ||
| 276 | '.ref' => '__' | ||
| 277 | }, | ||
| 278 | { | ||
| 279 | '.ref' => 'assignment_statement' | ||
| 280 | }, | ||
| 281 | { | ||
| 282 | '.ref' => 'code_statement' | ||
| 283 | } | ||
| 284 | ] | ||
| 285 | }, | ||
| 286 | 'code_statement' => { | ||
| 287 | '.all' => [ | ||
| 288 | { | ||
| 289 | '.ref' => 'code_expression' | ||
| 290 | }, | ||
| 291 | { | ||
| 292 | '+max' => 1, | ||
| 293 | '.ref' => 'assertion_call' | ||
| 294 | }, | ||
| 295 | { | ||
| 296 | '.ref' => 'ending' | ||
| 297 | } | ||
| 298 | ] | ||
| 299 | }, | ||
| 300 | 'comment' => { | ||
| 301 | '.rgx' => qr/\G\#.*\r?\n/ | ||
| 302 | }, | ||
| 303 | 'core_call' => { | ||
| 304 | '.rgx' => qr/\G([A-Z]\w*)/ | ||
| 305 | }, | ||
| 306 | 'data_block' => { | ||
| 307 | '.all' => [ | ||
| 308 | { | ||
| 309 | '.ref' => 'block_header' | ||
| 310 | }, | ||
| 311 | { | ||
| 312 | '+min' => 0, | ||
| 313 | '-skip' => 1, | ||
| 314 | '.any' => [ | ||
| 315 | { | ||
| 316 | '.ref' => 'blank_line' | ||
| 317 | }, | ||
| 318 | { | ||
| 319 | '.ref' => 'comment' | ||
| 320 | } | ||
| 321 | ] | ||
| 322 | }, | ||
| 323 | { | ||
| 324 | '+min' => 0, | ||
| 325 | '.ref' => 'block_point' | ||
| 326 | } | ||
| 327 | ] | ||
| 328 | }, | ||
| 329 | 'data_section' => { | ||
| 330 | '+min' => 0, | ||
| 331 | '.ref' => 'data_block' | ||
| 332 | }, | ||
| 333 | 'double_quoted_string' => { | ||
| 334 | '.rgx' => qr/\G(?:"((?:[^\n\\"]|\\"|\\\\|\\[0nt])*?)")/ | ||
| 335 | }, | ||
| 336 | 'ending' => { | ||
| 337 | '.any' => [ | ||
| 338 | { | ||
| 339 | '.rgx' => qr/\G(?:;|\r?\n)/ | ||
| 340 | }, | ||
| 341 | { | ||
| 342 | '+asr' => 1, | ||
| 343 | '.ref' => 'ending2' | ||
| 344 | } | ||
| 345 | ] | ||
| 346 | }, | ||
| 347 | 'ending2' => { | ||
| 348 | '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*\}/ | ||
| 349 | }, | ||
| 350 | 'function_object' => { | ||
| 351 | '.all' => [ | ||
| 352 | { | ||
| 353 | '+max' => 1, | ||
| 354 | '.ref' => 'function_signature' | ||
| 355 | }, | ||
| 356 | { | ||
| 357 | '.ref' => 'function_start' | ||
| 358 | }, | ||
| 359 | { | ||
| 360 | '+min' => 0, | ||
| 361 | '.any' => [ | ||
| 362 | { | ||
| 363 | '.ref' => '__' | ||
| 364 | }, | ||
| 365 | { | ||
| 366 | '.ref' => 'assignment_statement' | ||
| 367 | }, | ||
| 368 | { | ||
| 369 | '.ref' => 'code_statement' | ||
| 370 | } | ||
| 371 | ] | ||
| 372 | }, | ||
| 373 | { | ||
| 374 | '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*\}/ | ||
| 375 | } | ||
| 376 | ] | ||
| 377 | }, | ||
| 378 | 'function_signature' => { | ||
| 379 | '.all' => [ | ||
| 380 | { | ||
| 381 | '.rgx' => qr/\G\((?:[\ \t]|\r?\n|\#.*\r?\n)*/ | ||
| 382 | }, | ||
| 383 | { | ||
| 384 | '+max' => 1, | ||
| 385 | '.ref' => 'function_variables' | ||
| 386 | }, | ||
| 387 | { | ||
| 388 | '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*\)/ | ||
| 389 | } | ||
| 390 | ] | ||
| 391 | }, | ||
| 392 | 'function_start' => { | ||
| 393 | '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*(\{)(?:[\ \t]|\r?\n|\#.*\r?\n)*/ | ||
| 394 | }, | ||
| 395 | 'function_variable' => { | ||
| 396 | '.rgx' => qr/\G([a-zA-Z]\w*)/ | ||
| 397 | }, | ||
| 398 | 'function_variables' => { | ||
| 399 | '.all' => [ | ||
| 400 | { | ||
| 401 | '.ref' => 'function_variable' | ||
| 402 | }, | ||
| 403 | { | ||
| 404 | '+min' => 0, | ||
| 405 | '-flat' => 1, | ||
| 406 | '.all' => [ | ||
| 407 | { | ||
| 408 | '.rgx' => qr/\G(?:[\ \t]|\r?\n|\#.*\r?\n)*,(?:[\ \t]|\r?\n|\#.*\r?\n)*/ | ||
| 409 | }, | ||
| 410 | { | ||
| 411 | '.ref' => 'function_variable' | ||
| 412 | } | ||
| 413 | ] | ||
| 414 | } | ||
| 415 | ] | ||
| 416 | }, | ||
| 417 | 'lines_point' => { | ||
| 418 | '.all' => [ | ||
| 419 | { | ||
| 420 | '.ref' => 'point_marker' | ||
| 421 | }, | ||
| 422 | { | ||
| 423 | '.ref' => 'blanks' | ||
| 424 | }, | ||
| 425 | { | ||
| 426 | '.ref' => 'point_name' | ||
| 427 | }, | ||
| 428 | { | ||
| 429 | '.ref' => 'blank_line' | ||
| 430 | }, | ||
| 431 | { | ||
| 432 | '.ref' => 'point_lines' | ||
| 433 | } | ||
| 434 | ] | ||
| 435 | }, | ||
| 436 | 'number' => { | ||
| 437 | '.rgx' => qr/\G([0-9]+)/ | ||
| 438 | }, | ||
| 439 | 'number_object' => { | ||
| 440 | '.ref' => 'number' | ||
| 441 | }, | ||
| 442 | 'phrase_point' => { | ||
| 443 | '.all' => [ | ||
| 444 | { | ||
| 445 | '.ref' => 'point_marker' | ||
| 446 | }, | ||
| 447 | { | ||
| 448 | '.ref' => 'blanks' | ||
| 449 | }, | ||
| 450 | { | ||
| 451 | '.ref' => 'point_name' | ||
| 452 | }, | ||
| 453 | { | ||
| 454 | '.rgx' => qr/\G:[\ \t]/ | ||
| 455 | }, | ||
| 456 | { | ||
| 457 | '.ref' => 'point_phrase' | ||
| 458 | }, | ||
| 459 | { | ||
| 460 | '.rgx' => qr/\G\r?\n/ | ||
| 461 | }, | ||
| 462 | { | ||
| 463 | '.rgx' => qr/\G(?:\#.*\r?\n|[\ \t]*\r?\n)*/ | ||
| 464 | } | ||
| 465 | ] | ||
| 466 | }, | ||
| 467 | 'point_lines' => { | ||
| 468 | '.rgx' => qr/\G((?:(?!(?:===|\-\-\-)\ \w).*\r?\n)*)/ | ||
| 469 | }, | ||
| 470 | 'point_marker' => { | ||
| 471 | '.rgx' => qr/\G\-\-\-/ | ||
| 472 | }, | ||
| 473 | 'point_name' => { | ||
| 474 | '.rgx' => qr/\G([a-z]\w*|[A-Z]\w*)/ | ||
| 475 | }, | ||
| 476 | 'point_object' => { | ||
| 477 | '.rgx' => qr/\G(\*[a-z]\w*)/ | ||
| 478 | }, | ||
| 479 | 'point_phrase' => { | ||
| 480 | '.ref' => 'unquoted_string' | ||
| 481 | }, | ||
| 482 | 'quoted_string' => { | ||
| 483 | '.any' => [ | ||
| 484 | { | ||
| 485 | '.ref' => 'single_quoted_string' | ||
| 486 | }, | ||
| 487 | { | ||
| 488 | '.ref' => 'double_quoted_string' | ||
| 489 | } | ||
| 490 | ] | ||
| 491 | }, | ||
| 492 | 'single_quoted_string' => { | ||
| 493 | '.rgx' => qr/\G(?:'((?:[^\n\\']|\\'|\\\\)*?)')/ | ||
| 494 | }, | ||
| 495 | 'string_object' => { | ||
| 496 | '.ref' => 'quoted_string' | ||
| 497 | }, | ||
| 498 | 'testml_document' => { | ||
| 499 | '.all' => [ | ||
| 500 | { | ||
| 501 | '.ref' => 'code_section' | ||
| 502 | }, | ||
| 503 | { | ||
| 504 | '+max' => 1, | ||
| 505 | '.ref' => 'data_section' | ||
| 506 | } | ||
| 507 | ] | ||
| 508 | }, | ||
| 509 | 'unquoted_string' => { | ||
| 510 | '.rgx' => qr/\G([^\ \t\n\#](?:[^\n\#]*[^\ \t\n\#])?)/ | ||
| 511 | }, | ||
| 512 | 'user_call' => { | ||
| 513 | '.rgx' => qr/\G([a-z]\w*)/ | ||
| 514 | }, | ||
| 515 | 'variable_name' => { | ||
| 516 | '.rgx' => qr/\G([a-zA-Z]\w*)/ | ||
| 517 | } | ||
| 518 | } | ||
| 519 | } | ||
| 520 | |||
| 521 | 22 | 1; | |