1 ;;; srecode/srt-wy.el --- Generated parser support file
3 ;; Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011, 2012 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 etc/grammars/srecode-template.wy.
26 (require 'semantic
/lex
)
34 (defconst srecode-template-wy--keyword-table
35 (semantic-lex-make-keyword-table
40 ("template" . TEMPLATE
)
41 ("sectiondictionary" . SECTIONDICTIONARY
)
44 ("defaultmacro" . DEFAULTMACRO
)
47 '(("bind" summary
"bind \"<letter>\"")
48 ("read" summary
"prompt <symbol> \"Describe Symbol: \" [default[macro] <lispsym>|\"valuetext\"] [read <lispsym>]")
49 ("defaultmacro" summary
"prompt <symbol> \"Describe Symbol: \" [default[macro] <lispsym>|\"valuetext\"] [read <lispsym>]")
50 ("default" summary
"prompt <symbol> \"Describe Symbol: \" [default[macro] <lispsym>|\"valuetext\"] [read <lispsym>]")
51 ("prompt" summary
"prompt <symbol> \"Describe Symbol: \" [default[macro] <lispsym>|\"valuetext\"] [read <lispsym>]")
52 ("sectiondictionary" summary
"sectiondictionary <name>\\n <dictionary entries>")
53 ("template" summary
"template <name>\\n <template definition>")
54 ("context" summary
"context <name>")
55 ("macro" summary
"... macro \"string\" ...")
56 ("show" summary
"show <name> ; to show a section")
57 ("set" summary
"set <name> <value>")))
58 "Table of language keywords.")
60 (defconst srecode-template-wy--token-table
61 (semantic-lex-make-type-table
71 (TEMPLATE_BLOCK .
"^----"))
74 '(("number" :declared t
)
75 ("string" :declared t
)
76 ("symbol" :declared t
)
77 ("property" :declared t
)
78 ("newline" :declared t
)
79 ("punctuation" syntax
"\\s.+")
80 ("punctuation" :declared t
)
81 ("keyword" :declared t
)))
82 "Table of lexical tokens.")
84 (defconst srecode-template-wy--parse-table
87 (require 'semantic
/wisent
/comp
))
88 (wisent-compile-grammar
89 '((SET SHOW MACRO CONTEXT TEMPLATE SECTIONDICTIONARY PROMPT DEFAULT DEFAULTMACRO READ BIND newline TEMPLATE_BLOCK property symbol string number
)
99 ((CONTEXT symbol newline
)
101 (semantic-tag $
2 'context
))))
103 ((PROMPT symbol string opt-default-fcn opt-read-fcn newline
)
105 (semantic-tag $
2 'prompt
:text
107 :default $
4 :read $
5))))
115 ((DEFAULTMACRO string
)
126 ((SET symbol insertable-string-list newline
)
128 (semantic-tag-new-variable $
2 nil $
3)))
129 ((SHOW symbol newline
)
131 (semantic-tag-new-variable $
2 nil t
))))
132 (insertable-string-list
135 ((insertable-string-list insertable-string
)
145 ((TEMPLATE templatename opt-dynamic-arguments newline opt-string opt-section-dictionaries TEMPLATE_BLOCK newline opt-bind
)
147 (semantic-tag-new-function $
2 nil $
3 :documentation $
5 :code $
7 :dictionaries $
6 :binding $
9))))
158 (opt-dynamic-arguments
159 ((property opt-dynamic-arguments
)
166 (opt-section-dictionaries
168 ((section-dictionary-list)))
169 (section-dictionary-list
170 ((one-section-dictionary)
172 ((section-dictionary-list one-section-dictionary
)
175 (one-section-dictionary
176 ((SECTIONDICTIONARY string newline variable-list
)
182 (wisent-cook-tag $
1))
183 ((variable-list variable
)
185 (wisent-cook-tag $
2))))
187 ((BIND string newline
)
193 (defun srecode-template-wy--install-parser ()
194 "Setup the Semantic Parser."
195 (semantic-install-function-overrides
196 '((parse-stream . wisent-parse-stream
)))
197 (setq semantic-parser-name
"LALR"
198 semantic--parse-table srecode-template-wy--parse-table
199 semantic-debug-parser-source
"srecode-template.wy"
200 semantic-flex-keywords-obarray srecode-template-wy--keyword-table
201 semantic-lex-types-obarray srecode-template-wy--token-table
)
202 ;; Collect unmatched syntax lexical tokens
203 (semantic-make-local-hook 'wisent-discarding-token-functions
)
204 (add-hook 'wisent-discarding-token-functions
205 'wisent-collect-unmatched-syntax nil t
))
210 (define-lex-keyword-type-analyzer srecode-template-wy--
<keyword
>-keyword-analyzer
211 "keyword analyzer for <keyword> tokens."
212 "\\(\\sw\\|\\s_\\)+")
214 (define-lex-regex-type-analyzer srecode-template-wy--
<symbol
>-regexp-analyzer
215 "regexp analyzer for <symbol> tokens."
220 (define-lex-sexp-type-analyzer srecode-template-wy--
<string
>-sexp-analyzer
221 "sexp analyzer for <string> tokens."
225 (define-lex-regex-type-analyzer srecode-template-wy--
<number
>-regexp-analyzer
226 "regexp analyzer for <number> tokens."
227 semantic-lex-number-expression
231 (define-lex-string-type-analyzer srecode-template-wy--
<punctuation
>-string-analyzer
232 "string analyzer for <punctuation> tokens."
240 (define-lex-simple-regex-analyzer srecode-template-property-analyzer
241 "Detect and create a dynamic argument properties."
242 ":\\(\\w\\|\\s_\\)*" 'property
0)
244 (define-lex-regex-analyzer srecode-template-separator-block
245 "Detect and create a template quote block."
247 (semantic-lex-push-token
251 (semantic-lex-unterminated-syntax-protection 'TEMPLATE_BLOCK
252 (goto-char (match-end 0))
253 (re-search-forward "^----$")
254 (match-beginning 0))))
255 (setq semantic-lex-end-point
(point)))
258 (define-lex wisent-srecode-template-lexer
259 "Lexical analyzer that handles SRecode Template buffers.
260 It ignores whitespace, newlines and comments."
262 semantic-lex-ignore-whitespace
263 semantic-lex-ignore-newline
264 semantic-lex-ignore-comments
265 srecode-template-separator-block
266 srecode-template-wy--
<keyword
>-keyword-analyzer
267 srecode-template-property-analyzer
268 srecode-template-wy--
<symbol
>-regexp-analyzer
269 srecode-template-wy--
<number
>-regexp-analyzer
270 srecode-template-wy--
<string
>-sexp-analyzer
271 srecode-template-wy--
<punctuation
>-string-analyzer
272 semantic-lex-default-action
275 (provide 'srecode
/srt-wy
)
277 ;; arch-tag: 1be4c0bc-2a79-4f75-a07a-1ac518f41271
278 ;;; srecode/srt-wy.el ends here