aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorKenichi Handa2012-10-06 21:55:09 +0900
committerKenichi Handa2012-10-06 21:55:09 +0900
commit16ddec7e9e6adcf615db097d9627d490ca29208c (patch)
tree1c16b9565c9cca81ec8f5b10f0f4110340d4654a /admin
parent2b89bca49d55cec1a004353354a76de2972c68f3 (diff)
parentd5acb99a199d83cde1a43482709c3e9d4ec34b2f (diff)
downloademacs-16ddec7e9e6adcf615db097d9627d490ca29208c.tar.gz
emacs-16ddec7e9e6adcf615db097d9627d490ca29208c.zip
merge trunk
Diffstat (limited to 'admin')
-rw-r--r--admin/ChangeLog15
-rw-r--r--admin/grammars/bovine-grammar.el36
-rw-r--r--admin/grammars/c.by15
-rw-r--r--admin/grammars/grammar.wy12
-rw-r--r--admin/grammars/java-tags.wy12
-rw-r--r--admin/grammars/js.wy1
-rw-r--r--admin/grammars/make.by1
-rw-r--r--admin/grammars/python.wy64
-rw-r--r--admin/grammars/scheme.by1
-rw-r--r--admin/grammars/srecode-template.wy67
-rw-r--r--admin/grammars/wisent-grammar.el61
11 files changed, 196 insertions, 89 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog
index b5b1b75c55c..2da65523116 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,18 @@
12012-10-01 David Engster <deng@randomsample.de>
2
3 * grammars/bovine-grammar.el (bovine--grammar-newstyle-unquote):
4 Remove.
5 (bovine-grammar-expand-form): Test for emacs-major-version.
6
7 * grammars/c.by: Add EXPLICIT to keyword tokens.
8
9 * grammars/f90.by: Add %provide token.
10
11 * grammar/grammar.wy (semantic-grammar-lexer): Remove, since it
12 was copied to grammar.el. New %provide token to generate prefix
13 which conforms with Emacs conventions. Remove lexer definition,
14 which is now in grammar.el.
15
12012-09-27 Glenn Morris <rgm@gnu.org> 162012-09-27 Glenn Morris <rgm@gnu.org>
2 17
3 * admin.el (set-version): Set msdos.c's Vwindow_system_version. 18 * admin.el (set-version): Set msdos.c's Vwindow_system_version.
diff --git a/admin/grammars/bovine-grammar.el b/admin/grammars/bovine-grammar.el
index efe4db039c4..a7289f6bafe 100644
--- a/admin/grammars/bovine-grammar.el
+++ b/admin/grammars/bovine-grammar.el
@@ -109,14 +109,6 @@ NAME, ALIASCLASS, DEFINITION and ATTRIBUTES."
109;; Cache of macro definitions currently in use. 109;; Cache of macro definitions currently in use.
110(defvar bovine--grammar-macros nil) 110(defvar bovine--grammar-macros nil)
111 111
112;; Detect if we have an Emacs with newstyle unquotes allowed outside
113;; of backquote.
114;; This should probably be changed to a test to (= emacs-major-version 24)
115;; when it is released, but at the moment it might be possible that people
116;; are using an older snapshot.
117(defvar bovine--grammar-newstyle-unquote
118 (equal '(\, test) (read ",test")))
119
120(defun bovine-grammar-expand-form (form quotemode &optional inplace) 112(defun bovine-grammar-expand-form (form quotemode &optional inplace)
121 "Expand FORM into a new one suitable to the bovine parser. 113 "Expand FORM into a new one suitable to the bovine parser.
122FORM is a list in which we are substituting. 114FORM is a list in which we are substituting.
@@ -152,7 +144,7 @@ expanded from elsewhere."
152 form (cdr form)) 144 form (cdr form))
153 ;; Hack for dealing with new reading of unquotes outside of 145 ;; Hack for dealing with new reading of unquotes outside of
154 ;; backquote (introduced in rev. 102591 in emacs-bzr). 146 ;; backquote (introduced in rev. 102591 in emacs-bzr).
155 (when (and bovine--grammar-newstyle-unquote 147 (when (and (>= emacs-major-version 24)
156 (listp first) 148 (listp first)
157 (or (equal (car first) '\,) 149 (or (equal (car first) '\,)
158 (equal (car first) '\,@))) 150 (equal (car first) '\,@)))
@@ -456,6 +448,7 @@ Menu items are appended to the common grammar menu.")
456 448
457(defun bovine-make-parsers () 449(defun bovine-make-parsers ()
458 "Generate Emacs' built-in Bovine-based parser files." 450 "Generate Emacs' built-in Bovine-based parser files."
451 (interactive)
459 (semantic-mode 1) 452 (semantic-mode 1)
460 ;; Loop through each .by file in current directory, and run 453 ;; Loop through each .by file in current directory, and run
461 ;; `semantic-grammar-batch-build-one-package' to build the grammar. 454 ;; `semantic-grammar-batch-build-one-package' to build the grammar.
@@ -465,13 +458,14 @@ Menu items are appended to the common grammar menu.")
465 (with-current-buffer (find-file-noselect f) 458 (with-current-buffer (find-file-noselect f)
466 (semantic-grammar-create-package)) 459 (semantic-grammar-create-package))
467 (error (message "%s" (error-message-string err)) nil))) 460 (error (message "%s" (error-message-string err)) nil)))
468 lang) 461 lang filename)
469 (when (and packagename 462 (when (and packagename
470 (string-match "^semantic-\\(.*\\)-by\\.el\\'" packagename)) 463 (string-match "^.*/\\(.*\\)-by\\.el\\'" packagename))
471 (setq lang (match-string 1 packagename)) 464 (setq lang (match-string 1 packagename))
465 (setq filename (concat lang "-by.el"))
472 (with-temp-buffer 466 (with-temp-buffer
473 (insert-file-contents packagename) 467 (insert-file-contents filename)
474 (setq buffer-file-name (expand-file-name packagename)) 468 (setq buffer-file-name (expand-file-name filename))
475 ;; Fix copyright header: 469 ;; Fix copyright header:
476 (goto-char (point-min)) 470 (goto-char (point-min))
477 (re-search-forward "^;; Author:") 471 (re-search-forward "^;; Author:")
@@ -500,20 +494,14 @@ Menu items are appended to the common grammar menu.")
500 lang ".by. 494 lang ".by.
501 495
502;;; Code: 496;;; Code:
503 497")
504\(require 'semantic/lex)
505\(eval-when-compile (require 'semantic/bovine))\n")
506 (goto-char (point-min)) 498 (goto-char (point-min))
507 (delete-region (point-min) (line-end-position)) 499 (delete-region (point-min) (line-end-position))
508 (insert ";;; semantic/bovine/" lang 500 (insert ";;; " packagename
509 "-by.el --- Generated parser support file") 501 " --- Generated parser support file")
510 (delete-trailing-whitespace) 502 (delete-trailing-whitespace)
511 ;; Fix footer: 503 (re-search-forward ";;; \\(.*\\) ends here")
512 (goto-char (point-max)) 504 (replace-match packagename nil nil nil 1)
513 (re-search-backward ".\n;;; Analyzers")
514 (delete-region (point) (point-max))
515 (insert "(provide 'semantic/bovine/" lang "-by)\n\n")
516 (insert ";;; semantic/bovine/" lang "-by.el ends here\n")
517 (save-buffer)))))) 505 (save-buffer))))))
518 506
519;;; bovine-grammar.el ends here 507;;; bovine-grammar.el ends here
diff --git a/admin/grammars/c.by b/admin/grammars/c.by
index 1bdaf8f447b..dfced9813d1 100644
--- a/admin/grammars/c.by
+++ b/admin/grammars/c.by
@@ -1,5 +1,4 @@
1;;; c.by -- LL grammar for C/C++ language specification 1;;; c.by -- LL grammar for C/C++ language specification
2
3;; Copyright (C) 1999-2012 Free Software Foundation, Inc. 2;; Copyright (C) 1999-2012 Free Software Foundation, Inc.
4;; 3;;
5;; Author: Eric M. Ludlam <zappo@gnu.org> 4;; Author: Eric M. Ludlam <zappo@gnu.org>
@@ -39,6 +38,13 @@
39;; > * Can't parse signature element: "RmcBucStatus* rftBucStatus" 38;; > * Can't parse signature element: "RmcBucStatus* rftBucStatus"
40 39
41%package semantic-c-by 40%package semantic-c-by
41%provide semantic/bovine/c-by
42
43%{
44(declare-function semantic-c-reconstitute-token "semantic/bovine/c")
45(declare-function semantic-c-reconstitute-template "semantic/bovine/c")
46(declare-function semantic-expand-c-tag "semantic/bovine/c")
47}
42 48
43%languagemode c-mode c++-mode 49%languagemode c-mode c++-mode
44%start declaration 50%start declaration
@@ -98,6 +104,8 @@
98%put VIRTUAL summary "Method Modifier: virtual <type> <name>(...) ..." 104%put VIRTUAL summary "Method Modifier: virtual <type> <name>(...) ..."
99%token MUTABLE "mutable" 105%token MUTABLE "mutable"
100%put MUTABLE summary "Member Declaration Modifier: mutable <type> <name> ..." 106%put MUTABLE summary "Member Declaration Modifier: mutable <type> <name> ..."
107%token EXPLICIT "explicit"
108%put EXPLICIT summary "Forbids implicit type conversion: explicit <constructor>"
101 109
102%token STRUCT "struct" 110%token STRUCT "struct"
103%put STRUCT summary "Structure Type Declaration: struct [name] { ... };" 111%put STRUCT summary "Structure Type Declaration: struct [name] { ... };"
@@ -370,6 +378,9 @@ namespacesubparts
370 ;; PUBLIC or PRIVATE bits. Ignore them for now. 378 ;; PUBLIC or PRIVATE bits. Ignore them for now.
371 | template 379 | template
372 | using 380 | using
381 ;; Includes inside namespaces
382 | spp-include
383 (TAG $1 'include :inside-ns t)
373 | ;;EMPTY 384 | ;;EMPTY
374 ; 385 ;
375 386
@@ -1098,6 +1109,8 @@ functionname
1098function-pointer 1109function-pointer
1099 : LPAREN STAR symbol RPAREN 1110 : LPAREN STAR symbol RPAREN
1100 ( (concat "*" $3) ) 1111 ( (concat "*" $3) )
1112 | LPAREN symbol RPAREN
1113 ( $2 )
1101 ; 1114 ;
1102 1115
1103fun-or-proto-end 1116fun-or-proto-end
diff --git a/admin/grammars/grammar.wy b/admin/grammars/grammar.wy
index 1189d6b0886..f89fe6220ff 100644
--- a/admin/grammars/grammar.wy
+++ b/admin/grammars/grammar.wy
@@ -23,6 +23,9 @@
23;; You should have received a copy of the GNU General Public License 23;; You should have received a copy of the GNU General Public License
24;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 24;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 25
26%package semantic-grammar-wy
27%provide semantic/grammar-wy
28
26%{ 29%{
27(defvar semantic-grammar-lex-c-char-re) 30(defvar semantic-grammar-lex-c-char-re)
28 31
@@ -32,8 +35,6 @@
32(defvar semantic-grammar-wy--rindx nil) 35(defvar semantic-grammar-wy--rindx nil)
33} 36}
34 37
35%package semantic-grammar-wy
36
37%languagemode wy-mode 38%languagemode wy-mode
38 39
39;; Main 40;; Main
@@ -52,6 +53,7 @@
52%keyword LEFT "%left" 53%keyword LEFT "%left"
53%keyword NONASSOC "%nonassoc" 54%keyword NONASSOC "%nonassoc"
54%keyword PACKAGE "%package" 55%keyword PACKAGE "%package"
56%keyword PROVIDE "%provide"
55%keyword PREC "%prec" 57%keyword PREC "%prec"
56%keyword PUT "%put" 58%keyword PUT "%put"
57%keyword QUOTEMODE "%quotemode" 59%keyword QUOTEMODE "%quotemode"
@@ -134,6 +136,7 @@ decl:
134 | no_default_prec_decl 136 | no_default_prec_decl
135 | languagemode_decl 137 | languagemode_decl
136 | package_decl 138 | package_decl
139 | provide_decl
137 | precedence_decl 140 | precedence_decl
138 | put_decl 141 | put_decl
139 | quotemode_decl 142 | quotemode_decl
@@ -165,6 +168,11 @@ package_decl:
165 `(PACKAGE-TAG ',$2 nil) 168 `(PACKAGE-TAG ',$2 nil)
166 ; 169 ;
167 170
171provide_decl:
172 PROVIDE SYMBOL
173 `(TAG ',$2 'provide)
174 ;
175
168precedence_decl: 176precedence_decl:
169 associativity token_type_opt items 177 associativity token_type_opt items
170 `(TAG ',$1 'assoc :type ',$2 :value ',$3) 178 `(TAG ',$1 'assoc :type ',$2 :value ',$3)
diff --git a/admin/grammars/java-tags.wy b/admin/grammars/java-tags.wy
index b58b96c6bfb..708715533ff 100644
--- a/admin/grammars/java-tags.wy
+++ b/admin/grammars/java-tags.wy
@@ -23,6 +23,7 @@
23;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 23;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 24
25%package wisent-java-tags-wy 25%package wisent-java-tags-wy
26%provide semantic/wisent/javat-wy
26 27
27%languagemode java-mode 28%languagemode java-mode
28 29
@@ -444,7 +445,7 @@ class_member_declaration
444;;; Type Declaration token 445;;; Type Declaration token
445;; ("NAME" type "TYPE" ( PART-LIST ) ( PARENTS ) EXTRA-SPEC "DOCSTRING") 446;; ("NAME" type "TYPE" ( PART-LIST ) ( PARENTS ) EXTRA-SPEC "DOCSTRING")
446interface_declaration 447interface_declaration
447 : modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt interface_body 448 : modifiers_opt INTERFACE qualified_name extends_interfaces_opt interface_body
448 (TYPE-TAG $3 $2 $5 (if $4 (cons nil $4)) :typemodifiers $1) 449 (TYPE-TAG $3 $2 $5 (if $4 (cons nil $4)) :typemodifiers $1)
449 ; 450 ;
450 451
@@ -547,7 +548,7 @@ formal_parameters
547;;; Variable token 548;;; Variable token
548;; ("NAME" variable "TYPE" DEFAULT-VALUE EXTRA-SPEC "DOCSTRING") 549;; ("NAME" variable "TYPE" DEFAULT-VALUE EXTRA-SPEC "DOCSTRING")
549formal_parameter 550formal_parameter
550 : formal_parameter_modifier_opt type variable_declarator_id 551 : formal_parameter_modifier_opt type opt_variable_declarator_id
551 (VARIABLE-TAG $3 $2 nil :typemodifiers $1) 552 (VARIABLE-TAG $3 $2 nil :typemodifiers $1)
552 ; 553 ;
553 554
@@ -582,6 +583,13 @@ variable_declarator
582 (cons $1 $region) 583 (cons $1 $region)
583 ; 584 ;
584 585
586opt_variable_declarator_id
587 : ;; EMPTY
588 (identity "")
589 | variable_declarator_id
590 (identity $1)
591 ;
592
585variable_declarator_id 593variable_declarator_id
586 : IDENTIFIER dims_opt 594 : IDENTIFIER dims_opt
587 (concat $1 $2) 595 (concat $1 $2)
diff --git a/admin/grammars/js.wy b/admin/grammars/js.wy
index c6b3a58aac3..7b55f5c3834 100644
--- a/admin/grammars/js.wy
+++ b/admin/grammars/js.wy
@@ -58,6 +58,7 @@
58;; DAMAGE. 58;; DAMAGE.
59 59
60%package wisent-javascript-jv-wy 60%package wisent-javascript-jv-wy
61%provide semantic/wisent/js-wy
61;; JAVE I prefere ecmascript-mode 62;; JAVE I prefere ecmascript-mode
62%languagemode ecmascript-mode javascript-mode 63%languagemode ecmascript-mode javascript-mode
63 64
diff --git a/admin/grammars/make.by b/admin/grammars/make.by
index ee933805cf6..6cff4716f82 100644
--- a/admin/grammars/make.by
+++ b/admin/grammars/make.by
@@ -22,6 +22,7 @@
22;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 22;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23 23
24%package semantic-make-by 24%package semantic-make-by
25%provide semantic/bovine/make-by
25 26
26%languagemode makefile-mode 27%languagemode makefile-mode
27%start Makefile 28%start Makefile
diff --git a/admin/grammars/python.wy b/admin/grammars/python.wy
index f7808fd20b8..f17f41c9b1b 100644
--- a/admin/grammars/python.wy
+++ b/admin/grammars/python.wy
@@ -88,6 +88,12 @@
88;; -------- 88;; --------
89 89
90%package wisent-python-wy 90%package wisent-python-wy
91%provide semantic/wisent/python-wy
92
93%{
94(declare-function wisent-python-reconstitute-function-tag "semantic/wisent/python")
95(declare-function wisent-python-reconstitute-class-tag "semantic/wisent/python")
96}
91 97
92%languagemode python-mode 98%languagemode python-mode
93 99
@@ -173,6 +179,7 @@
173%token <punctuation> COMMA "," 179%token <punctuation> COMMA ","
174%token <punctuation> ASSIGN "=" 180%token <punctuation> ASSIGN "="
175%token <punctuation> BACKQUOTE "`" 181%token <punctuation> BACKQUOTE "`"
182%token <punctuation> AT "@"
176 183
177 184
178;; ----------------- 185;; -----------------
@@ -307,6 +314,10 @@
307%put WHILE summary 314%put WHILE summary
308"Start a 'while' loop" 315"Start a 'while' loop"
309 316
317%keyword WITH "with"
318%put WITH summary
319"Start statement with an associated context object"
320
310%keyword YIELD "yield" 321%keyword YIELD "yield"
311%put YIELD summary 322%put YIELD summary
312"Create a generator function" 323"Create a generator function"
@@ -545,8 +556,10 @@ import_stmt
545 556
546;; dotted_as_name (',' dotted_as_name)* 557;; dotted_as_name (',' dotted_as_name)*
547dotted_as_name_list 558dotted_as_name_list
548 : dotted_as_name 559 : dotted_as_name_list COMMA dotted_as_name
549 | dotted_as_name_list COMMA dotted_as_name 560 (cons $3 $1)
561 | dotted_as_name
562 (list $1)
550 ; 563 ;
551 564
552;; ('*' | import_as_name (',' import_as_name)*) 565;; ('*' | import_as_name (',' import_as_name)*)
@@ -649,6 +662,7 @@ compound_stmt
649 | while_stmt 662 | while_stmt
650 | for_stmt 663 | for_stmt
651 | try_stmt 664 | try_stmt
665 | with_stmt
652 | funcdef 666 | funcdef
653 | class_declaration 667 | class_declaration
654 ; 668 ;
@@ -756,13 +770,46 @@ zero_one_or_two_test
756 ; 770 ;
757 771
758;;;============================================================================ 772;;;============================================================================
773;;@@ with_stmt
774;;;============================================================================
775
776;; with_stmt: 'with' test [ with_var ] ':' suite
777with_stmt
778 : WITH test COLON suite
779 (CODE-TAG $1 nil)
780 | WITH test with_var COLON suite
781 (CODE-TAG $1 nil) ;; TODO capture variable
782 ;
783
784with_var
785 : AS expr
786 () ;; TODO capture
787 ;
788
789;;;============================================================================
759;;;@@ funcdef 790;;;@@ funcdef
760;;;============================================================================ 791;;;============================================================================
761 792
762;; funcdef: 'def' NAME parameters ':' suite 793decorator
794 : AT dotted_name varargslist_opt NEWLINE
795 (FUNCTION-TAG $2 "decorator" $3)
796 ;
797
798decorators
799 : decorator
800 (list $1)
801 | decorator decorators
802 (cons $1 $2)
803 ;
804
805;; funcdef: [decorators] 'def' NAME parameters ':' suite
763funcdef 806funcdef
764 : DEF NAME function_parameter_list COLON suite 807 : DEF NAME function_parameter_list COLON suite
765 (FUNCTION-TAG $2 nil $3) 808 (wisent-python-reconstitute-function-tag
809 (FUNCTION-TAG $2 nil $3) $5)
810 | decorators DEF NAME function_parameter_list COLON suite
811 (wisent-python-reconstitute-function-tag
812 (FUNCTION-TAG $3 nil $4 :decorators $1) $6)
766 ; 813 ;
767 814
768function_parameter_list 815function_parameter_list
@@ -798,10 +845,11 @@ function_parameter
798;; classdef: 'class' NAME ['(' testlist ')'] ':' suite 845;; classdef: 'class' NAME ['(' testlist ')'] ':' suite
799class_declaration 846class_declaration
800 : CLASS NAME paren_class_list_opt COLON suite 847 : CLASS NAME paren_class_list_opt COLON suite
801 (TYPE-TAG $2 $1 ;; Name "class" 848 (wisent-python-reconstitute-class-tag
802 $5 ;; Members 849 (TYPE-TAG $2 $1 ;; Name "class"
803 (cons $3 nil) ;; (SUPERCLASSES . INTERFACES) 850 $5 ;; Members
804 ) 851 (cons $3 nil) ;; (SUPERCLASSES . INTERFACES)
852 ))
805 ; 853 ;
806 854
807;; ['(' testlist ')'] 855;; ['(' testlist ')']
diff --git a/admin/grammars/scheme.by b/admin/grammars/scheme.by
index 3925f03c28b..98e75901a71 100644
--- a/admin/grammars/scheme.by
+++ b/admin/grammars/scheme.by
@@ -18,6 +18,7 @@
18;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 18;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19 19
20%package semantic-scm-by 20%package semantic-scm-by
21%provide semantic/bovine/scm-by
21 22
22%languagemode scheme-mode 23%languagemode scheme-mode
23%start scheme 24%start scheme
diff --git a/admin/grammars/srecode-template.wy b/admin/grammars/srecode-template.wy
index f38d7eaa2a1..f84a414b46e 100644
--- a/admin/grammars/srecode-template.wy
+++ b/admin/grammars/srecode-template.wy
@@ -28,6 +28,9 @@
28;; Semantic Recoder templates are based on Google Templates 28;; Semantic Recoder templates are based on Google Templates
29;; and are at the bottom of the Semantic Recoder API. 29;; and are at the bottom of the Semantic Recoder API.
30 30
31%package srecode-template-wy
32%provide srecode/srt-wy
33
31%languagemode srecode-mode 34%languagemode srecode-mode
32 35
33%start template_file 36%start template_file
@@ -46,6 +49,15 @@
46%put TEMPLATE summary "template <name>\\n <template definition>" 49%put TEMPLATE summary "template <name>\\n <template definition>"
47%keyword SECTIONDICTIONARY "sectiondictionary" 50%keyword SECTIONDICTIONARY "sectiondictionary"
48%put SECTIONDICTIONARY summary "sectiondictionary <name>\\n <dictionary entries>" 51%put SECTIONDICTIONARY summary "sectiondictionary <name>\\n <dictionary entries>"
52
53%keyword SECTION "section"
54%put SECTION summary
55 "section <name>\\n <dictionary entries>\\n end"
56
57%keyword END "end"
58%put END summary
59 "section ... end"
60
49%keyword PROMPT "prompt" 61%keyword PROMPT "prompt"
50%keyword DEFAULT "default" 62%keyword DEFAULT "default"
51%keyword DEFAULTMACRO "defaultmacro" 63%keyword DEFAULTMACRO "defaultmacro"
@@ -62,7 +74,7 @@
62%token <separator> TEMPLATE_BLOCK "^----" 74%token <separator> TEMPLATE_BLOCK "^----"
63 75
64;;; Bland default types 76;;; Bland default types
65%type <property> ":\\(\\w\\|\\s_\\)*" 77%type <property> syntax ":\\(\\w\\|\\s_\\)*"
66%token <property> property 78%token <property> property
67 79
68%type <symbol> 80%type <symbol>
@@ -134,7 +146,7 @@ insertable-string
134template 146template
135 : TEMPLATE templatename opt-dynamic-arguments newline 147 : TEMPLATE templatename opt-dynamic-arguments newline
136 opt-string 148 opt-string
137 opt-section-dictionaries 149 section-dictionary-list
138 TEMPLATE_BLOCK newline 150 TEMPLATE_BLOCK newline
139 opt-bind 151 opt-bind
140 (FUNCTION-TAG $2 nil $3 :documentation $5 :code $7 152 (FUNCTION-TAG $2 nil $3 :documentation $5 :code $7
@@ -165,29 +177,52 @@ opt-string
165 | () 177 | ()
166 ; 178 ;
167 179
168opt-section-dictionaries
169 : () ;; EMPTY
170 | section-dictionary-list
171 ;
172
173section-dictionary-list 180section-dictionary-list
174 : one-section-dictionary 181 : ;; empty
175 (list $1) 182 ()
176 | section-dictionary-list one-section-dictionary 183 | section-dictionary-list flat-section-dictionary
184 (append $1 (list $2))
185 | section-dictionary-list section-dictionary
177 (append $1 (list $2)) 186 (append $1 (list $2))
178 ; 187 ;
179 188
180one-section-dictionary 189flat-section-dictionary
181 : SECTIONDICTIONARY string newline 190 : SECTIONDICTIONARY string newline
182 variable-list 191 flat-dictionary-entry-list
192 (cons (read $2) $4)
193 ;
194
195flat-dictionary-entry-list
196 : ;; empty
197 ()
198 | flat-dictionary-entry-list flat-dictionary-entry
199 (append $1 $2)
200 ;
201
202flat-dictionary-entry
203 : variable
204 (EXPANDTAG $1)
205 ;
206
207section-dictionary
208 : SECTION string newline
209 dictionary-entry-list
210 END newline
183 (cons (read $2) $4) 211 (cons (read $2) $4)
184 ; 212 ;
185 213
186variable-list 214dictionary-entry-list
215 : ;; empty
216 ()
217 | dictionary-entry-list dictionary-entry
218 (append $1 $2)
219 ;
220
221dictionary-entry
187 : variable 222 : variable
188 (EXPANDTAG $1) 223 (EXPANDTAG $1)
189 | variable-list variable 224 | section-dictionary
190 (append $1 (EXPANDTAG $2)) 225 (list $1)
191 ; 226 ;
192 227
193opt-bind 228opt-bind
@@ -232,4 +267,4 @@ It ignores whitespace, newlines and comments."
232 semantic-lex-default-action 267 semantic-lex-default-action
233 ) 268 )
234 269
235;;; wisent-dot.wy ends here 270;;; srecode-template.wy ends here
diff --git a/admin/grammars/wisent-grammar.el b/admin/grammars/wisent-grammar.el
index 714b5211127..25dba5be2d8 100644
--- a/admin/grammars/wisent-grammar.el
+++ b/admin/grammars/wisent-grammar.el
@@ -209,15 +209,15 @@ See also the function `wisent-skip-token'."
209 "Return the list of terminal symbols. 209 "Return the list of terminal symbols.
210Keep order of declaration in the WY file without duplicates." 210Keep order of declaration in the WY file without duplicates."
211 (let (terms) 211 (let (terms)
212 (mapcar 212 (mapc
213 #'(lambda (tag) 213 #'(lambda (tag)
214 (mapcar #'(lambda (name) 214 (mapcar #'(lambda (name)
215 (add-to-list 'terms (intern name))) 215 (add-to-list 'terms (intern name)))
216 (cons (semantic-tag-name tag) 216 (cons (semantic-tag-name tag)
217 (semantic-tag-get-attribute tag :rest)))) 217 (semantic-tag-get-attribute tag :rest))))
218 (semantic--find-tags-by-function 218 (semantic--find-tags-by-function
219 #'(lambda (tag) 219 #'(lambda (tag)
220 (memq (semantic-tag-class tag) '(token keyword))) 220 (memq (semantic-tag-class tag) '(token keyword)))
221 (current-buffer))) 221 (current-buffer)))
222 (nreverse terms))) 222 (nreverse terms)))
223 223
@@ -464,23 +464,20 @@ Menu items are appended to the common grammar menu.")
464;; DAMAGE.") 464;; DAMAGE.")
465 465
466(defvar wisent-make-parsers--parser-file-name 466(defvar wisent-make-parsers--parser-file-name
467 `(("semantic-grammar-wy.el" 467 `(("semantic/grammar-wy.el")
468 "semantic/grammar-wy") 468 ("srecode/srt-wy.el")
469 ("srecode-template-wy.el" 469 ("semantic/wisent/js-wy.el"
470 "srecode/srt-wy")
471 ("wisent-javascript-jv-wy.el"
472 "semantic/wisent/js-wy"
473 "Copyright (C) 1998-2011 Ecma International." 470 "Copyright (C) 1998-2011 Ecma International."
474 ,wisent-make-parsers--ecmascript-license) 471 ,wisent-make-parsers--ecmascript-license)
475 ("wisent-java-tags-wy.el" 472 ("semantic/wisent/javat-wy.el")
476 "semantic/wisent/javat-wy") 473 ("semantic/wisent/python-wy.el"
477 ("wisent-python-wy.el" 474 "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
478 "semantic/wisent/python-wy" 475\;; 2009, 2010 Python Software Foundation; All Rights Reserved"
479 "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Python Software Foundation; All Rights Reserved."
480 ,wisent-make-parsers--python-license))) 476 ,wisent-make-parsers--python-license)))
481 477
482(defun wisent-make-parsers () 478(defun wisent-make-parsers ()
483 "Generate Emacs' built-in Wisent-based parser files." 479 "Generate Emacs' built-in Wisent-based parser files."
480 (interactive)
484 (semantic-mode 1) 481 (semantic-mode 1)
485 ;; Loop through each .wy file in current directory, and run 482 ;; Loop through each .wy file in current directory, and run
486 ;; `semantic-grammar-batch-build-one-package' to build the grammar. 483 ;; `semantic-grammar-batch-build-one-package' to build the grammar.
@@ -492,16 +489,16 @@ Menu items are appended to the common grammar menu.")
492 (error (message "%s" (error-message-string err)) nil))) 489 (error (message "%s" (error-message-string err)) nil)))
493 output-data) 490 output-data)
494 (when (setq output-data (assoc packagename wisent-make-parsers--parser-file-name)) 491 (when (setq output-data (assoc packagename wisent-make-parsers--parser-file-name))
495 (let ((require-name (nth 1 output-data)) 492 (let ((additional-copyright (nth 1 output-data))
496 (additional-copyright (nth 2 output-data)) 493 (additional-license (nth 2 output-data))
497 (additional-license (nth 3 output-data)) 494 (filename (progn (string-match ".*/\\(.*\\)" packagename) (match-string 1 packagename)))
498 copyright-end) 495 copyright-end)
499 ;; Touch up the generated parsers for Emacs integration. 496 ;; Touch up the generated parsers for Emacs integration.
500 (with-temp-buffer 497 (with-temp-buffer
501 (insert-file-contents packagename) 498 (insert-file-contents filename)
502 ;; Fix copyright header: 499 ;; Fix copyright header:
503 (goto-char (point-min)) 500 (goto-char (point-min))
504 (when additional-copyright 501 (when additional-copyright
505 (re-search-forward "Copyright (C).*$") 502 (re-search-forward "Copyright (C).*$")
506 (insert "\n;; " additional-copyright)) 503 (insert "\n;; " additional-copyright))
507 (re-search-forward "^;; Author:") 504 (re-search-forward "^;; Author:")
@@ -516,22 +513,14 @@ Menu items are appended to the common grammar menu.")
516 f ".") 513 f ".")
517 (when additional-license 514 (when additional-license
518 (insert "\n" additional-license)) 515 (insert "\n" additional-license))
519 (insert "\n\n;;; Code:\n 516 (insert "\n\n;;; Code:\n")
520\(require 'semantic/lex)\n")
521 (goto-char (point-min)) 517 (goto-char (point-min))
522 (delete-region (point-min) (line-end-position)) 518 (delete-region (point-min) (line-end-position))
523 (insert ";;; " require-name 519 (insert ";;; " packagename
524 ".el --- Generated parser support file") 520 " --- Generated parser support file")
521 (re-search-forward ";;; \\(.*\\) ends here")
522 (replace-match packagename nil nil nil 1)
525 (delete-trailing-whitespace) 523 (delete-trailing-whitespace)
526 (re-search-forward ";;\n(require 'semantic/lex)\n") 524 (write-region nil nil (expand-file-name filename))))))))
527 (delete-region (match-beginning 0) (match-end 0))
528 ;; Fix footer:
529 (goto-char (point-max))
530 (re-search-backward "^(provide")
531 (delete-region (match-beginning 0) (point-max))
532 (goto-char (point-max))
533 (insert "(provide '" require-name ")\n\n")
534 (insert ";;; " require-name ".el ends here\n")
535 (write-region nil nil (expand-file-name packagename))))))))
536 525
537;;; wisent-grammar.el ends here 526;;; wisent-grammar.el ends here