| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560 |
- <?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 ProtoParser extends lime_parser {
- var $qi = 0;
- var $i = array (
- 0 =>
- array (
- 'directives' => 's 1',
- 'directive' => 's 30',
- 'include' => 's 33',
- 'file' => 's 35',
- '\'start\'' => 'a \'start\'',
- 'message' => 'r 1',
- ),
- 1 =>
- array (
- 'messages' => 's 2',
- 'msgspec' => 's 3',
- 'message' => 's 5',
- ),
- 2 =>
- array (
- '#' => 'r 0',
- ),
- 3 =>
- array (
- 'msgspec' => 's 3',
- 'messages' => 's 4',
- 'message' => 's 5',
- '#' => 'r 4',
- ),
- 4 =>
- array (
- '#' => 'r 5',
- ),
- 5 =>
- array (
- 'name' => 's 6',
- ),
- 6 =>
- array (
- 'spar' => 's 7',
- ),
- 7 =>
- array (
- 'entries' => 's 8',
- 'entry' => 's 11',
- 'cardinality' => 's 13',
- 'repeated' => 's 26',
- 'optional' => 's 27',
- 'required' => 's 28',
- ),
- 8 =>
- array (
- 'epar' => 's 9',
- ),
- 9 =>
- array (
- 'semicolon' => 's 10',
- ),
- 10 =>
- array (
- 'message' => 'r 6',
- '#' => 'r 6',
- ),
- 11 =>
- array (
- 'entry' => 's 11',
- 'entries' => 's 12',
- 'cardinality' => 's 13',
- 'repeated' => 's 26',
- 'optional' => 's 27',
- 'required' => 's 28',
- 'epar' => 'r 7',
- ),
- 12 =>
- array (
- 'epar' => 'r 8',
- ),
- 13 =>
- array (
- 'type' => 's 14',
- 'uint' => 's 19',
- 'data' => 's 20',
- 'message' => 's 24',
- ),
- 14 =>
- array (
- 'name' => 's 15',
- ),
- 15 =>
- array (
- 'equals' => 's 16',
- ),
- 16 =>
- array (
- 'number' => 's 17',
- ),
- 17 =>
- array (
- 'semicolon' => 's 18',
- ),
- 18 =>
- array (
- 'repeated' => 'r 9',
- 'optional' => 'r 9',
- 'required' => 'r 9',
- 'epar' => 'r 9',
- ),
- 19 =>
- array (
- 'name' => 'r 14',
- ),
- 20 =>
- array (
- 'srpar' => 's 21',
- 'name' => 'r 15',
- ),
- 21 =>
- array (
- 'string' => 's 22',
- ),
- 22 =>
- array (
- 'erpar' => 's 23',
- ),
- 23 =>
- array (
- 'name' => 'r 16',
- ),
- 24 =>
- array (
- 'name' => 's 25',
- ),
- 25 =>
- array (
- 'name' => 'r 17',
- ),
- 26 =>
- array (
- 'uint' => 'r 10',
- 'data' => 'r 10',
- 'message' => 'r 10',
- ),
- 27 =>
- array (
- 'uint' => 'r 11',
- 'data' => 'r 11',
- 'message' => 'r 11',
- ),
- 28 =>
- array (
- 'repeated' => 's 29',
- 'uint' => 'r 12',
- 'data' => 'r 12',
- 'message' => 'r 12',
- ),
- 29 =>
- array (
- 'uint' => 'r 13',
- 'data' => 'r 13',
- 'message' => 'r 13',
- ),
- 30 =>
- array (
- 'semicolon' => 's 31',
- ),
- 31 =>
- array (
- 'directive' => 's 30',
- 'directives' => 's 32',
- 'include' => 's 33',
- 'message' => 'r 1',
- ),
- 32 =>
- array (
- 'message' => 'r 2',
- ),
- 33 =>
- array (
- 'string' => 's 34',
- ),
- 34 =>
- array (
- 'semicolon' => 'r 3',
- ),
- 35 =>
- array (
- '#' => 'r 18',
- ),
- );
- function reduce_0_file_1($tokens, &$result) {
- #
- # (0) file := directives messages
- #
- $result = reset($tokens);
- $result = array(
- "directives" => $tokens[0],
- "messages" => $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_messages_1($tokens, &$result) {
- #
- # (4) messages := msgspec
- #
- $result = reset($tokens);
- $result = array($tokens[0]);
-
- }
- function reduce_5_messages_2($tokens, &$result) {
- #
- # (5) messages := msgspec messages
- #
- $result = reset($tokens);
- $result = array_merge(array($tokens[0]), $tokens[1]);
-
- }
- function reduce_6_msgspec_1($tokens, &$result) {
- #
- # (6) msgspec := message name spar entries epar semicolon
- #
- $result = reset($tokens);
- $result = array(
- "name" => $tokens[1],
- "entries" => $tokens[3]
- );
- }
- 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 := cardinality type name equals number semicolon
- #
- $result = reset($tokens);
- $result = array(
- "cardinality" => $tokens[0],
- "type" => $tokens[1],
- "name" => $tokens[2],
- "id" => $tokens[4]
- );
-
- }
- function reduce_10_cardinality_1($tokens, &$result) {
- #
- # (10) cardinality := repeated
- #
- $result = reset($tokens);
- $result = "repeated";
-
- }
- function reduce_11_cardinality_2($tokens, &$result) {
- #
- # (11) cardinality := optional
- #
- $result = reset($tokens);
- $result = "optional";
-
- }
- function reduce_12_cardinality_3($tokens, &$result) {
- #
- # (12) cardinality := required
- #
- $result = reset($tokens);
- $result = "required";
-
- }
- function reduce_13_cardinality_4($tokens, &$result) {
- #
- # (13) cardinality := required repeated
- #
- $result = reset($tokens);
- $result = "required repeated";
-
- }
- function reduce_14_type_1($tokens, &$result) {
- #
- # (14) type := uint
- #
- $result = reset($tokens);
- $result = array(
- "type" => "uint",
- "size" => $tokens[0]
- );
-
- }
- function reduce_15_type_2($tokens, &$result) {
- #
- # (15) type := data
- #
- $result = reset($tokens);
- $result = array(
- "type" => "data"
- );
-
- }
- function reduce_16_type_3($tokens, &$result) {
- #
- # (16) type := data srpar string erpar
- #
- $result = reset($tokens);
- $result = array(
- "type" => "constdata",
- "size" => $tokens[2]
- );
-
- }
- function reduce_17_type_4($tokens, &$result) {
- #
- # (17) type := message name
- #
- $result = reset($tokens);
- $result = array(
- "type" => "message",
- "message" => $tokens[1]
- );
-
- }
- function reduce_18_start_1($tokens, &$result) {
- #
- # (18) '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_messages_1',
- 5 => 'reduce_5_messages_2',
- 6 => 'reduce_6_msgspec_1',
- 7 => 'reduce_7_entries_1',
- 8 => 'reduce_8_entries_2',
- 9 => 'reduce_9_entry_1',
- 10 => 'reduce_10_cardinality_1',
- 11 => 'reduce_11_cardinality_2',
- 12 => 'reduce_12_cardinality_3',
- 13 => 'reduce_13_cardinality_4',
- 14 => 'reduce_14_type_1',
- 15 => 'reduce_15_type_2',
- 16 => 'reduce_16_type_3',
- 17 => 'reduce_17_type_4',
- 18 => 'reduce_18_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' => 'messages',
- 'len' => 1,
- 'replace' => true,
- ),
- 5 =>
- array (
- 'symbol' => 'messages',
- 'len' => 2,
- 'replace' => true,
- ),
- 6 =>
- array (
- 'symbol' => 'msgspec',
- 'len' => 6,
- 'replace' => true,
- ),
- 7 =>
- array (
- 'symbol' => 'entries',
- 'len' => 1,
- 'replace' => true,
- ),
- 8 =>
- array (
- 'symbol' => 'entries',
- 'len' => 2,
- 'replace' => true,
- ),
- 9 =>
- array (
- 'symbol' => 'entry',
- 'len' => 6,
- 'replace' => true,
- ),
- 10 =>
- array (
- 'symbol' => 'cardinality',
- 'len' => 1,
- 'replace' => true,
- ),
- 11 =>
- array (
- 'symbol' => 'cardinality',
- 'len' => 1,
- 'replace' => true,
- ),
- 12 =>
- array (
- 'symbol' => 'cardinality',
- 'len' => 1,
- 'replace' => true,
- ),
- 13 =>
- array (
- 'symbol' => 'cardinality',
- 'len' => 2,
- 'replace' => true,
- ),
- 14 =>
- array (
- 'symbol' => 'type',
- 'len' => 1,
- 'replace' => true,
- ),
- 15 =>
- array (
- 'symbol' => 'type',
- 'len' => 1,
- 'replace' => true,
- ),
- 16 =>
- array (
- 'symbol' => 'type',
- 'len' => 4,
- 'replace' => true,
- ),
- 17 =>
- array (
- 'symbol' => 'type',
- 'len' => 2,
- 'replace' => true,
- ),
- 18 =>
- array (
- 'symbol' => '\'start\'',
- 'len' => 1,
- 'replace' => true,
- ),
- );
- }
|