1 ;;; srecode/srt-wy.el --- Generated parser support file
3 ;; Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
7 ;; GNU Emacs is free software: you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 ;; This file was generated from admin/grammars/srecode-template.wy.
26 (require 'semantic
/lex
)
27 (eval-when-compile (require 'semantic
/bovine
))
34 (defconst srecode-template-wy--keyword-table
35 (semantic-lex-make-keyword-table
40 ("template" . TEMPLATE
)
41 ("sectiondictionary" . SECTIONDICTIONARY
)
46 ("defaultmacro" . DEFAULTMACRO
)
49 '(("bind" summary
"bind \"<letter>\"")
50 ("read" summary
"prompt <symbol> \"Describe Symbol: \" [default[macro] <lispsym>|\"valuetext\"] [read <lispsym>]")
51 ("defaultmacro" summary
"prompt <symbol> \"Describe Symbol: \" [default[macro] <lispsym>|\"valuetext\"] [read <lispsym>]")
52 ("default" summary
"prompt <symbol> \"Describe Symbol: \" [default[macro] <lispsym>|\"valuetext\"] [read <lispsym>]")
53 ("prompt" summary
"prompt <symbol> \"Describe Symbol: \" [default[macro] <lispsym>|\"valuetext\"] [read <lispsym>]")
54 ("end" summary
"section ... end")
55 ("section" summary
"section <name>\\n <dictionary entries>\\n end")
56 ("sectiondictionary" summary
"sectiondictionary <name>\\n <dictionary entries>")
57 ("template" summary
"template <name>\\n <template definition>")
58 ("context" summary
"context <name>")
59 ("macro" summary
"... macro \"string\" ...")
60 ("show" summary
"show <name> ; to show a section")
61 ("set" summary
"set <name> <value>")))
62 "Table of language keywords.")
64 (defconst srecode-template-wy--token-table
65 (semantic-lex-make-type-table
75 (TEMPLATE_BLOCK .
"^----"))
78 '(("number" :declared t
)
79 ("string" :declared t
)
80 ("symbol" :declared t
)
81 ("property" syntax
":\\(\\w\\|\\s_\\)*")
82 ("property" :declared t
)
83 ("newline" :declared t
)
84 ("punctuation" syntax
"\\s.+")
85 ("punctuation" :declared t
)
86 ("keyword" :declared t
)))
87 "Table of lexical tokens.")
89 (defconst srecode-template-wy--parse-table
92 (require 'semantic
/wisent
/comp
))
93 (wisent-compile-grammar
94 '((SET SHOW MACRO CONTEXT TEMPLATE SECTIONDICTIONARY SECTION END PROMPT DEFAULT DEFAULTMACRO READ BIND newline TEMPLATE_BLOCK property symbol string number
)
104 ((CONTEXT symbol newline
)
106 (semantic-tag $
2 'context
))))
108 ((PROMPT symbol string opt-default-fcn opt-read-fcn newline
)
110 (semantic-tag $
2 'prompt
:text
112 :default $
4 :read $
5))))
120 ((DEFAULTMACRO string
)
131 ((SET symbol insertable-string-list newline
)
133 (semantic-tag-new-variable $
2 nil $
3)))
134 ((SHOW symbol newline
)
136 (semantic-tag-new-variable $
2 nil t
))))
137 (insertable-string-list
140 ((insertable-string-list insertable-string
)
150 ((TEMPLATE templatename opt-dynamic-arguments newline opt-string section-dictionary-list TEMPLATE_BLOCK newline opt-bind
)
152 (semantic-tag-new-function $
2 nil $
3 :documentation $
5 :code $
7 :dictionaries $
6 :binding $
9))))
163 (opt-dynamic-arguments
164 ((property opt-dynamic-arguments
)
171 (section-dictionary-list
173 ((section-dictionary-list flat-section-dictionary
)
176 ((section-dictionary-list section-dictionary
)
179 (flat-section-dictionary
180 ((SECTIONDICTIONARY string newline flat-dictionary-entry-list
)
184 (flat-dictionary-entry-list
186 ((flat-dictionary-entry-list flat-dictionary-entry
)
188 (flat-dictionary-entry
190 (wisent-cook-tag $
1)))
192 ((SECTION string newline dictionary-entry-list END newline
)
196 (dictionary-entry-list
198 ((dictionary-entry-list dictionary-entry
)
202 (wisent-cook-tag $
1))
203 ((section-dictionary)
206 ((BIND string newline
)
212 (defun srecode-template-wy--install-parser ()
213 "Setup the Semantic Parser."
214 (semantic-install-function-overrides
215 '((parse-stream . wisent-parse-stream
)))
216 (setq semantic-parser-name
"LALR"
217 semantic--parse-table srecode-template-wy--parse-table
218 semantic-debug-parser-source
"srecode-template.wy"
219 semantic-flex-keywords-obarray srecode-template-wy--keyword-table
220 semantic-lex-types-obarray srecode-template-wy--token-table
)
221 ;; Collect unmatched syntax lexical tokens
222 (semantic-make-local-hook 'wisent-discarding-token-functions
)
223 (add-hook 'wisent-discarding-token-functions
224 'wisent-collect-unmatched-syntax nil t
))
229 (define-lex-regex-type-analyzer srecode-template-wy--
<property
>-regexp-analyzer
230 "regexp analyzer for <property> tokens."
235 (define-lex-regex-type-analyzer srecode-template-wy--
<symbol
>-regexp-analyzer
236 "regexp analyzer for <symbol> tokens."
241 (define-lex-regex-type-analyzer srecode-template-wy--
<number
>-regexp-analyzer
242 "regexp analyzer for <number> tokens."
243 semantic-lex-number-expression
247 (define-lex-string-type-analyzer srecode-template-wy--
<punctuation
>-string-analyzer
248 "string analyzer for <punctuation> tokens."
253 (define-lex-sexp-type-analyzer srecode-template-wy--
<string
>-sexp-analyzer
254 "sexp analyzer for <string> tokens."
258 (define-lex-keyword-type-analyzer srecode-template-wy--
<keyword
>-keyword-analyzer
259 "keyword analyzer for <keyword> tokens."
260 "\\(\\sw\\|\\s_\\)+")
265 (define-lex-simple-regex-analyzer srecode-template-property-analyzer
266 "Detect and create a dynamic argument properties."
267 ":\\(\\w\\|\\s_\\)*" 'property
0)
269 (define-lex-regex-analyzer srecode-template-separator-block
270 "Detect and create a template quote block."
272 (semantic-lex-push-token
276 (semantic-lex-unterminated-syntax-protection 'TEMPLATE_BLOCK
277 (goto-char (match-end 0))
278 (re-search-forward "^----$")
279 (match-beginning 0))))
280 (setq semantic-lex-end-point
(point)))
283 (define-lex wisent-srecode-template-lexer
284 "Lexical analyzer that handles SRecode Template buffers.
285 It ignores whitespace, newlines and comments."
287 semantic-lex-ignore-whitespace
288 semantic-lex-ignore-newline
289 semantic-lex-ignore-comments
290 srecode-template-separator-block
291 srecode-template-wy--
<keyword
>-keyword-analyzer
292 srecode-template-property-analyzer
293 srecode-template-wy--
<symbol
>-regexp-analyzer
294 srecode-template-wy--
<number
>-regexp-analyzer
295 srecode-template-wy--
<string
>-sexp-analyzer
296 srecode-template-wy--
<punctuation
>-string-analyzer
297 semantic-lex-default-action
300 (provide 'srecode
/srt-wy
)
302 ;;; srecode/srt-wy.el ends here