<?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,
  ),
);
}
