
module MenhirBasics = struct
  
  exception Error
  
  let _eRR =
    fun _s ->
      raise Error
  
  type token = 
    | VALUES
    | TYPE
    | STRING
    | RIGHT_BRACKET
    | RANGE
    | LF
    | LEFT_BRACKET
    | INT
    | IDENT of (
# 9 "parser/parser.mly"
       (string)
# 23 "parser/parser.ml"
  )
    | EQUALS
    | EOF
    | DATE
    | COMMA
  
end

include MenhirBasics

# 1 "parser/parser.mly"
  
(* Header: Define the AST type *)
open Ast

# 39 "parser/parser.ml"

type ('s, 'r) _menhir_state = 
  | MenhirState00 : ('s, _menhir_box_main) _menhir_state
    (** State 00.
        Stack shape : .
        Start symbol: main. *)

  | MenhirState07 : (('s, _menhir_box_main) _menhir_cell1_columns, _menhir_box_main) _menhir_state
    (** State 07.
        Stack shape : columns.
        Start symbol: main. *)

  | MenhirState19 : (('s, _menhir_box_main) _menhir_cell1_column_name _menhir_cell0_column_type, _menhir_box_main) _menhir_state
    (** State 19.
        Stack shape : column_name column_type.
        Start symbol: main. *)

  | MenhirState23 : ((('s, _menhir_box_main) _menhir_cell1_column_name _menhir_cell0_column_type, _menhir_box_main) _menhir_cell1_values, _menhir_box_main) _menhir_state
    (** State 23.
        Stack shape : column_name column_type values.
        Start symbol: main. *)


and ('s, 'r) _menhir_cell1_column_name = 
  | MenhirCell1_column_name of 's * ('s, 'r) _menhir_state * (string)

and 's _menhir_cell0_column_type = 
  | MenhirCell0_column_type of 's * (Ast.data_type)

and ('s, 'r) _menhir_cell1_columns = 
  | MenhirCell1_columns of 's * ('s, 'r) _menhir_state * (Ast.column list)

and ('s, 'r) _menhir_cell1_values = 
  | MenhirCell1_values of 's * ('s, 'r) _menhir_state * (string list)

and _menhir_box_main = 
  | MenhirBox_main of (Ast.data) [@@unboxed]

let _menhir_action_01 =
  fun _1 _3 _5 ->
    (
# 25 "parser/parser.mly"
                                               ( Column(_1, _3, _5) )
# 83 "parser/parser.ml"
     : (Ast.column))

let _menhir_action_02 =
  fun _2 ->
    (
# 29 "parser/parser.mly"
                                     ( _2 )
# 91 "parser/parser.ml"
     : (string))

let _menhir_action_03 =
  fun () ->
    (
# 33 "parser/parser.mly"
                    ( Int )
# 99 "parser/parser.ml"
     : (Ast.data_type))

let _menhir_action_04 =
  fun () ->
    (
# 34 "parser/parser.mly"
                       ( String )
# 107 "parser/parser.ml"
     : (Ast.data_type))

let _menhir_action_05 =
  fun () ->
    (
# 35 "parser/parser.mly"
                     ( Date )
# 115 "parser/parser.ml"
     : (Ast.data_type))

let _menhir_action_06 =
  fun _4 ->
    (
# 39 "parser/parser.mly"
                                                    ( Values(List.rev(_4)) )
# 123 "parser/parser.ml"
     : (Ast.values))

let _menhir_action_07 =
  fun _4 ->
    (
# 40 "parser/parser.mly"
                                                  ( _4 )
# 131 "parser/parser.ml"
     : (Ast.values))

let _menhir_action_08 =
  fun _1 ->
    (
# 20 "parser/parser.mly"
           ( [_1] )
# 139 "parser/parser.ml"
     : (Ast.column list))

let _menhir_action_09 =
  fun _1 _4 ->
    (
# 21 "parser/parser.mly"
                         ( _4::_1 )
# 147 "parser/parser.ml"
     : (Ast.column list))

let _menhir_action_10 =
  fun _1 ->
    (
# 17 "parser/parser.mly"
                ( Columns(List.rev(_1)) )
# 155 "parser/parser.ml"
     : (Ast.data))

let _menhir_action_11 =
  fun _1 _3 ->
    (
# 49 "parser/parser.mly"
                      ( Range(_1, _3) )
# 163 "parser/parser.ml"
     : (Ast.values))

let _menhir_action_12 =
  fun _1 ->
    (
# 53 "parser/parser.mly"
          ( _1 )
# 171 "parser/parser.ml"
     : (string))

let _menhir_action_13 =
  fun _1 ->
    (
# 44 "parser/parser.mly"
          ( [_1] )
# 179 "parser/parser.ml"
     : (string list))

let _menhir_action_14 =
  fun _1 _3 ->
    (
# 45 "parser/parser.mly"
                       ( _3::_1 )
# 187 "parser/parser.ml"
     : (string list))

let _menhir_print_token : token -> string =
  fun _tok ->
    match _tok with
    | COMMA ->
        "COMMA"
    | DATE ->
        "DATE"
    | EOF ->
        "EOF"
    | EQUALS ->
        "EQUALS"
    | IDENT _ ->
        "IDENT"
    | INT ->
        "INT"
    | LEFT_BRACKET ->
        "LEFT_BRACKET"
    | LF ->
        "LF"
    | RANGE ->
        "RANGE"
    | RIGHT_BRACKET ->
        "RIGHT_BRACKET"
    | STRING ->
        "STRING"
    | TYPE ->
        "TYPE"
    | VALUES ->
        "VALUES"

let _menhir_fail : unit -> 'a =
  fun () ->
    Printf.eprintf "Internal failure -- please contact the parser generator's developers.\n%!";
    assert false

include struct
  
  [@@@ocaml.warning "-4-37"]
  
  let rec _menhir_run_01 : type  ttv_stack. ttv_stack -> _ -> _ -> (ttv_stack, _menhir_box_main) _menhir_state -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s ->
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | IDENT _v ->
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | RIGHT_BRACKET ->
              let _tok = _menhir_lexer _menhir_lexbuf in
              let _2 = _v in
              let _v = _menhir_action_02 _2 in
              let _menhir_stack = MenhirCell1_column_name (_menhir_stack, _menhir_s, _v) in
              (match (_tok : MenhirBasics.token) with
              | LF ->
                  let _tok = _menhir_lexer _menhir_lexbuf in
                  (match (_tok : MenhirBasics.token) with
                  | TYPE ->
                      let _tok = _menhir_lexer _menhir_lexbuf in
                      (match (_tok : MenhirBasics.token) with
                      | EQUALS ->
                          let _tok = _menhir_lexer _menhir_lexbuf in
                          (match (_tok : MenhirBasics.token) with
                          | STRING ->
                              let _tok = _menhir_lexer _menhir_lexbuf in
                              let _v = _menhir_action_04 () in
                              _menhir_goto_column_type _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
                          | INT ->
                              let _tok = _menhir_lexer _menhir_lexbuf in
                              let _v = _menhir_action_03 () in
                              _menhir_goto_column_type _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
                          | DATE ->
                              let _tok = _menhir_lexer _menhir_lexbuf in
                              let _v = _menhir_action_05 () in
                              _menhir_goto_column_type _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
                          | _ ->
                              _eRR ())
                      | _ ->
                          _eRR ())
                  | _ ->
                      _eRR ())
              | _ ->
                  _eRR ())
          | _ ->
              _eRR ())
      | _ ->
          _eRR ()
  
  and _menhir_goto_column_type : type  ttv_stack. (ttv_stack, _menhir_box_main) _menhir_cell1_column_name -> _ -> _ -> _ -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let _menhir_stack = MenhirCell0_column_type (_menhir_stack, _v) in
      match (_tok : MenhirBasics.token) with
      | LF ->
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | VALUES ->
              let _tok = _menhir_lexer _menhir_lexbuf in
              (match (_tok : MenhirBasics.token) with
              | EQUALS ->
                  let _tok = _menhir_lexer _menhir_lexbuf in
                  (match (_tok : MenhirBasics.token) with
                  | LEFT_BRACKET ->
                      let _menhir_s = MenhirState19 in
                      let _tok = _menhir_lexer _menhir_lexbuf in
                      (match (_tok : MenhirBasics.token) with
                      | IDENT _v ->
                          _menhir_run_20 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
                      | _ ->
                          _eRR ())
                  | _ ->
                      _eRR ())
              | _ ->
                  _eRR ())
          | RANGE ->
              let _tok = _menhir_lexer _menhir_lexbuf in
              (match (_tok : MenhirBasics.token) with
              | EQUALS ->
                  let _tok = _menhir_lexer _menhir_lexbuf in
                  (match (_tok : MenhirBasics.token) with
                  | LEFT_BRACKET ->
                      let _tok = _menhir_lexer _menhir_lexbuf in
                      (match (_tok : MenhirBasics.token) with
                      | IDENT _v_1 ->
                          let _tok = _menhir_lexer _menhir_lexbuf in
                          (match (_tok : MenhirBasics.token) with
                          | COMMA ->
                              let _tok = _menhir_lexer _menhir_lexbuf in
                              (match (_tok : MenhirBasics.token) with
                              | IDENT _v_2 ->
                                  let _tok = _menhir_lexer _menhir_lexbuf in
                                  let (_3, _1) = (_v_2, _v_1) in
                                  let _v = _menhir_action_11 _1 _3 in
                                  (match (_tok : MenhirBasics.token) with
                                  | RIGHT_BRACKET ->
                                      let _tok = _menhir_lexer _menhir_lexbuf in
                                      let _4 = _v in
                                      let _v = _menhir_action_07 _4 in
                                      _menhir_goto_column_value _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
                                  | _ ->
                                      _eRR ())
                              | _ ->
                                  _eRR ())
                          | _ ->
                              _eRR ())
                      | _ ->
                          _eRR ())
                  | _ ->
                      _eRR ())
              | _ ->
                  _eRR ())
          | _ ->
              _eRR ())
      | _ ->
          _eRR ()
  
  and _menhir_run_20 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_main) _menhir_state -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _tok = _menhir_lexer _menhir_lexbuf in
      let _1 = _v in
      let _v = _menhir_action_12 _1 in
      _menhir_goto_value _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_goto_value : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_main) _menhir_state -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      match _menhir_s with
      | MenhirState19 ->
          _menhir_run_25 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
      | MenhirState23 ->
          _menhir_run_24 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | _ ->
          _menhir_fail ()
  
  and _menhir_run_25 : type  ttv_stack. ((ttv_stack, _menhir_box_main) _menhir_cell1_column_name _menhir_cell0_column_type as 'stack) -> _ -> _ -> _ -> ('stack, _menhir_box_main) _menhir_state -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      let _1 = _v in
      let _v = _menhir_action_13 _1 in
      _menhir_goto_values _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_goto_values : type  ttv_stack. ((ttv_stack, _menhir_box_main) _menhir_cell1_column_name _menhir_cell0_column_type as 'stack) -> _ -> _ -> _ -> ('stack, _menhir_box_main) _menhir_state -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      match (_tok : MenhirBasics.token) with
      | RIGHT_BRACKET ->
          let _tok = _menhir_lexer _menhir_lexbuf in
          let _4 = _v in
          let _v = _menhir_action_06 _4 in
          _menhir_goto_column_value _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | COMMA ->
          let _menhir_stack = MenhirCell1_values (_menhir_stack, _menhir_s, _v) in
          let _menhir_s = MenhirState23 in
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | IDENT _v ->
              _menhir_run_20 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
          | _ ->
              _eRR ())
      | _ ->
          _eRR ()
  
  and _menhir_goto_column_value : type  ttv_stack. (ttv_stack, _menhir_box_main) _menhir_cell1_column_name _menhir_cell0_column_type -> _ -> _ -> _ -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let MenhirCell0_column_type (_menhir_stack, _3) = _menhir_stack in
      let MenhirCell1_column_name (_menhir_stack, _menhir_s, _1) = _menhir_stack in
      let _5 = _v in
      let _v = _menhir_action_01 _1 _3 _5 in
      _menhir_goto_column _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_goto_column : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_main) _menhir_state -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      match _menhir_s with
      | MenhirState00 ->
          _menhir_run_37 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
      | MenhirState07 ->
          _menhir_run_35 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | _ ->
          _menhir_fail ()
  
  and _menhir_run_37 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_main) _menhir_state -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      let _1 = _v in
      let _v = _menhir_action_08 _1 in
      _menhir_goto_columns _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_goto_columns : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_main) _menhir_state -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      match (_tok : MenhirBasics.token) with
      | LF ->
          let _menhir_stack = MenhirCell1_columns (_menhir_stack, _menhir_s, _v) in
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | LF ->
              let _menhir_s = MenhirState07 in
              let _tok = _menhir_lexer _menhir_lexbuf in
              (match (_tok : MenhirBasics.token) with
              | LEFT_BRACKET ->
                  _menhir_run_01 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
              | _ ->
                  _eRR ())
          | _ ->
              _eRR ())
      | EOF ->
          let _1 = _v in
          let _v = _menhir_action_10 _1 in
          MenhirBox_main _v
      | _ ->
          _eRR ()
  
  and _menhir_run_35 : type  ttv_stack. (ttv_stack, _menhir_box_main) _menhir_cell1_columns -> _ -> _ -> _ -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let MenhirCell1_columns (_menhir_stack, _menhir_s, _1) = _menhir_stack in
      let _4 = _v in
      let _v = _menhir_action_09 _1 _4 in
      _menhir_goto_columns _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_run_24 : type  ttv_stack. ((ttv_stack, _menhir_box_main) _menhir_cell1_column_name _menhir_cell0_column_type, _menhir_box_main) _menhir_cell1_values -> _ -> _ -> _ -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let MenhirCell1_values (_menhir_stack, _menhir_s, _1) = _menhir_stack in
      let _3 = _v in
      let _v = _menhir_action_14 _1 _3 in
      _menhir_goto_values _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  let _menhir_run_00 : type  ttv_stack. ttv_stack -> _ -> _ -> _menhir_box_main =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer ->
      let _menhir_s = MenhirState00 in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | LEFT_BRACKET ->
          _menhir_run_01 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
      | _ ->
          _eRR ()
  
end

let main =
  fun _menhir_lexer _menhir_lexbuf ->
    let _menhir_stack = () in
    let MenhirBox_main v = _menhir_run_00 _menhir_stack _menhir_lexbuf _menhir_lexer in
    v
