;;; subprograms-wy.el --- Generated parser support file

;; Copyright (C) 2013 Stephen Leake.  All Rights Reserved.

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 3, or (at
;; your option) any later version.
;;
;; This software is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.

(require 'wisi)
(require 'semantic/lex)
(require 'wisi-compile)

(defconst subprograms-wy--keyword-table
  (semantic-lex-make-keyword-table
   '(
    ("function" . FUNCTION)
    ("(" . LEFT_PAREN)
    ("procedure" . PROCEDURE)
    (")" . RIGHT_PAREN)
    )
   nil)
  "Table of language keywords.")

(defconst subprograms-wy--token-table
  (semantic-lex-make-type-table
   '(
     ("symbol"
      (SYMBOL)
     )
     ("punctuation"
      (TICK . "'")
     )
     ("string"
      (STRING_LITERAL)
     )
    )
   nil)
  "Table of language tokens.")

(defconst subprograms-wy--parse-table
   (wisi-compile-grammar
   '((SYMBOL TICK STRING_LITERAL FUNCTION LEFT_PAREN PROCEDURE RIGHT_PAREN )
     ((compilation_unit
       ((declarations )
        (setq wisi-test-success t)))
      (declarations
       ((declaration ))
       ((declarations declaration )))
      (declaration
       ((subprogram )))
      (subprogram
       ((FUNCTION parameter_list SYMBOL )
        `,(wisi-statement-action
        1 'function
        2 'other))
       ((PROCEDURE parameter_list )
        (wisi-statement-tokens
        $1 'procedure $region1
        $2 'other $region2)))
      (parameter_list
       ((LEFT_PAREN RIGHT_PAREN )
        `,(wisi-statement-action 1 'open-paren 2 'close-paren))
       (())
       ((LEFT_PAREN SYMBOL RIGHT_PAREN )
        `,(wisi-statement-action 1 'open-paren 3 'close-paren))
       ((TICK STRING_LITERAL ))))
     [((default . error) (FUNCTION .  1) (PROCEDURE .  2))
      ((default . error) (SYMBOL . (parameter_list . 1)) (LEFT_PAREN .  10) (TICK .  9))
      ((default . error) (PROCEDURE . (parameter_list . 1)) (FUNCTION . (parameter_list . 1)) ($EOI . (parameter_list . 1)) (LEFT_PAREN .  10) (TICK .  9))
      ((default . error) ($EOI .  8))
      ((default . error) ($EOI . (compilation_unit . 0)) (FUNCTION .  1) (PROCEDURE .  2))
      ((default . error) ($EOI . (declarations . 0)) (FUNCTION . (declarations . 0)) (PROCEDURE . (declarations . 0)))
      ((default . error) (PROCEDURE . (declaration . 0)) (FUNCTION . (declaration . 0)) ($EOI . (declaration . 0)))
      ((default . error) (PROCEDURE . (declarations . 1)) (FUNCTION . (declarations . 1)) ($EOI . (declarations . 1)))
      ((default . error) ($EOI . accept) (RIGHT_PAREN . accept) (PROCEDURE . accept) (LEFT_PAREN . accept) (FUNCTION . accept) (STRING_LITERAL . accept) (TICK . accept) (SYMBOL . accept))
      ((default . error) (STRING_LITERAL .  16))
      ((default . error) (SYMBOL .  14) (RIGHT_PAREN .  15))
      ((default . error) (PROCEDURE . (subprogram . 1)) (FUNCTION . (subprogram . 1)) ($EOI . (subprogram . 1)))
      ((default . error) (SYMBOL .  13))
      ((default . error) ($EOI . (subprogram . 0)) (FUNCTION . (subprogram . 0)) (PROCEDURE . (subprogram . 0)))
      ((default . error) (RIGHT_PAREN .  17))
      ((default . error) (SYMBOL . (parameter_list . 0)) ($EOI . (parameter_list . 0)) (FUNCTION . (parameter_list . 0)) (PROCEDURE . (parameter_list . 0)))
      ((default . error) (SYMBOL . (parameter_list . 3)) ($EOI . (parameter_list . 3)) (FUNCTION . (parameter_list . 3)) (PROCEDURE . (parameter_list . 3)))
      ((default . error) (PROCEDURE . (parameter_list . 2)) (FUNCTION . (parameter_list . 2)) ($EOI . (parameter_list . 2)) (SYMBOL . (parameter_list . 2)))]
     [((compilation_unit . 3)(declarations . 4)(declaration . 5)(subprogram . 6))
      ((parameter_list . 12))
      ((parameter_list . 11))
      nil
      ((declaration . 7)(subprogram . 6))
      nil
      nil
      nil
      nil
      nil
      nil
      nil
      nil
      nil
      nil
      nil
      nil
      nil]))
  "Parser table.")

(provide 'subprograms-wy)

;; end of file
