tree-sitter-omega
aien-dev/tree-sitter-omega
Brought by drakestapleton
tree-sitter-omega / src / grammar.json
| 1 | { |
| 2 | "$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json", |
| 3 | "name": "omega", |
| 4 | "word": "identifier", |
| 5 | "rules": { |
| 6 | "source_file": { |
| 7 | "type": "SEQ", |
| 8 | "members": [ |
| 9 | { |
| 10 | "type": "CHOICE", |
| 11 | "members": [ |
| 12 | { |
| 13 | "type": "SYMBOL", |
| 14 | "name": "_sep" |
| 15 | }, |
| 16 | { |
| 17 | "type": "BLANK" |
| 18 | } |
| 19 | ] |
| 20 | }, |
| 21 | { |
| 22 | "type": "CHOICE", |
| 23 | "members": [ |
| 24 | { |
| 25 | "type": "SEQ", |
| 26 | "members": [ |
| 27 | { |
| 28 | "type": "SYMBOL", |
| 29 | "name": "_top_level" |
| 30 | }, |
| 31 | { |
| 32 | "type": "REPEAT", |
| 33 | "content": { |
| 34 | "type": "SEQ", |
| 35 | "members": [ |
| 36 | { |
| 37 | "type": "SYMBOL", |
| 38 | "name": "_sep" |
| 39 | }, |
| 40 | { |
| 41 | "type": "SYMBOL", |
| 42 | "name": "_top_level" |
| 43 | } |
| 44 | ] |
| 45 | } |
| 46 | }, |
| 47 | { |
| 48 | "type": "CHOICE", |
| 49 | "members": [ |
| 50 | { |
| 51 | "type": "SYMBOL", |
| 52 | "name": "_sep" |
| 53 | }, |
| 54 | { |
| 55 | "type": "BLANK" |
| 56 | } |
| 57 | ] |
| 58 | } |
| 59 | ] |
| 60 | }, |
| 61 | { |
| 62 | "type": "BLANK" |
| 63 | } |
| 64 | ] |
| 65 | } |
| 66 | ] |
| 67 | }, |
| 68 | "_sep": { |
| 69 | "type": "REPEAT1", |
| 70 | "content": { |
| 71 | "type": "SYMBOL", |
| 72 | "name": "_newline" |
| 73 | } |
| 74 | }, |
| 75 | "_newline": { |
| 76 | "type": "STRING", |
| 77 | "value": "\n" |
| 78 | }, |
| 79 | "_top_level": { |
| 80 | "type": "CHOICE", |
| 81 | "members": [ |
| 82 | { |
| 83 | "type": "SYMBOL", |
| 84 | "name": "profile" |
| 85 | }, |
| 86 | { |
| 87 | "type": "SYMBOL", |
| 88 | "name": "global_declaration" |
| 89 | }, |
| 90 | { |
| 91 | "type": "SYMBOL", |
| 92 | "name": "text_declaration" |
| 93 | }, |
| 94 | { |
| 95 | "type": "SYMBOL", |
| 96 | "name": "const_declaration" |
| 97 | }, |
| 98 | { |
| 99 | "type": "SYMBOL", |
| 100 | "name": "struct_declaration" |
| 101 | }, |
| 102 | { |
| 103 | "type": "SYMBOL", |
| 104 | "name": "layout_declaration" |
| 105 | }, |
| 106 | { |
| 107 | "type": "SYMBOL", |
| 108 | "name": "abstract_declaration" |
| 109 | }, |
| 110 | { |
| 111 | "type": "SYMBOL", |
| 112 | "name": "holds_declaration" |
| 113 | }, |
| 114 | { |
| 115 | "type": "SYMBOL", |
| 116 | "name": "function_definition" |
| 117 | } |
| 118 | ] |
| 119 | }, |
| 120 | "profile": { |
| 121 | "type": "SEQ", |
| 122 | "members": [ |
| 123 | { |
| 124 | "type": "FIELD", |
| 125 | "name": "name", |
| 126 | "content": { |
| 127 | "type": "CHOICE", |
| 128 | "members": [ |
| 129 | { |
| 130 | "type": "STRING", |
| 131 | "value": "om2" |
| 132 | }, |
| 133 | { |
| 134 | "type": "STRING", |
| 135 | "value": "ir" |
| 136 | } |
| 137 | ] |
| 138 | } |
| 139 | }, |
| 140 | { |
| 141 | "type": "REPEAT", |
| 142 | "content": { |
| 143 | "type": "FIELD", |
| 144 | "name": "option", |
| 145 | "content": { |
| 146 | "type": "SYMBOL", |
| 147 | "name": "identifier" |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | ] |
| 152 | }, |
| 153 | "global_declaration": { |
| 154 | "type": "SEQ", |
| 155 | "members": [ |
| 156 | { |
| 157 | "type": "STRING", |
| 158 | "value": "global" |
| 159 | }, |
| 160 | { |
| 161 | "type": "FIELD", |
| 162 | "name": "name", |
| 163 | "content": { |
| 164 | "type": "SYMBOL", |
| 165 | "name": "identifier" |
| 166 | } |
| 167 | }, |
| 168 | { |
| 169 | "type": "REPEAT1", |
| 170 | "content": { |
| 171 | "type": "SYMBOL", |
| 172 | "name": "_word" |
| 173 | } |
| 174 | } |
| 175 | ] |
| 176 | }, |
| 177 | "text_declaration": { |
| 178 | "type": "SEQ", |
| 179 | "members": [ |
| 180 | { |
| 181 | "type": "STRING", |
| 182 | "value": "text" |
| 183 | }, |
| 184 | { |
| 185 | "type": "FIELD", |
| 186 | "name": "name", |
| 187 | "content": { |
| 188 | "type": "SYMBOL", |
| 189 | "name": "identifier" |
| 190 | } |
| 191 | }, |
| 192 | { |
| 193 | "type": "FIELD", |
| 194 | "name": "value", |
| 195 | "content": { |
| 196 | "type": "SYMBOL", |
| 197 | "name": "string" |
| 198 | } |
| 199 | } |
| 200 | ] |
| 201 | }, |
| 202 | "const_declaration": { |
| 203 | "type": "SEQ", |
| 204 | "members": [ |
| 205 | { |
| 206 | "type": "STRING", |
| 207 | "value": "const" |
| 208 | }, |
| 209 | { |
| 210 | "type": "FIELD", |
| 211 | "name": "name", |
| 212 | "content": { |
| 213 | "type": "SYMBOL", |
| 214 | "name": "identifier" |
| 215 | } |
| 216 | }, |
| 217 | { |
| 218 | "type": "REPEAT1", |
| 219 | "content": { |
| 220 | "type": "SYMBOL", |
| 221 | "name": "_word" |
| 222 | } |
| 223 | } |
| 224 | ] |
| 225 | }, |
| 226 | "struct_declaration": { |
| 227 | "type": "SEQ", |
| 228 | "members": [ |
| 229 | { |
| 230 | "type": "STRING", |
| 231 | "value": "struct" |
| 232 | }, |
| 233 | { |
| 234 | "type": "FIELD", |
| 235 | "name": "name", |
| 236 | "content": { |
| 237 | "type": "SYMBOL", |
| 238 | "name": "identifier" |
| 239 | } |
| 240 | }, |
| 241 | { |
| 242 | "type": "REPEAT", |
| 243 | "content": { |
| 244 | "type": "SYMBOL", |
| 245 | "name": "_word" |
| 246 | } |
| 247 | }, |
| 248 | { |
| 249 | "type": "STRING", |
| 250 | "value": "end" |
| 251 | } |
| 252 | ] |
| 253 | }, |
| 254 | "abstract_declaration": { |
| 255 | "type": "SEQ", |
| 256 | "members": [ |
| 257 | { |
| 258 | "type": "STRING", |
| 259 | "value": "abstract" |
| 260 | }, |
| 261 | { |
| 262 | "type": "FIELD", |
| 263 | "name": "name", |
| 264 | "content": { |
| 265 | "type": "SYMBOL", |
| 266 | "name": "identifier" |
| 267 | } |
| 268 | }, |
| 269 | { |
| 270 | "type": "REPEAT1", |
| 271 | "content": { |
| 272 | "type": "SYMBOL", |
| 273 | "name": "_word" |
| 274 | } |
| 275 | } |
| 276 | ] |
| 277 | }, |
| 278 | "holds_declaration": { |
| 279 | "type": "SEQ", |
| 280 | "members": [ |
| 281 | { |
| 282 | "type": "STRING", |
| 283 | "value": "holds" |
| 284 | }, |
| 285 | { |
| 286 | "type": "FIELD", |
| 287 | "name": "name", |
| 288 | "content": { |
| 289 | "type": "SYMBOL", |
| 290 | "name": "identifier" |
| 291 | } |
| 292 | }, |
| 293 | { |
| 294 | "type": "REPEAT1", |
| 295 | "content": { |
| 296 | "type": "SYMBOL", |
| 297 | "name": "_word" |
| 298 | } |
| 299 | } |
| 300 | ] |
| 301 | }, |
| 302 | "layout_declaration": { |
| 303 | "type": "SEQ", |
| 304 | "members": [ |
| 305 | { |
| 306 | "type": "STRING", |
| 307 | "value": "layout" |
| 308 | }, |
| 309 | { |
| 310 | "type": "FIELD", |
| 311 | "name": "name", |
| 312 | "content": { |
| 313 | "type": "SYMBOL", |
| 314 | "name": "identifier" |
| 315 | } |
| 316 | }, |
| 317 | { |
| 318 | "type": "REPEAT", |
| 319 | "content": { |
| 320 | "type": "SYMBOL", |
| 321 | "name": "_word" |
| 322 | } |
| 323 | }, |
| 324 | { |
| 325 | "type": "SYMBOL", |
| 326 | "name": "_sep" |
| 327 | }, |
| 328 | { |
| 329 | "type": "REPEAT", |
| 330 | "content": { |
| 331 | "type": "SEQ", |
| 332 | "members": [ |
| 333 | { |
| 334 | "type": "SYMBOL", |
| 335 | "name": "field_declaration" |
| 336 | }, |
| 337 | { |
| 338 | "type": "SYMBOL", |
| 339 | "name": "_sep" |
| 340 | } |
| 341 | ] |
| 342 | } |
| 343 | }, |
| 344 | { |
| 345 | "type": "STRING", |
| 346 | "value": "end" |
| 347 | } |
| 348 | ] |
| 349 | }, |
| 350 | "field_declaration": { |
| 351 | "type": "SEQ", |
| 352 | "members": [ |
| 353 | { |
| 354 | "type": "STRING", |
| 355 | "value": "field" |
| 356 | }, |
| 357 | { |
| 358 | "type": "FIELD", |
| 359 | "name": "name", |
| 360 | "content": { |
| 361 | "type": "SYMBOL", |
| 362 | "name": "identifier" |
| 363 | } |
| 364 | }, |
| 365 | { |
| 366 | "type": "REPEAT", |
| 367 | "content": { |
| 368 | "type": "SYMBOL", |
| 369 | "name": "_word" |
| 370 | } |
| 371 | } |
| 372 | ] |
| 373 | }, |
| 374 | "function_definition": { |
| 375 | "type": "SEQ", |
| 376 | "members": [ |
| 377 | { |
| 378 | "type": "CHOICE", |
| 379 | "members": [ |
| 380 | { |
| 381 | "type": "STRING", |
| 382 | "value": "export" |
| 383 | }, |
| 384 | { |
| 385 | "type": "BLANK" |
| 386 | } |
| 387 | ] |
| 388 | }, |
| 389 | { |
| 390 | "type": "STRING", |
| 391 | "value": "fn" |
| 392 | }, |
| 393 | { |
| 394 | "type": "FIELD", |
| 395 | "name": "name", |
| 396 | "content": { |
| 397 | "type": "SYMBOL", |
| 398 | "name": "identifier" |
| 399 | } |
| 400 | }, |
| 401 | { |
| 402 | "type": "CHOICE", |
| 403 | "members": [ |
| 404 | { |
| 405 | "type": "FIELD", |
| 406 | "name": "parameters", |
| 407 | "content": { |
| 408 | "type": "SYMBOL", |
| 409 | "name": "parameter_list" |
| 410 | } |
| 411 | }, |
| 412 | { |
| 413 | "type": "BLANK" |
| 414 | } |
| 415 | ] |
| 416 | }, |
| 417 | { |
| 418 | "type": "STRING", |
| 419 | "value": "to" |
| 420 | }, |
| 421 | { |
| 422 | "type": "FIELD", |
| 423 | "name": "return_type", |
| 424 | "content": { |
| 425 | "type": "SYMBOL", |
| 426 | "name": "return_type" |
| 427 | } |
| 428 | }, |
| 429 | { |
| 430 | "type": "SEQ", |
| 431 | "members": [ |
| 432 | { |
| 433 | "type": "SYMBOL", |
| 434 | "name": "_sep" |
| 435 | }, |
| 436 | { |
| 437 | "type": "CHOICE", |
| 438 | "members": [ |
| 439 | { |
| 440 | "type": "FIELD", |
| 441 | "name": "body", |
| 442 | "content": { |
| 443 | "type": "SYMBOL", |
| 444 | "name": "block" |
| 445 | } |
| 446 | }, |
| 447 | { |
| 448 | "type": "BLANK" |
| 449 | } |
| 450 | ] |
| 451 | } |
| 452 | ] |
| 453 | }, |
| 454 | { |
| 455 | "type": "STRING", |
| 456 | "value": "end" |
| 457 | } |
| 458 | ] |
| 459 | }, |
| 460 | "parameter_list": { |
| 461 | "type": "REPEAT1", |
| 462 | "content": { |
| 463 | "type": "SYMBOL", |
| 464 | "name": "_word" |
| 465 | } |
| 466 | }, |
| 467 | "return_type": { |
| 468 | "type": "REPEAT1", |
| 469 | "content": { |
| 470 | "type": "SYMBOL", |
| 471 | "name": "_word" |
| 472 | } |
| 473 | }, |
| 474 | "_statement": { |
| 475 | "type": "CHOICE", |
| 476 | "members": [ |
| 477 | { |
| 478 | "type": "SYMBOL", |
| 479 | "name": "if_statement" |
| 480 | }, |
| 481 | { |
| 482 | "type": "SYMBOL", |
| 483 | "name": "while_statement" |
| 484 | }, |
| 485 | { |
| 486 | "type": "SYMBOL", |
| 487 | "name": "for_statement" |
| 488 | }, |
| 489 | { |
| 490 | "type": "SYMBOL", |
| 491 | "name": "return_statement" |
| 492 | }, |
| 493 | { |
| 494 | "type": "SYMBOL", |
| 495 | "name": "put_statement" |
| 496 | }, |
| 497 | { |
| 498 | "type": "SYMBOL", |
| 499 | "name": "trap_statement" |
| 500 | }, |
| 501 | { |
| 502 | "type": "SYMBOL", |
| 503 | "name": "exit_statement" |
| 504 | }, |
| 505 | { |
| 506 | "type": "SYMBOL", |
| 507 | "name": "break_statement" |
| 508 | }, |
| 509 | { |
| 510 | "type": "SYMBOL", |
| 511 | "name": "continue_statement" |
| 512 | }, |
| 513 | { |
| 514 | "type": "SYMBOL", |
| 515 | "name": "assignment" |
| 516 | }, |
| 517 | { |
| 518 | "type": "SYMBOL", |
| 519 | "name": "expression_statement" |
| 520 | } |
| 521 | ] |
| 522 | }, |
| 523 | "block": { |
| 524 | "type": "REPEAT1", |
| 525 | "content": { |
| 526 | "type": "SEQ", |
| 527 | "members": [ |
| 528 | { |
| 529 | "type": "SYMBOL", |
| 530 | "name": "_statement" |
| 531 | }, |
| 532 | { |
| 533 | "type": "SYMBOL", |
| 534 | "name": "_sep" |
| 535 | } |
| 536 | ] |
| 537 | } |
| 538 | }, |
| 539 | "if_statement": { |
| 540 | "type": "SEQ", |
| 541 | "members": [ |
| 542 | { |
| 543 | "type": "STRING", |
| 544 | "value": "if" |
| 545 | }, |
| 546 | { |
| 547 | "type": "FIELD", |
| 548 | "name": "condition", |
| 549 | "content": { |
| 550 | "type": "SYMBOL", |
| 551 | "name": "expression" |
| 552 | } |
| 553 | }, |
| 554 | { |
| 555 | "type": "SEQ", |
| 556 | "members": [ |
| 557 | { |
| 558 | "type": "SYMBOL", |
| 559 | "name": "_sep" |
| 560 | }, |
| 561 | { |
| 562 | "type": "CHOICE", |
| 563 | "members": [ |
| 564 | { |
| 565 | "type": "FIELD", |
| 566 | "name": "consequence", |
| 567 | "content": { |
| 568 | "type": "SYMBOL", |
| 569 | "name": "block" |
| 570 | } |
| 571 | }, |
| 572 | { |
| 573 | "type": "BLANK" |
| 574 | } |
| 575 | ] |
| 576 | } |
| 577 | ] |
| 578 | }, |
| 579 | { |
| 580 | "type": "CHOICE", |
| 581 | "members": [ |
| 582 | { |
| 583 | "type": "FIELD", |
| 584 | "name": "alternative", |
| 585 | "content": { |
| 586 | "type": "SYMBOL", |
| 587 | "name": "else_clause" |
| 588 | } |
| 589 | }, |
| 590 | { |
| 591 | "type": "BLANK" |
| 592 | } |
| 593 | ] |
| 594 | }, |
| 595 | { |
| 596 | "type": "STRING", |
| 597 | "value": "end" |
| 598 | } |
| 599 | ] |
| 600 | }, |
| 601 | "else_clause": { |
| 602 | "type": "SEQ", |
| 603 | "members": [ |
| 604 | { |
| 605 | "type": "STRING", |
| 606 | "value": "else" |
| 607 | }, |
| 608 | { |
| 609 | "type": "SEQ", |
| 610 | "members": [ |
| 611 | { |
| 612 | "type": "SYMBOL", |
| 613 | "name": "_sep" |
| 614 | }, |
| 615 | { |
| 616 | "type": "CHOICE", |
| 617 | "members": [ |
| 618 | { |
| 619 | "type": "FIELD", |
| 620 | "name": "body", |
| 621 | "content": { |
| 622 | "type": "SYMBOL", |
| 623 | "name": "block" |
| 624 | } |
| 625 | }, |
| 626 | { |
| 627 | "type": "BLANK" |
| 628 | } |
| 629 | ] |
| 630 | } |
| 631 | ] |
| 632 | } |
| 633 | ] |
| 634 | }, |
| 635 | "while_statement": { |
| 636 | "type": "SEQ", |
| 637 | "members": [ |
| 638 | { |
| 639 | "type": "STRING", |
| 640 | "value": "while" |
| 641 | }, |
| 642 | { |
| 643 | "type": "FIELD", |
| 644 | "name": "condition", |
| 645 | "content": { |
| 646 | "type": "SYMBOL", |
| 647 | "name": "expression" |
| 648 | } |
| 649 | }, |
| 650 | { |
| 651 | "type": "CHOICE", |
| 652 | "members": [ |
| 653 | { |
| 654 | "type": "SEQ", |
| 655 | "members": [ |
| 656 | { |
| 657 | "type": "STRING", |
| 658 | "value": "bound" |
| 659 | }, |
| 660 | { |
| 661 | "type": "FIELD", |
| 662 | "name": "bound", |
| 663 | "content": { |
| 664 | "type": "SYMBOL", |
| 665 | "name": "_word" |
| 666 | } |
| 667 | } |
| 668 | ] |
| 669 | }, |
| 670 | { |
| 671 | "type": "BLANK" |
| 672 | } |
| 673 | ] |
| 674 | }, |
| 675 | { |
| 676 | "type": "SEQ", |
| 677 | "members": [ |
| 678 | { |
| 679 | "type": "SYMBOL", |
| 680 | "name": "_sep" |
| 681 | }, |
| 682 | { |
| 683 | "type": "CHOICE", |
| 684 | "members": [ |
| 685 | { |
| 686 | "type": "FIELD", |
| 687 | "name": "body", |
| 688 | "content": { |
| 689 | "type": "SYMBOL", |
| 690 | "name": "block" |
| 691 | } |
| 692 | }, |
| 693 | { |
| 694 | "type": "BLANK" |
| 695 | } |
| 696 | ] |
| 697 | } |
| 698 | ] |
| 699 | }, |
| 700 | { |
| 701 | "type": "STRING", |
| 702 | "value": "end" |
| 703 | } |
| 704 | ] |
| 705 | }, |
| 706 | "for_statement": { |
| 707 | "type": "SEQ", |
| 708 | "members": [ |
| 709 | { |
| 710 | "type": "STRING", |
| 711 | "value": "for" |
| 712 | }, |
| 713 | { |
| 714 | "type": "FIELD", |
| 715 | "name": "counter", |
| 716 | "content": { |
| 717 | "type": "SYMBOL", |
| 718 | "name": "identifier" |
| 719 | } |
| 720 | }, |
| 721 | { |
| 722 | "type": "FIELD", |
| 723 | "name": "count", |
| 724 | "content": { |
| 725 | "type": "SYMBOL", |
| 726 | "name": "expression" |
| 727 | } |
| 728 | }, |
| 729 | { |
| 730 | "type": "SEQ", |
| 731 | "members": [ |
| 732 | { |
| 733 | "type": "SYMBOL", |
| 734 | "name": "_sep" |
| 735 | }, |
| 736 | { |
| 737 | "type": "CHOICE", |
| 738 | "members": [ |
| 739 | { |
| 740 | "type": "FIELD", |
| 741 | "name": "body", |
| 742 | "content": { |
| 743 | "type": "SYMBOL", |
| 744 | "name": "block" |
| 745 | } |
| 746 | }, |
| 747 | { |
| 748 | "type": "BLANK" |
| 749 | } |
| 750 | ] |
| 751 | } |
| 752 | ] |
| 753 | }, |
| 754 | { |
| 755 | "type": "STRING", |
| 756 | "value": "end" |
| 757 | } |
| 758 | ] |
| 759 | }, |
| 760 | "return_statement": { |
| 761 | "type": "SEQ", |
| 762 | "members": [ |
| 763 | { |
| 764 | "type": "STRING", |
| 765 | "value": "ret" |
| 766 | }, |
| 767 | { |
| 768 | "type": "CHOICE", |
| 769 | "members": [ |
| 770 | { |
| 771 | "type": "FIELD", |
| 772 | "name": "value", |
| 773 | "content": { |
| 774 | "type": "SYMBOL", |
| 775 | "name": "expression" |
| 776 | } |
| 777 | }, |
| 778 | { |
| 779 | "type": "BLANK" |
| 780 | } |
| 781 | ] |
| 782 | } |
| 783 | ] |
| 784 | }, |
| 785 | "put_statement": { |
| 786 | "type": "SEQ", |
| 787 | "members": [ |
| 788 | { |
| 789 | "type": "STRING", |
| 790 | "value": "put" |
| 791 | }, |
| 792 | { |
| 793 | "type": "FIELD", |
| 794 | "name": "arguments", |
| 795 | "content": { |
| 796 | "type": "SYMBOL", |
| 797 | "name": "expression" |
| 798 | } |
| 799 | } |
| 800 | ] |
| 801 | }, |
| 802 | "trap_statement": { |
| 803 | "type": "SEQ", |
| 804 | "members": [ |
| 805 | { |
| 806 | "type": "STRING", |
| 807 | "value": "trap" |
| 808 | }, |
| 809 | { |
| 810 | "type": "FIELD", |
| 811 | "name": "code", |
| 812 | "content": { |
| 813 | "type": "SYMBOL", |
| 814 | "name": "expression" |
| 815 | } |
| 816 | } |
| 817 | ] |
| 818 | }, |
| 819 | "exit_statement": { |
| 820 | "type": "SEQ", |
| 821 | "members": [ |
| 822 | { |
| 823 | "type": "STRING", |
| 824 | "value": "exit" |
| 825 | }, |
| 826 | { |
| 827 | "type": "FIELD", |
| 828 | "name": "value", |
| 829 | "content": { |
| 830 | "type": "SYMBOL", |
| 831 | "name": "expression" |
| 832 | } |
| 833 | } |
| 834 | ] |
| 835 | }, |
| 836 | "break_statement": { |
| 837 | "type": "STRING", |
| 838 | "value": "break" |
| 839 | }, |
| 840 | "continue_statement": { |
| 841 | "type": "STRING", |
| 842 | "value": "continue" |
| 843 | }, |
| 844 | "assignment": { |
| 845 | "type": "SEQ", |
| 846 | "members": [ |
| 847 | { |
| 848 | "type": "FIELD", |
| 849 | "name": "name", |
| 850 | "content": { |
| 851 | "type": "SYMBOL", |
| 852 | "name": "identifier" |
| 853 | } |
| 854 | }, |
| 855 | { |
| 856 | "type": "STRING", |
| 857 | "value": "=" |
| 858 | }, |
| 859 | { |
| 860 | "type": "FIELD", |
| 861 | "name": "value", |
| 862 | "content": { |
| 863 | "type": "SYMBOL", |
| 864 | "name": "expression" |
| 865 | } |
| 866 | } |
| 867 | ] |
| 868 | }, |
| 869 | "expression_statement": { |
| 870 | "type": "SYMBOL", |
| 871 | "name": "expression" |
| 872 | }, |
| 873 | "expression": { |
| 874 | "type": "REPEAT1", |
| 875 | "content": { |
| 876 | "type": "SYMBOL", |
| 877 | "name": "_word" |
| 878 | } |
| 879 | }, |
| 880 | "_word": { |
| 881 | "type": "CHOICE", |
| 882 | "members": [ |
| 883 | { |
| 884 | "type": "SYMBOL", |
| 885 | "name": "identifier" |
| 886 | }, |
| 887 | { |
| 888 | "type": "SYMBOL", |
| 889 | "name": "integer" |
| 890 | }, |
| 891 | { |
| 892 | "type": "SYMBOL", |
| 893 | "name": "float" |
| 894 | }, |
| 895 | { |
| 896 | "type": "SYMBOL", |
| 897 | "name": "string" |
| 898 | }, |
| 899 | { |
| 900 | "type": "SYMBOL", |
| 901 | "name": "parenthesized" |
| 902 | }, |
| 903 | { |
| 904 | "type": "SYMBOL", |
| 905 | "name": "unsized" |
| 906 | } |
| 907 | ] |
| 908 | }, |
| 909 | "parenthesized": { |
| 910 | "type": "SEQ", |
| 911 | "members": [ |
| 912 | { |
| 913 | "type": "STRING", |
| 914 | "value": "(" |
| 915 | }, |
| 916 | { |
| 917 | "type": "REPEAT", |
| 918 | "content": { |
| 919 | "type": "SYMBOL", |
| 920 | "name": "_word" |
| 921 | } |
| 922 | }, |
| 923 | { |
| 924 | "type": "STRING", |
| 925 | "value": ")" |
| 926 | } |
| 927 | ] |
| 928 | }, |
| 929 | "unsized": { |
| 930 | "type": "STRING", |
| 931 | "value": "*" |
| 932 | }, |
| 933 | "identifier": { |
| 934 | "type": "PATTERN", |
| 935 | "value": "[A-Za-z_][A-Za-z0-9_]*" |
| 936 | }, |
| 937 | "integer": { |
| 938 | "type": "TOKEN", |
| 939 | "content": { |
| 940 | "type": "CHOICE", |
| 941 | "members": [ |
| 942 | { |
| 943 | "type": "PATTERN", |
| 944 | "value": "-?[0-9]+" |
| 945 | }, |
| 946 | { |
| 947 | "type": "PATTERN", |
| 948 | "value": "0x[0-9a-f]+" |
| 949 | } |
| 950 | ] |
| 951 | } |
| 952 | }, |
| 953 | "float": { |
| 954 | "type": "TOKEN", |
| 955 | "content": { |
| 956 | "type": "CHOICE", |
| 957 | "members": [ |
| 958 | { |
| 959 | "type": "PATTERN", |
| 960 | "value": "-?[0-9]+\\.[0-9]+([eE][+-]?[0-9]+)?(f32|f64)?" |
| 961 | }, |
| 962 | { |
| 963 | "type": "PATTERN", |
| 964 | "value": "-?[0-9]+[eE][+-]?[0-9]+(f32|f64)?" |
| 965 | }, |
| 966 | { |
| 967 | "type": "PATTERN", |
| 968 | "value": "-?[0-9]+(f32|f64)" |
| 969 | } |
| 970 | ] |
| 971 | } |
| 972 | }, |
| 973 | "string": { |
| 974 | "type": "SEQ", |
| 975 | "members": [ |
| 976 | { |
| 977 | "type": "STRING", |
| 978 | "value": "\"" |
| 979 | }, |
| 980 | { |
| 981 | "type": "REPEAT", |
| 982 | "content": { |
| 983 | "type": "CHOICE", |
| 984 | "members": [ |
| 985 | { |
| 986 | "type": "SYMBOL", |
| 987 | "name": "string_content" |
| 988 | }, |
| 989 | { |
| 990 | "type": "SYMBOL", |
| 991 | "name": "escape_sequence" |
| 992 | } |
| 993 | ] |
| 994 | } |
| 995 | }, |
| 996 | { |
| 997 | "type": "IMMEDIATE_TOKEN", |
| 998 | "content": { |
| 999 | "type": "STRING", |
| 1000 | "value": "\"" |
| 1001 | } |
| 1002 | } |
| 1003 | ] |
| 1004 | }, |
| 1005 | "string_content": { |
| 1006 | "type": "IMMEDIATE_TOKEN", |
| 1007 | "content": { |
| 1008 | "type": "PREC", |
| 1009 | "value": 2, |
| 1010 | "content": { |
| 1011 | "type": "PATTERN", |
| 1012 | "value": "[^\"\\\\\\n]+" |
| 1013 | } |
| 1014 | } |
| 1015 | }, |
| 1016 | "escape_sequence": { |
| 1017 | "type": "IMMEDIATE_TOKEN", |
| 1018 | "content": { |
| 1019 | "type": "PATTERN", |
| 1020 | "value": "\\\\[^\\n]" |
| 1021 | } |
| 1022 | }, |
| 1023 | "comment": { |
| 1024 | "type": "CHOICE", |
| 1025 | "members": [ |
| 1026 | { |
| 1027 | "type": "STRING", |
| 1028 | "value": "note" |
| 1029 | }, |
| 1030 | { |
| 1031 | "type": "TOKEN", |
| 1032 | "content": { |
| 1033 | "type": "PATTERN", |
| 1034 | "value": "note[ \\t\\r()][^\\n]*" |
| 1035 | } |
| 1036 | } |
| 1037 | ] |
| 1038 | } |
| 1039 | }, |
| 1040 | "extras": [ |
| 1041 | { |
| 1042 | "type": "PATTERN", |
| 1043 | "value": "[ \\t\\r]" |
| 1044 | }, |
| 1045 | { |
| 1046 | "type": "SYMBOL", |
| 1047 | "name": "comment" |
| 1048 | } |
| 1049 | ], |
| 1050 | "conflicts": [], |
| 1051 | "precedences": [], |
| 1052 | "externals": [], |
| 1053 | "inline": [], |
| 1054 | "supertypes": [], |
| 1055 | "reserved": {} |
| 1056 | } |