Initial Commit
[packages] / xemacs-packages / semantic / wisent / wisent-awk-wy.el
1 ;;; wisent-awk-wy.el --- Generated parser support file
2
3 ;; Copyright (C) 2002 David Ponce
4
5 ;; Author: Eric M. Ludlam <zappo@projectile.siege-engine.com>
6 ;; Created: 2007-06-05 21:46:54-0400
7 ;; Keywords: syntax
8 ;; X-RCS: $Id: wisent-awk-wy.el,v 1.1 2007-11-26 15:12:27 michaels Exp $
9
10 ;; This file is not part of GNU Emacs.
11 ;;
12 ;; This program is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 2, or (at
15 ;; your option) any later version.
16 ;;
17 ;; This software is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 ;; General Public License for more details.
21 ;;
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
26
27 ;;; Commentary:
28 ;;
29 ;; PLEASE DO NOT MANUALLY EDIT THIS FILE!  It is automatically
30 ;; generated from the grammar file wisent-awk.wy.
31
32 ;;; History:
33 ;;
34
35 ;;; Code:
36 \f
37 ;;; Prologue
38 ;;
39 \f
40 ;;; Declarations
41 ;;
42 (defconst wisent-awk-wy--keyword-table
43   (semantic-lex-make-keyword-table 'nil 'nil)
44   "Table of language keywords.")
45
46 (defconst wisent-awk-wy--token-table
47   (semantic-lex-make-type-table
48    '(("<no-type>"
49       (LEX_LENGTH)
50       (LEX_BUILTIN)
51       (DECREMENT)
52       (INCREMENT)
53       (LEX_OR)
54       (LEX_AND)
55       (LEX_IN)
56       (LEX_NEXTFILE)
57       (LEX_GETLINE)
58       (LEX_FUNCTION)
59       (LEX_EXIT)
60       (LEX_NEXT)
61       (LEX_PRINTF)
62       (LEX_PRINT)
63       (LEX_CONTINUE)
64       (LEX_BREAK)
65       (LEX_FOR)
66       (LEX_DO)
67       (LEX_WHILE)
68       (LEX_DELETE)
69       (LEX_RETURN)
70       (LEX_ELSE)
71       (LEX_IF)
72       (LEX_END)
73       (LEX_BEGIN)
74       (CONCAT_OP)
75       (NEWLINE)
76       (MATCHOP)
77       (ASSIGNOP)
78       (APPEND_OP)
79       (RELOP)
80       (YSTRING)
81       (YNUMBER)
82       (ERROR)
83       (REGEXP)
84       (NAME)
85       (FUNC_CALL)))
86    'nil)
87   "Table of lexical tokens.")
88
89 (defconst wisent-awk-wy--parse-table
90   (progn
91     (eval-when-compile
92       (require 'wisent-comp))
93     (wisent-compile-grammar
94      '((FUNC_CALL NAME REGEXP ERROR YNUMBER YSTRING RELOP APPEND_OP ASSIGNOP MATCHOP NEWLINE CONCAT_OP LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION LEX_GETLINE LEX_NEXTFILE LEX_IN LEX_AND LEX_OR INCREMENT DECREMENT LEX_BUILTIN LEX_LENGTH)
95        ((right ASSIGNOP)
96         (right 63 58)
97         (left LEX_OR)
98         (left LEX_AND)
99         (left LEX_GETLINE)
100         (nonassoc LEX_IN)
101         (left FUNC_CALL LEX_BUILTIN LEX_LENGTH)
102         (nonassoc 44)
103         (nonassoc MATCHOP)
104         (nonassoc RELOP 60 62 124 APPEND_OP TWOWAYIO)
105         (left CONCAT_OP)
106         (left YSTRING YNUMBER)
107         (left 43 45)
108         (left 42 47 37)
109         (right 33 UNARY)
110         (right 94)
111         (left INCREMENT DECREMENT)
112         (left 36)
113         (left 40 41))
114        (start_
115         ((opt_nls program opt_nls)))
116        (program
117         ((rule))
118         ((program rule))
119         ((error))
120         ((program error))
121         (nil))
122        (rule
123         ((LEX_BEGIN
124           (progn)
125           action))
126         ((LEX_END
127           (progn)
128           action))
129         ((LEX_BEGIN statement_term))
130         ((LEX_END statement_term))
131         ((pattern action))
132         ((action))
133         ((pattern statement_term))
134         ((function_prologue function_body)))
135        (func_name
136         ((NAME))
137         ((FUNC_CALL))
138         ((lex_builtin)))
139        (lex_builtin
140         ((LEX_BUILTIN))
141         ((LEX_LENGTH)))
142        (function_prologue
143         ((LEX_FUNCTION
144           (progn)
145           func_name 40 opt_param_list r_paren opt_nls)))
146        (function_body
147         ((l_brace statements r_brace opt_semi opt_nls))
148         ((l_brace r_brace opt_semi opt_nls)))
149        (pattern
150         ((exp))
151         ((exp 44 exp)))
152        (regexp
153         ((47
154           (progn)
155           REGEXP 47)))
156        (action
157         ((l_brace statements r_brace opt_semi opt_nls))
158         ((l_brace r_brace opt_semi opt_nls)))
159        (statements
160         ((statement))
161         ((statements statement))
162         ((error))
163         ((statements error)))
164        (statement_term
165         ((nls))
166         ((semi opt_nls)))
167        (statement
168         ((semi opt_nls))
169         ((l_brace r_brace))
170         ((l_brace statements r_brace))
171         ((if_statement))
172         ((LEX_WHILE 40 exp r_paren opt_nls statement))
173         ((LEX_DO opt_nls statement LEX_WHILE 40 exp r_paren opt_nls))
174         ((LEX_FOR 40 NAME LEX_IN NAME r_paren opt_nls statement))
175         ((LEX_FOR 40 opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement))
176         ((LEX_FOR 40 opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement))
177         ((LEX_BREAK statement_term))
178         ((LEX_CONTINUE statement_term))
179         ((print 40 expression_list r_paren output_redir statement_term))
180         ((print opt_rexpression_list output_redir statement_term))
181         ((LEX_NEXT statement_term))
182         ((LEX_NEXTFILE statement_term))
183         ((LEX_EXIT opt_exp statement_term))
184         ((LEX_RETURN
185           (progn)
186           opt_exp statement_term))
187         ((LEX_DELETE NAME 91 expression_list 93 statement_term))
188         ((LEX_DELETE NAME statement_term))
189         ((exp statement_term)))
190        (print
191         ((LEX_PRINT))
192         ((LEX_PRINTF)))
193        (if_statement
194         ((LEX_IF 40 exp r_paren opt_nls statement))
195         ((LEX_IF 40 exp r_paren opt_nls statement LEX_ELSE opt_nls statement)))
196        (nls
197         ((NEWLINE))
198         ((nls NEWLINE)))
199        (opt_nls
200         (nil)
201         ((nls)))
202        (input_redir
203         (nil)
204         ((60 simp_exp)))
205        (output_redir
206         (nil)
207         ((62 exp))
208         ((APPEND_OP exp))
209         ((124 exp))
210         ((TWOWAYIO exp)))
211        (opt_param_list
212         (nil)
213         ((param_list)))
214        (param_list
215         ((NAME))
216         ((param_list comma NAME))
217         ((error))
218         ((param_list error))
219         ((param_list comma error)))
220        (opt_exp
221         (nil)
222         ((exp)))
223        (opt_rexpression_list
224         (nil)
225         ((rexpression_list)))
226        (rexpression_list
227         ((rexp))
228         ((rexpression_list comma rexp))
229         ((error))
230         ((rexpression_list error))
231         ((rexpression_list error rexp))
232         ((rexpression_list comma error)))
233        (opt_expression_list
234         (nil)
235         ((expression_list)))
236        (expression_list
237         ((exp))
238         ((expression_list comma exp))
239         ((error))
240         ((expression_list error))
241         ((expression_list error exp))
242         ((expression_list comma error)))
243        (exp
244         ((variable ASSIGNOP
245                    (progn)
246                    exp))
247         ((40 expression_list r_paren LEX_IN NAME))
248         ((exp 124 LEX_GETLINE opt_variable))
249         ((exp TWOWAYIO LEX_GETLINE opt_variable))
250         ((LEX_GETLINE opt_variable input_redir))
251         ((exp LEX_AND exp))
252         ((exp LEX_OR exp))
253         ((exp MATCHOP exp))
254         ((regexp))
255         ((33 regexp)
256          [UNARY])
257         ((exp LEX_IN NAME))
258         ((exp RELOP exp))
259         ((exp 60 exp))
260         ((exp 62 exp))
261         ((exp 63 exp 58 exp))
262         ((simp_exp))
263         ((exp simp_exp)
264          [CONCAT_OP]))
265        (rexp
266         ((variable ASSIGNOP
267                    (progn)
268                    rexp))
269         ((rexp LEX_AND rexp))
270         ((rexp LEX_OR rexp))
271         ((LEX_GETLINE opt_variable input_redir))
272         ((regexp))
273         ((33 regexp)
274          [UNARY])
275         ((rexp MATCHOP rexp))
276         ((rexp LEX_IN NAME))
277         ((rexp RELOP rexp))
278         ((rexp 63 rexp 58 rexp))
279         ((simp_exp))
280         ((rexp simp_exp)
281          [CONCAT_OP]))
282        (simp_exp
283         ((non_post_simp_exp))
284         ((simp_exp 94 simp_exp))
285         ((simp_exp 42 simp_exp))
286         ((simp_exp 47 simp_exp))
287         ((simp_exp 37 simp_exp))
288         ((simp_exp 43 simp_exp))
289         ((simp_exp 45 simp_exp))
290         ((variable INCREMENT))
291         ((variable DECREMENT)))
292        (non_post_simp_exp
293         ((33 simp_exp)
294          [UNARY])
295         ((40 exp r_paren))
296         ((LEX_BUILTIN 40 opt_expression_list r_paren))
297         ((LEX_LENGTH 40 opt_expression_list r_paren))
298         ((LEX_LENGTH))
299         ((FUNC_CALL 40 opt_expression_list r_paren))
300         ((variable))
301         ((INCREMENT variable))
302         ((DECREMENT variable))
303         ((YNUMBER))
304         ((YSTRING))
305         ((45 simp_exp)
306          [UNARY])
307         ((43 simp_exp)
308          [UNARY]))
309        (opt_variable
310         (nil)
311         ((variable)))
312        (variable
313         ((NAME))
314         ((NAME 91 expression_list 93))
315         ((36 non_post_simp_exp)))
316        (l_brace
317         ((123 opt_nls)))
318        (r_brace
319         ((125 opt_nls)))
320        (r_paren
321         ((41)))
322        (opt_semi
323         (nil)
324         ((semi)))
325        (semi
326         ((59)))
327        (comma
328         ((44 opt_nls))))
329      'nil))
330   "Parser table.")
331
332 (defun wisent-awk-wy--install-parser ()
333   "Setup the Semantic Parser."
334   (semantic-install-function-overrides
335    '((parse-stream . wisent-parse-stream)))
336   (setq semantic-parser-name "LALR"
337         semantic--parse-table wisent-awk-wy--parse-table
338         semantic-debug-parser-source "wisent-awk.wy"
339         semantic-flex-keywords-obarray wisent-awk-wy--keyword-table
340         semantic-lex-types-obarray wisent-awk-wy--token-table)
341   ;; Collect unmatched syntax lexical tokens
342   (semantic-make-local-hook 'wisent-discarding-token-functions)
343   (add-hook 'wisent-discarding-token-functions
344             'wisent-collect-unmatched-syntax nil t))
345
346 \f
347 ;;; Analyzers
348 ;;
349 (require 'semantic-lex)
350
351 \f
352 ;;; Epilogue
353 ;;
354
355
356
357
358 (provide 'wisent-awk-wy)
359
360 ;;; wisent-awk-wy.el ends here