| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503 |
- <?php
- /*
- DON'T EDIT THIS FILE!
- This file was automatically generated by the Lime parser generator.
- The real source code you should be looking at is in one or more
- grammar files in the Lime format.
- THE ONLY REASON TO LOOK AT THIS FILE is to see where in the grammar
- file that your error happened, because there are enough comments to
- help you debug your grammar.
- If you ignore this warning, you're shooting yourself in the brain,
- not the foot.
- */
- class StructParser extends lime_parser {
- var $qi = 0;
- var $i = array (
- 0 =>
- array (
- 'directives' => 's 1',
- 'directive' => 's 33',
- 'include' => 's 36',
- 'file' => 's 38',
- '\'start\'' => 'a \'start\'',
- 'structure' => 'r 1',
- ),
- 1 =>
- array (
- 'structures' => 's 2',
- 'structspec' => 's 3',
- 'structure' => 's 5',
- ),
- 2 =>
- array (
- '#' => 'r 0',
- ),
- 3 =>
- array (
- 'structspec' => 's 3',
- 'structures' => 's 4',
- 'structure' => 's 5',
- '#' => 'r 4',
- ),
- 4 =>
- array (
- '#' => 'r 5',
- ),
- 5 =>
- array (
- 'name' => 's 6',
- ),
- 6 =>
- array (
- 'srpar' => 's 7',
- ),
- 7 =>
- array (
- 'string' => 's 8',
- ),
- 8 =>
- array (
- 'erpar' => 's 9',
- ),
- 9 =>
- array (
- 'spar' => 's 10',
- ),
- 10 =>
- array (
- 'entries' => 's 11',
- 'entry' => 's 14',
- 'typespec' => 's 16',
- 'string' => 's 23',
- 'size' => 's 24',
- 'structure' => 's 28',
- ),
- 11 =>
- array (
- 'epar' => 's 12',
- ),
- 12 =>
- array (
- 'semicolon' => 's 13',
- ),
- 13 =>
- array (
- 'structure' => 'r 6',
- '#' => 'r 6',
- ),
- 14 =>
- array (
- 'entry' => 's 14',
- 'entries' => 's 15',
- 'typespec' => 's 16',
- 'string' => 's 23',
- 'size' => 's 24',
- 'structure' => 's 28',
- 'epar' => 'r 7',
- ),
- 15 =>
- array (
- 'epar' => 'r 8',
- ),
- 16 =>
- array (
- 'name' => 's 17',
- ),
- 17 =>
- array (
- 'semicolon' => 's 18',
- 'sbracket' => 's 19',
- ),
- 18 =>
- array (
- 'string' => 'r 9',
- 'size' => 'r 9',
- 'structure' => 'r 9',
- 'epar' => 'r 9',
- ),
- 19 =>
- array (
- 'string' => 's 20',
- ),
- 20 =>
- array (
- 'ebracket' => 's 21',
- ),
- 21 =>
- array (
- 'semicolon' => 's 22',
- ),
- 22 =>
- array (
- 'string' => 'r 10',
- 'size' => 'r 10',
- 'structure' => 'r 10',
- 'epar' => 'r 10',
- ),
- 23 =>
- array (
- 'name' => 'r 11',
- ),
- 24 =>
- array (
- 'string' => 's 25',
- ),
- 25 =>
- array (
- 'align' => 's 26',
- ),
- 26 =>
- array (
- 'string' => 's 27',
- ),
- 27 =>
- array (
- 'name' => 'r 12',
- ),
- 28 =>
- array (
- 'name' => 's 29',
- ),
- 29 =>
- array (
- 'srpar' => 's 30',
- ),
- 30 =>
- array (
- 'string' => 's 31',
- ),
- 31 =>
- array (
- 'erpar' => 's 32',
- ),
- 32 =>
- array (
- 'name' => 'r 13',
- ),
- 33 =>
- array (
- 'semicolon' => 's 34',
- ),
- 34 =>
- array (
- 'directive' => 's 33',
- 'directives' => 's 35',
- 'include' => 's 36',
- 'structure' => 'r 1',
- ),
- 35 =>
- array (
- 'structure' => 'r 2',
- ),
- 36 =>
- array (
- 'string' => 's 37',
- ),
- 37 =>
- array (
- 'semicolon' => 'r 3',
- ),
- 38 =>
- array (
- '#' => 'r 14',
- ),
- );
- function reduce_0_file_1($tokens, &$result) {
- #
- # (0) file := directives structures
- #
- $result = reset($tokens);
- $result = array(
- "directives" => $tokens[0],
- "structures" => $tokens[1]
- );
- }
- function reduce_1_directives_1($tokens, &$result) {
- #
- # (1) directives :=
- #
- $result = reset($tokens);
- $result = array();
-
- }
- function reduce_2_directives_2($tokens, &$result) {
- #
- # (2) directives := directive semicolon directives
- #
- $result = reset($tokens);
- $result = array_merge(array($tokens[0]), $tokens[2]);
-
- }
- function reduce_3_directive_1($tokens, &$result) {
- #
- # (3) directive := include string
- #
- $result = reset($tokens);
- $result = array(
- "type" => "include",
- "file" => $tokens[1]
- );
-
- }
- function reduce_4_structures_1($tokens, &$result) {
- #
- # (4) structures := structspec
- #
- $result = reset($tokens);
- $result = array($tokens[0]);
-
- }
- function reduce_5_structures_2($tokens, &$result) {
- #
- # (5) structures := structspec structures
- #
- $result = reset($tokens);
- $result = array_merge(array($tokens[0]), $tokens[1]);
-
- }
- function reduce_6_structspec_1($tokens, &$result) {
- #
- # (6) structspec := structure name srpar string erpar spar entries epar semicolon
- #
- $result = reset($tokens);
- $result = array(
- "name" => $tokens[1],
- "parameters" => $tokens[3],
- "entries" => $tokens[6]
- );
- }
- function reduce_7_entries_1($tokens, &$result) {
- #
- # (7) entries := entry
- #
- $result = reset($tokens);
- $result = array($tokens[0]);
-
- }
- function reduce_8_entries_2($tokens, &$result) {
- #
- # (8) entries := entry entries
- #
- $result = reset($tokens);
- $result = array_merge(array($tokens[0]), $tokens[1]);
-
- }
- function reduce_9_entry_1($tokens, &$result) {
- #
- # (9) entry := typespec name semicolon
- #
- $result = reset($tokens);
- $result = array(
- "type" => $tokens[0],
- "name" => $tokens[1],
- "num" => "1"
- );
-
- }
- function reduce_10_entry_2($tokens, &$result) {
- #
- # (10) entry := typespec name sbracket string ebracket semicolon
- #
- $result = reset($tokens);
- $result = array(
- "type" => $tokens[0],
- "name" => $tokens[1],
- "num" => $tokens[3]
- );
-
- }
- function reduce_11_typespec_1($tokens, &$result) {
- #
- # (11) typespec := string
- #
- $result = reset($tokens);
- $result = array(
- "type" => "sizealign",
- "ctype" => $tokens[0],
- "size" => "sizeof($tokens[0])",
- "align" => "__alignof__($tokens[0])"
- );
-
- }
- function reduce_12_typespec_2($tokens, &$result) {
- #
- # (12) typespec := size string align string
- #
- $result = reset($tokens);
- $result = array(
- "type" => "sizealign",
- "ctype" => "void",
- "size" => $tokens[1],
- "align" => $tokens[3]
- );
-
- }
- function reduce_13_typespec_3($tokens, &$result) {
- #
- # (13) typespec := structure name srpar string erpar
- #
- $result = reset($tokens);
- $result = array(
- "type" => "structure",
- "ctype" => $tokens[1],
- "name" => $tokens[1],
- "parameters" => $tokens[3]
- );
-
- }
- function reduce_14_start_1($tokens, &$result) {
- #
- # (14) 'start' := file
- #
- $result = reset($tokens);
- }
- var $method = array (
- 0 => 'reduce_0_file_1',
- 1 => 'reduce_1_directives_1',
- 2 => 'reduce_2_directives_2',
- 3 => 'reduce_3_directive_1',
- 4 => 'reduce_4_structures_1',
- 5 => 'reduce_5_structures_2',
- 6 => 'reduce_6_structspec_1',
- 7 => 'reduce_7_entries_1',
- 8 => 'reduce_8_entries_2',
- 9 => 'reduce_9_entry_1',
- 10 => 'reduce_10_entry_2',
- 11 => 'reduce_11_typespec_1',
- 12 => 'reduce_12_typespec_2',
- 13 => 'reduce_13_typespec_3',
- 14 => 'reduce_14_start_1',
- );
- var $a = array (
- 0 =>
- array (
- 'symbol' => 'file',
- 'len' => 2,
- 'replace' => true,
- ),
- 1 =>
- array (
- 'symbol' => 'directives',
- 'len' => 0,
- 'replace' => true,
- ),
- 2 =>
- array (
- 'symbol' => 'directives',
- 'len' => 3,
- 'replace' => true,
- ),
- 3 =>
- array (
- 'symbol' => 'directive',
- 'len' => 2,
- 'replace' => true,
- ),
- 4 =>
- array (
- 'symbol' => 'structures',
- 'len' => 1,
- 'replace' => true,
- ),
- 5 =>
- array (
- 'symbol' => 'structures',
- 'len' => 2,
- 'replace' => true,
- ),
- 6 =>
- array (
- 'symbol' => 'structspec',
- 'len' => 9,
- 'replace' => true,
- ),
- 7 =>
- array (
- 'symbol' => 'entries',
- 'len' => 1,
- 'replace' => true,
- ),
- 8 =>
- array (
- 'symbol' => 'entries',
- 'len' => 2,
- 'replace' => true,
- ),
- 9 =>
- array (
- 'symbol' => 'entry',
- 'len' => 3,
- 'replace' => true,
- ),
- 10 =>
- array (
- 'symbol' => 'entry',
- 'len' => 6,
- 'replace' => true,
- ),
- 11 =>
- array (
- 'symbol' => 'typespec',
- 'len' => 1,
- 'replace' => true,
- ),
- 12 =>
- array (
- 'symbol' => 'typespec',
- 'len' => 4,
- 'replace' => true,
- ),
- 13 =>
- array (
- 'symbol' => 'typespec',
- 'len' => 5,
- 'replace' => true,
- ),
- 14 =>
- array (
- 'symbol' => '\'start\'',
- 'len' => 1,
- 'replace' => true,
- ),
- );
- }
|