aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2013-11-29 18:06:34 -0800
committerGlenn Morris2013-11-29 18:06:34 -0800
commitf9b697ddaa60742d4a60b1fa4ab37efc2c3cb1e1 (patch)
tree2983eafdf74ab173b7072c5722f0ef64525814d6
parenta64133bd252caf29a0a3ab6732ac1c76c91e17cb (diff)
downloademacs-f9b697ddaa60742d4a60b1fa4ab37efc2c3cb1e1.tar.gz
emacs-f9b697ddaa60742d4a60b1fa4ab37efc2c3cb1e1.zip
Stop keeping (all but one) generated cedet grammar files in the repository
* configure.ac (SUBDIR_MAKEFILES, AC_CONFIG_FILES): Add admin/grammars Makefile. * Makefile.in (distclean, bootstrap-clean, maintainer-clean): Also clean admin/grammars, if present. * admin/grammars/README: Remove. * admin/grammars/Makefile.in: New file. * admin/grammars/c.by, admin/grammars/java-tags.wy, admin/grammars/js.wy: * admin/grammars/python.wy: Update declarations to match generated outputs. * lisp/Makefile.in (semantic): New. (compile-main): Depend on semantic. * lisp/cedet/semantic/bovine/grammar.el (bovine--make-parser-1): New function, split from bovine-make-parsers. (bovine-make-parsers): Use bovine--make-parser-1. (bovine-batch-make-parser): New function. * lisp/cedet/semantic/wisent/grammar.el (wisent--make-parser-1): New function, split from wisent-make-parsers. (wisent-make-parsers): Use wisent--make-parser-1. (wisent-batch-make-parser): New function. * lisp/cedet/semantic/db.el (semanticdb-save-all-db): Avoid prompting in batch mode. * lisp/cedet/semantic/grammar.el (semantic-grammar-footer-template): Disable version-control and autoloads in the output. (semantic-grammar-create-package): Add option to return nil if output is up-to-date. * lisp/cedet/semantic/bovine/c-by.el, lisp/cedet/semantic/bovine/make-by.el: * lisp/cedet/semantic/bovine/scm-by.el, lisp/cedet/semantic/wisent/javat-wy.el: * lisp/cedet/semantic/wisent/js-wy.el, lisp/cedet/semantic/wisent/python-wy.el: * lisp/cedet/srecode/srt-wy.el: Remove generated files from repository. * .bzrignore: Update for this.
-rw-r--r--ChangeLog8
-rw-r--r--Makefile.in6
-rw-r--r--admin/ChangeLog8
-rw-r--r--admin/grammars/Makefile.in105
-rw-r--r--admin/grammars/README11
-rw-r--r--admin/grammars/c.by10
-rw-r--r--admin/grammars/java-tags.wy5
-rw-r--r--admin/grammars/js.wy6
-rw-r--r--admin/grammars/python.wy8
-rw-r--r--configure.ac11
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/Makefile.in12
-rw-r--r--lisp/cedet/ChangeLog22
-rw-r--r--lisp/cedet/semantic/bovine/c-by.el2224
-rw-r--r--lisp/cedet/semantic/bovine/grammar.el111
-rw-r--r--lisp/cedet/semantic/bovine/make-by.el391
-rw-r--r--lisp/cedet/semantic/bovine/scm-by.el196
-rw-r--r--lisp/cedet/semantic/db.el2
-rw-r--r--lisp/cedet/semantic/grammar.el20
-rw-r--r--lisp/cedet/semantic/wisent/grammar.el114
-rw-r--r--lisp/cedet/semantic/wisent/javat-wy.el688
-rw-r--r--lisp/cedet/semantic/wisent/js-wy.el530
-rw-r--r--lisp/cedet/semantic/wisent/python-wy.el847
-rw-r--r--lisp/cedet/srecode/srt-wy.el306
24 files changed, 357 insertions, 5290 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a34a8f9cf0..28d67634c79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
12013-11-30 Glenn Morris <rgm@gnu.org>
2
3 Stop keeping (most) generated cedet grammar files in the repository.
4 * configure.ac (SUBDIR_MAKEFILES, AC_CONFIG_FILES):
5 Add admin/grammars Makefile.
6 * Makefile.in (distclean, bootstrap-clean, maintainer-clean):
7 Also clean admin/grammars, if present.
8
12013-11-29 Dani Moncayo <dmoncayo@gmail.com> 92013-11-29 Dani Moncayo <dmoncayo@gmail.com>
2 10
3 * Makefile.in (epaths-force-w32): Fix 2013-11-20 typo. 11 * Makefile.in (epaths-force-w32): Fix 2013-11-20 typo.
diff --git a/Makefile.in b/Makefile.in
index 065168bbce5..aedb9acff0d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -857,7 +857,7 @@ distclean: FRC
857 cd leim && $(MAKE) $(MFLAGS) distclean 857 cd leim && $(MAKE) $(MFLAGS) distclean
858 cd lisp && $(MAKE) $(MFLAGS) distclean 858 cd lisp && $(MAKE) $(MFLAGS) distclean
859 cd nextstep && $(MAKE) $(MFLAGS) distclean 859 cd nextstep && $(MAKE) $(MFLAGS) distclean
860 for dir in test/automated admin/unidata; do \ 860 for dir in test/automated admin/grammars admin/unidata; do \
861 [ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) distclean); \ 861 [ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) distclean); \
862 done 862 done
863 ${top_distclean} 863 ${top_distclean}
@@ -879,7 +879,7 @@ bootstrap-clean: FRC
879 cd leim && $(MAKE) $(MFLAGS) bootstrap-clean 879 cd leim && $(MAKE) $(MFLAGS) bootstrap-clean
880 cd lisp && $(MAKE) $(MFLAGS) bootstrap-clean 880 cd lisp && $(MAKE) $(MFLAGS) bootstrap-clean
881 cd nextstep && $(MAKE) $(MFLAGS) maintainer-clean 881 cd nextstep && $(MAKE) $(MFLAGS) maintainer-clean
882 for dir in test/automated admin/unidata; do \ 882 for dir in test/automated admin/grammars admin/unidata; do \
883 [ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) bootstrap-clean); \ 883 [ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) bootstrap-clean); \
884 done 884 done
885 [ ! -f config.log ] || mv -f config.log config.log~ 885 [ ! -f config.log ] || mv -f config.log config.log~
@@ -903,7 +903,7 @@ maintainer-clean: bootstrap-clean FRC
903 cd src && $(MAKE) $(MFLAGS) maintainer-clean 903 cd src && $(MAKE) $(MFLAGS) maintainer-clean
904 cd leim && $(MAKE) $(MFLAGS) maintainer-clean 904 cd leim && $(MAKE) $(MFLAGS) maintainer-clean
905 cd lisp && $(MAKE) $(MFLAGS) maintainer-clean 905 cd lisp && $(MAKE) $(MFLAGS) maintainer-clean
906 for dir in test/automated admin/unidata; do \ 906 for dir in test/automated admin/grammars admin/unidata; do \
907 [ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) maintainer-clean); \ 907 [ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) maintainer-clean); \
908 done 908 done
909 ${top_maintainer_clean} 909 ${top_maintainer_clean}
diff --git a/admin/ChangeLog b/admin/ChangeLog
index c9930c7023a..d70056f001e 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,11 @@
12013-11-30 Glenn Morris <rgm@gnu.org>
2
3 Stop keeping (most) generated cedet grammar files in the repository.
4 * grammars/README: Remove.
5 * grammars/Makefile.in: New file.
6 * grammars/c.by, grammars/java-tags.wy, grammars/js.wy:
7 * grammars/python.wy: Update declarations to match generated outputs.
8
12013-11-28 Glenn Morris <rgm@gnu.org> 92013-11-28 Glenn Morris <rgm@gnu.org>
2 10
3 * unidata/unidata-gen.el (unidata-gen-files): 11 * unidata/unidata-gen.el (unidata-gen-files):
diff --git a/admin/grammars/Makefile.in b/admin/grammars/Makefile.in
new file mode 100644
index 00000000000..94c2e9a6ee2
--- /dev/null
+++ b/admin/grammars/Makefile.in
@@ -0,0 +1,105 @@
1### @configure_input@
2
3## Copyright (C) 2013 Free Software Foundation, Inc.
4
5## This file is part of GNU Emacs.
6
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.
11
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.
16
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/>.
19
20### Commentary:
21
22## This directory contains grammar files in Bison and Wisent,
23## used to generate the parser data in the lisp/cedet directory.
24
25SHELL = @SHELL@
26
27srcdir = @srcdir@
28top_srcdir = @top_srcdir@
29top_builddir = @top_builddir@
30
31EMACS = ${top_builddir}/src/emacs
32emacs = EMACSLOADPATH= "${EMACS}" -batch --no-site-file --no-site-lisp
33
34make_bovine = ${emacs} -l semantic/bovine/grammar -f bovine-batch-make-parser
35make_wisent = ${emacs} -l semantic/wisent/grammar -f wisent-batch-make-parser
36
37cedetdir = ${top_srcdir}/lisp/cedet
38bovinedir = ${cedetdir}/semantic/bovine
39wisentdir = ${cedetdir}/semantic/wisent
40
41BOVINE = \
42 ${bovinedir}/c-by.el \
43 ${bovinedir}/make-by.el \
44 ${bovinedir}/scm-by.el
45
46## FIXME Should include this one too:
47## ${cedetdir}/semantic/grammar-wy.el
48## but semantic/grammar.el (which is what we use to generate grammar-wy.el)
49## requires it!
50WISENT = \
51 ${wisentdir}/javat-wy.el \
52 ${wisentdir}/js-wy.el \
53 ${wisentdir}/python-wy.el \
54 ${cedetdir}/srecode/srt-wy.el
55
56ALL = ${BOVINE} ${WISENT}
57
58.PHONY: all bovine wisent
59
60all: ${ALL}
61
62bovine: ${BOVINE}
63
64wisent: ${WISENT}
65
66
67${bovinedir}/c-by.el: ${srcdir}/c.by
68 ${make_bovine} -o "$@" ${srcdir}/c.by
69
70${bovinedir}/make-by.el: ${srcdir}/make.by
71 ${make_bovine} -o "$@" ${srcdir}/make.by
72
73${bovinedir}/scm-by.el: ${srcdir}/scheme.by
74 ${make_bovine} -o "$@" ${srcdir}/scheme.by
75
76
77${cedetdir}/semantic/grammar-wy.el: ${srcdir}/grammar.wy
78 ${make_wisent} -o "$@" ${srcdir}/grammar.wy
79
80${wisentdir}/javat-wy.el: ${srcdir}/java-tags.wy
81 ${make_wisent} -o "$@" ${srcdir}/java-tags.wy
82
83${wisentdir}/js-wy.el: ${srcdir}/js.wy
84 ${make_wisent} -o "$@" ${srcdir}/js.wy
85
86${wisentdir}/python-wy.el: ${srcdir}/python.wy
87 ${make_wisent} -o "$@" ${srcdir}/python.wy
88
89${cedetdir}/srecode/srt-wy.el: ${srcdir}/srecode-template.wy
90 ${make_wisent} -o "$@" ${srcdir}/srecode-template.wy
91
92
93.PHONY: distclean bootstrap-clean maintainer-clean extraclean
94
95distclean:
96 rm -f Makefile
97
98bootstrap-clean maintainer-clean: distclean
99
100## We do not normally delete the generated files, even in bootstrap.
101## Creating them does not take long, so we could easily change this.
102extraclean:
103 rm -f ${ALL}
104
105# Makefile.in ends here
diff --git a/admin/grammars/README b/admin/grammars/README
deleted file mode 100644
index e38260952a5..00000000000
--- a/admin/grammars/README
+++ /dev/null
@@ -1,11 +0,0 @@
1This directory contains grammar files in Bison and Wisent, used to
2generate the parser data in the lisp/semantic/bovine/ and
3lisp/semantic/wisent/ directories. You can run the parser generators
4with
5
6emacs -batch -Q -l semantic/bovine/grammar -f bovine-make-parsers
7emacs -batch -Q -l semantic/wisent/grammar -f wisent-make-parsers
8
9Currently, the parser files in lisp/ are not generated directly from
10these grammar files when making Emacs. This state of affairs, and the
11contents of this directory, will change in a future version of Emacs.
diff --git a/admin/grammars/c.by b/admin/grammars/c.by
index 5d2f407e8e3..55ec0fbaf01 100644
--- a/admin/grammars/c.by
+++ b/admin/grammars/c.by
@@ -41,9 +41,13 @@
41%provide semantic/bovine/c-by 41%provide semantic/bovine/c-by
42 42
43%{ 43%{
44(declare-function semantic-c-reconstitute-token "semantic/bovine/c") 44(declare-function semantic-c-reconstitute-token "semantic/bovine/c"
45(declare-function semantic-c-reconstitute-template "semantic/bovine/c") 45 (tokenpart declmods typedecl))
46(declare-function semantic-expand-c-tag "semantic/bovine/c") 46(declare-function semantic-c-reconstitute-template "semantic/bovine/c"
47 (tag specifier))
48(declare-function semantic-expand-c-tag "semantic/bovine/c" (tag))
49(declare-function semantic-parse-region "semantic"
50 (start end &optional nonterminal depth returnonerror))
47} 51}
48 52
49%languagemode c-mode c++-mode 53%languagemode c-mode c++-mode
diff --git a/admin/grammars/java-tags.wy b/admin/grammars/java-tags.wy
index 71607f452a0..3f5c3ad04c6 100644
--- a/admin/grammars/java-tags.wy
+++ b/admin/grammars/java-tags.wy
@@ -25,6 +25,11 @@
25%package wisent-java-tags-wy 25%package wisent-java-tags-wy
26%provide semantic/wisent/javat-wy 26%provide semantic/wisent/javat-wy
27 27
28%{
29(declare-function semantic-parse-region "semantic"
30 (start end &optional nonterminal depth returnonerror))
31}
32
28%languagemode java-mode 33%languagemode java-mode
29 34
30;; The default start symbol 35;; The default start symbol
diff --git a/admin/grammars/js.wy b/admin/grammars/js.wy
index 3b602296552..a6a358a0ee7 100644
--- a/admin/grammars/js.wy
+++ b/admin/grammars/js.wy
@@ -59,6 +59,12 @@
59 59
60%package wisent-javascript-jv-wy 60%package wisent-javascript-jv-wy
61%provide semantic/wisent/js-wy 61%provide semantic/wisent/js-wy
62
63%{
64(declare-function semantic-parse-region "semantic"
65 (start end &optional nonterminal depth returnonerror))
66}
67
62;; JAVE I prefere ecmascript-mode 68;; JAVE I prefere ecmascript-mode
63%languagemode ecmascript-mode javascript-mode 69%languagemode ecmascript-mode javascript-mode
64 70
diff --git a/admin/grammars/python.wy b/admin/grammars/python.wy
index 02fb7390b01..b82125d2bc3 100644
--- a/admin/grammars/python.wy
+++ b/admin/grammars/python.wy
@@ -91,8 +91,12 @@
91%provide semantic/wisent/python-wy 91%provide semantic/wisent/python-wy
92 92
93%{ 93%{
94(declare-function wisent-python-reconstitute-function-tag "semantic/wisent/python") 94(declare-function wisent-python-reconstitute-function-tag
95(declare-function wisent-python-reconstitute-class-tag "semantic/wisent/python") 95 "semantic/wisent/python" (tag suite))
96(declare-function wisent-python-reconstitute-class-tag "semantic/wisent/python"
97 (tag))
98(declare-function semantic-parse-region "semantic"
99 (start end &optional nonterminal depth returnonerror))
96} 100}
97 101
98%languagemode python-mode 102%languagemode python-mode
diff --git a/configure.ac b/configure.ac
index 0d07d563946..a2e4cd9e159 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4971,13 +4971,12 @@ if test -f "$srcdir/$opt_makefile.in"; then
4971fi 4971fi
4972 4972
4973 4973
4974dnl admin/ may or may not be present. 4974dnl The admin/ directory used to be excluded from tarfiles.
4975opt_makefile=admin/unidata/Makefile 4975if test -d $srcdir/admin; then
4976 4976 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES admin/unidata/Makefile admin/grammars/Makefile"
4977if test -f "$srcdir/$opt_makefile.in"; then
4978 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
4979 AC_CONFIG_FILES([admin/unidata/Makefile]) 4977 AC_CONFIG_FILES([admin/unidata/Makefile])
4980fi 4978 AC_CONFIG_FILES([admin/grammars/Makefile])
4979fi dnl -d admin
4981 4980
4982 4981
4983SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'` 4982SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 26c0f502334..2455b9a10b6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12013-11-30 Glenn Morris <rgm@gnu.org>
2
3 Stop keeping (most) generated cedet grammar files in the repository.
4 * Makefile.in (semantic): New.
5 (compile-main): Depend on semantic.
6
12013-11-29 Stefan Monnier <monnier@iro.umontreal.ca> 72013-11-29 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * net/newst-reader.el (newsticker-html-renderer): Default to SHR if 9 * net/newst-reader.el (newsticker-html-renderer): Default to SHR if
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 391e50c8b7d..9c9eacfd386 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -296,7 +296,7 @@ compile-targets: $(TARGETS)
296 296
297# Compile all the Elisp files that need it. Beware: it approximates 297# Compile all the Elisp files that need it. Beware: it approximates
298# `no-byte-compile', so watch out for false-positives! 298# `no-byte-compile', so watch out for false-positives!
299compile-main: leim compile-clean 299compile-main: leim semantic compile-clean
300 @(cd $(lisp) && $(setwins); \ 300 @(cd $(lisp) && $(setwins); \
301 els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \ 301 els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
302 for el in $$els; do \ 302 for el in $$els; do \
@@ -320,10 +320,18 @@ compile-clean:
320 fi \ 320 fi \
321 done 321 done
322 322
323.PHONY: leim 323.PHONY: leim semantic
324leim: 324leim:
325 cd ../leim && $(MAKE) $(MFLAGS) all EMACS="$(EMACS)" 325 cd ../leim && $(MAKE) $(MFLAGS) all EMACS="$(EMACS)"
326 326
327# FIXME. Yuck.
328semantic:
329 case ${EMACS} in \
330 .*) EMACS="../${EMACS}" ;; \
331 *) EMACS="${EMACS}" ;; \
332 esac; \
333 cd ../admin/grammars && $(MAKE) $(MFLAGS) all EMACS="$${EMACS}"
334
327# Compile all Lisp files, but don't recompile those that are up to 335# Compile all Lisp files, but don't recompile those that are up to
328# date. Some .el files don't get compiled because they set the 336# date. Some .el files don't get compiled because they set the
329# local variable no-byte-compile. 337# local variable no-byte-compile.
diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog
index ecdebe0363c..1a4a6580007 100644
--- a/lisp/cedet/ChangeLog
+++ b/lisp/cedet/ChangeLog
@@ -1,3 +1,25 @@
12013-11-30 Glenn Morris <rgm@gnu.org>
2
3 Stop keeping (most) generated cedet grammar files in the repository.
4 * semantic/bovine/grammar.el (bovine--make-parser-1):
5 New function, split from bovine-make-parsers.
6 (bovine-make-parsers): Use bovine--make-parser-1.
7 (bovine-batch-make-parser): New function.
8 * semantic/wisent/grammar.el (wisent--make-parser-1):
9 New function, split from wisent-make-parsers.
10 (wisent-make-parsers): Use wisent--make-parser-1.
11 (wisent-batch-make-parser): New function.
12 * semantic/db.el (semanticdb-save-all-db):
13 Avoid prompting in batch mode.
14 * semantic/grammar.el (semantic-grammar-footer-template):
15 Disable version-control and autoloads in the output.
16 (semantic-grammar-create-package):
17 Add option to return nil if output is up-to-date.
18 * semantic/bovine/c-by.el, semantic/bovine/make-by.el:
19 * semantic/bovine/scm-by.el, semantic/wisent/javat-wy.el:
20 * semantic/wisent/js-wy.el, semantic/wisent/python-wy.el:
21 * srecode/srt-wy.el: Remove generated files from repository.
22
12013-11-16 Barry O'Reilly <gundaetiapo@gmail.com> 232013-11-16 Barry O'Reilly <gundaetiapo@gmail.com>
2 24
3 * semantic/fw.el (semantic-exit-on-input) 25 * semantic/fw.el (semantic-exit-on-input)
diff --git a/lisp/cedet/semantic/bovine/c-by.el b/lisp/cedet/semantic/bovine/c-by.el
deleted file mode 100644
index af3724a32c8..00000000000
--- a/lisp/cedet/semantic/bovine/c-by.el
+++ /dev/null
@@ -1,2224 +0,0 @@
1;;; semantic/bovine/c-by.el --- Generated parser support file
2
3;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
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.
11
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.
16
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/>.
19
20;;; Commentary:
21;;
22;; This file was generated from admin/grammars/c.by.
23
24;;; Code:
25
26(require 'semantic/lex)
27(eval-when-compile (require 'semantic/bovine))
28
29;;; Prologue
30;;
31(declare-function semantic-c-reconstitute-token "semantic/bovine/c"
32 (tokenpart declmods typedecl))
33(declare-function semantic-c-reconstitute-template "semantic/bovine/c"
34 (tag specifier))
35(declare-function semantic-expand-c-tag "semantic/bovine/c" (tag))
36(declare-function semantic-parse-region "semantic"
37 (start end &optional nonterminal depth returnonerror))
38
39;;; Declarations
40;;
41(defconst semantic-c-by--keyword-table
42 (semantic-lex-make-keyword-table
43 '(("extern" . EXTERN)
44 ("static" . STATIC)
45 ("const" . CONST)
46 ("volatile" . VOLATILE)
47 ("register" . REGISTER)
48 ("signed" . SIGNED)
49 ("unsigned" . UNSIGNED)
50 ("inline" . INLINE)
51 ("virtual" . VIRTUAL)
52 ("mutable" . MUTABLE)
53 ("explicit" . EXPLICIT)
54 ("struct" . STRUCT)
55 ("union" . UNION)
56 ("enum" . ENUM)
57 ("typedef" . TYPEDEF)
58 ("class" . CLASS)
59 ("typename" . TYPENAME)
60 ("namespace" . NAMESPACE)
61 ("using" . USING)
62 ("new" . NEW)
63 ("delete" . DELETE)
64 ("template" . TEMPLATE)
65 ("throw" . THROW)
66 ("reentrant" . REENTRANT)
67 ("try" . TRY)
68 ("catch" . CATCH)
69 ("operator" . OPERATOR)
70 ("public" . PUBLIC)
71 ("private" . PRIVATE)
72 ("protected" . PROTECTED)
73 ("friend" . FRIEND)
74 ("if" . IF)
75 ("else" . ELSE)
76 ("do" . DO)
77 ("while" . WHILE)
78 ("for" . FOR)
79 ("switch" . SWITCH)
80 ("case" . CASE)
81 ("default" . DEFAULT)
82 ("return" . RETURN)
83 ("break" . BREAK)
84 ("continue" . CONTINUE)
85 ("sizeof" . SIZEOF)
86 ("void" . VOID)
87 ("char" . CHAR)
88 ("wchar_t" . WCHAR)
89 ("short" . SHORT)
90 ("int" . INT)
91 ("long" . LONG)
92 ("float" . FLOAT)
93 ("double" . DOUBLE)
94 ("bool" . BOOL)
95 ("_P" . UNDERP)
96 ("__P" . UNDERUNDERP))
97 '(("__P" summary "Common macro to eliminate prototype compatibility on some compilers")
98 ("_P" summary "Common macro to eliminate prototype compatibility on some compilers")
99 ("bool" summary "Primitive boolean type")
100 ("double" summary "Primitive floating-point type (double-precision 64-bit IEEE 754)")
101 ("float" summary "Primitive floating-point type (single-precision 32-bit IEEE 754)")
102 ("long" summary "Integral primitive type (-9223372036854775808 to 9223372036854775807)")
103 ("int" summary "Integral Primitive Type: (-2147483648 to 2147483647)")
104 ("short" summary "Integral Primitive Type: (-32768 to 32767)")
105 ("wchar_t" summary "Wide Character Type")
106 ("char" summary "Integral Character Type: (0 to 256)")
107 ("void" summary "Built in typeless type: void")
108 ("sizeof" summary "Compile time macro: sizeof(<type or variable>) // size in bytes")
109 ("continue" summary "Non-local continue within a loop (for, do/while): continue;")
110 ("break" summary "Non-local exit within a loop or switch (for, do/while, switch): break;")
111 ("return" summary "return <value>;")
112 ("default" summary "switch (<variable>) { case <constvalue>: code; ... default: code; }")
113 ("case" summary "switch (<variable>) { case <constvalue>: code; ... default: code; }")
114 ("switch" summary "switch (<variable>) { case <constvalue>: code; ... default: code; }")
115 ("for" summary "for(<init>; <condition>; <increment>) { code }")
116 ("while" summary "do { code } while (<condition>); or while (<condition>) { code };")
117 ("do" summary " do { code } while (<condition>);")
118 ("else" summary "if (<condition>) { code } [ else { code } ]")
119 ("if" summary "if (<condition>) { code } [ else { code } ]")
120 ("friend" summary "friend class <CLASSNAME>")
121 ("catch" summary "try { <body> } catch { <catch code> }")
122 ("try" summary "try { <body> } catch { <catch code> }")
123 ("reentrant" summary "<type> <methoddef> (<method args>) reentrant ...")
124 ("throw" summary "<type> <methoddef> (<method args>) throw (<exception>) ...")
125 ("template" summary "template <class TYPE ...> TYPE_OR_FUNCTION")
126 ("delete" summary "delete <object>;")
127 ("new" summary "new <classname>();")
128 ("using" summary "using <namespace>;")
129 ("namespace" summary "Namespace Declaration: namespace <name> { ... };")
130 ("typename" summary "typename is used to handle a qualified name as a typename;")
131 ("class" summary "Class Declaration: class <name>[:parents] { ... };")
132 ("typedef" summary "Arbitrary Type Declaration: typedef <typedeclaration> <name>;")
133 ("enum" summary "Enumeration Type Declaration: enum [name] { ... };")
134 ("union" summary "Union Type Declaration: union [name] { ... };")
135 ("struct" summary "Structure Type Declaration: struct [name] { ... };")
136 ("explicit" summary "Forbids implicit type conversion: explicit <constructor>")
137 ("mutable" summary "Member Declaration Modifier: mutable <type> <name> ...")
138 ("virtual" summary "Method Modifier: virtual <type> <name>(...) ...")
139 ("inline" summary "Function Modifier: inline <return type> <name>(...) {...};")
140 ("unsigned" summary "Numeric Type Modifier: unsigned <numeric type> <name> ...")
141 ("signed" summary "Numeric Type Modifier: signed <numeric type> <name> ...")
142 ("register" summary "Declaration Modifier: register <type> <name> ...")
143 ("volatile" summary "Declaration Modifier: volatile <type> <name> ...")
144 ("const" summary "Declaration Modifier: const <type> <name> ...")
145 ("static" summary "Declaration Modifier: static <type> <name> ...")
146 ("extern" summary "Declaration Modifier: extern <type> <name> ...")))
147 "Table of language keywords.")
148
149(defconst semantic-c-by--token-table
150 (semantic-lex-make-type-table
151 '(("semantic-list"
152 (BRACKETS . "\\[\\]")
153 (PARENS . "()")
154 (VOID_BLCK . "^(void)$")
155 (BRACE_BLCK . "^{")
156 (PAREN_BLCK . "^(")
157 (BRACK_BLCK . "\\[.*\\]$"))
158 ("close-paren"
159 (RBRACE . "}")
160 (RPAREN . ")"))
161 ("open-paren"
162 (LBRACE . "{")
163 (LPAREN . "("))
164 ("symbol"
165 (RESTRICT . "\\<\\(__\\)?restrict\\>"))
166 ("number"
167 (ZERO . "^0$"))
168 ("string"
169 (CPP . "\"C\\+\\+\"")
170 (C . "\"C\""))
171 ("punctuation"
172 (OR . "\\`[|]\\'")
173 (HAT . "\\`\\^\\'")
174 (MOD . "\\`[%]\\'")
175 (TILDE . "\\`[~]\\'")
176 (COMA . "\\`[,]\\'")
177 (GREATER . "\\`[>]\\'")
178 (LESS . "\\`[<]\\'")
179 (EQUAL . "\\`[=]\\'")
180 (BANG . "\\`[!]\\'")
181 (MINUS . "\\`[-]\\'")
182 (PLUS . "\\`[+]\\'")
183 (DIVIDE . "\\`[/]\\'")
184 (AMPERSAND . "\\`[&]\\'")
185 (STAR . "\\`[*]\\'")
186 (SEMICOLON . "\\`[;]\\'")
187 (COLON . "\\`[:]\\'")
188 (PERIOD . "\\`[.]\\'")
189 (HASH . "\\`[#]\\'")))
190 'nil)
191 "Table of lexical tokens.")
192
193(defconst semantic-c-by--parse-table
194 `(
195 (bovine-toplevel
196 (declaration)
197 ) ;; end bovine-toplevel
198
199 (bovine-inner-scope
200 (codeblock)
201 ) ;; end bovine-inner-scope
202
203 (declaration
204 (macro)
205 (type)
206 (define)
207 (var-or-fun)
208 (extern-c)
209 (template)
210 (using)
211 ) ;; end declaration
212
213 (codeblock
214 (define)
215 (codeblock-var-or-fun)
216 (type)
217 (using)
218 ) ;; end codeblock
219
220 (extern-c-contents
221 (open-paren
222 ,(semantic-lambda
223 (list nil))
224 )
225 (declaration)
226 (close-paren
227 ,(semantic-lambda
228 (list nil))
229 )
230 ) ;; end extern-c-contents
231
232 (extern-c
233 (EXTERN
234 string
235 "\"C\""
236 semantic-list
237 ,(semantic-lambda
238 (semantic-tag
239 "C"
240 'extern :members
241 (semantic-parse-region
242 (car
243 (nth 2 vals))
244 (cdr
245 (nth 2 vals))
246 'extern-c-contents
247 1)))
248 )
249 (EXTERN
250 string
251 "\"C\\+\\+\""
252 semantic-list
253 ,(semantic-lambda
254 (semantic-tag
255 "C"
256 'extern :members
257 (semantic-parse-region
258 (car
259 (nth 2 vals))
260 (cdr
261 (nth 2 vals))
262 'extern-c-contents
263 1)))
264 )
265 (EXTERN
266 string
267 "\"C\""
268 ,(semantic-lambda
269 (list nil))
270 )
271 (EXTERN
272 string
273 "\"C\\+\\+\""
274 ,(semantic-lambda
275 (list nil))
276 )
277 ) ;; end extern-c
278
279 (macro
280 (spp-macro-def
281 ,(semantic-lambda
282 (semantic-tag-new-variable
283 (nth 0 vals) nil nil :constant-flag t))
284 )
285 (spp-system-include
286 ,(semantic-lambda
287 (semantic-tag-new-include
288 (nth 0 vals) t))
289 )
290 (spp-include
291 ,(semantic-lambda
292 (semantic-tag-new-include
293 (nth 0 vals) nil))
294 )
295 ) ;; end macro
296
297 (define
298 (spp-macro-def
299 ,(semantic-lambda
300 (semantic-tag-new-variable
301 (nth 0 vals) nil nil :constant-flag t))
302 )
303 (spp-macro-undef
304 ,(semantic-lambda
305 (list nil))
306 )
307 ) ;; end define
308
309 (unionparts
310 (semantic-list
311 ,(semantic-lambda
312 (semantic-parse-region
313 (car
314 (nth 0 vals))
315 (cdr
316 (nth 0 vals))
317 'classsubparts
318 1))
319 )
320 ) ;; end unionparts
321
322 (opt-symbol
323 (symbol)
324 ( ;;EMPTY
325 )
326 ) ;; end opt-symbol
327
328 (classsubparts
329 (open-paren
330 "{"
331 ,(semantic-lambda
332 (list nil))
333 )
334 (close-paren
335 "}"
336 ,(semantic-lambda
337 (list nil))
338 )
339 (class-protection
340 opt-symbol
341 punctuation
342 "\\`[:]\\'"
343 ,(semantic-lambda
344 (semantic-tag
345 (car
346 (nth 0 vals))
347 'label))
348 )
349 (var-or-fun)
350 (FRIEND
351 func-decl
352 ,(semantic-lambda
353 (semantic-tag
354 (car
355 (nth 1 vals))
356 'friend))
357 )
358 (FRIEND
359 CLASS
360 symbol
361 ,(semantic-lambda
362 (semantic-tag
363 (nth 2 vals)
364 'friend))
365 )
366 (type)
367 (define)
368 (template)
369 ( ;;EMPTY
370 )
371 ) ;; end classsubparts
372
373 (opt-class-parents
374 (punctuation
375 "\\`[:]\\'"
376 class-parents
377 opt-template-specifier
378 ,(semantic-lambda
379 (list
380 (nth 1 vals)))
381 )
382 ( ;;EMPTY
383 ,(semantic-lambda)
384 )
385 ) ;; end opt-class-parents
386
387 (one-class-parent
388 (opt-class-protection
389 opt-class-declmods
390 namespace-symbol
391 ,(semantic-lambda
392 (semantic-tag-new-type
393 (car
394 (nth 2 vals))
395 "class" nil nil :protection
396 (car
397 (nth 0 vals))))
398 )
399 (opt-class-declmods
400 opt-class-protection
401 namespace-symbol
402 ,(semantic-lambda
403 (semantic-tag-new-type
404 (car
405 (nth 2 vals))
406 "class" nil nil :protection
407 (car
408 (nth 1 vals))))
409 )
410 ) ;; end one-class-parent
411
412 (class-parents
413 (one-class-parent
414 punctuation
415 "\\`[,]\\'"
416 class-parents
417 ,(semantic-lambda
418 (cons
419 (nth 0 vals)
420 (nth 2 vals)))
421 )
422 (one-class-parent
423 ,(semantic-lambda
424 (list
425 (nth 0 vals)))
426 )
427 ) ;; end class-parents
428
429 (opt-class-declmods
430 (class-declmods
431 opt-class-declmods
432 ,(semantic-lambda
433 (list nil))
434 )
435 ( ;;EMPTY
436 )
437 ) ;; end opt-class-declmods
438
439 (class-declmods
440 (VIRTUAL)
441 ) ;; end class-declmods
442
443 (class-protection
444 (PUBLIC)
445 (PRIVATE)
446 (PROTECTED)
447 ) ;; end class-protection
448
449 (opt-class-protection
450 (class-protection
451 ,(semantic-lambda
452 (nth 0 vals))
453 )
454 ( ;;EMPTY
455 ,(semantic-lambda
456 (list
457 "unspecified"))
458 )
459 ) ;; end opt-class-protection
460
461 (namespaceparts
462 (semantic-list
463 ,(semantic-lambda
464 (semantic-parse-region
465 (car
466 (nth 0 vals))
467 (cdr
468 (nth 0 vals))
469 'namespacesubparts
470 1))
471 )
472 ) ;; end namespaceparts
473
474 (namespacesubparts
475 (open-paren
476 "{"
477 ,(semantic-lambda
478 (list nil))
479 )
480 (close-paren
481 "}"
482 ,(semantic-lambda
483 (list nil))
484 )
485 (type)
486 (var-or-fun)
487 (define)
488 (class-protection
489 punctuation
490 "\\`[:]\\'"
491 ,(semantic-lambda
492 (semantic-tag
493 (car
494 (nth 0 vals))
495 'label))
496 )
497 (template)
498 (using)
499 (spp-include
500 ,(semantic-lambda
501 (semantic-tag
502 (nth 0 vals)
503 'include :inside-ns t))
504 )
505 ( ;;EMPTY
506 )
507 ) ;; end namespacesubparts
508
509 (enumparts
510 (semantic-list
511 ,(semantic-lambda
512 (semantic-parse-region
513 (car
514 (nth 0 vals))
515 (cdr
516 (nth 0 vals))
517 'enumsubparts
518 1))
519 )
520 ) ;; end enumparts
521
522 (enumsubparts
523 (symbol
524 opt-assign
525 ,(semantic-lambda
526 (semantic-tag-new-variable
527 (nth 0 vals)
528 "int"
529 (car
530 (nth 1 vals)) :constant-flag t))
531 )
532 (open-paren
533 "{"
534 ,(semantic-lambda
535 (list nil))
536 )
537 (close-paren
538 "}"
539 ,(semantic-lambda
540 (list nil))
541 )
542 (punctuation
543 "\\`[,]\\'"
544 ,(semantic-lambda
545 (list nil))
546 )
547 ) ;; end enumsubparts
548
549 (opt-name
550 (symbol)
551 ( ;;EMPTY
552 ,(semantic-lambda
553 (list
554 ""))
555 )
556 ) ;; end opt-name
557
558 (typesimple
559 (struct-or-class
560 opt-class
561 opt-name
562 opt-template-specifier
563 opt-class-parents
564 semantic-list
565 ,(semantic-lambda
566 (semantic-tag-new-type
567 (car
568 (nth 2 vals))
569 (car
570 (nth 0 vals))
571 (let
572 (
573 (semantic-c-classname
574 (cons
575 (car
576 (nth 2 vals))
577 (car
578 (nth 0 vals)))))
579 (semantic-parse-region
580 (car
581 (nth 5 vals))
582 (cdr
583 (nth 5 vals))
584 'classsubparts
585 1))
586 (nth 4 vals) :template-specifier
587 (nth 3 vals) :parent
588 (car
589 (nth 1 vals))))
590 )
591 (struct-or-class
592 opt-class
593 opt-name
594 opt-template-specifier
595 opt-class-parents
596 ,(semantic-lambda
597 (semantic-tag-new-type
598 (car
599 (nth 2 vals))
600 (car
601 (nth 0 vals)) nil
602 (nth 4 vals) :template-specifier
603 (nth 3 vals) :prototype t :parent
604 (car
605 (nth 1 vals))))
606 )
607 (UNION
608 opt-class
609 opt-name
610 unionparts
611 ,(semantic-lambda
612 (semantic-tag-new-type
613 (car
614 (nth 2 vals))
615 (nth 0 vals)
616 (nth 3 vals) nil :parent
617 (car
618 (nth 1 vals))))
619 )
620 (ENUM
621 opt-class
622 opt-name
623 enumparts
624 ,(semantic-lambda
625 (semantic-tag-new-type
626 (car
627 (nth 2 vals))
628 (nth 0 vals)
629 (nth 3 vals) nil :parent
630 (car
631 (nth 1 vals))))
632 )
633 (TYPEDEF
634 declmods
635 typeformbase
636 cv-declmods
637 typedef-symbol-list
638 ,(semantic-lambda
639 (semantic-tag-new-type
640 (nth 4 vals)
641 (nth 0 vals) nil
642 (list
643 (nth 2 vals))))
644 )
645 ) ;; end typesimple
646
647 (typedef-symbol-list
648 (typedefname
649 punctuation
650 "\\`[,]\\'"
651 typedef-symbol-list
652 ,(semantic-lambda
653 (cons
654 (nth 0 vals)
655 (nth 2 vals)))
656 )
657 (typedefname
658 ,(semantic-lambda
659 (list
660 (nth 0 vals)))
661 )
662 ) ;; end typedef-symbol-list
663
664 (typedefname
665 (opt-stars
666 symbol
667 opt-bits
668 opt-array
669 ,(semantic-lambda
670 (list
671 (nth 0 vals)
672 (nth 1 vals)))
673 )
674 ) ;; end typedefname
675
676 (struct-or-class
677 (STRUCT)
678 (CLASS)
679 ) ;; end struct-or-class
680
681 (type
682 (typesimple
683 punctuation
684 "\\`[;]\\'"
685 ,(semantic-lambda
686 (nth 0 vals))
687 )
688 (NAMESPACE
689 symbol
690 namespaceparts
691 ,(semantic-lambda
692 (semantic-tag-new-type
693 (nth 1 vals)
694 (nth 0 vals)
695 (nth 2 vals) nil))
696 )
697 (NAMESPACE
698 namespaceparts
699 ,(semantic-lambda
700 (semantic-tag-new-type
701 "unnamed"
702 (nth 0 vals)
703 (nth 1 vals) nil))
704 )
705 (NAMESPACE
706 symbol
707 punctuation
708 "\\`[=]\\'"
709 typeformbase
710 punctuation
711 "\\`[;]\\'"
712 ,(semantic-lambda
713 (semantic-tag-new-type
714 (nth 1 vals)
715 (nth 0 vals)
716 (list
717 (semantic-tag-new-type
718 (car
719 (nth 3 vals))
720 (nth 0 vals) nil nil)) nil :kind
721 'alias))
722 )
723 ) ;; end type
724
725 (using
726 (USING
727 usingname
728 punctuation
729 "\\`[;]\\'"
730 ,(semantic-lambda
731 (semantic-tag
732 (car
733 (nth 1 vals))
734 'using :type
735 (nth 1 vals)))
736 )
737 ) ;; end using
738
739 (usingname
740 (typeformbase
741 ,(semantic-lambda
742 (semantic-tag-new-type
743 (car
744 (nth 0 vals))
745 "class" nil nil :prototype t))
746 )
747 (NAMESPACE
748 typeformbase
749 ,(semantic-lambda
750 (semantic-tag-new-type
751 (car
752 (nth 1 vals))
753 "namespace" nil nil :prototype t))
754 )
755 ) ;; end usingname
756
757 (template
758 (TEMPLATE
759 template-specifier
760 opt-friend
761 template-definition
762 ,(semantic-lambda
763 (semantic-c-reconstitute-template
764 (nth 3 vals)
765 (nth 1 vals)))
766 )
767 ) ;; end template
768
769 (opt-friend
770 (FRIEND)
771 ( ;;EMPTY
772 )
773 ) ;; end opt-friend
774
775 (opt-template-specifier
776 (template-specifier
777 ,(semantic-lambda
778 (nth 0 vals))
779 )
780 ( ;;EMPTY
781 ,(semantic-lambda)
782 )
783 ) ;; end opt-template-specifier
784
785 (template-specifier
786 (punctuation
787 "\\`[<]\\'"
788 template-specifier-types
789 punctuation
790 "\\`[>]\\'"
791 ,(semantic-lambda
792 (nth 1 vals))
793 )
794 ) ;; end template-specifier
795
796 (template-specifier-types
797 (template-var
798 template-specifier-type-list
799 ,(semantic-lambda
800 (cons
801 (nth 0 vals)
802 (nth 1 vals)))
803 )
804 ( ;;EMPTY
805 )
806 ) ;; end template-specifier-types
807
808 (template-specifier-type-list
809 (punctuation
810 "\\`[,]\\'"
811 template-specifier-types
812 ,(semantic-lambda
813 (nth 1 vals))
814 )
815 ( ;;EMPTY
816 ,(semantic-lambda)
817 )
818 ) ;; end template-specifier-type-list
819
820 (template-var
821 (template-type
822 opt-template-equal
823 ,(semantic-lambda
824 (cons
825 (car
826 (nth 0 vals))
827 (cdr
828 (nth 0 vals))))
829 )
830 (string
831 ,(semantic-lambda
832 (list
833 (nth 0 vals)))
834 )
835 (number
836 ,(semantic-lambda
837 (list
838 (nth 0 vals)))
839 )
840 (opt-stars
841 opt-ref
842 namespace-symbol
843 ,(semantic-lambda
844 (nth 2 vals))
845 )
846 (semantic-list
847 ,(semantic-lambda
848 (list
849 (nth 0 vals)))
850 )
851 (SIZEOF
852 semantic-list
853 ,(semantic-lambda
854 (list
855 (nth 1 vals)))
856 )
857 ) ;; end template-var
858
859 (opt-template-equal
860 (punctuation
861 "\\`[=]\\'"
862 symbol
863 punctuation
864 "\\`[<]\\'"
865 template-specifier-types
866 punctuation
867 "\\`[>]\\'"
868 ,(semantic-lambda
869 (list
870 (nth 1 vals)))
871 )
872 (punctuation
873 "\\`[=]\\'"
874 symbol
875 ,(semantic-lambda
876 (list
877 (nth 1 vals)))
878 )
879 ( ;;EMPTY
880 ,(semantic-lambda)
881 )
882 ) ;; end opt-template-equal
883
884 (template-type
885 (CLASS
886 symbol
887 ,(semantic-lambda
888 (semantic-tag-new-type
889 (nth 1 vals)
890 "class" nil nil))
891 )
892 (STRUCT
893 symbol
894 ,(semantic-lambda
895 (semantic-tag-new-type
896 (nth 1 vals)
897 "struct" nil nil))
898 )
899 (TYPENAME
900 symbol
901 ,(semantic-lambda
902 (semantic-tag-new-type
903 (nth 1 vals)
904 "class" nil nil))
905 )
906 (declmods
907 typeformbase
908 cv-declmods
909 opt-stars
910 opt-ref
911 variablearg-opt-name
912 ,(semantic-lambda
913 (semantic-tag-new-type
914 (car
915 (nth 1 vals)) nil nil nil :constant-flag
916 (if
917 (member
918 "const"
919 (append
920 (nth 0 vals)
921 (nth 2 vals))) t nil) :typemodifiers
922 (delete
923 "const"
924 (append
925 (nth 0 vals)
926 (nth 2 vals))) :reference
927 (car
928 (nth 4 vals)) :pointer
929 (car
930 (nth 3 vals))))
931 )
932 ) ;; end template-type
933
934 (template-definition
935 (type
936 ,(semantic-lambda
937 (nth 0 vals))
938 )
939 (var-or-fun
940 ,(semantic-lambda
941 (nth 0 vals))
942 )
943 ) ;; end template-definition
944
945 (opt-stars
946 (punctuation
947 "\\`[*]\\'"
948 opt-starmod
949 opt-stars
950 ,(semantic-lambda
951 (list
952 (1+
953 (car
954 (nth 2 vals)))))
955 )
956 ( ;;EMPTY
957 ,(semantic-lambda
958 (list
959 0))
960 )
961 ) ;; end opt-stars
962
963 (opt-starmod
964 (STARMOD
965 opt-starmod
966 ,(semantic-lambda
967 (cons
968 (car
969 (nth 0 vals))
970 (nth 1 vals)))
971 )
972 ( ;;EMPTY
973 ,(semantic-lambda)
974 )
975 ) ;; end opt-starmod
976
977 (STARMOD
978 (CONST)
979 ) ;; end STARMOD
980
981 (declmods
982 (DECLMOD
983 declmods
984 ,(semantic-lambda
985 (cons
986 (car
987 (nth 0 vals))
988 (nth 1 vals)))
989 )
990 (DECLMOD
991 ,(semantic-lambda
992 (nth 0 vals))
993 )
994 ( ;;EMPTY
995 ,(semantic-lambda)
996 )
997 ) ;; end declmods
998
999 (DECLMOD
1000 (EXTERN)
1001 (STATIC)
1002 (CVDECLMOD)
1003 (INLINE)
1004 (REGISTER)
1005 (FRIEND)
1006 (TYPENAME)
1007 (METADECLMOD)
1008 (VIRTUAL)
1009 ) ;; end DECLMOD
1010
1011 (metadeclmod
1012 (METADECLMOD
1013 ,(semantic-lambda)
1014 )
1015 ( ;;EMPTY
1016 ,(semantic-lambda)
1017 )
1018 ) ;; end metadeclmod
1019
1020 (CVDECLMOD
1021 (CONST)
1022 (VOLATILE)
1023 ) ;; end CVDECLMOD
1024
1025 (cv-declmods
1026 (CVDECLMOD
1027 cv-declmods
1028 ,(semantic-lambda
1029 (cons
1030 (car
1031 (nth 0 vals))
1032 (nth 1 vals)))
1033 )
1034 (CVDECLMOD
1035 ,(semantic-lambda
1036 (nth 0 vals))
1037 )
1038 ( ;;EMPTY
1039 ,(semantic-lambda)
1040 )
1041 ) ;; end cv-declmods
1042
1043 (METADECLMOD
1044 (VIRTUAL)
1045 (MUTABLE)
1046 ) ;; end METADECLMOD
1047
1048 (opt-ref
1049 (punctuation
1050 "\\`[&]\\'"
1051 ,(semantic-lambda
1052 (list
1053 1))
1054 )
1055 ( ;;EMPTY
1056 ,(semantic-lambda
1057 (list
1058 0))
1059 )
1060 ) ;; end opt-ref
1061
1062 (typeformbase
1063 (typesimple
1064 ,(semantic-lambda
1065 (nth 0 vals))
1066 )
1067 (STRUCT
1068 symbol
1069 ,(semantic-lambda
1070 (semantic-tag-new-type
1071 (nth 1 vals)
1072 (nth 0 vals) nil nil))
1073 )
1074 (UNION
1075 symbol
1076 ,(semantic-lambda
1077 (semantic-tag-new-type
1078 (nth 1 vals)
1079 (nth 0 vals) nil nil))
1080 )
1081 (ENUM
1082 symbol
1083 ,(semantic-lambda
1084 (semantic-tag-new-type
1085 (nth 1 vals)
1086 (nth 0 vals) nil nil))
1087 )
1088 (builtintype
1089 ,(semantic-lambda
1090 (nth 0 vals))
1091 )
1092 (symbol
1093 template-specifier
1094 ,(semantic-lambda
1095 (semantic-tag-new-type
1096 (nth 0 vals)
1097 "class" nil nil :template-specifier
1098 (nth 1 vals)))
1099 )
1100 (namespace-symbol-for-typeformbase
1101 opt-template-specifier
1102 ,(semantic-lambda
1103 (semantic-tag-new-type
1104 (car
1105 (nth 0 vals))
1106 "class" nil nil :template-specifier
1107 (nth 1 vals)))
1108 )
1109 (symbol
1110 ,(semantic-lambda
1111 (list
1112 (nth 0 vals)))
1113 )
1114 ) ;; end typeformbase
1115
1116 (signedmod
1117 (UNSIGNED)
1118 (SIGNED)
1119 ) ;; end signedmod
1120
1121 (builtintype-types
1122 (VOID)
1123 (CHAR)
1124 (WCHAR)
1125 (SHORT
1126 INT
1127 ,(semantic-lambda
1128 (list
1129 (concat
1130 (nth 0 vals)
1131 " "
1132 (nth 1 vals))))
1133 )
1134 (SHORT)
1135 (INT)
1136 (LONG
1137 INT
1138 ,(semantic-lambda
1139 (list
1140 (concat
1141 (nth 0 vals)
1142 " "
1143 (nth 1 vals))))
1144 )
1145 (FLOAT)
1146 (DOUBLE)
1147 (BOOL)
1148 (LONG
1149 DOUBLE
1150 ,(semantic-lambda
1151 (list
1152 (concat
1153 (nth 0 vals)
1154 " "
1155 (nth 1 vals))))
1156 )
1157 (LONG
1158 LONG
1159 ,(semantic-lambda
1160 (list
1161 (concat
1162 (nth 0 vals)
1163 " "
1164 (nth 1 vals))))
1165 )
1166 (LONG)
1167 ) ;; end builtintype-types
1168
1169 (builtintype
1170 (signedmod
1171 builtintype-types
1172 ,(semantic-lambda
1173 (list
1174 (concat
1175 (car
1176 (nth 0 vals))
1177 " "
1178 (car
1179 (nth 1 vals)))))
1180 )
1181 (builtintype-types
1182 ,(semantic-lambda
1183 (nth 0 vals))
1184 )
1185 (signedmod
1186 ,(semantic-lambda
1187 (list
1188 (concat
1189 (car
1190 (nth 0 vals))
1191 " int")))
1192 )
1193 ) ;; end builtintype
1194
1195 (codeblock-var-or-fun
1196 (declmods
1197 typeformbase
1198 declmods
1199 opt-ref
1200 var-or-func-decl
1201 ,(semantic-lambda
1202 (semantic-c-reconstitute-token
1203 (nth 4 vals)
1204 (nth 0 vals)
1205 (nth 1 vals)))
1206 )
1207 ) ;; end codeblock-var-or-fun
1208
1209 (var-or-fun
1210 (codeblock-var-or-fun
1211 ,(semantic-lambda
1212 (nth 0 vals))
1213 )
1214 (declmods
1215 var-or-func-decl
1216 ,(semantic-lambda
1217 (semantic-c-reconstitute-token
1218 (nth 1 vals)
1219 (nth 0 vals) nil))
1220 )
1221 ) ;; end var-or-fun
1222
1223 (var-or-func-decl
1224 (func-decl
1225 ,(semantic-lambda
1226 (nth 0 vals))
1227 )
1228 (var-decl
1229 ,(semantic-lambda
1230 (nth 0 vals))
1231 )
1232 ) ;; end var-or-func-decl
1233
1234 (func-decl
1235 (opt-stars
1236 opt-class
1237 opt-destructor
1238 functionname
1239 opt-template-specifier
1240 opt-under-p
1241 arg-list
1242 opt-post-fcn-modifiers
1243 opt-throw
1244 opt-initializers
1245 fun-or-proto-end
1246 ,(semantic-lambda
1247 (nth 3 vals)
1248 (list
1249 'function
1250 (nth 1 vals)
1251 (nth 2 vals)
1252 (nth 6 vals)
1253 (nth 8 vals)
1254 (nth 7 vals))
1255 (nth 0 vals)
1256 (nth 10 vals)
1257 (list
1258 (nth 4 vals))
1259 (nth 9 vals))
1260 )
1261 (opt-stars
1262 opt-class
1263 opt-destructor
1264 functionname
1265 opt-template-specifier
1266 opt-under-p
1267 opt-post-fcn-modifiers
1268 opt-throw
1269 opt-initializers
1270 fun-try-end
1271 ,(semantic-lambda
1272 (nth 3 vals)
1273 (list
1274 'function
1275 (nth 1 vals)
1276 (nth 2 vals) nil
1277 (nth 7 vals)
1278 (nth 6 vals))
1279 (nth 0 vals)
1280 (nth 9 vals)
1281 (list
1282 (nth 4 vals))
1283 (nth 8 vals))
1284 )
1285 ) ;; end func-decl
1286
1287 (var-decl
1288 (varnamelist
1289 punctuation
1290 "\\`[;]\\'"
1291 ,(semantic-lambda
1292 (list
1293 (nth 0 vals)
1294 'variable))
1295 )
1296 ) ;; end var-decl
1297
1298 (opt-under-p
1299 (UNDERP
1300 ,(semantic-lambda
1301 (list nil))
1302 )
1303 (UNDERUNDERP
1304 ,(semantic-lambda
1305 (list nil))
1306 )
1307 ( ;;EMPTY
1308 )
1309 ) ;; end opt-under-p
1310
1311 (opt-initializers
1312 (punctuation
1313 "\\`[:]\\'"
1314 namespace-symbol
1315 semantic-list
1316 opt-initializers)
1317 (punctuation
1318 "\\`[,]\\'"
1319 namespace-symbol
1320 semantic-list
1321 opt-initializers)
1322 ( ;;EMPTY
1323 )
1324 ) ;; end opt-initializers
1325
1326 (opt-post-fcn-modifiers
1327 (post-fcn-modifiers
1328 opt-post-fcn-modifiers
1329 ,(semantic-lambda
1330 (cons
1331 (nth 0 vals)
1332 (nth 1 vals)))
1333 )
1334 ( ;;EMPTY
1335 ,(semantic-lambda
1336 (list nil))
1337 )
1338 ) ;; end opt-post-fcn-modifiers
1339
1340 (post-fcn-modifiers
1341 (REENTRANT)
1342 (CONST)
1343 ) ;; end post-fcn-modifiers
1344
1345 (opt-throw
1346 (THROW
1347 semantic-list
1348 ,(lambda (vals start end)
1349 (semantic-bovinate-from-nonterminal
1350 (car
1351 (nth 1 vals))
1352 (cdr
1353 (nth 1 vals))
1354 'throw-exception-list))
1355 )
1356 ( ;;EMPTY
1357 )
1358 ) ;; end opt-throw
1359
1360 (throw-exception-list
1361 (namespace-symbol
1362 punctuation
1363 "\\`[,]\\'"
1364 throw-exception-list
1365 ,(semantic-lambda
1366 (cons
1367 (car
1368 (nth 0 vals))
1369 (nth 2 vals)))
1370 )
1371 (namespace-symbol
1372 close-paren
1373 ")"
1374 ,(semantic-lambda
1375 (nth 0 vals))
1376 )
1377 (symbol
1378 close-paren
1379 ")"
1380 ,(semantic-lambda
1381 (list
1382 (nth 0 vals)))
1383 )
1384 (open-paren
1385 "("
1386 throw-exception-list
1387 ,(semantic-lambda
1388 (nth 1 vals))
1389 )
1390 (close-paren
1391 ")"
1392 ,(semantic-lambda)
1393 )
1394 ) ;; end throw-exception-list
1395
1396 (opt-bits
1397 (punctuation
1398 "\\`[:]\\'"
1399 number
1400 ,(semantic-lambda
1401 (list
1402 (nth 1 vals)))
1403 )
1404 ( ;;EMPTY
1405 ,(semantic-lambda
1406 (list nil))
1407 )
1408 ) ;; end opt-bits
1409
1410 (opt-array
1411 (semantic-list
1412 "\\[.*\\]$"
1413 opt-array
1414 ,(semantic-lambda
1415 (list
1416 (cons
1417 1
1418 (car
1419 (nth 1 vals)))))
1420 )
1421 ( ;;EMPTY
1422 ,(semantic-lambda
1423 (list nil))
1424 )
1425 ) ;; end opt-array
1426
1427 (opt-assign
1428 (punctuation
1429 "\\`[=]\\'"
1430 expression
1431 ,(semantic-lambda
1432 (list
1433 (nth 1 vals)))
1434 )
1435 ( ;;EMPTY
1436 ,(semantic-lambda
1437 (list nil))
1438 )
1439 ) ;; end opt-assign
1440
1441 (opt-restrict
1442 (symbol
1443 "\\<\\(__\\)?restrict\\>")
1444 ( ;;EMPTY
1445 )
1446 ) ;; end opt-restrict
1447
1448 (varname
1449 (opt-stars
1450 opt-restrict
1451 namespace-symbol
1452 opt-bits
1453 opt-array
1454 ,(semantic-lambda
1455 (nth 2 vals)
1456 (nth 0 vals)
1457 (nth 3 vals)
1458 (nth 4 vals))
1459 )
1460 ) ;; end varname
1461
1462 (variablearg
1463 (declmods
1464 typeformbase
1465 cv-declmods
1466 opt-ref
1467 variablearg-opt-name
1468 ,(semantic-lambda
1469 (semantic-tag-new-variable
1470 (list
1471 (nth 4 vals))
1472 (nth 1 vals) nil :constant-flag
1473 (if
1474 (member
1475 "const"
1476 (append
1477 (nth 0 vals)
1478 (nth 2 vals))) t nil) :typemodifiers
1479 (delete
1480 "const"
1481 (append
1482 (nth 0 vals)
1483 (nth 2 vals))) :reference
1484 (car
1485 (nth 3 vals))))
1486 )
1487 ) ;; end variablearg
1488
1489 (variablearg-opt-name
1490 (varname
1491 ,(semantic-lambda
1492 (nth 0 vals))
1493 )
1494 (opt-stars
1495 ,(semantic-lambda
1496 (list
1497 "")
1498 (nth 0 vals)
1499 (list nil nil nil))
1500 )
1501 ) ;; end variablearg-opt-name
1502
1503 (varname-opt-initializer
1504 (semantic-list)
1505 (opt-assign)
1506 ( ;;EMPTY
1507 )
1508 ) ;; end varname-opt-initializer
1509
1510 (varnamelist
1511 (opt-ref
1512 varname
1513 varname-opt-initializer
1514 punctuation
1515 "\\`[,]\\'"
1516 varnamelist
1517 ,(semantic-lambda
1518 (cons
1519 (nth 1 vals)
1520 (nth 4 vals)))
1521 )
1522 (opt-ref
1523 varname
1524 varname-opt-initializer
1525 ,(semantic-lambda
1526 (list
1527 (nth 1 vals)))
1528 )
1529 ) ;; end varnamelist
1530
1531 (namespace-symbol
1532 (symbol
1533 opt-template-specifier
1534 punctuation
1535 "\\`[:]\\'"
1536 punctuation
1537 "\\`[:]\\'"
1538 namespace-symbol
1539 ,(semantic-lambda
1540 (list
1541 (concat
1542 (nth 0 vals)
1543 "::"
1544 (car
1545 (nth 4 vals)))))
1546 )
1547 (symbol
1548 opt-template-specifier
1549 ,(semantic-lambda
1550 (list
1551 (nth 0 vals)))
1552 )
1553 ) ;; end namespace-symbol
1554
1555 (namespace-symbol-for-typeformbase
1556 (symbol
1557 opt-template-specifier
1558 punctuation
1559 "\\`[:]\\'"
1560 punctuation
1561 "\\`[:]\\'"
1562 namespace-symbol-for-typeformbase
1563 ,(semantic-lambda
1564 (list
1565 (concat
1566 (nth 0 vals)
1567 "::"
1568 (car
1569 (nth 4 vals)))))
1570 )
1571 (symbol
1572 ,(semantic-lambda
1573 (list
1574 (nth 0 vals)))
1575 )
1576 ) ;; end namespace-symbol-for-typeformbase
1577
1578 (namespace-opt-class
1579 (symbol
1580 punctuation
1581 "\\`[:]\\'"
1582 punctuation
1583 "\\`[:]\\'"
1584 namespace-opt-class
1585 ,(semantic-lambda
1586 (list
1587 (concat
1588 (nth 0 vals)
1589 "::"
1590 (car
1591 (nth 3 vals)))))
1592 )
1593 (symbol
1594 opt-template-specifier
1595 punctuation
1596 "\\`[:]\\'"
1597 punctuation
1598 "\\`[:]\\'"
1599 ,(semantic-lambda
1600 (list
1601 (nth 0 vals)))
1602 )
1603 ) ;; end namespace-opt-class
1604
1605 (opt-class
1606 (namespace-opt-class
1607 ,(semantic-lambda
1608 (nth 0 vals))
1609 )
1610 ( ;;EMPTY
1611 ,(semantic-lambda
1612 (list nil))
1613 )
1614 ) ;; end opt-class
1615
1616 (opt-destructor
1617 (punctuation
1618 "\\`[~]\\'"
1619 ,(semantic-lambda
1620 (list t))
1621 )
1622 ( ;;EMPTY
1623 ,(semantic-lambda
1624 (list nil))
1625 )
1626 ) ;; end opt-destructor
1627
1628 (arg-list
1629 (semantic-list
1630 "^("
1631 knr-arguments
1632 ,(semantic-lambda
1633 (nth 1 vals))
1634 )
1635 (semantic-list
1636 "^("
1637 ,(semantic-lambda
1638 (semantic-parse-region
1639 (car
1640 (nth 0 vals))
1641 (cdr
1642 (nth 0 vals))
1643 'arg-sub-list
1644 1))
1645 )
1646 (semantic-list
1647 "^(void)$"
1648 ,(semantic-lambda)
1649 )
1650 ) ;; end arg-list
1651
1652 (knr-varnamelist
1653 (varname
1654 punctuation
1655 "\\`[,]\\'"
1656 knr-varnamelist
1657 ,(semantic-lambda
1658 (cons
1659 (nth 0 vals)
1660 (nth 2 vals)))
1661 )
1662 (varname
1663 ,(semantic-lambda
1664 (list
1665 (nth 0 vals)))
1666 )
1667 ) ;; end knr-varnamelist
1668
1669 (knr-one-variable-decl
1670 (declmods
1671 typeformbase
1672 cv-declmods
1673 knr-varnamelist
1674 ,(semantic-lambda
1675 (semantic-tag-new-variable
1676 (nreverse
1677 (nth 3 vals))
1678 (nth 1 vals) nil :constant-flag
1679 (if
1680 (member
1681 "const"
1682 (append
1683 (nth 2 vals))) t nil) :typemodifiers
1684 (delete
1685 "const"
1686 (nth 2 vals))))
1687 )
1688 ) ;; end knr-one-variable-decl
1689
1690 (knr-arguments
1691 (knr-one-variable-decl
1692 punctuation
1693 "\\`[;]\\'"
1694 knr-arguments
1695 ,(semantic-lambda
1696 (append
1697 (semantic-expand-c-tag
1698 (nth 0 vals))
1699 (nth 2 vals)))
1700 )
1701 (knr-one-variable-decl
1702 punctuation
1703 "\\`[;]\\'"
1704 ,(semantic-lambda
1705 (semantic-expand-c-tag
1706 (nth 0 vals)))
1707 )
1708 ) ;; end knr-arguments
1709
1710 (arg-sub-list
1711 (variablearg
1712 ,(semantic-lambda
1713 (nth 0 vals))
1714 )
1715 (punctuation
1716 "\\`[.]\\'"
1717 punctuation
1718 "\\`[.]\\'"
1719 punctuation
1720 "\\`[.]\\'"
1721 close-paren
1722 ")"
1723 ,(semantic-lambda
1724 (semantic-tag-new-variable
1725 "..."
1726 "vararg" nil))
1727 )
1728 (punctuation
1729 "\\`[,]\\'"
1730 ,(semantic-lambda
1731 (list nil))
1732 )
1733 (open-paren
1734 "("
1735 ,(semantic-lambda
1736 (list nil))
1737 )
1738 (close-paren
1739 ")"
1740 ,(semantic-lambda
1741 (list nil))
1742 )
1743 ) ;; end arg-sub-list
1744
1745 (operatorsym
1746 (punctuation
1747 "\\`[<]\\'"
1748 punctuation
1749 "\\`[<]\\'"
1750 punctuation
1751 "\\`[=]\\'"
1752 ,(semantic-lambda
1753 (list
1754 "<<="))
1755 )
1756 (punctuation
1757 "\\`[>]\\'"
1758 punctuation
1759 "\\`[>]\\'"
1760 punctuation
1761 "\\`[=]\\'"
1762 ,(semantic-lambda
1763 (list
1764 ">>="))
1765 )
1766 (punctuation
1767 "\\`[<]\\'"
1768 punctuation
1769 "\\`[<]\\'"
1770 ,(semantic-lambda
1771 (list
1772 "<<"))
1773 )
1774 (punctuation
1775 "\\`[>]\\'"
1776 punctuation
1777 "\\`[>]\\'"
1778 ,(semantic-lambda
1779 (list
1780 ">>"))
1781 )
1782 (punctuation
1783 "\\`[=]\\'"
1784 punctuation
1785 "\\`[=]\\'"
1786 ,(semantic-lambda
1787 (list
1788 "=="))
1789 )
1790 (punctuation
1791 "\\`[<]\\'"
1792 punctuation
1793 "\\`[=]\\'"
1794 ,(semantic-lambda
1795 (list
1796 "<="))
1797 )
1798 (punctuation
1799 "\\`[>]\\'"
1800 punctuation
1801 "\\`[=]\\'"
1802 ,(semantic-lambda
1803 (list
1804 ">="))
1805 )
1806 (punctuation
1807 "\\`[!]\\'"
1808 punctuation
1809 "\\`[=]\\'"
1810 ,(semantic-lambda
1811 (list
1812 "!="))
1813 )
1814 (punctuation
1815 "\\`[+]\\'"
1816 punctuation
1817 "\\`[=]\\'"
1818 ,(semantic-lambda
1819 (list
1820 "+="))
1821 )
1822 (punctuation
1823 "\\`[-]\\'"
1824 punctuation
1825 "\\`[=]\\'"
1826 ,(semantic-lambda
1827 (list
1828 "-="))
1829 )
1830 (punctuation
1831 "\\`[*]\\'"
1832 punctuation
1833 "\\`[=]\\'"
1834 ,(semantic-lambda
1835 (list
1836 "*="))
1837 )
1838 (punctuation
1839 "\\`[/]\\'"
1840 punctuation
1841 "\\`[=]\\'"
1842 ,(semantic-lambda
1843 (list
1844 "/="))
1845 )
1846 (punctuation
1847 "\\`[%]\\'"
1848 punctuation
1849 "\\`[=]\\'"
1850 ,(semantic-lambda
1851 (list
1852 "%="))
1853 )
1854 (punctuation
1855 "\\`[&]\\'"
1856 punctuation
1857 "\\`[=]\\'"
1858 ,(semantic-lambda
1859 (list
1860 "&="))
1861 )
1862 (punctuation
1863 "\\`[|]\\'"
1864 punctuation
1865 "\\`[=]\\'"
1866 ,(semantic-lambda
1867 (list
1868 "|="))
1869 )
1870 (punctuation
1871 "\\`[-]\\'"
1872 punctuation
1873 "\\`[>]\\'"
1874 punctuation
1875 "\\`[*]\\'"
1876 ,(semantic-lambda
1877 (list
1878 "->*"))
1879 )
1880 (punctuation
1881 "\\`[-]\\'"
1882 punctuation
1883 "\\`[>]\\'"
1884 ,(semantic-lambda
1885 (list
1886 "->"))
1887 )
1888 (semantic-list
1889 "()"
1890 ,(semantic-lambda
1891 (list
1892 "()"))
1893 )
1894 (semantic-list
1895 "\\[\\]"
1896 ,(semantic-lambda
1897 (list
1898 "[]"))
1899 )
1900 (punctuation
1901 "\\`[<]\\'")
1902 (punctuation
1903 "\\`[>]\\'")
1904 (punctuation
1905 "\\`[*]\\'")
1906 (punctuation
1907 "\\`[+]\\'"
1908 punctuation
1909 "\\`[+]\\'"
1910 ,(semantic-lambda
1911 (list
1912 "++"))
1913 )
1914 (punctuation
1915 "\\`[+]\\'")
1916 (punctuation
1917 "\\`[-]\\'"
1918 punctuation
1919 "\\`[-]\\'"
1920 ,(semantic-lambda
1921 (list
1922 "--"))
1923 )
1924 (punctuation
1925 "\\`[-]\\'")
1926 (punctuation
1927 "\\`[&]\\'"
1928 punctuation
1929 "\\`[&]\\'"
1930 ,(semantic-lambda
1931 (list
1932 "&&"))
1933 )
1934 (punctuation
1935 "\\`[&]\\'")
1936 (punctuation
1937 "\\`[|]\\'"
1938 punctuation
1939 "\\`[|]\\'"
1940 ,(semantic-lambda
1941 (list
1942 "||"))
1943 )
1944 (punctuation
1945 "\\`[|]\\'")
1946 (punctuation
1947 "\\`[/]\\'")
1948 (punctuation
1949 "\\`[=]\\'")
1950 (punctuation
1951 "\\`[!]\\'")
1952 (punctuation
1953 "\\`[~]\\'")
1954 (punctuation
1955 "\\`[%]\\'")
1956 (punctuation
1957 "\\`[,]\\'")
1958 (punctuation
1959 "\\`\\^\\'"
1960 punctuation
1961 "\\`[=]\\'"
1962 ,(semantic-lambda
1963 (list
1964 "^="))
1965 )
1966 (punctuation
1967 "\\`\\^\\'")
1968 ) ;; end operatorsym
1969
1970 (functionname
1971 (OPERATOR
1972 operatorsym
1973 ,(semantic-lambda
1974 (nth 1 vals))
1975 )
1976 (semantic-list
1977 ,(lambda (vals start end)
1978 (semantic-bovinate-from-nonterminal
1979 (car
1980 (nth 0 vals))
1981 (cdr
1982 (nth 0 vals))
1983 'function-pointer))
1984 )
1985 (symbol
1986 ,(semantic-lambda
1987 (list
1988 (nth 0 vals)))
1989 )
1990 ) ;; end functionname
1991
1992 (function-pointer
1993 (open-paren
1994 "("
1995 punctuation
1996 "\\`[*]\\'"
1997 symbol
1998 close-paren
1999 ")"
2000 ,(semantic-lambda
2001 (list
2002 (concat
2003 "*"
2004 (nth 2 vals))))
2005 )
2006 (open-paren
2007 "("
2008 symbol
2009 close-paren
2010 ")"
2011 ,(semantic-lambda
2012 (list
2013 (nth 1 vals)))
2014 )
2015 ) ;; end function-pointer
2016
2017 (fun-or-proto-end
2018 (punctuation
2019 "\\`[;]\\'"
2020 ,(semantic-lambda
2021 (list t))
2022 )
2023 (semantic-list
2024 ,(semantic-lambda
2025 (list nil))
2026 )
2027 (punctuation
2028 "\\`[=]\\'"
2029 number
2030 "^0$"
2031 punctuation
2032 "\\`[;]\\'"
2033 ,(semantic-lambda
2034 (list ':pure-virtual-flag))
2035 )
2036 (fun-try-end
2037 ,(semantic-lambda
2038 (list nil))
2039 )
2040 ) ;; end fun-or-proto-end
2041
2042 (fun-try-end
2043 (TRY
2044 opt-initializers
2045 semantic-list
2046 "^{"
2047 fun-try-several-catches
2048 ,(semantic-lambda
2049 (list nil))
2050 )
2051 ) ;; end fun-try-end
2052
2053 (fun-try-several-catches
2054 (CATCH
2055 semantic-list
2056 "^("
2057 semantic-list
2058 "^{"
2059 fun-try-several-catches
2060 ,(semantic-lambda)
2061 )
2062 (CATCH
2063 semantic-list
2064 "^{"
2065 fun-try-several-catches
2066 ,(semantic-lambda)
2067 )
2068 ( ;;EMPTY
2069 ,(semantic-lambda)
2070 )
2071 ) ;; end fun-try-several-catches
2072
2073 (type-cast
2074 (semantic-list
2075 ,(lambda (vals start end)
2076 (semantic-bovinate-from-nonterminal
2077 (car
2078 (nth 0 vals))
2079 (cdr
2080 (nth 0 vals))
2081 'type-cast-list))
2082 )
2083 ) ;; end type-cast
2084
2085 (type-cast-list
2086 (open-paren
2087 typeformbase
2088 close-paren)
2089 ) ;; end type-cast-list
2090
2091 (opt-stuff-after-symbol
2092 (semantic-list
2093 "^(")
2094 (semantic-list
2095 "\\[.*\\]$")
2096 ( ;;EMPTY
2097 )
2098 ) ;; end opt-stuff-after-symbol
2099
2100 (multi-stage-dereference
2101 (namespace-symbol
2102 opt-stuff-after-symbol
2103 punctuation
2104 "\\`[.]\\'"
2105 multi-stage-dereference)
2106 (namespace-symbol
2107 opt-stuff-after-symbol
2108 punctuation
2109 "\\`[-]\\'"
2110 punctuation
2111 "\\`[>]\\'"
2112 multi-stage-dereference)
2113 (namespace-symbol
2114 opt-stuff-after-symbol)
2115 ) ;; end multi-stage-dereference
2116
2117 (string-seq
2118 (string
2119 string-seq
2120 ,(semantic-lambda
2121 (list
2122 (concat
2123 (nth 0 vals)
2124 (car
2125 (nth 1 vals)))))
2126 )
2127 (string
2128 ,(semantic-lambda
2129 (list
2130 (nth 0 vals)))
2131 )
2132 ) ;; end string-seq
2133
2134 (expr-start
2135 (punctuation
2136 "\\`[-]\\'")
2137 (punctuation
2138 "\\`[+]\\'")
2139 (punctuation
2140 "\\`[*]\\'")
2141 (punctuation
2142 "\\`[&]\\'")
2143 ) ;; end expr-start
2144
2145 (expr-binop
2146 (punctuation
2147 "\\`[-]\\'")
2148 (punctuation
2149 "\\`[+]\\'")
2150 (punctuation
2151 "\\`[*]\\'")
2152 (punctuation
2153 "\\`[/]\\'")
2154 (punctuation
2155 "\\`[&]\\'"
2156 punctuation
2157 "\\`[&]\\'")
2158 (punctuation
2159 "\\`[&]\\'")
2160 (punctuation
2161 "\\`[|]\\'"
2162 punctuation
2163 "\\`[|]\\'")
2164 (punctuation
2165 "\\`[|]\\'")
2166 ) ;; end expr-binop
2167
2168 (expression
2169 (unaryexpression
2170 expr-binop
2171 unaryexpression
2172 ,(semantic-lambda
2173 (list
2174 (identity start)
2175 (identity end)))
2176 )
2177 (unaryexpression
2178 ,(semantic-lambda
2179 (list
2180 (identity start)
2181 (identity end)))
2182 )
2183 ) ;; end expression
2184
2185 (unaryexpression
2186 (number)
2187 (multi-stage-dereference)
2188 (NEW
2189 multi-stage-dereference)
2190 (NEW
2191 builtintype-types
2192 semantic-list)
2193 (namespace-symbol)
2194 (string-seq)
2195 (type-cast
2196 expression)
2197 (semantic-list
2198 expression)
2199 (semantic-list)
2200 (expr-start
2201 expression)
2202 ) ;; end unaryexpression
2203 )
2204 "Parser table.")
2205
2206(defun semantic-c-by--install-parser ()
2207 "Setup the Semantic Parser."
2208 (setq semantic--parse-table semantic-c-by--parse-table
2209 semantic-debug-parser-source "c.by"
2210 semantic-debug-parser-class 'semantic-bovine-debug-parser
2211 semantic-flex-keywords-obarray semantic-c-by--keyword-table
2212 semantic-equivalent-major-modes '(c-mode c++-mode)
2213 ))
2214
2215
2216;;; Analyzers
2217;;
2218
2219;;; Epilogue
2220;;
2221
2222(provide 'semantic/bovine/c-by)
2223
2224;;; semantic/bovine/c-by.el ends here
diff --git a/lisp/cedet/semantic/bovine/grammar.el b/lisp/cedet/semantic/bovine/grammar.el
index 0133ee72b18..8a87fa9170e 100644
--- a/lisp/cedet/semantic/bovine/grammar.el
+++ b/lisp/cedet/semantic/bovine/grammar.el
@@ -443,34 +443,39 @@ Menu items are appended to the common grammar menu.")
443 ) 443 )
444 "Semantic grammar macros used in bovine grammars.") 444 "Semantic grammar macros used in bovine grammars.")
445 445
446(defun bovine-make-parsers () 446(defun bovine--make-parser-1 (infile &optional outdir)
447 "Generate Emacs' built-in Bovine-based parser files." 447 (if outdir (setq outdir (file-name-directory (expand-file-name outdir))))
448 (interactive) 448 ;; It would be nicer to use a temp-buffer rather than find-file-noselect.
449 (semantic-mode 1) 449 ;; The only thing stopping us is bovine-grammar-setupcode-builder's
450 ;; Loop through each .by file in current directory, and run 450 ;; use of (buffer-name). Perhaps that could be changed to
451 ;; `semantic-grammar-batch-build-one-package' to build the grammar. 451 ;; (file-name-nondirectory (buffer-file-name)) ?
452 (dolist (f (directory-files default-directory nil "\\.by\\'")) 452;; (with-temp-buffer
453 (let ((packagename 453;; (insert-file-contents infile)
454 (condition-case err 454;; (bovine-grammar-mode)
455 (with-current-buffer (find-file-noselect f) 455;; (setq buffer-file-name (expand-file-name infile))
456 (semantic-grammar-create-package)) 456;; (if outdir (setq default-directory outdir))
457 (error (message "%s" (error-message-string err)) nil))) 457 (let ((packagename
458 lang filename copyright-end) 458 ;; This is with-demoted-errors.
459 (when (and packagename 459 (condition-case err
460 (string-match "^.*/\\(.*\\)-by\\.el\\'" packagename)) 460 (with-current-buffer (find-file-noselect infile)
461 (setq lang (match-string 1 packagename)) 461 (if outdir (setq default-directory outdir))
462 (setq filename (concat lang "-by.el")) 462 (semantic-grammar-create-package nil t))
463 (with-temp-buffer 463 (error (message "%s" (error-message-string err)) nil)))
464 (insert-file-contents filename) 464 lang filename copyright-end)
465 (setq buffer-file-name (expand-file-name filename)) 465 (when (and packagename
466 ;; Fix copyright header: 466 (string-match "^.*/\\(.*\\)-by\\.el\\'" packagename))
467 (goto-char (point-min)) 467 (setq lang (match-string 1 packagename))
468 (re-search-forward "^;; Author:") 468 (setq filename (expand-file-name (concat lang "-by.el") outdir))
469 (setq copyright-end (match-beginning 0)) 469 (with-temp-file filename
470 (re-search-forward "^;;; Code:\n") 470 (insert-file-contents filename)
471 (delete-region copyright-end (match-end 0)) 471 ;; Fix copyright header:
472 (goto-char copyright-end) 472 (goto-char (point-min))
473 (insert ";; This file is part of GNU Emacs. 473 (re-search-forward "^;; Author:")
474 (setq copyright-end (match-beginning 0))
475 (re-search-forward "^;;; Code:\n")
476 (delete-region copyright-end (match-end 0))
477 (goto-char copyright-end)
478 (insert ";; This file is part of GNU Emacs.
474 479
475;; GNU Emacs is free software: you can redistribute it and/or modify 480;; GNU Emacs is free software: you can redistribute it and/or modify
476;; it under the terms of the GNU General Public License as published by 481;; it under the terms of the GNU General Public License as published by
@@ -488,18 +493,50 @@ Menu items are appended to the common grammar menu.")
488;;; Commentary: 493;;; Commentary:
489;; 494;;
490;; This file was generated from admin/grammars/" 495;; This file was generated from admin/grammars/"
491 lang ".by. 496 lang ".by.
492 497
493;;; Code: 498;;; Code:
494") 499")
495 (goto-char (point-min)) 500 (goto-char (point-min))
496 (delete-region (point-min) (line-end-position)) 501 (delete-region (point-min) (line-end-position))
497 (insert ";;; " packagename 502 (insert ";;; " packagename
498 " --- Generated parser support file") 503 " --- Generated parser support file")
499 (delete-trailing-whitespace) 504 (delete-trailing-whitespace)
500 (re-search-forward ";;; \\(.*\\) ends here") 505 (re-search-forward ";;; \\(.*\\) ends here")
501 (replace-match packagename nil nil nil 1) 506 (replace-match packagename nil nil nil 1)))))
502 (save-buffer)))))) 507
508(defun bovine-make-parsers ()
509 "Generate Emacs's built-in Bovine-based parser files."
510 (interactive)
511 (semantic-mode 1)
512 ;; Loop through each .by file in current directory, and run
513 ;; `semantic-grammar-batch-build-one-package' to build the grammar.
514 (dolist (f (directory-files default-directory nil "\\.by\\'"))
515 (bovine--make-parser-1 f)))
516
517
518(defun bovine-batch-make-parser (&optional infile outdir)
519 "Generate a Bovine parser from input INFILE, writing to OUTDIR.
520This is mainly intended for use in batch mode:
521
522emacs -batch -l semantic/bovine/grammar -f bovine-make-parser-batch \\
523 [-dir output-dir | -o output-file] file.by
524
525If -o is supplied, only the directory part is used."
526 (semantic-mode 1)
527 (when (and noninteractive (not infile))
528 (let (arg)
529 (while command-line-args-left
530 (setq arg (pop command-line-args-left))
531 (cond ((string-equal arg "-dir")
532 (setq outdir (pop command-line-args-left)))
533 ((string-equal arg "-o")
534 (setq outdir (file-name-directory (pop command-line-args-left))))
535 (t (setq infile arg))))))
536 (or infile (error "No input file specified"))
537 (or (file-readable-p infile)
538 (error "Input file `%s' not readable" infile))
539 (bovine--make-parser-1 infile outdir))
503 540
504(provide 'semantic/bovine/grammar) 541(provide 'semantic/bovine/grammar)
505 542
diff --git a/lisp/cedet/semantic/bovine/make-by.el b/lisp/cedet/semantic/bovine/make-by.el
deleted file mode 100644
index b94cfa44aac..00000000000
--- a/lisp/cedet/semantic/bovine/make-by.el
+++ /dev/null
@@ -1,391 +0,0 @@
1;;; semantic/bovine/make-by.el --- Generated parser support file
2
3;; Copyright (C) 1999-2004, 2008-2013 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
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.
11
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.
16
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/>.
19
20;;; Commentary:
21;;
22;; This file was generated from admin/grammars/make.by.
23
24;;; Code:
25
26(require 'semantic/lex)
27(eval-when-compile (require 'semantic/bovine))
28
29;;; Prologue
30;;
31
32;;; Declarations
33;;
34(defconst semantic-make-by--keyword-table
35 (semantic-lex-make-keyword-table
36 '(("if" . IF)
37 ("ifdef" . IFDEF)
38 ("ifndef" . IFNDEF)
39 ("ifeq" . IFEQ)
40 ("ifneq" . IFNEQ)
41 ("else" . ELSE)
42 ("endif" . ENDIF)
43 ("include" . INCLUDE))
44 '(("include" summary "Macro: include filename1 filename2 ...")
45 ("ifneq" summary "Conditional: ifneq (expression) ... else ... endif")
46 ("ifeq" summary "Conditional: ifeq (expression) ... else ... endif")
47 ("ifndef" summary "Conditional: ifndef (expression) ... else ... endif")
48 ("ifdef" summary "Conditional: ifdef (expression) ... else ... endif")
49 ("endif" summary "Conditional: if (expression) ... else ... endif")
50 ("else" summary "Conditional: if (expression) ... else ... endif")
51 ("if" summary "Conditional: if (expression) ... else ... endif")))
52 "Table of language keywords.")
53
54(defconst semantic-make-by--token-table
55 (semantic-lex-make-type-table
56 '(("punctuation"
57 (BACKSLASH . "\\`[\\]\\'")
58 (DOLLAR . "\\`[$]\\'")
59 (EQUAL . "\\`[=]\\'")
60 (PLUS . "\\`[+]\\'")
61 (COLON . "\\`[:]\\'")))
62 'nil)
63 "Table of lexical tokens.")
64
65(defconst semantic-make-by--parse-table
66 `(
67 (bovine-toplevel
68 (Makefile)
69 ) ;; end bovine-toplevel
70
71 (Makefile
72 (bol
73 newline
74 ,(semantic-lambda
75 (list nil))
76 )
77 (bol
78 variable
79 ,(semantic-lambda
80 (nth 1 vals))
81 )
82 (bol
83 rule
84 ,(semantic-lambda
85 (nth 1 vals))
86 )
87 (bol
88 conditional
89 ,(semantic-lambda
90 (nth 1 vals))
91 )
92 (bol
93 include
94 ,(semantic-lambda
95 (nth 1 vals))
96 )
97 (whitespace
98 ,(semantic-lambda
99 (list nil))
100 )
101 (newline
102 ,(semantic-lambda
103 (list nil))
104 )
105 ) ;; end Makefile
106
107 (variable
108 (symbol
109 opt-whitespace
110 equals
111 opt-whitespace
112 element-list
113 ,(semantic-lambda
114 (semantic-tag-new-variable
115 (nth 0 vals) nil
116 (nth 4 vals)))
117 )
118 ) ;; end variable
119
120 (rule
121 (targets
122 opt-whitespace
123 colons
124 opt-whitespace
125 element-list
126 commands
127 ,(semantic-lambda
128 (semantic-tag-new-function
129 (nth 0 vals) nil
130 (nth 4 vals)))
131 )
132 ) ;; end rule
133
134 (targets
135 (target
136 opt-whitespace
137 targets
138 ,(semantic-lambda
139 (list
140 (car
141 (nth 0 vals))
142 (car
143 (nth 2 vals))))
144 )
145 (target
146 ,(semantic-lambda
147 (list
148 (car
149 (nth 0 vals))))
150 )
151 ) ;; end targets
152
153 (target
154 (sub-target
155 target
156 ,(semantic-lambda
157 (list
158 (concat
159 (car
160 (nth 0 vals))
161 (car
162 (nth 2 vals)))))
163 )
164 (sub-target
165 ,(semantic-lambda
166 (list
167 (car
168 (nth 0 vals))))
169 )
170 ) ;; end target
171
172 (sub-target
173 (symbol)
174 (string)
175 (varref)
176 ) ;; end sub-target
177
178 (conditional
179 (IF
180 some-whitespace
181 symbol
182 newline
183 ,(semantic-lambda
184 (list nil))
185 )
186 (IFDEF
187 some-whitespace
188 symbol
189 newline
190 ,(semantic-lambda
191 (list nil))
192 )
193 (IFNDEF
194 some-whitespace
195 symbol
196 newline
197 ,(semantic-lambda
198 (list nil))
199 )
200 (IFEQ
201 some-whitespace
202 expression
203 newline
204 ,(semantic-lambda
205 (list nil))
206 )
207 (IFNEQ
208 some-whitespace
209 expression
210 newline
211 ,(semantic-lambda
212 (list nil))
213 )
214 (ELSE
215 newline
216 ,(semantic-lambda
217 (list nil))
218 )
219 (ENDIF
220 newline
221 ,(semantic-lambda
222 (list nil))
223 )
224 ) ;; end conditional
225
226 (expression
227 (semantic-list)
228 ) ;; end expression
229
230 (include
231 (INCLUDE
232 some-whitespace
233 element-list
234 ,(semantic-lambda
235 (semantic-tag-new-include
236 (nth 2 vals) nil))
237 )
238 ) ;; end include
239
240 (equals
241 (punctuation
242 "\\`[:]\\'"
243 punctuation
244 "\\`[=]\\'"
245 ,(semantic-lambda)
246 )
247 (punctuation
248 "\\`[+]\\'"
249 punctuation
250 "\\`[=]\\'"
251 ,(semantic-lambda)
252 )
253 (punctuation
254 "\\`[=]\\'"
255 ,(semantic-lambda)
256 )
257 ) ;; end equals
258
259 (colons
260 (punctuation
261 "\\`[:]\\'"
262 punctuation
263 "\\`[:]\\'"
264 ,(semantic-lambda)
265 )
266 (punctuation
267 "\\`[:]\\'"
268 ,(semantic-lambda)
269 )
270 ) ;; end colons
271
272 (element-list
273 (elements
274 newline
275 ,(semantic-lambda
276 (nth 0 vals))
277 )
278 ) ;; end element-list
279
280 (elements
281 (element
282 some-whitespace
283 elements
284 ,(semantic-lambda
285 (nth 0 vals)
286 (nth 2 vals))
287 )
288 (element
289 ,(semantic-lambda
290 (nth 0 vals))
291 )
292 ( ;;EMPTY
293 )
294 ) ;; end elements
295
296 (element
297 (sub-element
298 element
299 ,(semantic-lambda
300 (list
301 (concat
302 (car
303 (nth 0 vals))
304 (car
305 (nth 1 vals)))))
306 )
307 ( ;;EMPTY
308 )
309 ) ;; end element
310
311 (sub-element
312 (symbol)
313 (string)
314 (punctuation)
315 (semantic-list
316 ,(semantic-lambda
317 (list
318 (buffer-substring-no-properties
319 (identity start)
320 (identity end))))
321 )
322 ) ;; end sub-element
323
324 (varref
325 (punctuation
326 "\\`[$]\\'"
327 semantic-list
328 ,(semantic-lambda
329 (list
330 (buffer-substring-no-properties
331 (identity start)
332 (identity end))))
333 )
334 ) ;; end varref
335
336 (commands
337 (bol
338 shell-command
339 newline
340 commands
341 ,(semantic-lambda
342 (list
343 (nth 0 vals))
344 (nth 1 vals))
345 )
346 ( ;;EMPTY
347 ,(semantic-lambda)
348 )
349 ) ;; end commands
350
351 (opt-whitespace
352 (some-whitespace
353 ,(semantic-lambda
354 (list nil))
355 )
356 ( ;;EMPTY
357 )
358 ) ;; end opt-whitespace
359
360 (some-whitespace
361 (whitespace
362 some-whitespace
363 ,(semantic-lambda
364 (list nil))
365 )
366 (whitespace
367 ,(semantic-lambda
368 (list nil))
369 )
370 ) ;; end some-whitespace
371 )
372 "Parser table.")
373
374(defun semantic-make-by--install-parser ()
375 "Setup the Semantic Parser."
376 (setq semantic--parse-table semantic-make-by--parse-table
377 semantic-debug-parser-source "make.by"
378 semantic-debug-parser-class 'semantic-bovine-debug-parser
379 semantic-flex-keywords-obarray semantic-make-by--keyword-table
380 ))
381
382
383;;; Analyzers
384;;
385
386;;; Epilogue
387;;
388
389(provide 'semantic/bovine/make-by)
390
391;;; semantic/bovine/make-by.el ends here
diff --git a/lisp/cedet/semantic/bovine/scm-by.el b/lisp/cedet/semantic/bovine/scm-by.el
deleted file mode 100644
index 261607c84d1..00000000000
--- a/lisp/cedet/semantic/bovine/scm-by.el
+++ /dev/null
@@ -1,196 +0,0 @@
1;;; semantic/bovine/scm-by.el --- Generated parser support file
2
3;; Copyright (C) 2001, 2003, 2009-2013 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
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.
11
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.
16
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/>.
19
20;;; Commentary:
21;;
22;; This file was generated from admin/grammars/scm.by.
23
24;;; Code:
25
26(require 'semantic/lex)
27(eval-when-compile (require 'semantic/bovine))
28
29;;; Prologue
30;;
31
32;;; Declarations
33;;
34(defconst semantic-scm-by--keyword-table
35 (semantic-lex-make-keyword-table
36 '(("define" . DEFINE)
37 ("define-module" . DEFINE-MODULE)
38 ("load" . LOAD))
39 '(("load" summary "Function: (load \"filename\")")
40 ("define-module" summary "Function: (define-module (name arg1 ...)) ")
41 ("define" summary "Function: (define symbol expression)")))
42 "Table of language keywords.")
43
44(defconst semantic-scm-by--token-table
45 (semantic-lex-make-type-table
46 '(("close-paren"
47 (CLOSEPAREN . ")"))
48 ("open-paren"
49 (OPENPAREN . "(")))
50 'nil)
51 "Table of lexical tokens.")
52
53(defconst semantic-scm-by--parse-table
54 `(
55 (bovine-toplevel
56 (scheme)
57 ) ;; end bovine-toplevel
58
59 (scheme
60 (semantic-list
61 ,(lambda (vals start end)
62 (semantic-bovinate-from-nonterminal
63 (car
64 (nth 0 vals))
65 (cdr
66 (nth 0 vals))
67 'scheme-list))
68 )
69 ) ;; end scheme
70
71 (scheme-list
72 (open-paren
73 "("
74 scheme-in-list
75 close-paren
76 ")"
77 ,(semantic-lambda
78 (nth 1 vals))
79 )
80 ) ;; end scheme-list
81
82 (scheme-in-list
83 (DEFINE
84 symbol
85 expression
86 ,(semantic-lambda
87 (semantic-tag-new-variable
88 (nth 1 vals) nil
89 (nth 2 vals)))
90 )
91 (DEFINE
92 name-args
93 opt-doc
94 sequence
95 ,(semantic-lambda
96 (semantic-tag-new-function
97 (car
98 (nth 1 vals)) nil
99 (cdr
100 (nth 1 vals))))
101 )
102 (DEFINE-MODULE
103 name-args
104 ,(semantic-lambda
105 (semantic-tag-new-package
106 (nth
107 (length
108 (nth 1 vals))
109 (nth 1 vals)) nil))
110 )
111 (LOAD
112 string
113 ,(semantic-lambda
114 (semantic-tag-new-include
115 (file-name-nondirectory
116 (read
117 (nth 1 vals)))
118 (read
119 (nth 1 vals))))
120 )
121 (symbol
122 ,(semantic-lambda
123 (semantic-tag-new-code
124 (nth 0 vals) nil))
125 )
126 ) ;; end scheme-in-list
127
128 (name-args
129 (semantic-list
130 ,(lambda (vals start end)
131 (semantic-bovinate-from-nonterminal
132 (car
133 (nth 0 vals))
134 (cdr
135 (nth 0 vals))
136 'name-arg-expand))
137 )
138 ) ;; end name-args
139
140 (name-arg-expand
141 (open-paren
142 name-arg-expand
143 ,(semantic-lambda
144 (nth 1 vals))
145 )
146 (symbol
147 name-arg-expand
148 ,(semantic-lambda
149 (cons
150 (nth 0 vals)
151 (nth 1 vals)))
152 )
153 ( ;;EMPTY
154 ,(semantic-lambda)
155 )
156 ) ;; end name-arg-expand
157
158 (opt-doc
159 (string)
160 ( ;;EMPTY
161 )
162 ) ;; end opt-doc
163
164 (sequence
165 (expression
166 sequence)
167 (expression)
168 ) ;; end sequence
169
170 (expression
171 (symbol)
172 (semantic-list)
173 (string)
174 (number)
175 ) ;; end expression
176 )
177 "Parser table.")
178
179(defun semantic-scm-by--install-parser ()
180 "Setup the Semantic Parser."
181 (setq semantic--parse-table semantic-scm-by--parse-table
182 semantic-debug-parser-source "scheme.by"
183 semantic-debug-parser-class 'semantic-bovine-debug-parser
184 semantic-flex-keywords-obarray semantic-scm-by--keyword-table
185 ))
186
187
188;;; Analyzers
189;;
190
191;;; Epilogue
192;;
193
194(provide 'semantic/bovine/scm-by)
195
196;;; semantic/bovine/scm-by.el ends here
diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el
index 8d9cfcccd7d..614ce706b0c 100644
--- a/lisp/cedet/semantic/db.el
+++ b/lisp/cedet/semantic/db.el
@@ -697,7 +697,7 @@ form."
697 (interactive) 697 (interactive)
698 (unless noninteractive 698 (unless noninteractive
699 (message "Saving tag summaries...")) 699 (message "Saving tag summaries..."))
700 (let ((semanticdb--inhibit-make-directory nil)) 700 (let ((semanticdb--inhibit-make-directory noninteractive))
701 (mapc 'semanticdb-save-db semanticdb-database-list)) 701 (mapc 'semanticdb-save-db semanticdb-database-list))
702 (unless noninteractive 702 (unless noninteractive
703 (message "Saving tag summaries...done"))) 703 (message "Saving tag summaries...done")))
diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el
index a545fcaee46..ca36829df82 100644
--- a/lisp/cedet/semantic/grammar.el
+++ b/lisp/cedet/semantic/grammar.el
@@ -33,6 +33,8 @@
33(require 'semantic/wisent) 33(require 'semantic/wisent)
34(require 'semantic/ctxt) 34(require 'semantic/ctxt)
35(require 'semantic/format) 35(require 'semantic/format)
36;; FIXME this is a generated file, but we need to load this file to
37;; generate it!
36(require 'semantic/grammar-wy) 38(require 'semantic/grammar-wy)
37(require 'semantic/idle) 39(require 'semantic/idle)
38(require 'help-fns) 40(require 'help-fns)
@@ -605,6 +607,11 @@ The symbols in the template are local variables in
605 607
606\(provide '" libr ") 608\(provide '" libr ")
607 609
610;; Local Variables:
611;; version-control: never
612;; no-update-autoloads: t
613;; End:
614
608;;; " file " ends here 615;;; " file " ends here
609") 616")
610 "Generated footer template. 617 "Generated footer template.
@@ -822,9 +829,10 @@ Block definitions are read from the current table of lexical types."
822 (noninteractive) 829 (noninteractive)
823 noninteractive)) 830 noninteractive))
824 831
825(defun semantic-grammar-create-package (&optional force) 832(defun semantic-grammar-create-package (&optional force uptodate)
826 "Create package Lisp code from grammar in current buffer. 833 "Create package Lisp code from grammar in current buffer.
827Does nothing if the Lisp code seems up to date. 834If the Lisp code seems up to date, do nothing (if UPTODATE
835is non-nil, return nil in such cases).
828If optional argument FORCE is non-nil, unconditionally re-generate the 836If optional argument FORCE is non-nil, unconditionally re-generate the
829Lisp code." 837Lisp code."
830 (interactive "P") 838 (interactive "P")
@@ -854,7 +862,12 @@ Lisp code."
854 (file-newer-than-file-p 862 (file-newer-than-file-p
855 (buffer-file-name semantic--grammar-output-buffer) 863 (buffer-file-name semantic--grammar-output-buffer)
856 (buffer-file-name semantic--grammar-input-buffer))) 864 (buffer-file-name semantic--grammar-input-buffer)))
857 (message "Package `%s' is up to date." semantic--grammar-package) 865 (progn
866 (message "Package `%s' is up to date." semantic--grammar-package)
867 ;; It would be better if this were always the case, IMO,
868 ;; but the (unspecified) return value of this function is
869 ;; assumed to be non-nil in some places, it seems.
870 (if uptodate (setq output nil)))
858 ;; Create the package 871 ;; Create the package
859 (set-buffer semantic--grammar-output-buffer) 872 (set-buffer semantic--grammar-output-buffer)
860 ;; Use Unix EOLs, so that the file is portable to all platforms. 873 ;; Use Unix EOLs, so that the file is portable to all platforms.
@@ -1914,6 +1927,7 @@ Optional argument COLOR determines if color is added to the text."
1914 1927
1915(provide 'semantic/grammar) 1928(provide 'semantic/grammar)
1916 1929
1930
1917;; Local variables: 1931;; Local variables:
1918;; generated-autoload-load-name: "semantic/grammar" 1932;; generated-autoload-load-name: "semantic/grammar"
1919;; End: 1933;; End:
diff --git a/lisp/cedet/semantic/wisent/grammar.el b/lisp/cedet/semantic/wisent/grammar.el
index 109d5ae7dfb..f61b05fa2e6 100644
--- a/lisp/cedet/semantic/wisent/grammar.el
+++ b/lisp/cedet/semantic/wisent/grammar.el
@@ -473,6 +473,54 @@ Menu items are appended to the common grammar menu.")
473\;; 2009, 2010 Python Software Foundation; All Rights Reserved" 473\;; 2009, 2010 Python Software Foundation; All Rights Reserved"
474 ,wisent-make-parsers--python-license))) 474 ,wisent-make-parsers--python-license)))
475 475
476;; Cf bovine--make-parser-1.
477(defun wisent--make-parser-1 (infile &optional outdir)
478 (if outdir (setq outdir (file-name-directory (expand-file-name outdir))))
479 (let ((packagename
480 ;; This is with-demoted-errors.
481 (condition-case err
482 (with-current-buffer (find-file-noselect infile)
483 (if outdir (setq default-directory outdir))
484 (semantic-grammar-create-package nil t))
485 (error (message "%s" (error-message-string err)) nil)))
486 output-data)
487 (when (setq output-data (assoc packagename wisent-make-parsers--parser-file-name))
488 (let ((additional-copyright (nth 1 output-data))
489 (additional-license (nth 2 output-data))
490 (filename (expand-file-name
491 (progn (string-match ".*/\\(.*\\)" packagename)
492 (match-string 1 packagename))
493 outdir))
494 copyright-end)
495 ;; Touch up the generated parsers for Emacs integration.
496 (with-temp-file filename
497 (insert-file-contents filename)
498 ;; Fix copyright header:
499 (goto-char (point-min))
500 (when additional-copyright
501 (re-search-forward "Copyright (C).*$")
502 (insert "\n;; " additional-copyright))
503 (re-search-forward "^;; Author:")
504 (setq copyright-end (match-beginning 0))
505 (re-search-forward "^;;; Code:\n")
506 (delete-region copyright-end (match-end 0))
507 (goto-char copyright-end)
508 (insert wisent-make-parsers--emacs-license)
509 (insert "\n\n;;; Commentary:
510;;
511;; This file was generated from admin/grammars/"
512 (file-name-nondirectory infile) ".")
513 (when additional-license
514 (insert "\n" additional-license))
515 (insert "\n\n;;; Code:\n")
516 (goto-char (point-min))
517 (delete-region (point-min) (line-end-position))
518 (insert ";;; " packagename
519 " --- Generated parser support file")
520 (re-search-forward ";;; \\(.*\\) ends here")
521 (replace-match packagename nil nil nil 1)
522 (delete-trailing-whitespace))))))
523
476(defun wisent-make-parsers () 524(defun wisent-make-parsers ()
477 "Generate Emacs' built-in Wisent-based parser files." 525 "Generate Emacs' built-in Wisent-based parser files."
478 (interactive) 526 (interactive)
@@ -480,46 +528,32 @@ Menu items are appended to the common grammar menu.")
480 ;; Loop through each .wy file in current directory, and run 528 ;; Loop through each .wy file in current directory, and run
481 ;; `semantic-grammar-batch-build-one-package' to build the grammar. 529 ;; `semantic-grammar-batch-build-one-package' to build the grammar.
482 (dolist (f (directory-files default-directory nil "\\.wy\\'")) 530 (dolist (f (directory-files default-directory nil "\\.wy\\'"))
483 (let ((packagename 531 (wisent--make-parser-1 f)))
484 (condition-case err 532
485 (with-current-buffer (find-file-noselect f) 533
486 (semantic-grammar-create-package)) 534(defun wisent-batch-make-parser (&optional infile outdir)
487 (error (message "%s" (error-message-string err)) nil))) 535 "Generate a Wisent parser from input INFILE, writing to OUTDIR.
488 output-data) 536This is mainly intended for use in batch mode:
489 (when (setq output-data (assoc packagename wisent-make-parsers--parser-file-name)) 537
490 (let ((additional-copyright (nth 1 output-data)) 538emacs -batch -l semantic/wisent/grammar -f wisent-make-parser-batch \\
491 (additional-license (nth 2 output-data)) 539 [-dir output-dir | -o output-file] file.by
492 (filename (progn (string-match ".*/\\(.*\\)" packagename) (match-string 1 packagename))) 540
493 copyright-end) 541If -o is supplied, only the directory part is used."
494 ;; Touch up the generated parsers for Emacs integration. 542 (semantic-mode 1)
495 (with-temp-buffer 543 (when (and noninteractive (not infile))
496 (insert-file-contents filename) 544 (let (arg)
497 ;; Fix copyright header: 545 (while command-line-args-left
498 (goto-char (point-min)) 546 (setq arg (pop command-line-args-left))
499 (when additional-copyright 547 (cond ((string-equal arg "-dir")
500 (re-search-forward "Copyright (C).*$") 548 (setq outdir (pop command-line-args-left)))
501 (insert "\n;; " additional-copyright)) 549 ((string-equal arg "-o")
502 (re-search-forward "^;; Author:") 550 (setq outdir (file-name-directory (pop command-line-args-left))))
503 (setq copyright-end (match-beginning 0)) 551 (t (setq infile arg))))))
504 (re-search-forward "^;;; Code:\n") 552 (or infile (error "No input file specified"))
505 (delete-region copyright-end (match-end 0)) 553 (or (file-readable-p infile)
506 (goto-char copyright-end) 554 (error "Input file `%s' not readable" infile))
507 (insert wisent-make-parsers--emacs-license) 555 (wisent--make-parser-1 infile outdir))
508 (insert "\n\n;;; Commentary: 556
509;;
510;; This file was generated from admin/grammars/"
511 f ".")
512 (when additional-license
513 (insert "\n" additional-license))
514 (insert "\n\n;;; Code:\n")
515 (goto-char (point-min))
516 (delete-region (point-min) (line-end-position))
517 (insert ";;; " packagename
518 " --- Generated parser support file")
519 (re-search-forward ";;; \\(.*\\) ends here")
520 (replace-match packagename nil nil nil 1)
521 (delete-trailing-whitespace)
522 (write-region nil nil (expand-file-name filename))))))))
523 557
524(provide 'semantic/wisent/grammar) 558(provide 'semantic/wisent/grammar)
525 559
diff --git a/lisp/cedet/semantic/wisent/javat-wy.el b/lisp/cedet/semantic/wisent/javat-wy.el
deleted file mode 100644
index 1156cb5792c..00000000000
--- a/lisp/cedet/semantic/wisent/javat-wy.el
+++ /dev/null
@@ -1,688 +0,0 @@
1;;; semantic/wisent/javat-wy.el --- Generated parser support file
2
3;; Copyright (C) 2002-2013 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
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.
11
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.
16
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/>.
19
20;;; Commentary:
21;;
22;; This file was generated from admin/grammars/java-tags.wy.
23
24;;; Code:
25
26(require 'semantic/lex)
27(eval-when-compile (require 'semantic/bovine))
28
29;;; Prologue
30;;
31(declare-function semantic-parse-region "semantic"
32 (start end &optional nonterminal depth returnonerror))
33
34;;; Declarations
35;;
36(defconst wisent-java-tags-wy--keyword-table
37 (semantic-lex-make-keyword-table
38 '(("abstract" . ABSTRACT)
39 ("boolean" . BOOLEAN)
40 ("break" . BREAK)
41 ("byte" . BYTE)
42 ("case" . CASE)
43 ("catch" . CATCH)
44 ("char" . CHAR)
45 ("class" . CLASS)
46 ("const" . CONST)
47 ("continue" . CONTINUE)
48 ("default" . DEFAULT)
49 ("do" . DO)
50 ("double" . DOUBLE)
51 ("else" . ELSE)
52 ("extends" . EXTENDS)
53 ("final" . FINAL)
54 ("finally" . FINALLY)
55 ("float" . FLOAT)
56 ("for" . FOR)
57 ("goto" . GOTO)
58 ("if" . IF)
59 ("implements" . IMPLEMENTS)
60 ("import" . IMPORT)
61 ("instanceof" . INSTANCEOF)
62 ("int" . INT)
63 ("interface" . INTERFACE)
64 ("long" . LONG)
65 ("native" . NATIVE)
66 ("new" . NEW)
67 ("package" . PACKAGE)
68 ("private" . PRIVATE)
69 ("protected" . PROTECTED)
70 ("public" . PUBLIC)
71 ("return" . RETURN)
72 ("short" . SHORT)
73 ("static" . STATIC)
74 ("strictfp" . STRICTFP)
75 ("super" . SUPER)
76 ("switch" . SWITCH)
77 ("synchronized" . SYNCHRONIZED)
78 ("this" . THIS)
79 ("throw" . THROW)
80 ("throws" . THROWS)
81 ("transient" . TRANSIENT)
82 ("try" . TRY)
83 ("void" . VOID)
84 ("volatile" . VOLATILE)
85 ("while" . WHILE)
86 ("@author" . _AUTHOR)
87 ("@version" . _VERSION)
88 ("@param" . _PARAM)
89 ("@return" . _RETURN)
90 ("@exception" . _EXCEPTION)
91 ("@throws" . _THROWS)
92 ("@see" . _SEE)
93 ("@since" . _SINCE)
94 ("@serial" . _SERIAL)
95 ("@serialData" . _SERIALDATA)
96 ("@serialField" . _SERIALFIELD)
97 ("@deprecated" . _DEPRECATED))
98 '(("@deprecated" javadoc
99 (seq 12 usage
100 (type function variable)
101 opt t))
102 ("@serialField" javadoc
103 (seq 11 usage
104 (variable)
105 opt t))
106 ("@serialData" javadoc
107 (seq 10 usage
108 (function)
109 opt t))
110 ("@serial" javadoc
111 (seq 9 usage
112 (variable)
113 opt t))
114 ("@since" javadoc
115 (seq 8 usage
116 (type function variable)
117 opt t))
118 ("@see" javadoc
119 (seq 7 usage
120 (type function variable)
121 opt t with-ref t))
122 ("@throws" javadoc
123 (seq 6 usage
124 (function)
125 with-name t))
126 ("@exception" javadoc
127 (seq 5 usage
128 (function)
129 with-name t))
130 ("@return" javadoc
131 (seq 4 usage
132 (function)))
133 ("@param" javadoc
134 (seq 3 usage
135 (function)
136 with-name t))
137 ("@version" javadoc
138 (seq 2 usage
139 (type)))
140 ("@author" javadoc
141 (seq 1 usage
142 (type)))
143 ("while" summary "while (<expr>) <stmt> | do <stmt> while (<expr>);")
144 ("volatile" summary "Field declaration modifier: volatile <type> <name> ...")
145 ("void" summary "Method return type: void <name> ...")
146 ("try" summary "try {<stmts>} [catch(<parm>) {<stmts>} ...] [finally {<stmts>}]")
147 ("transient" summary "Field declaration modifier: transient <type> <name> ...")
148 ("throws" summary "Method|Constructor declaration: throws <classType>, ...")
149 ("throw" summary "throw <expr> ;")
150 ("synchronized" summary "synchronized (<expr>) ... | Method decl. modifier: synchronized <type> <name> ...")
151 ("switch" summary "switch(<expr>) {[case <const-expr>: <stmts> ...] [default: <stmts>]}")
152 ("strictfp" summary "Declaration modifier: strictfp {class|interface|<type>} <name> ...")
153 ("static" summary "Declaration modifier: static {class|interface|<type>} <name> ...")
154 ("short" summary "Integral primitive type (-32768 to 32767)")
155 ("return" summary "return [<expr>] ;")
156 ("public" summary "Access level modifier: public {class|interface|<type>} <name> ...")
157 ("protected" summary "Access level modifier: protected {class|interface|<type>} <name> ...")
158 ("private" summary "Access level modifier: private {class|interface|<type>} <name> ...")
159 ("package" summary "Package declaration: package <name>")
160 ("native" summary "Method declaration modifier: native <type> <name> ...")
161 ("long" summary "Integral primitive type (-9223372036854775808 to 9223372036854775807)")
162 ("interface" summary "Interface declaration: interface <name>")
163 ("int" summary "Integral primitive type (-2147483648 to 2147483647)")
164 ("import" summary "Import package declarations: import <package>")
165 ("implements" summary "Class SuperInterfaces declaration: implements <name> [, ...]")
166 ("if" summary "if (<expr>) <stmt> [else <stmt>]")
167 ("goto" summary "Unused reserved word")
168 ("for" summary "for ([<init-expr>]; [<expr>]; [<update-expr>]) <stmt>")
169 ("float" summary "Primitive floating-point type (single-precision 32-bit IEEE 754)")
170 ("finally" summary "try {<stmts>} ... finally {<stmts>}")
171 ("final" summary "Class|Member declaration modifier: final {class|<type>} <name> ...")
172 ("extends" summary "SuperClass|SuperInterfaces declaration: extends <name> [, ...]")
173 ("else" summary "if (<expr>) <stmt> else <stmt>")
174 ("double" summary "Primitive floating-point type (double-precision 64-bit IEEE 754)")
175 ("do" summary "do <stmt> while (<expr>);")
176 ("default" summary "switch(<expr>) { ... default: <stmts>}")
177 ("continue" summary "continue [<label>] ;")
178 ("const" summary "Unused reserved word")
179 ("class" summary "Class declaration: class <name>")
180 ("char" summary "Integral primitive type (0 to 65535)")
181 ("catch" summary "try {<stmts>} catch(<parm>) {<stmts>} ... ")
182 ("case" summary "switch(<expr>) {case <const-expr>: <stmts> ... }")
183 ("byte" summary "Integral primitive type (-128 to 127)")
184 ("break" summary "break [<label>] ;")
185 ("boolean" summary "Primitive logical quantity type (true or false)")
186 ("abstract" summary "Class|Method declaration modifier: abstract {class|<type>} <name> ...")))
187 "Table of language keywords.")
188
189(defconst wisent-java-tags-wy--token-table
190 (semantic-lex-make-type-table
191 '(("unicode"
192 (unicodecharacter))
193 ("number"
194 (NUMBER_LITERAL))
195 ("string"
196 (STRING_LITERAL))
197 ("symbol"
198 (IDENTIFIER))
199 ("punctuation"
200 (COMP . "~")
201 (OROR . "||")
202 (OREQ . "|=")
203 (OR . "|")
204 (XOREQ . "^=")
205 (XOR . "^")
206 (QUESTION . "?")
207 (URSHIFTEQ . ">>>=")
208 (URSHIFT . ">>>")
209 (RSHIFTEQ . ">>=")
210 (RSHIFT . ">>")
211 (GTEQ . ">=")
212 (GT . ">")
213 (EQEQ . "==")
214 (EQ . "=")
215 (LTEQ . "<=")
216 (LSHIFTEQ . "<<=")
217 (LSHIFT . "<<")
218 (LT . "<")
219 (SEMICOLON . ";")
220 (COLON . ":")
221 (DIVEQ . "/=")
222 (DIV . "/")
223 (DOT . ".")
224 (MINUSEQ . "-=")
225 (MINUSMINUS . "--")
226 (MINUS . "-")
227 (COMMA . ",")
228 (PLUSEQ . "+=")
229 (PLUSPLUS . "++")
230 (PLUS . "+")
231 (MULTEQ . "*=")
232 (MULT . "*")
233 (ANDEQ . "&=")
234 (ANDAND . "&&")
235 (AND . "&")
236 (MODEQ . "%=")
237 (MOD . "%")
238 (NOTEQ . "!=")
239 (NOT . "!"))
240 ("close-paren"
241 (RBRACK . "]")
242 (RBRACE . "}")
243 (RPAREN . ")"))
244 ("open-paren"
245 (LBRACK . "[")
246 (LBRACE . "{")
247 (LPAREN . "("))
248 ("block"
249 (BRACK_BLOCK . "(LBRACK RBRACK)")
250 (BRACE_BLOCK . "(LBRACE RBRACE)")
251 (PAREN_BLOCK . "(LPAREN RPAREN)")))
252 '(("keyword" :declared t)
253 ("unicode" syntax "\\\\u[0-9a-f][0-9a-f][0-9a-f][0-9a-f]")
254 ("unicode" :declared t)
255 ("number" :declared t)
256 ("string" :declared t)
257 ("symbol" :declared t)
258 ("punctuation" :declared t)
259 ("block" :declared t)))
260 "Table of lexical tokens.")
261
262(defconst wisent-java-tags-wy--parse-table
263 (progn
264 (eval-when-compile
265 (require 'semantic/wisent/comp))
266 (wisent-compile-grammar
267 '((PAREN_BLOCK BRACE_BLOCK BRACK_BLOCK LPAREN RPAREN LBRACE RBRACE LBRACK RBRACK NOT NOTEQ MOD MODEQ AND ANDAND ANDEQ MULT MULTEQ PLUS PLUSPLUS PLUSEQ COMMA MINUS MINUSMINUS MINUSEQ DOT DIV DIVEQ COLON SEMICOLON LT LSHIFT LSHIFTEQ LTEQ EQ EQEQ GT GTEQ RSHIFT RSHIFTEQ URSHIFT URSHIFTEQ QUESTION XOR XOREQ OR OREQ OROR COMP IDENTIFIER STRING_LITERAL NUMBER_LITERAL unicodecharacter ABSTRACT BOOLEAN BREAK BYTE CASE CATCH CHAR CLASS CONST CONTINUE DEFAULT DO DOUBLE ELSE EXTENDS FINAL FINALLY FLOAT FOR GOTO IF IMPLEMENTS IMPORT INSTANCEOF INT INTERFACE LONG NATIVE NEW PACKAGE PRIVATE PROTECTED PUBLIC RETURN SHORT STATIC STRICTFP SUPER SWITCH SYNCHRONIZED THIS THROW THROWS TRANSIENT TRY VOID VOLATILE WHILE _AUTHOR _VERSION _PARAM _RETURN _EXCEPTION _THROWS _SEE _SINCE _SERIAL _SERIALDATA _SERIALFIELD _DEPRECATED)
268 nil
269 (compilation_unit
270 ((package_declaration))
271 ((import_declaration))
272 ((type_declaration)))
273 (package_declaration
274 ((PACKAGE qualified_name SEMICOLON)
275 (wisent-raw-tag
276 (semantic-tag-new-package $2 nil))))
277 (import_declaration
278 ((IMPORT qualified_name SEMICOLON)
279 (wisent-raw-tag
280 (semantic-tag-new-include $2 nil)))
281 ((IMPORT qualified_name DOT MULT SEMICOLON)
282 (wisent-raw-tag
283 (semantic-tag-new-include
284 (concat $2 $3 $4)
285 nil))))
286 (type_declaration
287 ((SEMICOLON)
288 nil)
289 ((class_declaration))
290 ((interface_declaration)))
291 (class_declaration
292 ((modifiers_opt CLASS qualified_name superc_opt interfaces_opt class_body)
293 (wisent-raw-tag
294 (semantic-tag-new-type $3 $2 $6
295 (if
296 (or $4 $5)
297 (cons $4 $5))
298 :typemodifiers $1))))
299 (superc_opt
300 (nil)
301 ((EXTENDS qualified_name)
302 (identity $2)))
303 (interfaces_opt
304 (nil)
305 ((IMPLEMENTS qualified_name_list)
306 (nreverse $2)))
307 (class_body
308 ((BRACE_BLOCK)
309 (semantic-parse-region
310 (car $region1)
311 (cdr $region1)
312 'class_member_declaration 1)))
313 (class_member_declaration
314 ((LBRACE)
315 nil)
316 ((RBRACE)
317 nil)
318 ((block)
319 nil)
320 ((static_initializer)
321 nil)
322 ((constructor_declaration))
323 ((interface_declaration))
324 ((class_declaration))
325 ((method_declaration))
326 ((field_declaration)))
327 (interface_declaration
328 ((modifiers_opt INTERFACE qualified_name extends_interfaces_opt interface_body)
329 (wisent-raw-tag
330 (semantic-tag-new-type $3 $2 $5
331 (if $4
332 (cons nil $4))
333 :typemodifiers $1))))
334 (extends_interfaces_opt
335 (nil)
336 ((EXTENDS qualified_name_list)
337 (identity $2)))
338 (interface_body
339 ((BRACE_BLOCK)
340 (semantic-parse-region
341 (car $region1)
342 (cdr $region1)
343 'interface_member_declaration 1)))
344 (interface_member_declaration
345 ((LBRACE)
346 nil)
347 ((RBRACE)
348 nil)
349 ((interface_declaration))
350 ((class_declaration))
351 ((method_declaration))
352 ((field_declaration)))
353 (static_initializer
354 ((STATIC block)))
355 (constructor_declaration
356 ((modifiers_opt constructor_declarator throwsc_opt constructor_body)
357 (wisent-raw-tag
358 (semantic-tag-new-function
359 (car $2)
360 nil
361 (cdr $2)
362 :typemodifiers $1 :throws $3 :constructor-flag t))))
363 (constructor_declarator
364 ((IDENTIFIER formal_parameter_list)
365 (cons $1 $2)))
366 (constructor_body
367 ((block)))
368 (method_declaration
369 ((modifiers_opt VOID method_declarator throwsc_opt method_body)
370 (wisent-raw-tag
371 (semantic-tag-new-function
372 (car $3)
373 $2
374 (cdr $3)
375 :typemodifiers $1 :throws $4)))
376 ((modifiers_opt type method_declarator throwsc_opt method_body)
377 (wisent-raw-tag
378 (semantic-tag-new-function
379 (car $3)
380 $2
381 (cdr $3)
382 :typemodifiers $1 :throws $4))))
383 (method_declarator
384 ((IDENTIFIER formal_parameter_list dims_opt)
385 (cons
386 (concat $1 $3)
387 $2)))
388 (throwsc_opt
389 (nil)
390 ((THROWS qualified_name_list)
391 (nreverse $2)))
392 (qualified_name_list
393 ((qualified_name_list COMMA qualified_name)
394 (cons $3 $1))
395 ((qualified_name)
396 (list $1)))
397 (method_body
398 ((SEMICOLON))
399 ((block)))
400 (block
401 ((BRACE_BLOCK)))
402 (formal_parameter_list
403 ((PAREN_BLOCK)
404 (semantic-parse-region
405 (car $region1)
406 (cdr $region1)
407 'formal_parameters 1)))
408 (formal_parameters
409 ((LPAREN)
410 nil)
411 ((RPAREN)
412 nil)
413 ((formal_parameter COMMA))
414 ((formal_parameter RPAREN)))
415 (formal_parameter
416 ((formal_parameter_modifier_opt type opt_variable_declarator_id)
417 (wisent-raw-tag
418 (semantic-tag-new-variable $3 $2 nil :typemodifiers $1))))
419 (formal_parameter_modifier_opt
420 (nil)
421 ((FINAL)
422 (list $1)))
423 (field_declaration
424 ((modifiers_opt type variable_declarators SEMICOLON)
425 (wisent-raw-tag
426 (semantic-tag-new-variable $3 $2 nil :typemodifiers $1))))
427 (variable_declarators
428 ((variable_declarators COMMA variable_declarator)
429 (progn
430 (setcdr
431 (cdr
432 (car $1))
433 (cdr $region2))
434 (cons $3 $1)))
435 ((variable_declarator)
436 (list $1)))
437 (variable_declarator
438 ((variable_declarator_id EQ variable_initializer)
439 (cons $1 $region))
440 ((variable_declarator_id)
441 (cons $1 $region)))
442 (opt_variable_declarator_id
443 (nil
444 (identity ""))
445 ((variable_declarator_id)
446 (identity $1)))
447 (variable_declarator_id
448 ((IDENTIFIER dims_opt)
449 (concat $1 $2)))
450 (variable_initializer
451 ((expression)))
452 (expression
453 ((expression term))
454 ((term)))
455 (term
456 ((literal))
457 ((operator))
458 ((primitive_type))
459 ((IDENTIFIER))
460 ((BRACK_BLOCK))
461 ((PAREN_BLOCK))
462 ((BRACE_BLOCK))
463 ((NEW))
464 ((CLASS))
465 ((THIS))
466 ((SUPER)))
467 (literal
468 ((STRING_LITERAL))
469 ((NUMBER_LITERAL)))
470 (operator
471 ((NOT))
472 ((PLUS))
473 ((PLUSPLUS))
474 ((MINUS))
475 ((MINUSMINUS))
476 ((NOTEQ))
477 ((MOD))
478 ((MODEQ))
479 ((AND))
480 ((ANDAND))
481 ((ANDEQ))
482 ((MULT))
483 ((MULTEQ))
484 ((PLUSEQ))
485 ((MINUSEQ))
486 ((DOT))
487 ((DIV))
488 ((DIVEQ))
489 ((COLON))
490 ((LT))
491 ((LSHIFT))
492 ((LSHIFTEQ))
493 ((LTEQ))
494 ((EQ))
495 ((EQEQ))
496 ((GT))
497 ((GTEQ))
498 ((RSHIFT))
499 ((RSHIFTEQ))
500 ((URSHIFT))
501 ((URSHIFTEQ))
502 ((QUESTION))
503 ((XOR))
504 ((XOREQ))
505 ((OR))
506 ((OREQ))
507 ((OROR))
508 ((COMP))
509 ((INSTANCEOF)))
510 (primitive_type
511 ((BOOLEAN))
512 ((CHAR))
513 ((LONG))
514 ((INT))
515 ((SHORT))
516 ((BYTE))
517 ((DOUBLE))
518 ((FLOAT)))
519 (modifiers_opt
520 (nil)
521 ((modifiers)
522 (nreverse $1)))
523 (modifiers
524 ((modifiers modifier)
525 (cons $2 $1))
526 ((modifier)
527 (list $1)))
528 (modifier
529 ((STRICTFP))
530 ((VOLATILE))
531 ((TRANSIENT))
532 ((SYNCHRONIZED))
533 ((NATIVE))
534 ((FINAL))
535 ((ABSTRACT))
536 ((STATIC))
537 ((PRIVATE))
538 ((PROTECTED))
539 ((PUBLIC)))
540 (type
541 ((qualified_name dims_opt)
542 (concat $1 $2))
543 ((primitive_type dims_opt)
544 (concat $1 $2)))
545 (qualified_name
546 ((qualified_name DOT IDENTIFIER)
547 (concat $1 $2 $3))
548 ((IDENTIFIER)))
549 (dims_opt
550 (nil
551 (identity ""))
552 ((dims)))
553 (dims
554 ((dims BRACK_BLOCK)
555 (concat $1 "[]"))
556 ((BRACK_BLOCK)
557 (identity "[]"))))
558 '(compilation_unit package_declaration import_declaration class_declaration field_declaration method_declaration formal_parameter constructor_declaration interface_declaration class_member_declaration interface_member_declaration formal_parameters)))
559 "Parser table.")
560
561(defun wisent-java-tags-wy--install-parser ()
562 "Setup the Semantic Parser."
563 (semantic-install-function-overrides
564 '((parse-stream . wisent-parse-stream)))
565 (setq semantic-parser-name "LALR"
566 semantic--parse-table wisent-java-tags-wy--parse-table
567 semantic-debug-parser-source "java-tags.wy"
568 semantic-flex-keywords-obarray wisent-java-tags-wy--keyword-table
569 semantic-lex-types-obarray wisent-java-tags-wy--token-table)
570 ;; Collect unmatched syntax lexical tokens
571 (semantic-make-local-hook 'wisent-discarding-token-functions)
572 (add-hook 'wisent-discarding-token-functions
573 'wisent-collect-unmatched-syntax nil t))
574
575
576;;; Analyzers
577;;
578(define-lex-block-type-analyzer wisent-java-tags-wy--<block>-block-analyzer
579 "block analyzer for <block> tokens."
580 "\\s(\\|\\s)"
581 '((("(" LPAREN PAREN_BLOCK)
582 ("{" LBRACE BRACE_BLOCK)
583 ("[" LBRACK BRACK_BLOCK))
584 (")" RPAREN)
585 ("}" RBRACE)
586 ("]" RBRACK))
587 )
588
589(define-lex-string-type-analyzer wisent-java-tags-wy--<punctuation>-string-analyzer
590 "string analyzer for <punctuation> tokens."
591 "\\(\\s.\\|\\s$\\|\\s'\\)+"
592 '((COMP . "~")
593 (OROR . "||")
594 (OREQ . "|=")
595 (OR . "|")
596 (XOREQ . "^=")
597 (XOR . "^")
598 (QUESTION . "?")
599 (URSHIFTEQ . ">>>=")
600 (URSHIFT . ">>>")
601 (RSHIFTEQ . ">>=")
602 (RSHIFT . ">>")
603 (GTEQ . ">=")
604 (GT . ">")
605 (EQEQ . "==")
606 (EQ . "=")
607 (LTEQ . "<=")
608 (LSHIFTEQ . "<<=")
609 (LSHIFT . "<<")
610 (LT . "<")
611 (SEMICOLON . ";")
612 (COLON . ":")
613 (DIVEQ . "/=")
614 (DIV . "/")
615 (DOT . ".")
616 (MINUSEQ . "-=")
617 (MINUSMINUS . "--")
618 (MINUS . "-")
619 (COMMA . ",")
620 (PLUSEQ . "+=")
621 (PLUSPLUS . "++")
622 (PLUS . "+")
623 (MULTEQ . "*=")
624 (MULT . "*")
625 (ANDEQ . "&=")
626 (ANDAND . "&&")
627 (AND . "&")
628 (MODEQ . "%=")
629 (MOD . "%")
630 (NOTEQ . "!=")
631 (NOT . "!"))
632 'punctuation)
633
634(define-lex-regex-type-analyzer wisent-java-tags-wy--<symbol>-regexp-analyzer
635 "regexp analyzer for <symbol> tokens."
636 "\\(\\sw\\|\\s_\\)+"
637 nil
638 'IDENTIFIER)
639
640(define-lex-regex-type-analyzer wisent-java-tags-wy--<unicode>-regexp-analyzer
641 "regexp analyzer for <unicode> tokens."
642 "\\\\u[0-9a-f][0-9a-f][0-9a-f][0-9a-f]"
643 nil
644 'unicodecharacter)
645
646(define-lex-regex-type-analyzer wisent-java-tags-wy--<number>-regexp-analyzer
647 "regexp analyzer for <number> tokens."
648 semantic-lex-number-expression
649 nil
650 'NUMBER_LITERAL)
651
652(define-lex-sexp-type-analyzer wisent-java-tags-wy--<string>-sexp-analyzer
653 "sexp analyzer for <string> tokens."
654 "\\s\""
655 'STRING_LITERAL)
656
657(define-lex-keyword-type-analyzer wisent-java-tags-wy--<keyword>-keyword-analyzer
658 "keyword analyzer for <keyword> tokens."
659 "\\(\\sw\\|\\s_\\)+")
660
661
662;;; Epilogue
663;;
664;; Define the lexer for this grammar
665(define-lex wisent-java-tags-lexer
666 "Lexical analyzer that handles Java buffers.
667It ignores whitespaces, newlines and comments."
668 semantic-lex-ignore-whitespace
669 semantic-lex-ignore-newline
670 semantic-lex-ignore-comments
671 ;;;; Auto-generated analyzers.
672 wisent-java-tags-wy--<number>-regexp-analyzer
673 wisent-java-tags-wy--<string>-sexp-analyzer
674 ;; Must detect keywords before other symbols
675 wisent-java-tags-wy--<keyword>-keyword-analyzer
676 wisent-java-tags-wy--<symbol>-regexp-analyzer
677 wisent-java-tags-wy--<punctuation>-string-analyzer
678 wisent-java-tags-wy--<block>-block-analyzer
679 ;; In theory, Unicode chars should be turned into normal chars
680 ;; and then combined into regular ascii keywords and text. This
681 ;; analyzer just keeps these things from making the lexer go boom.
682 wisent-java-tags-wy--<unicode>-regexp-analyzer
683 ;;;;
684 semantic-lex-default-action)
685
686(provide 'semantic/wisent/javat-wy)
687
688;;; semantic/wisent/javat-wy.el ends here
diff --git a/lisp/cedet/semantic/wisent/js-wy.el b/lisp/cedet/semantic/wisent/js-wy.el
deleted file mode 100644
index 2e331b1c4d9..00000000000
--- a/lisp/cedet/semantic/wisent/js-wy.el
+++ /dev/null
@@ -1,530 +0,0 @@
1;;; semantic/wisent/js-wy.el --- Generated parser support file
2
3;; Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
4;; Copyright (C) 1998-2011 Ecma International.
5
6;; This file is part of GNU Emacs.
7
8;; GNU Emacs is free software: you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version.
12
13;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20
21;;; Commentary:
22;;
23;; This file was generated from admin/grammars/js.wy.
24
25;; It is derived from the grammar in the ECMAScript Language
26;; Specification published at
27;;
28;; http://www.ecma-international.org/publications/standards/Ecma-262.htm
29;;
30;; and redistributed under the following license:
31;;
32;; Redistribution and use in source and binary forms, with or without
33;; modification, are permitted provided that the following conditions
34;; are met:
35;;
36;; 1. Redistributions of source code must retain the above copyright
37;; notice, this list of conditions and the following disclaimer.
38;;
39;; 2. Redistributions in binary form must reproduce the above
40;; copyright notice, this list of conditions and the following
41;; disclaimer in the documentation and/or other materials provided
42;; with the distribution.
43;;
44;; 3. Neither the name of the authors nor Ecma International may be
45;; used to endorse or promote products derived from this software
46;; without specific prior written permission. THIS SOFTWARE IS
47;; PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR
48;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
49;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50;; ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR
51;; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
52;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
53;; OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
54;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
55;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
57;; USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
58;; DAMAGE.
59
60;;; Code:
61
62(require 'semantic/lex)
63(eval-when-compile (require 'semantic/bovine))
64
65;;; Prologue
66;;
67(declare-function semantic-parse-region "semantic"
68 (start end &optional nonterminal depth returnonerror))
69
70;;; Declarations
71;;
72(defconst wisent-javascript-jv-wy--keyword-table
73 (semantic-lex-make-keyword-table
74 '(("if" . IF)
75 ("break" . BREAK)
76 ("continue" . CONTINUE)
77 ("else" . ELSE)
78 ("for" . FOR)
79 ("function" . FUNCTION)
80 ("this" . THIS)
81 ("return" . RETURN)
82 ("while" . WHILE)
83 ("void" . VOID_SYMBOL)
84 ("new" . NEW)
85 ("delete" . DELETE)
86 ("var" . VAR)
87 ("with" . WITH)
88 ("typeof" . TYPEOF)
89 ("in" . IN))
90 '(("in" summary "in something")
91 ("typeof" summary "typeof ")
92 ("with" summary "with ")
93 ("var" summary "var <variablename> [= value];")
94 ("delete" summary "delete(<objectreference>) - Deletes the object.")
95 ("new" summary "new <objecttype> - Creates a new object.")
96 ("void" summary "Method return type: void <name> ...")
97 ("while" summary "while (<expr>) <stmt> | do <stmt> while (<expr>);")
98 ("return" summary "return [<expr>] ;")
99 ("this" summary "this")
100 ("function" summary "function declaration blah blah")
101 ("for" summary "for ([<init-expr>]; [<expr>]; [<update-expr>]) <stmt>")
102 ("else" summary "if (<expr>) <stmt> else <stmt>")
103 ("continue" summary "continue [<label>] ;")
104 ("break" summary "break [<label>] ;")
105 ("if" summary "if (<expr>) <stmt> [else <stmt>] (jv)")))
106 "Table of language keywords.")
107
108(defconst wisent-javascript-jv-wy--token-table
109 (semantic-lex-make-type-table
110 '(("<no-type>"
111 (NULL_TOKEN)
112 (QUERY)
113 (TRUE)
114 (FALSE))
115 ("number"
116 (NUMBER))
117 ("string"
118 (STRING))
119 ("symbol"
120 (VARIABLE))
121 ("close-paren"
122 (CLOSE_SQ_BRACKETS . "]")
123 (END_BLOCK . "}")
124 (CLOSE_PARENTHESIS . ")"))
125 ("open-paren"
126 (OPEN_SQ_BRACKETS . "[")
127 (START_BLOCK . "{")
128 (OPEN_PARENTHESIS . "("))
129 ("block"
130 (BRACK_BLOCK . "(OPEN_SQ_BRACKETS CLOSE_SQ_BRACKETS)")
131 (BRACE_BLOCK . "(START_BLOCK END_BLOCK)")
132 (PAREN_BLOCK . "(OPEN_PARENTHESIS CLOSE_PARENTHESIS)"))
133 ("punctuation"
134 (ONES_COMPLIMENT . "~")
135 (SEMICOLON . ";")
136 (LINE_TERMINATOR . "\n")
137 (LESS_THAN . "<")
138 (DOT . ".")
139 (COMMA . ",")
140 (COLON . ":")
141 (DIV . "/")
142 (DECREMENT . "--")
143 (INCREMENT . "++")
144 (PLUS_EQUALS . "+=")
145 (PLUS . "+")
146 (MULTIPLY_EQUALS . "*=")
147 (MULTIPLY . "*")
148 (MOD_EQUALS . "%=")
149 (MOD . "%")
150 (MINUS_EQUALS . "-=")
151 (MINUS . "-")
152 (LS_EQUAL . "<=")
153 (LOGICAL_NOT . "!!")
154 (LOGICAL_OR . "||")
155 (LOGICAL_AND . "&&")
156 (GT_EQUAL . ">=")
157 (GREATER_THAN . ">")
158 (EQUALS . "==")
159 (DIV_EQUALS . "/=")
160 (NOT_EQUAL . "!=")
161 (BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS . ">>>=")
162 (BITWISE_SHIFT_RIGHT_ZERO_FILL . ">>>")
163 (BITWISE_SHIFT_RIGHT_EQUALS . ">>=")
164 (BITWISE_SHIFT_RIGHT . ">>")
165 (BITWISE_SHIFT_LEFT_EQUALS . "<<=")
166 (BITWISE_SHIFT_LEFT . "<<")
167 (BITWISE_OR_EQUALS . "|=")
168 (BITWISE_OR . "|")
169 (BITWISE_EXCLUSIVE_OR_EQUALS . "^=")
170 (BITWISE_EXCLUSIVE_OR . "^")
171 (BITWISE_AND_EQUALS . "&=")
172 (BITWISE_AND . "&")
173 (ASSIGN_SYMBOL . "=")))
174 '(("number" :declared t)
175 ("string" :declared t)
176 ("symbol" :declared t)
177 ("keyword" :declared t)
178 ("block" :declared t)
179 ("punctuation" :declared t)))
180 "Table of lexical tokens.")
181
182(defconst wisent-javascript-jv-wy--parse-table
183 (progn
184 (eval-when-compile
185 (require 'semantic/wisent/comp))
186 (wisent-compile-grammar
187 '((ASSIGN_SYMBOL BITWISE_AND BITWISE_AND_EQUALS BITWISE_EXCLUSIVE_OR BITWISE_EXCLUSIVE_OR_EQUALS BITWISE_OR BITWISE_OR_EQUALS BITWISE_SHIFT_LEFT BITWISE_SHIFT_LEFT_EQUALS BITWISE_SHIFT_RIGHT BITWISE_SHIFT_RIGHT_EQUALS BITWISE_SHIFT_RIGHT_ZERO_FILL BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS NOT_EQUAL DIV_EQUALS EQUALS GREATER_THAN GT_EQUAL LOGICAL_AND LOGICAL_OR LOGICAL_NOT LS_EQUAL MINUS MINUS_EQUALS MOD MOD_EQUALS MULTIPLY MULTIPLY_EQUALS PLUS PLUS_EQUALS INCREMENT DECREMENT DIV COLON COMMA DOT LESS_THAN LINE_TERMINATOR SEMICOLON ONES_COMPLIMENT PAREN_BLOCK BRACE_BLOCK BRACK_BLOCK OPEN_PARENTHESIS CLOSE_PARENTHESIS START_BLOCK END_BLOCK OPEN_SQ_BRACKETS CLOSE_SQ_BRACKETS IF BREAK CONTINUE ELSE FOR FUNCTION THIS RETURN WHILE VOID_SYMBOL NEW DELETE VAR WITH TYPEOF IN VARIABLE STRING NUMBER FALSE TRUE QUERY NULL_TOKEN)
188 ((left PLUS MINUS)
189 (left MULTIPLY DIV MOD)
190 (nonassoc FALSE)
191 (nonassoc HIGHER_THAN_FALSE)
192 (nonassoc ELSE)
193 (nonassoc LOWER_THAN_CLOSE_PARENTHESIS)
194 (nonassoc CLOSE_PARENTHESIS))
195 (Program
196 ((SourceElement)))
197 (SourceElement
198 ((Statement))
199 ((FunctionDeclaration)))
200 (Statement
201 ((Block))
202 ((VariableStatement))
203 ((EmptyStatement))
204 ((ExpressionStatement))
205 ((IfStatement))
206 ((IterationExpression))
207 ((ContinueStatement))
208 ((BreakStatement))
209 ((ReturnStatement))
210 ((WithStatement)))
211 (FunctionDeclaration
212 ((FUNCTION VARIABLE FormalParameterListBlock Block)
213 (wisent-raw-tag
214 (semantic-tag-new-function $2 nil $3))))
215 (FormalParameterListBlock
216 ((PAREN_BLOCK)
217 (semantic-parse-region
218 (car $region1)
219 (cdr $region1)
220 'FormalParameterList 1)))
221 (FormalParameterList
222 ((OPEN_PARENTHESIS)
223 nil)
224 ((VARIABLE)
225 (wisent-raw-tag
226 (semantic-tag-new-variable $1 nil nil)))
227 ((CLOSE_PARENTHESIS)
228 nil)
229 ((COMMA)
230 nil))
231 (StatementList
232 ((Statement))
233 ((StatementList Statement)))
234 (Block
235 ((BRACE_BLOCK)))
236 (BlockExpand
237 ((START_BLOCK StatementList END_BLOCK))
238 ((START_BLOCK END_BLOCK)))
239 (VariableStatement
240 ((VAR VariableDeclarationList SEMICOLON)
241 (wisent-raw-tag
242 (semantic-tag-new-variable $2 nil nil))))
243 (VariableDeclarationList
244 ((VariableDeclaration)
245 (list $1))
246 ((VariableDeclarationList COMMA VariableDeclaration)
247 (append $1
248 (list $3))))
249 (VariableDeclaration
250 ((VARIABLE)
251 (append
252 (list $1 nil)
253 $region))
254 ((VARIABLE Initializer)
255 (append
256 (cons $1 $2)
257 $region)))
258 (Initializer
259 ((ASSIGN_SYMBOL AssignmentExpression)
260 (list $2)))
261 (EmptyStatement
262 ((SEMICOLON)))
263 (ExpressionStatement
264 ((Expression SEMICOLON)))
265 (IfStatement
266 ((IF OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement)
267 [HIGHER_THAN_FALSE])
268 ((IF OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement ELSE Statement))
269 ((IF OPEN_PARENTHESIS FALSE CLOSE_PARENTHESIS Statement))
270 ((IF OPEN_PARENTHESIS LeftHandSideExpression AssignmentOperator AssignmentExpression CLOSE_PARENTHESIS Statement)))
271 (IterationExpression
272 ((WHILE OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement)
273 [HIGHER_THAN_FALSE])
274 ((WHILE OPEN_PARENTHESIS FALSE CLOSE_PARENTHESIS Statement))
275 ((WHILE OPEN_PARENTHESIS LeftHandSideExpression AssignmentOperator AssignmentExpression CLOSE_PARENTHESIS Statement))
276 ((FOR OPEN_PARENTHESIS OptionalExpression SEMICOLON OptionalExpression SEMICOLON OptionalExpression CLOSE_PARENTHESIS Statement))
277 ((FOR OPEN_PARENTHESIS VAR VariableDeclarationList SEMICOLON OptionalExpression SEMICOLON OptionalExpression CLOSE_PARENTHESIS Statement))
278 ((FOR OPEN_PARENTHESIS LeftHandSideExpression IN Expression CLOSE_PARENTHESIS Statement))
279 ((FOR OPEN_PARENTHESIS VAR VARIABLE OptionalInitializer IN Expression CLOSE_PARENTHESIS Statement)))
280 (ContinueStatement
281 ((CONTINUE SEMICOLON)))
282 (BreakStatement
283 ((BREAK SEMICOLON)))
284 (ReturnStatement
285 ((RETURN Expression SEMICOLON))
286 ((RETURN SEMICOLON)))
287 (WithStatement
288 ((WITH OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement)))
289 (OptionalInitializer
290 ((Initializer))
291 (nil))
292 (PrimaryExpression
293 ((THIS))
294 ((VARIABLE))
295 ((NUMBER))
296 ((STRING))
297 ((NULL_TOKEN))
298 ((TRUE))
299 ((FALSE))
300 ((OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS)))
301 (MemberExpression
302 ((PrimaryExpression))
303 ((MemberExpression OPEN_SQ_BRACKETS Expression CLOSE_SQ_BRACKETS))
304 ((MemberExpression DOT VARIABLE))
305 ((NEW MemberExpression Arguments)))
306 (NewExpression
307 ((MemberExpression))
308 ((NEW NewExpression)))
309 (CallExpression
310 ((MemberExpression Arguments))
311 ((CallExpression Arguments))
312 ((CallExpression OPEN_SQ_BRACKETS Expression CLOSE_SQ_BRACKETS))
313 ((CallExpression DOT VARIABLE)))
314 (Arguments
315 ((OPEN_PARENTHESIS CLOSE_PARENTHESIS))
316 ((OPEN_PARENTHESIS ArgumentList CLOSE_PARENTHESIS)))
317 (ArgumentList
318 ((AssignmentExpression))
319 ((ArgumentList COMMA AssignmentExpression)))
320 (LeftHandSideExpression
321 ((NewExpression))
322 ((CallExpression)))
323 (PostfixExpression
324 ((LeftHandSideExpression))
325 ((LeftHandSideExpression INCREMENT))
326 ((LeftHandSideExpression DECREMENT)))
327 (UnaryExpression
328 ((PostfixExpression))
329 ((DELETE UnaryExpression))
330 ((VOID_SYMBOL UnaryExpression))
331 ((TYPEOF UnaryExpression))
332 ((INCREMENT UnaryExpression))
333 ((DECREMENT UnaryExpression))
334 ((PLUS UnaryExpression))
335 ((MINUS UnaryExpression))
336 ((ONES_COMPLIMENT UnaryExpression))
337 ((LOGICAL_NOT UnaryExpression)))
338 (MultiplicativeExpression
339 ((UnaryExpression))
340 ((MultiplicativeExpression MULTIPLY UnaryExpression))
341 ((MultiplicativeExpression DIV UnaryExpression))
342 ((MultiplicativeExpression MOD UnaryExpression)))
343 (AdditiveExpression
344 ((MultiplicativeExpression))
345 ((AdditiveExpression PLUS MultiplicativeExpression))
346 ((AdditiveExpression MINUS MultiplicativeExpression)))
347 (ShiftExpression
348 ((AdditiveExpression))
349 ((ShiftExpression BITWISE_SHIFT_LEFT AdditiveExpression))
350 ((ShiftExpression BITWISE_SHIFT_RIGHT AdditiveExpression))
351 ((ShiftExpression BITWISE_SHIFT_RIGHT_ZERO_FILL AdditiveExpression)))
352 (RelationalExpression
353 ((ShiftExpression))
354 ((RelationalExpression LESS_THAN ShiftExpression))
355 ((RelationalExpression GREATER_THAN ShiftExpression))
356 ((RelationalExpression LS_EQUAL ShiftExpression))
357 ((RelationalExpression GT_EQUAL ShiftExpression)))
358 (EqualityExpression
359 ((RelationalExpression))
360 ((EqualityExpression EQUALS RelationalExpression))
361 ((EqualityExpression NOT_EQUAL RelationalExpression)))
362 (BitwiseANDExpression
363 ((EqualityExpression))
364 ((BitwiseANDExpression BITWISE_AND EqualityExpression)))
365 (BitwiseXORExpression
366 ((BitwiseANDExpression))
367 ((BitwiseXORExpression BITWISE_EXCLUSIVE_OR BitwiseANDExpression)))
368 (BitwiseORExpression
369 ((BitwiseXORExpression))
370 ((BitwiseORExpression BITWISE_OR BitwiseXORExpression)))
371 (LogicalANDExpression
372 ((BitwiseORExpression))
373 ((LogicalANDExpression LOGICAL_AND BitwiseORExpression)))
374 (LogicalORExpression
375 ((LogicalANDExpression))
376 ((LogicalORExpression LOGICAL_OR LogicalANDExpression)))
377 (ConditionalExpression
378 ((LogicalORExpression))
379 ((LogicalORExpression QUERY AssignmentExpression COLON AssignmentExpression)))
380 (AssignmentExpression
381 ((ConditionalExpression))
382 ((LeftHandSideExpression AssignmentOperator AssignmentExpression)
383 [LOWER_THAN_CLOSE_PARENTHESIS]))
384 (AssignmentOperator
385 ((ASSIGN_SYMBOL))
386 ((MULTIPLY_EQUALS))
387 ((DIV_EQUALS))
388 ((MOD_EQUALS))
389 ((PLUS_EQUALS))
390 ((MINUS_EQUALS))
391 ((BITWISE_SHIFT_LEFT_EQUALS))
392 ((BITWISE_SHIFT_RIGHT_EQUALS))
393 ((BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS))
394 ((BITWISE_AND_EQUALS))
395 ((BITWISE_EXCLUSIVE_OR_EQUALS))
396 ((BITWISE_OR_EQUALS)))
397 (Expression
398 ((AssignmentExpression))
399 ((Expression COMMA AssignmentExpression)))
400 (OptionalExpression
401 ((Expression))
402 (nil)))
403 '(Program FormalParameterList)))
404 "Parser table.")
405
406(defun wisent-javascript-jv-wy--install-parser ()
407 "Setup the Semantic Parser."
408 (semantic-install-function-overrides
409 '((parse-stream . wisent-parse-stream)))
410 (setq semantic-parser-name "LALR"
411 semantic--parse-table wisent-javascript-jv-wy--parse-table
412 semantic-debug-parser-source "js.wy"
413 semantic-flex-keywords-obarray wisent-javascript-jv-wy--keyword-table
414 semantic-lex-types-obarray wisent-javascript-jv-wy--token-table)
415 ;; Collect unmatched syntax lexical tokens
416 (semantic-make-local-hook 'wisent-discarding-token-functions)
417 (add-hook 'wisent-discarding-token-functions
418 'wisent-collect-unmatched-syntax nil t))
419
420
421;;; Analyzers
422;;
423(define-lex-block-type-analyzer wisent-javascript-jv-wy--<block>-block-analyzer
424 "block analyzer for <block> tokens."
425 "\\s(\\|\\s)"
426 '((("(" OPEN_PARENTHESIS PAREN_BLOCK)
427 ("{" START_BLOCK BRACE_BLOCK)
428 ("[" OPEN_SQ_BRACKETS BRACK_BLOCK))
429 (")" CLOSE_PARENTHESIS)
430 ("}" END_BLOCK)
431 ("]" CLOSE_SQ_BRACKETS))
432 )
433
434(define-lex-regex-type-analyzer wisent-javascript-jv-wy--<symbol>-regexp-analyzer
435 "regexp analyzer for <symbol> tokens."
436 "\\(\\sw\\|\\s_\\)+"
437 nil
438 'VARIABLE)
439
440(define-lex-regex-type-analyzer wisent-javascript-jv-wy--<number>-regexp-analyzer
441 "regexp analyzer for <number> tokens."
442 semantic-lex-number-expression
443 nil
444 'NUMBER)
445
446(define-lex-string-type-analyzer wisent-javascript-jv-wy--<punctuation>-string-analyzer
447 "string analyzer for <punctuation> tokens."
448 "\\(\\s.\\|\\s$\\|\\s'\\)+"
449 '((ONES_COMPLIMENT . "~")
450 (SEMICOLON . ";")
451 (LINE_TERMINATOR . "\n")
452 (LESS_THAN . "<")
453 (DOT . ".")
454 (COMMA . ",")
455 (COLON . ":")
456 (DIV . "/")
457 (DECREMENT . "--")
458 (INCREMENT . "++")
459 (PLUS_EQUALS . "+=")
460 (PLUS . "+")
461 (MULTIPLY_EQUALS . "*=")
462 (MULTIPLY . "*")
463 (MOD_EQUALS . "%=")
464 (MOD . "%")
465 (MINUS_EQUALS . "-=")
466 (MINUS . "-")
467 (LS_EQUAL . "<=")
468 (LOGICAL_NOT . "!!")
469 (LOGICAL_OR . "||")
470 (LOGICAL_AND . "&&")
471 (GT_EQUAL . ">=")
472 (GREATER_THAN . ">")
473 (EQUALS . "==")
474 (DIV_EQUALS . "/=")
475 (NOT_EQUAL . "!=")
476 (BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS . ">>>=")
477 (BITWISE_SHIFT_RIGHT_ZERO_FILL . ">>>")
478 (BITWISE_SHIFT_RIGHT_EQUALS . ">>=")
479 (BITWISE_SHIFT_RIGHT . ">>")
480 (BITWISE_SHIFT_LEFT_EQUALS . "<<=")
481 (BITWISE_SHIFT_LEFT . "<<")
482 (BITWISE_OR_EQUALS . "|=")
483 (BITWISE_OR . "|")
484 (BITWISE_EXCLUSIVE_OR_EQUALS . "^=")
485 (BITWISE_EXCLUSIVE_OR . "^")
486 (BITWISE_AND_EQUALS . "&=")
487 (BITWISE_AND . "&")
488 (ASSIGN_SYMBOL . "="))
489 'punctuation)
490
491(define-lex-sexp-type-analyzer wisent-javascript-jv-wy--<string>-sexp-analyzer
492 "sexp analyzer for <string> tokens."
493 "\\s\""
494 'STRING)
495
496(define-lex-keyword-type-analyzer wisent-javascript-jv-wy--<keyword>-keyword-analyzer
497 "keyword analyzer for <keyword> tokens."
498 "\\(\\sw\\|\\s_\\)+")
499
500
501;;; Epilogue
502;;
503;;here something like:
504;;(define-lex wisent-java-tags-lexer
505;; should go
506(define-lex javascript-lexer-jv
507"javascript thingy"
508;;std stuff
509 semantic-lex-ignore-whitespace
510 semantic-lex-ignore-newline
511 semantic-lex-ignore-comments
512
513 ;;stuff generated from the wy file(one for each "type" declaration)
514 wisent-javascript-jv-wy--<number>-regexp-analyzer
515 wisent-javascript-jv-wy--<string>-sexp-analyzer
516
517 wisent-javascript-jv-wy--<keyword>-keyword-analyzer
518
519 wisent-javascript-jv-wy--<symbol>-regexp-analyzer
520 wisent-javascript-jv-wy--<punctuation>-string-analyzer
521 wisent-javascript-jv-wy--<block>-block-analyzer
522
523
524 ;;;;more std stuff
525 semantic-lex-default-action
526 )
527
528(provide 'semantic/wisent/js-wy)
529
530;;; semantic/wisent/js-wy.el ends here
diff --git a/lisp/cedet/semantic/wisent/python-wy.el b/lisp/cedet/semantic/wisent/python-wy.el
deleted file mode 100644
index bfa96ff1a88..00000000000
--- a/lisp/cedet/semantic/wisent/python-wy.el
+++ /dev/null
@@ -1,847 +0,0 @@
1;;; semantic/wisent/python-wy.el --- Generated parser support file
2
3;; Copyright (C) 2002-2013 Free Software Foundation, Inc.
4;; Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
5;; 2009, 2010 Python Software Foundation; All Rights Reserved
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22;;; Commentary:
23;;
24;; This file was generated from admin/grammars/python.wy.
25;; It is derived in part from the Python grammar, used under the
26;; following license:
27;;
28;; PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
29;; --------------------------------------------
30;; 1. This LICENSE AGREEMENT is between the Python Software Foundation
31;; ("PSF"), and the Individual or Organization ("Licensee") accessing
32;; and otherwise using this software ("Python") in source or binary
33;; form and its associated documentation.
34;;
35;; 2. Subject to the terms and conditions of this License Agreement,
36;; PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide
37;; license to reproduce, analyze, test, perform and/or display
38;; publicly, prepare derivative works, distribute, and otherwise use
39;; Python alone or in any derivative version, provided, however, that
40;; PSF's License Agreement and PSF's notice of copyright, i.e.,
41;; "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
42;; 2009, 2010 Python Software Foundation; All Rights Reserved" are
43;; retained in Python alone or in any derivative version prepared by
44;; Licensee.
45;;
46;; 3. In the event Licensee prepares a derivative work that is based
47;; on or incorporates Python or any part thereof, and wants to make
48;; the derivative work available to others as provided herein, then
49;; Licensee hereby agrees to include in any such work a brief summary
50;; of the changes made to Python.
51;;
52;; 4. PSF is making Python available to Licensee on an "AS IS"
53;; basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
54;; IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
55;; DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
56;; FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
57;; INFRINGE ANY THIRD PARTY RIGHTS.
58;;
59;; 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
60;; FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A
61;; RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR
62;; ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
63;;
64;; 6. This License Agreement will automatically terminate upon a
65;; material breach of its terms and conditions.
66;;
67;; 7. Nothing in this License Agreement shall be deemed to create any
68;; relationship of agency, partnership, or joint venture between PSF
69;; and Licensee. This License Agreement does not grant permission to
70;; use PSF trademarks or trade name in a trademark sense to endorse or
71;; promote products or services of Licensee, or any third party.
72;;
73;; 8. By copying, installing or otherwise using Python, Licensee
74;; agrees to be bound by the terms and conditions of this License
75;; Agreement.
76
77;;; Code:
78
79(require 'semantic/lex)
80(eval-when-compile (require 'semantic/bovine))
81
82;;; Prologue
83;;
84(declare-function wisent-python-reconstitute-function-tag
85 "semantic/wisent/python" (tag suite))
86(declare-function wisent-python-reconstitute-class-tag "semantic/wisent/python"
87 (tag))
88(declare-function semantic-parse-region "semantic"
89 (start end &optional nonterminal depth returnonerror))
90
91;;; Declarations
92;;
93(defconst wisent-python-wy--keyword-table
94 (semantic-lex-make-keyword-table
95 '(("and" . AND)
96 ("as" . AS)
97 ("assert" . ASSERT)
98 ("break" . BREAK)
99 ("class" . CLASS)
100 ("continue" . CONTINUE)
101 ("def" . DEF)
102 ("del" . DEL)
103 ("elif" . ELIF)
104 ("else" . ELSE)
105 ("except" . EXCEPT)
106 ("exec" . EXEC)
107 ("finally" . FINALLY)
108 ("for" . FOR)
109 ("from" . FROM)
110 ("global" . GLOBAL)
111 ("if" . IF)
112 ("import" . IMPORT)
113 ("in" . IN)
114 ("is" . IS)
115 ("lambda" . LAMBDA)
116 ("not" . NOT)
117 ("or" . OR)
118 ("pass" . PASS)
119 ("print" . PRINT)
120 ("raise" . RAISE)
121 ("return" . RETURN)
122 ("try" . TRY)
123 ("while" . WHILE)
124 ("with" . WITH)
125 ("yield" . YIELD))
126 '(("yield" summary "Create a generator function")
127 ("with" summary "Start statement with an associated context object")
128 ("while" summary "Start a 'while' loop")
129 ("try" summary "Start of statements protected by exception handlers")
130 ("return" summary "Return from a function")
131 ("raise" summary "Raise an exception")
132 ("print" summary "Print each argument to standard output")
133 ("pass" summary "Statement that does nothing")
134 ("or" summary "Binary logical 'or' operator")
135 ("not" summary "Unary boolean negation operator")
136 ("lambda" summary "Create anonymous function")
137 ("is" summary "Binary operator that tests for object equality")
138 ("in" summary "Part of 'for' statement ")
139 ("import" summary "Load specified modules")
140 ("if" summary "Start 'if' conditional statement")
141 ("global" summary "Declare one or more symbols as global symbols")
142 ("from" summary "Modify behavior of 'import' statement")
143 ("for" summary "Start a 'for' loop")
144 ("finally" summary "Specify code to be executed after 'try' statements whether or not an exception occurred")
145 ("exec" summary "Dynamically execute Python code")
146 ("except" summary "Specify exception handlers along with 'try' keyword")
147 ("else" summary "Start the 'else' clause following an 'if' statement")
148 ("elif" summary "Shorthand for 'else if' following an 'if' statement")
149 ("del" summary "Delete specified objects, i.e., undo what assignment did")
150 ("def" summary "Define a new function")
151 ("continue" summary "Skip to the next iteration of enclosing 'for' or 'while' loop")
152 ("class" summary "Define a new class")
153 ("break" summary "Terminate 'for' or 'while' loop")
154 ("assert" summary "Raise AssertionError exception if <expr> is false")
155 ("as" summary "EXPR as NAME makes value of EXPR available as variable NAME")
156 ("and" summary "Logical AND binary operator ... ")))
157 "Table of language keywords.")
158
159(defconst wisent-python-wy--token-table
160 (semantic-lex-make-type-table
161 '(("symbol"
162 (NAME))
163 ("number"
164 (NUMBER_LITERAL))
165 ("string"
166 (STRING_LITERAL))
167 ("punctuation"
168 (AT . "@")
169 (BACKQUOTE . "`")
170 (ASSIGN . "=")
171 (COMMA . ",")
172 (SEMICOLON . ";")
173 (COLON . ":")
174 (BAR . "|")
175 (TILDE . "~")
176 (PERIOD . ".")
177 (MINUS . "-")
178 (PLUS . "+")
179 (MOD . "%")
180 (DIV . "/")
181 (MULT . "*")
182 (AMP . "&")
183 (GT . ">")
184 (LT . "<")
185 (HAT . "^")
186 (NE . "!=")
187 (LTGT . "<>")
188 (HATEQ . "^=")
189 (OREQ . "|=")
190 (AMPEQ . "&=")
191 (MODEQ . "%=")
192 (DIVEQ . "/=")
193 (MULTEQ . "*=")
194 (MINUSEQ . "-=")
195 (PLUSEQ . "+=")
196 (LE . "<=")
197 (GE . ">=")
198 (EQ . "==")
199 (EXPONENT . "**")
200 (GTGT . ">>")
201 (LTLT . "<<")
202 (DIVDIV . "//")
203 (DIVDIVEQ . "//=")
204 (EXPEQ . "**=")
205 (GTGTEQ . ">>=")
206 (LTLTEQ . "<<="))
207 ("close-paren"
208 (RBRACK . "]")
209 (RBRACE . "}")
210 (RPAREN . ")"))
211 ("open-paren"
212 (LBRACK . "[")
213 (LBRACE . "{")
214 (LPAREN . "("))
215 ("block"
216 (BRACK_BLOCK . "(LBRACK RBRACK)")
217 (BRACE_BLOCK . "(LBRACE RBRACE)")
218 (PAREN_BLOCK . "(LPAREN RPAREN)"))
219 ("indentation"
220 (INDENT_BLOCK . "(INDENT DEDENT)")
221 (DEDENT . "[^:INDENT:]")
222 (INDENT . "^\\s-+"))
223 ("newline"
224 (NEWLINE . "\n"))
225 ("charquote"
226 (BACKSLASH . "\\")))
227 '(("keyword" :declared t)
228 ("symbol" :declared t)
229 ("number" :declared t)
230 ("punctuation" :declared t)
231 ("block" :declared t)))
232 "Table of lexical tokens.")
233
234(defconst wisent-python-wy--parse-table
235 (progn
236 (eval-when-compile
237 (require 'semantic/wisent/comp))
238 (wisent-compile-grammar
239 '((BACKSLASH NEWLINE INDENT DEDENT INDENT_BLOCK PAREN_BLOCK BRACE_BLOCK BRACK_BLOCK LPAREN RPAREN LBRACE RBRACE LBRACK RBRACK LTLTEQ GTGTEQ EXPEQ DIVDIVEQ DIVDIV LTLT GTGT EXPONENT EQ GE LE PLUSEQ MINUSEQ MULTEQ DIVEQ MODEQ AMPEQ OREQ HATEQ LTGT NE HAT LT GT AMP MULT DIV MOD PLUS MINUS PERIOD TILDE BAR COLON SEMICOLON COMMA ASSIGN BACKQUOTE AT STRING_LITERAL NUMBER_LITERAL NAME AND AS ASSERT BREAK CLASS CONTINUE DEF DEL ELIF ELSE EXCEPT EXEC FINALLY FOR FROM GLOBAL IF IMPORT IN IS LAMBDA NOT OR PASS PRINT RAISE RETURN TRY WHILE WITH YIELD)
240 nil
241 (goal
242 ((NEWLINE))
243 ((simple_stmt))
244 ((compound_stmt)))
245 (simple_stmt
246 ((small_stmt_list semicolon_opt NEWLINE)))
247 (small_stmt_list
248 ((small_stmt))
249 ((small_stmt_list SEMICOLON small_stmt)))
250 (small_stmt
251 ((expr_stmt))
252 ((print_stmt))
253 ((del_stmt))
254 ((pass_stmt))
255 ((flow_stmt))
256 ((import_stmt))
257 ((global_stmt))
258 ((exec_stmt))
259 ((assert_stmt)))
260 (print_stmt
261 ((PRINT print_stmt_trailer)
262 (wisent-raw-tag
263 (semantic-tag-new-code $1 nil))))
264 (print_stmt_trailer
265 ((test_list_opt)
266 nil)
267 ((GTGT test trailing_test_list_with_opt_comma_opt)
268 nil))
269 (trailing_test_list_with_opt_comma_opt
270 (nil)
271 ((trailing_test_list comma_opt)
272 nil))
273 (trailing_test_list
274 ((COMMA test)
275 nil)
276 ((trailing_test_list COMMA test)
277 nil))
278 (expr_stmt
279 ((testlist expr_stmt_trailer)
280 (if
281 (and $2
282 (stringp $1)
283 (string-match "^\\(\\sw\\|\\s_\\)+$" $1))
284 (wisent-raw-tag
285 (semantic-tag-new-variable $1 nil nil))
286 (wisent-raw-tag
287 (semantic-tag-new-code $1 nil)))))
288 (expr_stmt_trailer
289 ((augassign testlist))
290 ((eq_testlist_zom)))
291 (eq_testlist_zom
292 (nil)
293 ((eq_testlist_zom ASSIGN testlist)
294 (identity $3)))
295 (augassign
296 ((PLUSEQ))
297 ((MINUSEQ))
298 ((MULTEQ))
299 ((DIVEQ))
300 ((MODEQ))
301 ((AMPEQ))
302 ((OREQ))
303 ((HATEQ))
304 ((LTLTEQ))
305 ((GTGTEQ))
306 ((EXPEQ))
307 ((DIVDIVEQ)))
308 (del_stmt
309 ((DEL exprlist)
310 (wisent-raw-tag
311 (semantic-tag-new-code $1 nil))))
312 (exprlist
313 ((expr_list comma_opt)
314 nil))
315 (expr_list
316 ((expr)
317 nil)
318 ((expr_list COMMA expr)
319 nil))
320 (pass_stmt
321 ((PASS)
322 (wisent-raw-tag
323 (semantic-tag-new-code $1 nil))))
324 (flow_stmt
325 ((break_stmt))
326 ((continue_stmt))
327 ((return_stmt))
328 ((raise_stmt))
329 ((yield_stmt)))
330 (break_stmt
331 ((BREAK)
332 (wisent-raw-tag
333 (semantic-tag-new-code $1 nil))))
334 (continue_stmt
335 ((CONTINUE)
336 (wisent-raw-tag
337 (semantic-tag-new-code $1 nil))))
338 (return_stmt
339 ((RETURN testlist_opt)
340 (wisent-raw-tag
341 (semantic-tag-new-code $1 nil))))
342 (testlist_opt
343 (nil)
344 ((testlist)
345 nil))
346 (yield_stmt
347 ((YIELD)
348 (wisent-raw-tag
349 (semantic-tag-new-code $1 nil)))
350 ((YIELD testlist)
351 (wisent-raw-tag
352 (semantic-tag-new-code $1 nil))))
353 (raise_stmt
354 ((RAISE zero_one_two_or_three_tests)
355 (wisent-raw-tag
356 (semantic-tag-new-code $1 nil))))
357 (zero_one_two_or_three_tests
358 (nil)
359 ((test zero_one_or_two_tests)
360 nil))
361 (zero_one_or_two_tests
362 (nil)
363 ((COMMA test zero_or_one_comma_test)
364 nil))
365 (zero_or_one_comma_test
366 (nil)
367 ((COMMA test)
368 nil))
369 (import_stmt
370 ((IMPORT dotted_as_name_list)
371 (wisent-raw-tag
372 (semantic-tag-new-include $2 nil)))
373 ((FROM dotted_name IMPORT star_or_import_as_name_list)
374 (wisent-raw-tag
375 (semantic-tag-new-include $2 nil))))
376 (dotted_as_name_list
377 ((dotted_as_name_list COMMA dotted_as_name)
378 (cons $3 $1))
379 ((dotted_as_name)
380 (list $1)))
381 (star_or_import_as_name_list
382 ((MULT)
383 nil)
384 ((import_as_name_list)
385 nil))
386 (import_as_name_list
387 ((import_as_name)
388 nil)
389 ((import_as_name_list COMMA import_as_name)
390 nil))
391 (import_as_name
392 ((NAME as_name_opt)
393 nil))
394 (dotted_as_name
395 ((dotted_name as_name_opt)))
396 (as_name_opt
397 (nil)
398 ((AS NAME)
399 (identity $2)))
400 (dotted_name
401 ((NAME))
402 ((dotted_name PERIOD NAME)
403 (format "%s.%s" $1 $3)))
404 (global_stmt
405 ((GLOBAL comma_sep_name_list)
406 (wisent-raw-tag
407 (semantic-tag-new-code $1 nil))))
408 (comma_sep_name_list
409 ((NAME))
410 ((comma_sep_name_list COMMA NAME)))
411 (exec_stmt
412 ((EXEC expr exec_trailer)
413 (wisent-raw-tag
414 (semantic-tag-new-code $1 nil))))
415 (exec_trailer
416 (nil)
417 ((IN test comma_test_opt)
418 nil))
419 (comma_test_opt
420 (nil)
421 ((COMMA test)
422 nil))
423 (assert_stmt
424 ((ASSERT test comma_test_opt)
425 (wisent-raw-tag
426 (semantic-tag-new-code $1 nil))))
427 (compound_stmt
428 ((if_stmt))
429 ((while_stmt))
430 ((for_stmt))
431 ((try_stmt))
432 ((with_stmt))
433 ((funcdef))
434 ((class_declaration)))
435 (if_stmt
436 ((IF test COLON suite elif_suite_pair_list else_suite_pair_opt)
437 (wisent-raw-tag
438 (semantic-tag-new-code $1 nil))))
439 (elif_suite_pair_list
440 (nil)
441 ((elif_suite_pair_list ELIF test COLON suite)
442 nil))
443 (else_suite_pair_opt
444 (nil)
445 ((ELSE COLON suite)
446 nil))
447 (suite
448 ((simple_stmt)
449 (list $1))
450 ((NEWLINE indented_block)
451 (progn $2)))
452 (indented_block
453 ((INDENT_BLOCK)
454 (semantic-parse-region
455 (car $region1)
456 (cdr $region1)
457 'indented_block_body 1)))
458 (indented_block_body
459 ((INDENT)
460 nil)
461 ((DEDENT)
462 nil)
463 ((simple_stmt))
464 ((compound_stmt)))
465 (while_stmt
466 ((WHILE test COLON suite else_suite_pair_opt)
467 (wisent-raw-tag
468 (semantic-tag-new-code $1 nil))))
469 (for_stmt
470 ((FOR exprlist IN testlist COLON suite else_suite_pair_opt)
471 (wisent-raw-tag
472 (semantic-tag-new-code $1 nil))))
473 (try_stmt
474 ((TRY COLON suite except_clause_suite_pair_list else_suite_pair_opt)
475 (wisent-raw-tag
476 (semantic-tag-new-code $1 nil)))
477 ((TRY COLON suite FINALLY COLON suite)
478 (wisent-raw-tag
479 (semantic-tag-new-code $1 nil))))
480 (except_clause_suite_pair_list
481 ((except_clause COLON suite)
482 nil)
483 ((except_clause_suite_pair_list except_clause COLON suite)
484 nil))
485 (except_clause
486 ((EXCEPT zero_one_or_two_test)
487 nil))
488 (zero_one_or_two_test
489 (nil)
490 ((test zero_or_one_comma_test)
491 nil))
492 (with_stmt
493 ((WITH test COLON suite)
494 (wisent-raw-tag
495 (semantic-tag-new-code $1 nil)))
496 ((WITH test with_var COLON suite)
497 (wisent-raw-tag
498 (semantic-tag-new-code $1 nil))))
499 (with_var
500 ((AS expr)
501 nil))
502 (decorator
503 ((AT dotted_name varargslist_opt NEWLINE)
504 (wisent-raw-tag
505 (semantic-tag-new-function $2 "decorator" $3))))
506 (decorators
507 ((decorator)
508 (list $1))
509 ((decorator decorators)
510 (cons $1 $2)))
511 (funcdef
512 ((DEF NAME function_parameter_list COLON suite)
513 (wisent-python-reconstitute-function-tag
514 (wisent-raw-tag
515 (semantic-tag-new-function $2 nil $3))
516 $5))
517 ((decorators DEF NAME function_parameter_list COLON suite)
518 (wisent-python-reconstitute-function-tag
519 (wisent-raw-tag
520 (semantic-tag-new-function $3 nil $4 :decorators $1))
521 $6)))
522 (function_parameter_list
523 ((PAREN_BLOCK)
524 (let
525 ((wisent-python-EXPANDING-block t))
526 (semantic-parse-region
527 (car $region1)
528 (cdr $region1)
529 'function_parameters 1))))
530 (function_parameters
531 ((LPAREN)
532 nil)
533 ((RPAREN)
534 nil)
535 ((function_parameter COMMA))
536 ((function_parameter RPAREN)))
537 (function_parameter
538 ((fpdef_opt_test))
539 ((MULT NAME)
540 (wisent-raw-tag
541 (semantic-tag-new-variable $2 nil nil)))
542 ((EXPONENT NAME)
543 (wisent-raw-tag
544 (semantic-tag-new-variable $2 nil nil))))
545 (class_declaration
546 ((CLASS NAME paren_class_list_opt COLON suite)
547 (wisent-python-reconstitute-class-tag
548 (wisent-raw-tag
549 (semantic-tag-new-type $2 $1 $5
550 (cons $3 nil))))))
551 (paren_class_list_opt
552 (nil)
553 ((paren_class_list)))
554 (paren_class_list
555 ((PAREN_BLOCK)
556 (let
557 ((wisent-python-EXPANDING-block t))
558 (mapcar 'semantic-tag-name
559 (semantic-parse-region
560 (car $region1)
561 (cdr $region1)
562 'paren_classes 1)))))
563 (paren_classes
564 ((LPAREN)
565 nil)
566 ((RPAREN)
567 nil)
568 ((paren_class COMMA)
569 (wisent-raw-tag
570 (semantic-tag-new-variable $1 nil nil)))
571 ((paren_class RPAREN)
572 (wisent-raw-tag
573 (semantic-tag-new-variable $1 nil nil))))
574 (paren_class
575 ((dotted_name)))
576 (test
577 ((test_test))
578 ((lambdef)))
579 (test_test
580 ((and_test))
581 ((test_test OR and_test)
582 nil))
583 (and_test
584 ((not_test))
585 ((and_test AND not_test)
586 nil))
587 (not_test
588 ((NOT not_test)
589 nil)
590 ((comparison)))
591 (comparison
592 ((expr))
593 ((comparison comp_op expr)
594 nil))
595 (comp_op
596 ((LT))
597 ((GT))
598 ((EQ))
599 ((GE))
600 ((LE))
601 ((LTGT))
602 ((NE))
603 ((IN))
604 ((NOT IN))
605 ((IS))
606 ((IS NOT)))
607 (expr
608 ((xor_expr))
609 ((expr BAR xor_expr)
610 nil))
611 (xor_expr
612 ((and_expr))
613 ((xor_expr HAT and_expr)
614 nil))
615 (and_expr
616 ((shift_expr))
617 ((and_expr AMP shift_expr)
618 nil))
619 (shift_expr
620 ((arith_expr))
621 ((shift_expr shift_expr_operators arith_expr)
622 nil))
623 (shift_expr_operators
624 ((LTLT))
625 ((GTGT)))
626 (arith_expr
627 ((term))
628 ((arith_expr plus_or_minus term)
629 nil))
630 (plus_or_minus
631 ((PLUS))
632 ((MINUS)))
633 (term
634 ((factor))
635 ((term term_operator factor)
636 nil))
637 (term_operator
638 ((MULT))
639 ((DIV))
640 ((MOD))
641 ((DIVDIV)))
642 (factor
643 ((prefix_operators factor)
644 nil)
645 ((power)))
646 (prefix_operators
647 ((PLUS))
648 ((MINUS))
649 ((TILDE)))
650 (power
651 ((atom trailer_zom exponent_zom)
652 (concat $1
653 (if $2
654 (concat " " $2 " ")
655 "")
656 (if $3
657 (concat " " $3)
658 ""))))
659 (trailer_zom
660 (nil)
661 ((trailer_zom trailer)
662 nil))
663 (exponent_zom
664 (nil)
665 ((exponent_zom EXPONENT factor)
666 nil))
667 (trailer
668 ((PAREN_BLOCK)
669 nil)
670 ((BRACK_BLOCK)
671 nil)
672 ((PERIOD NAME)
673 nil))
674 (atom
675 ((PAREN_BLOCK)
676 nil)
677 ((BRACK_BLOCK)
678 nil)
679 ((BRACE_BLOCK)
680 nil)
681 ((BACKQUOTE testlist BACKQUOTE)
682 nil)
683 ((NAME))
684 ((NUMBER_LITERAL))
685 ((one_or_more_string)))
686 (test_list_opt
687 (nil)
688 ((testlist)
689 nil))
690 (testlist
691 ((comma_sep_test_list comma_opt)))
692 (comma_sep_test_list
693 ((test))
694 ((comma_sep_test_list COMMA test)
695 (format "%s, %s" $1 $3)))
696 (one_or_more_string
697 ((STRING_LITERAL))
698 ((one_or_more_string STRING_LITERAL)
699 (concat $1 $2)))
700 (lambdef
701 ((LAMBDA varargslist_opt COLON test)
702 (format "%s %s" $1
703 (or $2 ""))))
704 (varargslist_opt
705 (nil)
706 ((varargslist)))
707 (varargslist
708 ((fpdef_opt_test_list_comma_zom rest_args)
709 (nconc $2 $1))
710 ((fpdef_opt_test_list comma_opt)))
711 (rest_args
712 ((MULT NAME multmult_name_opt)
713 nil)
714 ((EXPONENT NAME)
715 nil))
716 (multmult_name_opt
717 (nil)
718 ((COMMA EXPONENT NAME)
719 (wisent-raw-tag
720 (semantic-tag-new-variable $3 nil nil))))
721 (fpdef_opt_test_list_comma_zom
722 (nil)
723 ((fpdef_opt_test_list_comma_zom fpdef_opt_test COMMA)
724 (nconc $2 $1)))
725 (fpdef_opt_test_list
726 ((fpdef_opt_test))
727 ((fpdef_opt_test_list COMMA fpdef_opt_test)
728 (nconc $3 $1)))
729 (fpdef_opt_test
730 ((fpdef eq_test_opt)))
731 (fpdef
732 ((NAME)
733 (wisent-raw-tag
734 (semantic-tag-new-variable $1 nil nil))))
735 (fplist
736 ((fpdef_list comma_opt)))
737 (fpdef_list
738 ((fpdef))
739 ((fpdef_list COMMA fpdef)))
740 (eq_test_opt
741 (nil)
742 ((ASSIGN test)
743 nil))
744 (comma_opt
745 (nil)
746 ((COMMA)))
747 (semicolon_opt
748 (nil)
749 ((SEMICOLON))))
750 '(goal function_parameter paren_class indented_block function_parameters paren_classes indented_block_body)))
751 "Parser table.")
752
753(defun wisent-python-wy--install-parser ()
754 "Setup the Semantic Parser."
755 (semantic-install-function-overrides
756 '((parse-stream . wisent-parse-stream)))
757 (setq semantic-parser-name "LALR"
758 semantic--parse-table wisent-python-wy--parse-table
759 semantic-debug-parser-source "python.wy"
760 semantic-flex-keywords-obarray wisent-python-wy--keyword-table
761 semantic-lex-types-obarray wisent-python-wy--token-table)
762 ;; Collect unmatched syntax lexical tokens
763 (semantic-make-local-hook 'wisent-discarding-token-functions)
764 (add-hook 'wisent-discarding-token-functions
765 'wisent-collect-unmatched-syntax nil t))
766
767
768;;; Analyzers
769;;
770(define-lex-block-type-analyzer wisent-python-wy--<block>-block-analyzer
771 "block analyzer for <block> tokens."
772 "\\s(\\|\\s)"
773 '((("(" LPAREN PAREN_BLOCK)
774 ("{" LBRACE BRACE_BLOCK)
775 ("[" LBRACK BRACK_BLOCK))
776 (")" RPAREN)
777 ("}" RBRACE)
778 ("]" RBRACK))
779 )
780
781(define-lex-regex-type-analyzer wisent-python-wy--<symbol>-regexp-analyzer
782 "regexp analyzer for <symbol> tokens."
783 "\\(\\sw\\|\\s_\\)+"
784 nil
785 'NAME)
786
787(define-lex-regex-type-analyzer wisent-python-wy--<number>-regexp-analyzer
788 "regexp analyzer for <number> tokens."
789 semantic-lex-number-expression
790 nil
791 'NUMBER_LITERAL)
792
793(define-lex-string-type-analyzer wisent-python-wy--<punctuation>-string-analyzer
794 "string analyzer for <punctuation> tokens."
795 "\\(\\s.\\|\\s$\\|\\s'\\)+"
796 '((AT . "@")
797 (BACKQUOTE . "`")
798 (ASSIGN . "=")
799 (COMMA . ",")
800 (SEMICOLON . ";")
801 (COLON . ":")
802 (BAR . "|")
803 (TILDE . "~")
804 (PERIOD . ".")
805 (MINUS . "-")
806 (PLUS . "+")
807 (MOD . "%")
808 (DIV . "/")
809 (MULT . "*")
810 (AMP . "&")
811 (GT . ">")
812 (LT . "<")
813 (HAT . "^")
814 (NE . "!=")
815 (LTGT . "<>")
816 (HATEQ . "^=")
817 (OREQ . "|=")
818 (AMPEQ . "&=")
819 (MODEQ . "%=")
820 (DIVEQ . "/=")
821 (MULTEQ . "*=")
822 (MINUSEQ . "-=")
823 (PLUSEQ . "+=")
824 (LE . "<=")
825 (GE . ">=")
826 (EQ . "==")
827 (EXPONENT . "**")
828 (GTGT . ">>")
829 (LTLT . "<<")
830 (DIVDIV . "//")
831 (DIVDIVEQ . "//=")
832 (EXPEQ . "**=")
833 (GTGTEQ . ">>=")
834 (LTLTEQ . "<<="))
835 'punctuation)
836
837(define-lex-keyword-type-analyzer wisent-python-wy--<keyword>-keyword-analyzer
838 "keyword analyzer for <keyword> tokens."
839 "\\(\\sw\\|\\s_\\)+")
840
841
842;;; Epilogue
843;;
844
845(provide 'semantic/wisent/python-wy)
846
847;;; semantic/wisent/python-wy.el ends here
diff --git a/lisp/cedet/srecode/srt-wy.el b/lisp/cedet/srecode/srt-wy.el
deleted file mode 100644
index 450f57d943c..00000000000
--- a/lisp/cedet/srecode/srt-wy.el
+++ /dev/null
@@ -1,306 +0,0 @@
1;;; srecode/srt-wy.el --- Generated parser support file
2
3;; Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
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.
11
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.
16
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/>.
19
20;;; Commentary:
21;;
22;; This file was generated from admin/grammars/srecode-template.wy.
23
24;;; Code:
25
26(require 'semantic/lex)
27(eval-when-compile (require 'semantic/bovine))
28
29;;; Prologue
30;;
31
32;;; Declarations
33;;
34(defconst srecode-template-wy--keyword-table
35 (semantic-lex-make-keyword-table
36 '(("set" . SET)
37 ("show" . SHOW)
38 ("macro" . MACRO)
39 ("context" . CONTEXT)
40 ("template" . TEMPLATE)
41 ("sectiondictionary" . SECTIONDICTIONARY)
42 ("section" . SECTION)
43 ("end" . END)
44 ("prompt" . PROMPT)
45 ("default" . DEFAULT)
46 ("defaultmacro" . DEFAULTMACRO)
47 ("read" . READ)
48 ("bind" . BIND))
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.")
63
64(defconst srecode-template-wy--token-table
65 (semantic-lex-make-type-table
66 '(("number"
67 (number))
68 ("string"
69 (string))
70 ("symbol"
71 (symbol))
72 ("property"
73 (property))
74 ("separator"
75 (TEMPLATE_BLOCK . "^----"))
76 ("newline"
77 (newline)))
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.")
88
89(defconst srecode-template-wy--parse-table
90 (progn
91 (eval-when-compile
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)
95 nil
96 (template_file
97 ((newline)
98 nil)
99 ((context))
100 ((prompt))
101 ((variable))
102 ((template)))
103 (context
104 ((CONTEXT symbol newline)
105 (wisent-raw-tag
106 (semantic-tag $2 'context))))
107 (prompt
108 ((PROMPT symbol string opt-default-fcn opt-read-fcn newline)
109 (wisent-raw-tag
110 (semantic-tag $2 'prompt :text
111 (read $3)
112 :default $4 :read $5))))
113 (opt-default-fcn
114 ((DEFAULT symbol)
115 (progn
116 (read $2)))
117 ((DEFAULT string)
118 (progn
119 (read $2)))
120 ((DEFAULTMACRO string)
121 (progn
122 (cons 'macro
123 (read $2))))
124 (nil nil))
125 (opt-read-fcn
126 ((READ symbol)
127 (progn
128 (read $2)))
129 (nil nil))
130 (variable
131 ((SET symbol insertable-string-list newline)
132 (wisent-raw-tag
133 (semantic-tag-new-variable $2 nil $3)))
134 ((SET symbol number newline)
135 (wisent-raw-tag
136 (semantic-tag-new-variable $2 nil
137 (list $3))))
138 ((SHOW symbol newline)
139 (wisent-raw-tag
140 (semantic-tag-new-variable $2 nil t))))
141 (insertable-string-list
142 ((insertable-string)
143 (list $1))
144 ((insertable-string-list insertable-string)
145 (append $1
146 (list $2))))
147 (insertable-string
148 ((string)
149 (read $1))
150 ((MACRO string)
151 (cons 'macro
152 (read $2))))
153 (template
154 ((TEMPLATE templatename opt-dynamic-arguments newline opt-string section-dictionary-list TEMPLATE_BLOCK newline opt-bind)
155 (wisent-raw-tag
156 (semantic-tag-new-function $2 nil $3 :documentation $5 :code $7 :dictionaries $6 :binding $9))))
157 (templatename
158 ((symbol))
159 ((PROMPT))
160 ((CONTEXT))
161 ((TEMPLATE))
162 ((DEFAULT))
163 ((MACRO))
164 ((DEFAULTMACRO))
165 ((READ))
166 ((SET)))
167 (opt-dynamic-arguments
168 ((property opt-dynamic-arguments)
169 (cons $1 $2))
170 (nil nil))
171 (opt-string
172 ((string newline)
173 (read $1))
174 (nil nil))
175 (section-dictionary-list
176 (nil nil)
177 ((section-dictionary-list flat-section-dictionary)
178 (append $1
179 (list $2)))
180 ((section-dictionary-list section-dictionary)
181 (append $1
182 (list $2))))
183 (flat-section-dictionary
184 ((SECTIONDICTIONARY string newline flat-dictionary-entry-list)
185 (cons
186 (read $2)
187 $4)))
188 (flat-dictionary-entry-list
189 (nil nil)
190 ((flat-dictionary-entry-list flat-dictionary-entry)
191 (append $1 $2)))
192 (flat-dictionary-entry
193 ((variable)
194 (wisent-cook-tag $1)))
195 (section-dictionary
196 ((SECTION string newline dictionary-entry-list END newline)
197 (cons
198 (read $2)
199 $4)))
200 (dictionary-entry-list
201 (nil nil)
202 ((dictionary-entry-list dictionary-entry)
203 (append $1 $2)))
204 (dictionary-entry
205 ((variable)
206 (wisent-cook-tag $1))
207 ((section-dictionary)
208 (list $1)))
209 (opt-bind
210 ((BIND string newline)
211 (read $2))
212 (nil nil)))
213 '(template_file)))
214 "Parser table.")
215
216(defun srecode-template-wy--install-parser ()
217 "Setup the Semantic Parser."
218 (semantic-install-function-overrides
219 '((parse-stream . wisent-parse-stream)))
220 (setq semantic-parser-name "LALR"
221 semantic--parse-table srecode-template-wy--parse-table
222 semantic-debug-parser-source "srecode-template.wy"
223 semantic-flex-keywords-obarray srecode-template-wy--keyword-table
224 semantic-lex-types-obarray srecode-template-wy--token-table)
225 ;; Collect unmatched syntax lexical tokens
226 (semantic-make-local-hook 'wisent-discarding-token-functions)
227 (add-hook 'wisent-discarding-token-functions
228 'wisent-collect-unmatched-syntax nil t))
229
230
231;;; Analyzers
232;;
233(define-lex-regex-type-analyzer srecode-template-wy--<property>-regexp-analyzer
234 "regexp analyzer for <property> tokens."
235 ":\\(\\w\\|\\s_\\)*"
236 nil
237 'property)
238
239(define-lex-regex-type-analyzer srecode-template-wy--<symbol>-regexp-analyzer
240 "regexp analyzer for <symbol> tokens."
241 "\\(\\sw\\|\\s_\\)+"
242 nil
243 'symbol)
244
245(define-lex-regex-type-analyzer srecode-template-wy--<number>-regexp-analyzer
246 "regexp analyzer for <number> tokens."
247 semantic-lex-number-expression
248 nil
249 'number)
250
251(define-lex-string-type-analyzer srecode-template-wy--<punctuation>-string-analyzer
252 "string analyzer for <punctuation> tokens."
253 "\\s.+"
254 nil
255 'punctuation)
256
257(define-lex-sexp-type-analyzer srecode-template-wy--<string>-sexp-analyzer
258 "sexp analyzer for <string> tokens."
259 "\\s\""
260 'string)
261
262(define-lex-keyword-type-analyzer srecode-template-wy--<keyword>-keyword-analyzer
263 "keyword analyzer for <keyword> tokens."
264 "\\(\\sw\\|\\s_\\)+")
265
266
267;;; Epilogue
268;;
269(define-lex-simple-regex-analyzer srecode-template-property-analyzer
270 "Detect and create a dynamic argument properties."
271 ":\\(\\w\\|\\s_\\)*" 'property 0)
272
273(define-lex-regex-analyzer srecode-template-separator-block
274 "Detect and create a template quote block."
275 "^----\n"
276 (semantic-lex-push-token
277 (semantic-lex-token
278 'TEMPLATE_BLOCK
279 (match-end 0)
280 (semantic-lex-unterminated-syntax-protection 'TEMPLATE_BLOCK
281 (goto-char (match-end 0))
282 (re-search-forward "^----$")
283 (match-beginning 0))))
284 (setq semantic-lex-end-point (point)))
285
286
287(define-lex wisent-srecode-template-lexer
288 "Lexical analyzer that handles SRecode Template buffers.
289It ignores whitespace, newlines and comments."
290 semantic-lex-newline
291 semantic-lex-ignore-whitespace
292 semantic-lex-ignore-newline
293 semantic-lex-ignore-comments
294 srecode-template-separator-block
295 srecode-template-wy--<keyword>-keyword-analyzer
296 srecode-template-property-analyzer
297 srecode-template-wy--<number>-regexp-analyzer
298 srecode-template-wy--<symbol>-regexp-analyzer
299 srecode-template-wy--<string>-sexp-analyzer
300 srecode-template-wy--<punctuation>-string-analyzer
301 semantic-lex-default-action
302 )
303
304(provide 'srecode/srt-wy)
305
306;;; srecode/srt-wy.el ends here