summaryrefslogtreecommitdiff
path: root/admin/grammars/srecode-template.wy
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-10-02 02:10:29 +0800
committerChong Yidong <cyd@gnu.org>2012-10-02 02:10:29 +0800
commit62a81506f802e4824b718cc30321ee3a0057cdf7 (patch)
treed681d7b767b1c3f7e4aee24ce39f6bef0d7f1f7e /admin/grammars/srecode-template.wy
parentb3317662acc0157406c20c8e14c43b7126eaa8a0 (diff)
downloademacs-62a81506f802e4824b718cc30321ee3a0057cdf7.tar.gz
Update CEDET from upstream.
Diffstat (limited to 'admin/grammars/srecode-template.wy')
-rw-r--r--admin/grammars/srecode-template.wy67
1 files changed, 51 insertions, 16 deletions
diff --git a/admin/grammars/srecode-template.wy b/admin/grammars/srecode-template.wy
index f38d7eaa2a1..95ac8a07307 100644
--- a/admin/grammars/srecode-template.wy
+++ b/admin/grammars/srecode-template.wy
@@ -28,6 +28,9 @@
;; Semantic Recoder templates are based on Google Templates
;; and are at the bottom of the Semantic Recoder API.
+%package srecode-template-wy
+%provide srecode/srt-wy
+
%languagemode srecode-mode
%start template_file
@@ -46,6 +49,15 @@
%put TEMPLATE summary "template <name>\\n <template definition>"
%keyword SECTIONDICTIONARY "sectiondictionary"
%put SECTIONDICTIONARY summary "sectiondictionary <name>\\n <dictionary entries>"
+
+%keyword SECTION "section"
+%put SECTION summary
+ "section <name>\\n <dictionary entries>\\n end"
+
+%keyword END "end"
+%put END summary
+ "section ... end"
+
%keyword PROMPT "prompt"
%keyword DEFAULT "default"
%keyword DEFAULTMACRO "defaultmacro"
@@ -62,7 +74,7 @@
%token <separator> TEMPLATE_BLOCK "^----"
;;; Bland default types
-%type <property> ":\\(\\w\\|\\s_\\)*"
+%type <property> syntax ":\\(\\w\\|\\s_\\)*"
%token <property> property
%type <symbol>
@@ -134,7 +146,7 @@ insertable-string
template
: TEMPLATE templatename opt-dynamic-arguments newline
opt-string
- opt-section-dictionaries
+ section-dictionary-list
TEMPLATE_BLOCK newline
opt-bind
(FUNCTION-TAG $2 nil $3 :documentation $5 :code $7
@@ -165,29 +177,52 @@ opt-string
| ()
;
-opt-section-dictionaries
- : () ;; EMPTY
- | section-dictionary-list
- ;
-
section-dictionary-list
- : one-section-dictionary
- (list $1)
- | section-dictionary-list one-section-dictionary
+ : ;; empty
+ ()
+ | section-dictionary-list flat-section-dictionary
+ (append $1 (list $2))
+ | section-dictionary-list section-dictionary
(append $1 (list $2))
;
-one-section-dictionary
+flat-section-dictionary
: SECTIONDICTIONARY string newline
- variable-list
+ flat-dictionary-entry-list
+ (cons (read $2) $4)
+ ;
+
+flat-dictionary-entry-list
+ : ;; empty
+ ()
+ | flat-dictionary-entry-list flat-dictionary-entry
+ (append $1 $2)
+ ;
+
+flat-dictionary-entry
+ : variable
+ (EXPANDTAG $1)
+ ;
+
+section-dictionary
+ : SECTION string newline
+ dictionary-entry-list
+ END newline
(cons (read $2) $4)
;
-variable-list
+dictionary-entry-list
+ : ;; emtpy
+ ()
+ | dictionary-entry-list dictionary-entry
+ (append $1 $2)
+ ;
+
+dictionary-entry
: variable
(EXPANDTAG $1)
- | variable-list variable
- (append $1 (EXPANDTAG $2))
+ | section-dictionary
+ (list $1)
;
opt-bind
@@ -232,4 +267,4 @@ It ignores whitespace, newlines and comments."
semantic-lex-default-action
)
-;;; wisent-dot.wy ends here
+;;; srecode-template.wy ends here