diff options
Diffstat (limited to 'admin/grammars')
-rw-r--r-- | admin/grammars/Makefile.in | 58 | ||||
-rw-r--r-- | admin/grammars/c.by | 2 | ||||
-rw-r--r-- | admin/grammars/grammar.wy | 10 | ||||
-rw-r--r-- | admin/grammars/python.wy | 33 |
4 files changed, 54 insertions, 49 deletions
diff --git a/admin/grammars/Makefile.in b/admin/grammars/Makefile.in index 98c9c623abc..aaf95c08973 100644 --- a/admin/grammars/Makefile.in +++ b/admin/grammars/Makefile.in @@ -28,24 +28,13 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ -# 'make' verbosity. -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ - -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = - -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = +-include ${top_builddir}/src/verbose.mk # Prevent any settings in the user environment causing problems. unexport EMACSDATA EMACSDOC EMACSPATH EMACS = ${top_builddir}/src/emacs -emacs = EMACSLOADPATH= "${EMACS}" -batch --no-site-file --no-site-lisp +emacs = EMACSLOADPATH= "${EMACS}" -batch --no-site-file --no-site-lisp --eval '(setq load-prefer-newer t)' make_bovine = ${emacs} -l semantic/bovine/grammar -f bovine-batch-make-parser make_wisent = ${emacs} -l semantic/wisent/grammar -f wisent-batch-make-parser @@ -54,19 +43,19 @@ cedetdir = ${top_srcdir}/lisp/cedet bovinedir = ${cedetdir}/semantic/bovine wisentdir = ${cedetdir}/semantic/wisent +grammar_bovine = ${bovinedir}/grammar.el +grammar_wisent = ${wisentdir}/grammar.el + BOVINE = \ ${bovinedir}/c-by.el \ ${bovinedir}/make-by.el \ ${bovinedir}/scm-by.el -## FIXME Should include this one too: -## ${cedetdir}/semantic/grammar-wy.el -## but semantic/grammar.el (which is what we use to generate grammar-wy.el) -## requires it! -WISENT = \ - ${wisentdir}/javat-wy.el \ - ${wisentdir}/js-wy.el \ - ${wisentdir}/python-wy.el \ +WISENT = \ + ${cedetdir}/semantic/grammar-wy.el \ + ${wisentdir}/javat-wy.el \ + ${wisentdir}/js-wy.el \ + ${wisentdir}/python-wy.el \ ${cedetdir}/srecode/srt-wy.el ALL = ${BOVINE} ${WISENT} @@ -80,46 +69,45 @@ bovine: ${BOVINE} wisent: ${WISENT} ## c-by.el, make-by.el. -${bovinedir}/%-by.el: ${srcdir}/%.by +${bovinedir}/%-by.el: ${srcdir}/%.by ${grammar_bovine} $(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@" $(AM_V_at)${make_bovine} -o "$@" $< -${bovinedir}/scm-by.el: ${srcdir}/scheme.by +${bovinedir}/scm-by.el: ${srcdir}/scheme.by ${grammar_bovine} $(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@" $(AM_V_at)${make_bovine} -o "$@" $< ## grammar-wy.el -${cedetdir}/semantic/%-wy.el: ${srcdir}/%.wy +${cedetdir}/semantic/%-wy.el: ${srcdir}/%.wy ${grammar_wisent} $(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@" $(AM_V_at)${make_wisent} -o "$@" $< ## js-wy.el, python-wy.el -${wisentdir}/%-wy.el: ${srcdir}/%.wy +${wisentdir}/%-wy.el: ${srcdir}/%.wy ${grammar_wisent} $(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@" $(AM_V_at)${make_wisent} -o "$@" $< -${wisentdir}/javat-wy.el: ${srcdir}/java-tags.wy +${wisentdir}/javat-wy.el: ${srcdir}/java-tags.wy ${grammar_wisent} $(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@" $(AM_V_at)${make_wisent} -o "$@" $< -${cedetdir}/srecode/srt-wy.el: ${srcdir}/srecode-template.wy +${cedetdir}/srecode/srt-wy.el: ${srcdir}/srecode-template.wy ${grammar_wisent} $(AM_V_GEN)[ ! -f "$@" ] || chmod +w "$@" $(AM_V_at)${make_wisent} -o "$@" $< - -.PHONY: distclean bootstrap-clean maintainer-clean extraclean +.PHONY: distclean bootstrap-clean maintainer-clean gen-clean distclean: rm -f Makefile -## Perhaps this should do what extraclean (qv) does. +## IMO this should run gen-clean. bootstrap-clean: -maintainer-clean: distclean - -## We do not normally delete the generated files, even in bootstrap. -## Creating them does not take long, so we could easily change this. -extraclean: +gen-clean: rm -f ${ALL} +maintainer-clean: gen-clean distclean + + + # Makefile.in ends here diff --git a/admin/grammars/c.by b/admin/grammars/c.by index 2d04c999aca..289081e3ced 100644 --- a/admin/grammars/c.by +++ b/admin/grammars/c.by @@ -415,7 +415,7 @@ typesimple : struct-or-class opt-class opt-name opt-template-specifier opt-class-parents semantic-list (TYPE-TAG (car $3) (car $1) - (let ((semantic-c-classname (cons (car ,$3) (car ,$1)))) + (dlet ((semantic-c-classname (cons (car ,$3) (car ,$1)))) (EXPANDFULL $6 classsubparts)) $5 :template-specifier $4 diff --git a/admin/grammars/grammar.wy b/admin/grammars/grammar.wy index 054e85bf70d..35fb7e832e9 100644 --- a/admin/grammars/grammar.wy +++ b/admin/grammars/grammar.wy @@ -128,7 +128,7 @@ epilogue: ;; declaration: decl - (eval $1) + (eval $1 t) ; decl: @@ -206,7 +206,7 @@ put_decl: put_name_list: BRACE_BLOCK - (mapcar 'semantic-tag-name (EXPANDFULL $1 put_names)) + (mapcar #'semantic-tag-name (EXPANDFULL $1 put_names)) ; put_names: @@ -226,7 +226,7 @@ put_name: put_value_list: BRACE_BLOCK - (mapcar 'semantic-tag-code-detail (EXPANDFULL $1 put_values)) + (mapcar #'semantic-tag-code-detail (EXPANDFULL $1 put_values)) ; put_values: @@ -300,7 +300,7 @@ plist: use_name_list: BRACE_BLOCK - (mapcar 'semantic-tag-name (EXPANDFULL $1 use_names)) + (mapcar #'semantic-tag-name (EXPANDFULL $1 use_names)) ; use_names: @@ -356,7 +356,7 @@ nonterminal: rules: lifo_rules - (apply 'nconc (nreverse $1)) + (apply #'nconc (nreverse $1)) ; lifo_rules: diff --git a/admin/grammars/python.wy b/admin/grammars/python.wy index aaa25ced202..2539d1bec8c 100644 --- a/admin/grammars/python.wy +++ b/admin/grammars/python.wy @@ -88,15 +88,17 @@ %package wisent-python-wy %provide semantic/wisent/python-wy -%expectedconflicts 4 +%expectedconflicts 5 %{ +(require 'semantic/tag) (declare-function wisent-python-reconstitute-function-tag "semantic/wisent/python" (tag suite)) (declare-function wisent-python-reconstitute-class-tag "semantic/wisent/python" (tag)) (declare-function semantic-parse-region "semantic" (start end &optional nonterminal depth returnonerror)) +(defvar wisent-python-EXPANDING-block) } %languagemode python-mode @@ -184,6 +186,7 @@ %token <punctuation> ASSIGN "=" %token <punctuation> BACKQUOTE "`" %token <punctuation> AT "@" +%token <punctuation> FOLLOWS "->" ;; ----------------- @@ -808,12 +811,17 @@ decorators ;; funcdef: [decorators] 'def' NAME parameters ':' suite funcdef - : DEF NAME function_parameter_list COLON suite + : DEF NAME function_parameter_list return_type_hint COLON suite (wisent-python-reconstitute-function-tag - (FUNCTION-TAG $2 nil $3) $5) - | decorators DEF NAME function_parameter_list COLON suite + (FUNCTION-TAG $2 nil $3) $6) + | decorators DEF NAME function_parameter_list return_type_hint COLON suite (wisent-python-reconstitute-function-tag - (FUNCTION-TAG $3 nil $4 :decorators $1) $6) + (FUNCTION-TAG $3 nil $4 :decorators $1) $7) + ; + +return_type_hint + : ;;EMPTY + | FOLLOWS type ; function_parameter_list @@ -865,7 +873,7 @@ paren_class_list_opt paren_class_list : PAREN_BLOCK (let ((wisent-python-EXPANDING-block t)) - (mapcar 'semantic-tag-name (EXPANDFULL $1 paren_classes))) + (mapcar #'semantic-tag-name (EXPANDFULL $1 paren_classes))) ; ;; parameters: '(' [varargslist] ')' @@ -887,7 +895,7 @@ paren_classes ;; parser can parse general expressions, I don't see much benefit in ;; generating a string of expression as base class "name". paren_class - : dotted_name + : type ; ;;;**************************************************************************** @@ -1140,7 +1148,7 @@ fpdef_opt_test ;; fpdef: NAME | '(' fplist ')' fpdef - : NAME + : NAME type_hint (VARIABLE-TAG $1 nil nil) ;; Below breaks the parser. Don't know why, but my guess is that ;; LPAREN/RPAREN clashes with the ones in function_parameters. @@ -1160,6 +1168,15 @@ fpdef ;; | fpdef_list COMMA fpdef ;; ; +type_hint + : ;;EMPTY + | COLON type + ; + +type + : test + ; + ;; ['=' test] eq_test_opt : ;;EMPTY |