User: scop
Date: 06/02/27 23:43:10
Modified: packages/xemacs-packages/semantic ChangeLog
ChangeLog.upstream Makefile NEWS Project.ede c.bnf
semantic-c.el semantic-cb.el semantic-ia.el
semantic-load.el semantic-util-modes.el
semantic-util.el semantic.el semanticdb.el
senator.el
Log:
Sync with upstream 1.4.4.
Revision Changes Path
1.39 +4 -0 XEmacs/packages/xemacs-packages/semantic/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/ChangeLog,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -p -r1.38 -r1.39
--- ChangeLog 2004/10/31 10:15:48 1.38
+++ ChangeLog 2006/02/27 22:43:05 1.39
@@ -1,3 +1,7 @@
+2006-02-26 Ville Skyttä <scop(a)xemacs.org>
+
+ * Sync with upstream 1.4.4.
+
2004-10-31 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.19 released.
1.3 +241 -0 XEmacs/packages/xemacs-packages/semantic/ChangeLog.upstream
Index: ChangeLog.upstream
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/ChangeLog.upstream,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- ChangeLog.upstream 2003/01/06 12:12:47 1.2
+++ ChangeLog.upstream 2006/02/27 22:43:05 1.3
@@ -1,3 +1,244 @@
+2003-04-22 14:58 ponced
+
+ * semantic.el:
+
+ (semantic-version): Updated to 1.4.4.
+
+2003-04-22 14:57 ponced
+
+ * Project.ede:
+
+ (ede-proj-project "semantic"): Updated :version to 1.4.4.
+
+2003-04-11 09:53 berndl
+
+ * semantic-util-modes.el:
+
+ (semantic-stickyfunc-fetch-stickyline): Searching the token-name to get more
+ useful information in the header line
+
+2003-04-10 17:40 berndl
+
+ * NEWS:
+
+ Added news for bugfixes of the c++-grammar
+
+2003-04-08 14:53 ponced
+
+ * semantic-util.el:
+
+ (semantic-uml-nonterminal-protection): New macro.
+ (semantic-uml-abbreviate-nonterminal-default)
+ (semantic-uml-prototype-nonterminal-default)
+ (semantic-uml-concise-prototype-nonterminal-default): Use it.
+
+2003-04-08 14:34 zappo
+
+ * NEWS:
+
+ Added section for semantic 1.4.4.
+ Discuss stickyfunc mode.
+
+2003-04-08 00:09 zappo
+
+ * semantic-load.el:
+
+ (global-semantic-stickyfunc-mode): On by default if available.
+
+2003-04-08 00:07 zappo
+
+ * semantic-util-modes.el:
+
+ (global-semantic-stickyfunc-mode)
+ (global-semantic-stickyfunc-mode-hook)
+ (semantic-stickyfunc-mode-map)
+ (semantic-stickyfunc-mode)
+ (semantic-stickyfunc-mode-setup)
+ (semantic-stickyfunc-sticky-classes)
+ (semantic-stickyfunc-fetch-stickyline): New minor mode.
+
+2003-04-04 14:19 berndl
+
+ * semantic-c.el, c.bnf:
+
+ (namespace-symbol): fixed so also template-specifiers can be parsed here.
+
+ (typeformbase): ajusted for new namespace-symbol definition
+
+2003-04-04 11:42 berndl
+
+ * c.bnf:
+
+ (macro-expression-list): Removed a backslash from the comment before which
+ prevented the whole file from being lexed and/or parsed.
+
+2003-04-04 10:28 ponced
+
+ * senator.el:
+
+ Fix for bug #692919.
+ Unconditionally add `senator-hippie-expand-hook' to
+ `senator-minor-mode-hook'.
+
+2003-02-01 19:18 berndl
+
+ * NEWS:
+
+ Added announcements for recent enhancements for C++ parsing
+
+2003-02-01 19:16 berndl
+
+ * semantic-c.el:
+
+ Regenerated from latest c.bnf
+
+2003-02-01 19:15 berndl
+
+ * c.bnf:
+
+ (template-var): In template-types arguments can be any symbols with optional
+ adress-operator (&) and optional dereferencing operator (*)
+
+ (template-type): template-types can be all flavors of variable-args
+
+2003-01-30 14:42 berndl
+
+ * NEWS:
+
+ templates-types with constants or literals as parameters are parsed.
+
+2003-01-30 14:41 berndl
+
+ * semantic-c.el:
+
+ Newly generated from c.bnf
+
+2003-01-30 14:41 berndl
+
+ * c.bnf:
+
+ (template-var): Parses constants and literals in template types like in
+ foo<ClassX, 10> foo_10_var;
+
+2003-01-30 09:09 berndl
+
+ * semantic-c.el:
+
+ (semantic-flex-c-extensions): Added
+ semantic-flex-wide-char-literal
+ (semantic-flex-wide-char-literal): New function which lexes
+ wide-char string- and char-literals like L"str" and L'c'
+
+2003-01-30 09:09 berndl
+
+ * NEWS:
+
+ Added announcement for parsing wide-char literals like L"str"
+
+2003-01-29 17:19 berndl
+
+ * NEWS:
+
+ Added more enhancements announcements
+
+2003-01-29 17:19 berndl
+
+ * semantic-c.el:
+
+ Newly generated from latest c.bnf
+
+2003-01-29 17:18 berndl
+
+ * c.bnf:
+
+ (variablearg): Removed a superfluous opt-stars which has prevented
+ pointers counted correct for arguments
+ (variablearg-opt-name): Enabled parsing and counting pointers even
+ for arguments without an argumentname.
+ WCHAR: Added new token for "wchar_t"
+ (builtintype-types): Added WCHAR
+ (string-seq): New rule for string sequences
+ (expression): Changed string to string-seq, so that
+ string-sequences are parsed correct too
+
+2003-01-29 10:14 ponced
+
+ * semantic-c.el:
+
+ (semantic-flex-c-extensions): Support #elif.
+
+2003-01-28 09:19 berndl
+
+ * NEWS:
+
+ Added entry for better parsing of const and volatile
+
+2003-01-28 09:18 berndl
+
+ * semantic-c.el:
+
+ Newly generated from latest c.bnf
+
+2003-01-28 09:18 berndl
+
+ * c.bnf:
+
+ (typesimple): typedefs can also include declmods
+ (CVDECLMOD): New rule
+ (cv-declmods): New rule
+ (DECLMOD): uses now CVDECLMOD
+ (codeblock-var-or-fun): declmods also after typeformbase allowed
+ (variablearg): cv-declmods after typeformbase allowed
+
+2003-01-27 17:19 ponced
+
+ * semantic.el:
+
+ (semantic-version): Updated to 1.4.3.
+
+2003-01-27 17:17 ponced
+
+ * Project.ede:
+
+ (ede-proj-project "semantic"): Updated :version to 1.4.3.
+
+2003-01-24 13:34 berndl
+
+ * NEWS:
+
+ New section for semantic 1.4.3 and an entry "Enhancements to the C/C++
+ grammar" which describes all enhancements in c.bnf and semantic-c.el
+
+2003-01-24 13:31 berndl
+
+ * semantic-c.el:
+
+ (semantic-flex-c-extensions): Added semantic-flex-backslash-newline
+ (semantic-flex-backslash-newline): New function
+
+2003-01-24 13:31 berndl
+
+ * c.bnf:
+
+ (macro-expression-list): Parsing one-line macros correct
+ (define): Fixing a bug
+ (type): Added unnamed namespaces
+ (using): Allowing "using namespace XXX"
+ (template-type): changing symbol -> namespace-symbol, adding
+ keyword typename
+ (DECLMOD): Removed SIGNED and UNSIGNED, added TYPENAME
+ (builtintype-types): was builtintype; added long int, long long,
+ long double
+ (signedmod): New
+ (builtintype): Now uses signedmod and builtintype-types
+ (opt-initializers): changing symbol -> namespace-symbol
+ (varname): changing symbol -> namespace-symbol
+ (namespace-opt-class): Allowing template-specifiers
+ (opt-class): parsing namespaces here
+ (operatorsym): Parsing operator()() and operator[]()
+ (function-call): changing symbol -> namespace-symbol
+ (expression): changing symbol -> namespace-symbol
+
2002-12-31 10:50 ponced
* NEWS:
1.38 +1 -1 XEmacs/packages/xemacs-packages/semantic/Makefile
Index: Makefile
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/Makefile,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -p -r1.37 -r1.38
--- Makefile 2004/10/31 10:15:48 1.37
+++ Makefile 2006/02/27 22:43:05 1.38
@@ -18,7 +18,7 @@
# Boston, MA 02111-1307, USA.
VERSION = 1.19
-AUTHOR_VERSION = 1.4.2
+AUTHOR_VERSION = 1.4.4
MAINTAINER = Eric M. Ludlam <zappo(a)gnu.org>
PACKAGE = semantic
PKG_TYPE = regular
1.4 +67 -0 XEmacs/packages/xemacs-packages/semantic/NEWS
Index: NEWS
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/NEWS,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- NEWS 2003/01/06 12:12:48 1.3
+++ NEWS 2006/02/27 22:43:06 1.4
@@ -1,3 +1,70 @@
+* Changes for Semantic 1.4.4
+
+** New `semantic-stickyfunc-mode'. Displays the function header at top of
+ window in the Emacs 21 header-line.
+
+** Fixed a bug in the C++-grammar/parser which is related to templates.
+
+* Changes for Semantic 1.4.3
+
+** Much better C/C++ grammar (almost complete) - now complex C++ can be parsed
+
+*** Fixed some aspects of 'using' (e.g. now "using namespace XXX" is
possible)
+
+*** Much better namespace handling
+
+**** Unnamed namespaces are correct parsed and "unnamed" is added as type-name
+
+**** Namespace-qualified class- and type-names are now allowed whereever it is
+ necessary
+
+*** Much better handling of builtin-types
+
+**** signed and unsigned is now only allowed for builtin types
+
+**** Supporting composed builtins like 'long int' and 'long double'
+
+**** Parsing builtin-type wchar_t and also literals like L"str" and
L'c'
+
+*** Much better template parsing:
+
+**** Templates in combination with namespaces
+
+**** Outside method-implementations for template classes are now correct parsed
+ and also correct grouped to the type of the template class-declaration
+
+**** Template-specifier can now contain all flavors of normal args regardless
+ if builtin types or user-defined types and also in combination with
+ adress(&)- und dereferencing(*)-operator.
+
+**** All typemodifiers like const, volatile etc.. and pointers and
+ references of a template-parameter are parsed and displayed correct.
+
+**** Template types can now contain constant- and literal-arguments like in
+ "foo<ClassX, 10> foo_10_var;"
+
+**** Template-specifiers are allowed in class-qualifiers
+
+*** Improving macro-parsing, i.e. now also multiline-macros (every line ending
+ with a \) are parsed correctly; same for arbitrary one-liners
+
+*** C++ keyword 'typename' is recognized and parsed
+
+*** operator()() and operator[]() are parsed correctly
+
+*** Better parsing of const and volatile (now also allowed to be after the type)
+
+*** Correct parsing pointer-arguments of functions/methods, even if there is no
+ argument-name
+
+*** Correct parsing of string sequences like "string1" "string2"
string3" which
+ are concatenated by the cpp-precomiler to one string
+
+*** Improved typedef parsing with const/volatile types and template-types
+
+*** Some minor fixes
+
+
* Changes for Semantic 1.4.2
** Added namespaces support to the C/C++ grammar.
1.8 +1 -1 XEmacs/packages/xemacs-packages/semantic/Project.ede
Index: Project.ede
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/Project.ede,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- Project.ede 2003/01/06 12:12:48 1.7
+++ Project.ede 2006/02/27 22:43:06 1.8
@@ -2,7 +2,7 @@
;; EDE project file.
(ede-proj-project "semantic"
:name "semantic"
-:version "1.4.2"
+:version "1.4.4"
:file "Project.ede"
:targets (list
(ede-proj-target-makefile-miscelaneous "example"
1.10 +244 -60 XEmacs/packages/xemacs-packages/semantic/c.bnf
Index: c.bnf
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/c.bnf,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -r1.9 -r1.10
--- c.bnf 2003/01/06 12:12:48 1.9
+++ c.bnf 2006/02/27 22:43:06 1.10
@@ -3,7 +3,7 @@
# Copyright (C) 1999, 2000, 2001, 2002 Eric M. Ludlam
#
# Author: Eric M. Ludlam <zappo(a)gnu.org>
-# X-RCS: $Id: c.bnf,v 1.59.2.3 2002/12/27 17:00:57 ponced Exp $
+# X-RCS: $Id: c.bnf,v 1.59.2.10 2003/04/04 12:19:38 berndl Exp $
#
# c.bnf is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -104,6 +104,8 @@
%put TYPEDEF summary "Arbitrary Type Declaration: typedef <typedeclaration>
<name>;"
%token CLASS "class"
%put CLASS summary "Class Declaration: class <name>[:parents] { ... };"
+%token TYPENAME "typename"
+%put TYPENAME summary "typename is used to handle a qualified name as a
typename;"
%token NAMESPACE "namespace"
%put NAMESPACE summary "Namespace Declaration: namespace <name> { ...
};"
%token USING "using"
@@ -161,6 +163,8 @@
%put VOID summary "Built in typeless type: void"
%token CHAR "char"
%put CHAR summary "Integral Character Type: (0 to 256)"
+%token WCHAR "wchar_t"
+%put WCHAR summary "Wide Character Type"
%token SHORT "short"
%put SHORT summary "Integral Primitive Type: (-32768 to 32767)"
%token INT "int"
@@ -179,8 +183,10 @@
declaration : macro
| type
- | var-or-fun
+# TODO: Klaus Berndl <klaus.berndl(a)sdm.de>: Is the define here
+# necessary or even wrong? Is this part not already covered by macro??
| define
+ | var-or-fun
| extern-c
| template
| using
@@ -210,11 +216,32 @@ extern-c: EXTERN string "\"C\"" semantic
( nil )
;
+# Klaus Berndl <klaus.berndl(a)sdm.de>: At least one-liner should be
+# parsed correctly! Multi-line macros (every line ends with a
+# backslash) not being one code-block can not be parsed because
+# \+newline is flexed as nothing and therefore we can not distinguish
+# if the lines > 1 belong to the macro or are separated statements!
+# Maybe we need special backslash recognizing and then better
+# macro-parsing. For the moment it's goog enough.
+macro-expression-list: expression macro-expression-list SEMICOLON
+ ( nil )
+ | expression
+ ( nil )
+ ;
+
+
+macro-def: macro-expression-list
+ ( nil )
+ | expression
+ ( nil )
+ | EMPTY
+ ;
+
macro : HASH macro-or-include
( ,$2 )
;
-macro-or-include: DEFINE symbol opt-define-arglist opt-expression
+macro-or-include: DEFINE symbol opt-define-arglist macro-def
( $2 variable nil $3
(ASSOC const t)
nil
@@ -231,8 +258,8 @@ opt-define-arglist : semantic-list
;
# This is used in struct parts.
-define: HASH DEFINE symbol opt-expression
- ( $2 variable nil $3
+define: HASH DEFINE symbol opt-define-arglist macro-def
+ ( $3 variable nil $4
(ASSOC const t)
nil
)
@@ -286,9 +313,9 @@ opt-class-parents : COLON class-parents
class-parents : opt-class-protection opt-class-declmods
namespace-symbol COMA class-parents
- ( ,(cons (car $4) $6 ) )
+ ( ,(cons $3 $5 ) )
| opt-class-protection opt-class-declmods namespace-symbol
- ( ,$4 )
+ ( ,$3 )
;
opt-class-declmods : class-declmods opt-class-declmods
@@ -368,11 +395,13 @@ typesimple : struct-or-class opt-name op
| UNION opt-name unionparts
( ,$2 type $1 $3 nil nil nil )
| ENUM opt-name enumparts
- ( ,$2 type $1 $3 nil nil nil )
- | TYPEDEF typeformbase typedef-symbol-list
+ ( ,$2 type $1 $3 nil nil nil )
+# Klaus Berndl <klaus.berndl(a)sdm.de>: a typedef can be a typeformbase
+# with all this declmods stuff.
+ | TYPEDEF declmods typeformbase cv-declmods typedef-symbol-list
## We put the type this typedef renames into PARENT
## but will move it in the expand function.
- ( $3 type $1 nil $2 nil nil )
+ ( $5 type $1 nil $3 nil nil )
;
typedef-symbol-list : typedefname COMA typedef-symbol-list
@@ -381,6 +410,8 @@ typedef-symbol-list : typedefname COMA t
( $1 )
;
+# TODO: Klaus Berndl <klaus.berndl(a)sdm.de>: symbol -> namespace-symbol?!
+# Answer: Probably symbol is correct here!
typedefname : opt-stars symbol opt-bits opt-array
( $1 $2 )
;
@@ -391,15 +422,23 @@ struct-or-class: STRUCT
type : typesimple SEMICOLON
( ,$1 )
+ # named namespaces like "namespace XXX {"
| NAMESPACE symbol namespaceparts
( $2 type $1 $3 nil nil nil )
+ # unnamed namespaces like "namespace {"
+ | NAMESPACE namespaceparts
+ ( "unnamed" type $1 $2 nil nil nil )
;
+# Klaus Berndl <klaus.berndl(a)sdm.de>:
+# We must parse "using namespace XXX" too
+
# Using is vaguely like an include statement in the named portions
# of the code. We should probably specify a new token type for this.
using : USING typeformbase SEMICOLON
( nil )
- | USING symbol COLON COLON typeformbase SEMICOLON;
+ | USING NAMESPACE typeformbase SEMICOLON
+ ( nil )
;
template : TEMPLATE template-specifier opt-friend template-definition
@@ -431,9 +470,38 @@ template-specifier-type-list : COMA temp
( )
;
-template-var: template-type opt-stars opt-template-equal
- ( ,(cons (concat (car $1) (make-string (car ,$2) ?*))
- (cdr $1)))
+#template-var: template-type opt-stars opt-template-equal
+# ( ,(cons (concat (car $1) (make-string (car ,$2) ?*))
+# (cdr $1)))
+## Klaus Berndl <klaus.berndl(a)sdm.de>: for template-types the
+## template-var can also be literals or constants.
+## Example: map<ClassX, ClassY, 10> map_size10_var; This parses also
+## template<class T, 0> which is nonsense but who cares....
+# | string
+# ( $1 )
+# | number
+# ( $1 )
+# ;
+
+template-var:
+# Klaus Berndl <klaus.berndl(a)sdm.de>: The following handles all
+# template-vars of template-definitions
+ template-type opt-template-equal
+ ( ,(cons (car $1) (cdr $1)) )
+# Klaus Berndl <klaus.berndl(a)sdm.de>: for template-types the
+# template-var can also be literals or constants.
+# Example: map<ClassX, ClassY, 10> map_size10_var; This parses also
+# template<class T, 0> which is nonsense but who cares....
+ | string
+ ( $1 )
+ | number
+ ( $1 )
+# Klaus Berndl <klaus.berndl(a)sdm.de>: In template-types arguments can
+# be any symbols with optional adress-operator (&) and optional
+# dereferencing operator (*)
+# Example map<ClassX, ClassY, *size_var_ptr> sized_map_var.
+ | opt-stars opt-ref namespace-symbol
+ ( ,$3 )
;
opt-template-equal : EQUAL symbol LESS template-specifier-types GREATER
@@ -445,10 +513,22 @@ template-type : CLASS symbol
( $2 type "class" nil nil)
| STRUCT symbol
( $2 type "struct" nil nil)
- | builtintype
- ( ,$1 type nil nil nil)
- | symbol
- ( $1 type nil nil nil)
+# TODO: Klaus Berndl <klaus.berndl(a)sdm.de>: For the moment is is ok,
+# that we parse the C++ keyword typename as a class....
+ | TYPENAME symbol
+ ( $2 type "class" nil nil)
+# Klaus Berndl <klaus.berndl(a)sdm.de>: template-types can be all
+# flavors of variable-args but here the argument is ignored, only the
+# type stuff is needed.
+ | declmods typeformbase cv-declmods opt-stars
+ opt-ref variablearg-opt-name
+ ( (car $2) type nil nil
+ (ASSOC const (if (member "const" (append $1 $3)) t nil)
+ typemodifiers (delete "const" (append $1 $3))
+ reference (car ,$5)
+ pointer (car $4)
+ )
+ )
;
template-definition : type
@@ -482,15 +562,22 @@ declmods : DECLMOD declmods
DECLMOD : EXTERN
| STATIC
- | CONST
- | VOLATILE
- | SIGNED
- | UNSIGNED
+ | CVDECLMOD
+# Klaus Berndl <klaus.berndl(a)sdm.de>: IMHO signed and unsigned are not
+# decl-modes but these are only valid for some buildin-types like
+# short, int etc... whereas "real" declmods are valid for all types,
+# buildin and user-defined!
+# | SIGNED
+# | UNSIGNED
| INLINE
| REGISTER
| FRIEND
+# Klaus Berndl <klaus.berndl(a)sdm.de>: There can be a few cases where
+# TYPENAME is not allowed in C++-syntax but better than not
+# recognizing the allowed situations.
+ | TYPENAME
| METADECLMOD
- ;; This is a hack in case we are in a class.
+ # This is a hack in case we are in a class.
| VIRTUAL
;
@@ -500,6 +587,18 @@ metadeclmod : METADECLMOD
()
;
+CVDECLMOD: CONST
+ | VOLATILE
+ ;
+
+cv-declmods: CVDECLMOD cv-declmods
+ ( ,(cons ,(car ,$1) $2 ) )
+ | CVDECLMOD
+ ( ,$1 )
+ | EMPTY
+ ()
+ ;
+
METADECLMOD : VIRTUAL
| MUTABLE
;
@@ -521,24 +620,60 @@ typeformbase : typesimple
( $2 type $1 )
| builtintype
( ,$1 )
- | symbol template-specifier
- ( $1 type "class" )
- | namespace-symbol opt-stars opt-template-specifier
- ( ,$1 )
+# | symbol template-specifier
+# ( $1 type "class" )
+# | namespace-symbol opt-stars opt-template-specifier
+# | namespace-symbol opt-template-specifier
+ | namespace-symbol
+# ( ,$1 )
+ ( ,$1 type "class" )
| symbol
( $1 )
;
-builtintype: VOID
- | CHAR
- | SHORT
- | INT
- | LONG
- | FLOAT
- | DOUBLE
+signedmod: UNSIGNED
+ | SIGNED
+ ;
+
+# Klaus Berndl <klaus.berndl(a)sdm.de>: builtintype-types was builtintype
+builtintype-types: VOID
+ | CHAR
+# Klaus Berndl <klaus.berndl(a)sdm.de>: Added WCHAR
+ | WCHAR
+ | SHORT
+ | INT
+ | LONG INT
+ ( (concat $1 " " $2) )
+ | FLOAT
+ | DOUBLE
+ | LONG DOUBLE
+ ( (concat $1 " " $2) )
+# TODO: Klaus Berndl <klaus.berndl(a)sdm.de>: Is there a long long, i
+# think so?!
+ | LONG LONG
+ ( (concat $1 " " $2) )
+ | LONG
+ ;
+
+builtintype: signedmod builtintype-types
+ ( (concat (car $1) " " (car $2)) )
+ | builtintype-types
+ ( ,$1 )
+# Klaus Berndl <klaus.berndl(a)sdm.de>: unsigned is synonym for unsigned
+# int and signed for signed int. To make this confusing stuff clear we
+# add here the int.
+ | signedmod
+ ( (concat (car $1) " int") )
;
-codeblock-var-or-fun: declmods typeformbase metadeclmod
+# Klaus Berndl <klaus.berndl(a)sdm.de>: This parses also nonsense like
+# "const volatile int const volatile const const volatile a ..." but
+# IMHO nobody writes such code. Normaly we shoud define a rule like
+# typeformbase-mode which exactly defines the different allowed cases
+# and combinations of declmods (minus the CVDECLMOD) typeformbase and
+# cv-declmods so we could recognize more invalid code but IMHO this is
+# not worth the effort...
+codeblock-var-or-fun: declmods typeformbase declmods
opt-ref var-or-func-decl
( ,(semantic-c-reconstitute-token ,$5 $1 $2 ) )
;
@@ -588,8 +723,9 @@ opt-under-p : UNDERP
| EMPTY
;
-opt-initializers: COLON symbol semantic-list opt-initializers
- | COMA symbol semantic-list opt-initializers
+# Klaus Berndl <klaus.berndl(a)sdm.de>: symbol -> namespace-symbol
+opt-initializers: COLON namespace-symbol semantic-list opt-initializers
+ | COMA namespace-symbol semantic-list opt-initializers
| EMPTY
;
@@ -642,26 +778,34 @@ opt-assign : EQUAL expression
opt-restrict : symbol "\\<\\(__\\)?restrict\\>"
| EMPTY
;
+
-varname: opt-stars opt-restrict symbol opt-bits opt-array opt-assign
- ( $3 ,$1 ,$4 ,$5 ,$6 )
+# Klaus Berndl <klaus.berndl(a)sdm.de>: symbol -> namespace-symbol?! I
+# think so. Can be that then also some invalid C++-syntax is parsed
+# but this is better than not parsing valid syntax.
+varname: opt-stars opt-restrict namespace-symbol opt-bits opt-array opt-assign
+ ( ,$3 ,$1 ,$4 ,$5 ,$6 )
;
-# I should store more in this def, but leave it simple for now.
-variablearg: declmods typeformbase opt-ref opt-stars variablearg-opt-name
+# I should store more in this def, but leave it simple for now. Klaus
+# Berndl <klaus.berndl(a)sdm.de>: const and volatile can be written
+# after the type!
+variablearg: declmods typeformbase cv-declmods opt-ref variablearg-opt-name
( (list $5) variable $2 nil
- (ASSOC const (if (member "const" $1) t nil)
- typemodifiers (delete "const" $1)
- reference (car ,$3)
- )
+ (ASSOC const (if (member "const" (append $1 $3)) t nil)
+ typemodifiers (delete "const" (append $1 $3))
+ reference (car ,$4)
+ )
nil
)
;
variablearg-opt-name: varname
( ,$1)
- | EMPTY
- ( "" 0 nil nil nil )
+# Klaus Berndl <klaus.berndl(a)sdm.de>: This allows variableargs without
+# a arg-name being parsed correct even if there several pointers (*)
+ | opt-stars
+ ( "" ,$1 nil nil nil )
;
varnamelist : varname COMA varnamelist
@@ -670,14 +814,42 @@ varnamelist : varname COMA varnamelist
( $1 )
;
-namespace-symbol: symbol COLON COLON namespace-symbol
- ( (concat $1 "::" (car $4)) )
- | symbol
+# Klaus Berndl <klaus.berndl(a)sdm.de>:
+# Is necessary to parse stuff like
+# class list_of_facts : public list<fact>, public entity
+# and
+# list <shared_ptr<item> >::const_iterator l;
+# Parses also invalid(?) and senseless(?) c++-syntax like
+# symbol<template-spec>::symbol1<template-spec1>::test_iterator
+# but better parsing too much than to less
+namespace-symbol: symbol opt-template-specifier COLON COLON namespace-symbol
+ ( (concat $1 "::" (car $5)) )
+ | symbol opt-template-specifier
( $1 )
;
+
+#namespace-symbol: symbol COLON COLON namespace-symbol
+# ( (concat $1 "::" (car $4)) )
+# | symbol
+# ( $1 )
+# ;
+
+namespace-opt-class: symbol COLON COLON namespace-opt-class
+ ( (concat $1 "::" (car $4)) )
+# Klaus Berndl <klaus.berndl(a)sdm.de>: We must recognize
+# template-specifiers here so we can parse correctly the
+# method-implementations of template-classes outside the
+# template-class-declaration
+# Example: TemplateClass1<T>::method_1(...)
+ | symbol opt-template-specifier COLON COLON
+ ( $1 )
+ ;
-opt-class: symbol COLON COLON
- ( $1 )
+# Klaus Berndl <klaus.berndl(a)sdm.de>: The opt-class of a func-decl
+# must be able to recognize opt-classes with namespaces, e.g.
+# Test1::Test2::classname::
+opt-class: namespace-opt-class
+ ( ,$1 )
| EMPTY
( nil )
;
@@ -728,6 +900,12 @@ operatorsym : LESS LESS
( "!=" )
| MINUS GREATER
( "->" )
+# Klaus Berndl <klaus.berndl(a)sdm.de>: We have to parse also
+# operator() and operator[]
+ | semantic-list "()"
+ ( "()" )
+ | semantic-list "\\[\\]"
+ ( "[]" )
| LESS
| GREATER
| STAR
@@ -753,10 +931,6 @@ fun-or-proto-end: SEMICOLON
( 'pure-virtual )
;
-opt-expression: expression
- | EMPTY ( nil )
- ;
-
type-cast : semantic-list
( EXPAND $1 type-cast-list )
;
@@ -764,18 +938,28 @@ type-cast : semantic-list
type-cast-list : open-paren typeformbase close-paren
;
-function-call: symbol semantic-list
+# Klaus Berndl <klaus.berndl(a)sdm.de>: symbol -> namespace-symbol!
+function-call: namespace-symbol semantic-list
;
+string-seq: string string-seq
+ ( (concat $1 (car $2)) )
+ | string
+ ( $1 )
+ ;
+
# Use expression for parsing only. Don't actually return anything
# for now. Hopefully we can fix this later.
expression : number
- ( (identity start) (identity end) )
+ ( (identity start) (identity end) )
| function-call
( (identity start) (identity end) )
- | symbol
+# Klaus Berndl <klaus.berndl(a)sdm.de>: symbol -> namespace-symbol!
+ | namespace-symbol
( (identity start) (identity end) )
- | string
+# Klaus Berndl <klaus.berndl(a)sdm.de>: C/C++ allows sequences of
+# strings which are concatenated by the precompiler to one string
+ | string-seq
( (identity start) (identity end))
| type-cast expression # A cast to some other type
( (identity start) (identity end) )
1.11 +158 -54 XEmacs/packages/xemacs-packages/semantic/semantic-c.el
Index: semantic-c.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/semantic-c.el,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -p -r1.10 -r1.11
--- semantic-c.el 2003/01/06 12:12:48 1.10
+++ semantic-c.el 2006/02/27 22:43:06 1.11
@@ -1,9 +1,9 @@
;;; semantic-c.el --- Semantic details for C
-;;; Copyright (C) 1999, 2000, 2001, 2002 Eric M. Ludlam
+;;; Copyright (C) 1999, 2000, 2001, 2002, 2003 Eric M. Ludlam
;; Author: Eric M. Ludlam <zappo(a)gnu.org>
-;; X-RCS: $Id: semantic-c.el,v 1.57.2.3 2002/12/27 17:01:37 ponced Exp $
+;; X-RCS: $Id: semantic-c.el,v 1.57.2.11 2003/04/04 12:19:37 berndl Exp $
;; This file is not part of GNU Emacs.
@@ -43,8 +43,8 @@
`((bovine-toplevel
( macro)
( type)
- ( var-or-fun)
( define)
+ ( var-or-fun)
( extern-c)
( template)
( using)
@@ -73,13 +73,30 @@
,(semantic-lambda
(list nil)))
) ; end extern-c
+ (macro-expression-list
+ ( expression macro-expression-list punctuation "\\b;\\b"
+ ,(semantic-lambda
+ (list nil)))
+ ( expression
+ ,(semantic-lambda
+ (list nil)))
+ ) ; end macro-expression-list
+ (macro-def
+ ( macro-expression-list
+ ,(semantic-lambda
+ (list nil)))
+ ( expression
+ ,(semantic-lambda
+ (list nil)))
+ ()
+ ) ; end macro-def
(macro
( punctuation "\\b#\\b" macro-or-include
,(semantic-lambda
(nth 1 vals)))
) ; end macro
(macro-or-include
- ( DEFINE symbol opt-define-arglist opt-expression
+ ( DEFINE symbol opt-define-arglist macro-def
,(semantic-lambda
(list (nth 1 vals) 'variable nil (nth 2 vals) ( semantic-bovinate-make-assoc-list
'const t) nil)))
( INCLUDE system-include
@@ -96,9 +113,9 @@
()
) ; end opt-define-arglist
(define
- ( punctuation "\\b#\\b" DEFINE symbol opt-expression
+ ( punctuation "\\b#\\b" DEFINE symbol opt-define-arglist macro-def
,(semantic-lambda
- (list (nth 1 vals) 'variable nil (nth 2 vals) ( semantic-bovinate-make-assoc-list
'const t) nil)))
+ (list (nth 2 vals) 'variable nil (nth 3 vals) ( semantic-bovinate-make-assoc-list
'const t) nil)))
) ; end define
(unionparts
( semantic-list
@@ -140,10 +157,10 @@
(class-parents
( opt-class-protection opt-class-declmods namespace-symbol punctuation
"\\b,\\b" class-parents
,(semantic-lambda
- ( cons ( car (nth 3 vals)) (nth 5 vals))))
+ ( cons (nth 2 vals) (nth 4 vals))))
( opt-class-protection opt-class-declmods namespace-symbol
,(semantic-lambda
- (nth 3 vals)))
+ (nth 2 vals)))
) ; end class-parents
(opt-class-declmods
( class-declmods opt-class-declmods
@@ -236,9 +253,9 @@
( ENUM opt-name enumparts
,(semantic-lambda
(nth 1 vals) (list 'type (nth 0 vals) (nth 2 vals) nil nil nil)))
- ( TYPEDEF typeformbase typedef-symbol-list
+ ( TYPEDEF declmods typeformbase cv-declmods typedef-symbol-list
,(semantic-lambda
- (list (nth 2 vals) 'type (nth 0 vals) nil (nth 1 vals) nil nil)))
+ (list (nth 4 vals) 'type (nth 0 vals) nil (nth 2 vals) nil nil)))
) ; end typesimple
(typedef-symbol-list
( typedefname punctuation "\\b,\\b" typedef-symbol-list
@@ -264,12 +281,17 @@
( NAMESPACE symbol namespaceparts
,(semantic-lambda
(list (nth 1 vals) 'type (nth 0 vals) (nth 2 vals) nil nil nil)))
+ ( NAMESPACE namespaceparts
+ ,(semantic-lambda
+ (list "unnamed" 'type (nth 0 vals) (nth 1 vals) nil nil nil)))
) ; end type
(using
( USING typeformbase punctuation "\\b;\\b"
,(semantic-lambda
+ (list nil)))
+ ( USING NAMESPACE typeformbase punctuation "\\b;\\b"
+ ,(semantic-lambda
(list nil)))
- ( USING symbol punctuation "\\b:\\b" punctuation "\\b:\\b"
typeformbase punctuation "\\b;\\b")
) ; end using
(template
( TEMPLATE template-specifier opt-friend template-definition
@@ -308,9 +330,18 @@
))
) ; end template-specifier-type-list
(template-var
- ( template-type opt-stars opt-template-equal
+ ( template-type opt-template-equal
+ ,(semantic-lambda
+ ( cons ( car (nth 0 vals)) ( cdr (nth 0 vals)))))
+ ( string
+ ,(semantic-lambda
+ (list (nth 0 vals))))
+ ( number
,(semantic-lambda
- ( cons ( concat ( car (nth 0 vals)) ( make-string ( car (nth 1 vals)) 42)) ( cdr (nth 0
vals)))))
+ (list (nth 0 vals))))
+ ( opt-stars opt-ref namespace-symbol
+ ,(semantic-lambda
+ (nth 2 vals)))
) ; end template-var
(opt-template-equal
( punctuation "\\b=\\b" symbol punctuation "\\b<\\b"
template-specifier-types punctuation "\\b>\\b"
@@ -325,12 +356,12 @@
( STRUCT symbol
,(semantic-lambda
(list (nth 1 vals) 'type "struct" nil nil)))
- ( builtintype
+ ( TYPENAME symbol
,(semantic-lambda
- (nth 0 vals) (list 'type nil nil nil)))
- ( symbol
+ (list (nth 1 vals) 'type "class" nil nil)))
+ ( declmods typeformbase cv-declmods opt-stars opt-ref variablearg-opt-name
,(semantic-lambda
- (list (nth 0 vals) 'type nil nil nil)))
+ (list ( car (nth 1 vals)) 'type nil nil ( semantic-bovinate-make-assoc-list
'const ( if ( member "const" ( append (nth 0 vals) (nth 2 vals))) t nil)
'typemodifiers ( delete "const" ( append (nth 0 vals) (nth 2 vals)))
'reference ( car (nth 4 vals)) 'pointer ( car (nth 3 vals))))))
) ; end template-type
(template-definition
( type
@@ -373,14 +404,13 @@
(DECLMOD
( EXTERN)
( STATIC)
- ( CONST)
- ( VOLATILE)
- ( SIGNED)
- ( UNSIGNED)
+ ( CVDECLMOD)
( INLINE)
( REGISTER)
( FRIEND)
+ ( TYPENAME)
( METADECLMOD)
+ ( VIRTUAL)
) ; end DECLMOD
(metadeclmod
( METADECLMOD
@@ -390,6 +420,21 @@
,(semantic-lambda
))
) ; end metadeclmod
+ (CVDECLMOD
+ ( CONST)
+ ( VOLATILE)
+ ) ; end CVDECLMOD
+ (cv-declmods
+ ( CVDECLMOD cv-declmods
+ ,(semantic-lambda
+ ( cons ( car (nth 0 vals)) (nth 1 vals))))
+ ( CVDECLMOD
+ ,(semantic-lambda
+ (nth 0 vals)))
+ (
+ ,(semantic-lambda
+ ))
+ ) ; end cv-declmods
(METADECLMOD
( VIRTUAL)
( MUTABLE)
@@ -418,27 +463,49 @@
( builtintype
,(semantic-lambda
(nth 0 vals)))
- ( symbol template-specifier
+ ( namespace-symbol
,(semantic-lambda
- (list (nth 0 vals) 'type "class")))
- ( namespace-symbol opt-stars opt-template-specifier
- ,(semantic-lambda
- (nth 0 vals)))
+ (nth 0 vals) (list 'type "class")))
( symbol
,(semantic-lambda
(list (nth 0 vals))))
) ; end typeformbase
- (builtintype
+ (signedmod
+ ( UNSIGNED)
+ ( SIGNED)
+ ) ; end signedmod
+ (builtintype-types
( VOID)
( CHAR)
+ ( WCHAR)
( SHORT)
( INT)
- ( LONG)
+ ( LONG INT
+ ,(semantic-lambda
+ (list ( concat (nth 0 vals) " " (nth 1 vals)))))
( FLOAT)
( DOUBLE)
+ ( LONG DOUBLE
+ ,(semantic-lambda
+ (list ( concat (nth 0 vals) " " (nth 1 vals)))))
+ ( LONG LONG
+ ,(semantic-lambda
+ (list ( concat (nth 0 vals) " " (nth 1 vals)))))
+ ( LONG)
+ ) ; end builtintype-types
+ (builtintype
+ ( signedmod builtintype-types
+ ,(semantic-lambda
+ (list ( concat ( car (nth 0 vals)) " " ( car (nth 1 vals))))))
+ ( builtintype-types
+ ,(semantic-lambda
+ (nth 0 vals)))
+ ( signedmod
+ ,(semantic-lambda
+ (list ( concat ( car (nth 0 vals)) " int"))))
) ; end builtintype
(codeblock-var-or-fun
- ( declmods typeformbase metadeclmod opt-ref var-or-func-decl
+ ( declmods typeformbase declmods opt-ref var-or-func-decl
,(semantic-lambda
( semantic-c-reconstitute-token (nth 4 vals) (nth 0 vals) (nth 1 vals))))
) ; end codeblock-var-or-fun
@@ -478,8 +545,8 @@
()
) ; end opt-under-p
(opt-initializers
- ( punctuation "\\b:\\b" symbol semantic-list opt-initializers)
- ( punctuation "\\b,\\b" symbol semantic-list opt-initializers)
+ ( punctuation "\\b:\\b" namespace-symbol semantic-list opt-initializers)
+ ( punctuation "\\b,\\b" namespace-symbol semantic-list opt-initializers)
()
) ; end opt-initializers
(opt-post-fcn-modifiers
@@ -545,22 +612,22 @@
()
) ; end opt-restrict
(varname
- ( opt-stars opt-restrict symbol opt-bits opt-array opt-assign
+ ( opt-stars opt-restrict namespace-symbol opt-bits opt-array opt-assign
,(semantic-lambda
- (list (nth 2 vals)) (nth 0 vals) (nth 3 vals) (nth 4 vals) (nth 5 vals)))
+ (nth 2 vals) (nth 0 vals) (nth 3 vals) (nth 4 vals) (nth 5 vals)))
) ; end varname
(variablearg
- ( declmods typeformbase opt-ref opt-stars variablearg-opt-name
+ ( declmods typeformbase cv-declmods opt-ref variablearg-opt-name
,(semantic-lambda
- (list ( list (nth 4 vals)) 'variable (nth 1 vals) nil (
semantic-bovinate-make-assoc-list 'const ( if ( member "const" (nth 0 vals))
t nil) 'typemodifiers ( delete "const" (nth 0 vals)) 'reference ( car
(nth 2 vals))) nil)))
+ (list ( list (nth 4 vals)) 'variable (nth 1 vals) nil (
semantic-bovinate-make-assoc-list 'const ( if ( member "const" ( append (nth
0 vals) (nth 2 vals))) t nil) 'typemodifiers ( delete "const" ( append (nth
0 vals) (nth 2 vals))) 'reference ( car (nth 3 vals))) nil)))
) ; end variablearg
(variablearg-opt-name
( varname
,(semantic-lambda
(nth 0 vals)))
- (
+ ( opt-stars
,(semantic-lambda
- (list "" 0 nil nil nil)))
+ (list "") (nth 0 vals) (list nil nil nil)))
) ; end variablearg-opt-name
(varnamelist
( varname punctuation "\\b,\\b" varnamelist
@@ -571,17 +638,25 @@
(list (nth 0 vals))))
) ; end varnamelist
(namespace-symbol
- ( symbol punctuation "\\b:\\b" punctuation "\\b:\\b"
namespace-symbol
+ ( symbol opt-template-specifier punctuation "\\b:\\b" punctuation
"\\b:\\b" namespace-symbol
,(semantic-lambda
- (list ( concat (nth 0 vals) "::" ( car (nth 3 vals))))))
- ( symbol
+ (list ( concat (nth 0 vals) "::" ( car (nth 4 vals))))))
+ ( symbol opt-template-specifier
,(semantic-lambda
(list (nth 0 vals))))
) ; end namespace-symbol
- (opt-class
- ( symbol punctuation "\\b:\\b" punctuation "\\b:\\b"
+ (namespace-opt-class
+ ( symbol punctuation "\\b:\\b" punctuation "\\b:\\b"
namespace-opt-class
,(semantic-lambda
+ (list ( concat (nth 0 vals) "::" ( car (nth 3 vals))))))
+ ( symbol opt-template-specifier punctuation "\\b:\\b" punctuation
"\\b:\\b"
+ ,(semantic-lambda
(list (nth 0 vals))))
+ ) ; end namespace-opt-class
+ (opt-class
+ ( namespace-opt-class
+ ,(semantic-lambda
+ (nth 0 vals)))
(
,(semantic-lambda
(list nil)))
@@ -654,6 +729,12 @@
( punctuation "\\b-\\b" punctuation "\\b>\\b"
,(semantic-lambda
(list "->")))
+ ( semantic-list "()"
+ ,(semantic-lambda
+ (list "()")))
+ ( semantic-list "\\[\\]"
+ ,(semantic-lambda
+ (list "[]")))
( punctuation "\\b<\\b")
( punctuation "\\b>\\b")
( punctuation "\\b\\*\\b")
@@ -682,12 +763,6 @@
,(semantic-lambda
(list 'pure-virtual)))
) ; end fun-or-proto-end
- (opt-expression
- ( expression)
- (
- ,(semantic-lambda
- (list nil)))
- ) ; end opt-expression
(type-cast
( semantic-list
,(lambda (vals start end)
@@ -699,8 +774,16 @@
( open-paren typeformbase close-paren)
) ; end type-cast-list
(function-call
- ( symbol semantic-list)
+ ( namespace-symbol semantic-list)
) ; end function-call
+ (string-seq
+ ( string string-seq
+ ,(semantic-lambda
+ (list ( concat (nth 0 vals) ( car (nth 1 vals))))))
+ ( string
+ ,(semantic-lambda
+ (list (nth 0 vals))))
+ ) ; end string-seq
(expression
( number
,(semantic-lambda
@@ -708,10 +791,10 @@
( function-call
,(semantic-lambda
(list ( identity start) ( identity end))))
- ( symbol
+ ( namespace-symbol
,(semantic-lambda
(list ( identity start) ( identity end))))
- ( string
+ ( string-seq
,(semantic-lambda
(list ( identity start) ( identity end))))
( type-cast expression
@@ -729,10 +812,27 @@
(defvar semantic-flex-c-extensions
'(("^\\s-*#if\\s-*0$" . semantic-flex-c-if-0)
- ("^#\\(if\\(def\\)?\\|else\\|endif\\)" . semantic-flex-c-if)
+ ("^#\\(if\\(def\\)?\\|el\\(if\\|se\\)\\|endif\\)" . semantic-flex-c-if)
("<[^\n>]+>" . semantic-flex-c-include-system)
+ ("\\(\\\\\n\\)" . semantic-flex-backslash-newline)
+ ("L\\s\"" . semantic-flex-wide-char-literal)
)
- "Extensions to the flexer for C.")
+ "Extensions to the flexer for C and C++.")
+
+(defun semantic-flex-wide-char-literal ()
+ "Identify wide-char string- and char-literals like L\"string\" and
L'c'
+and return them as string-token."
+ (let ((start (point)))
+ (forward-char 1)
+ ;; now we should be onto the string-delimiter direct after the L
+ (forward-sexp 1)
+ (cons 'string (cons start (point)))))
+
+(defun semantic-flex-backslash-newline ()
+ "If there is a \ ending a line, then it isn't really a newline. Move cursor
+direct after the \"backslashed\"-newline and return nothing."
+ (goto-char (match-end 1))
+ nil)
(defun semantic-flex-c-include-system ()
"Move cursor to the end of system includes and return it.
@@ -940,7 +1040,7 @@ Optional argument STAR and REF indicate
def)
(defvar semantic-c-keyword-table
- (semantic-flex-make-keyword-table
+ (semantic-flex-make-keyword-table
`( ("include" . INCLUDE)
("define" . DEFINE)
("extern" . EXTERN)
@@ -958,6 +1058,7 @@ Optional argument STAR and REF indicate
("enum" . ENUM)
("typedef" . TYPEDEF)
("class" . CLASS)
+ ("typename" . TYPENAME)
("namespace" . NAMESPACE)
("using" . USING)
("template" . TEMPLATE)
@@ -982,6 +1083,7 @@ Optional argument STAR and REF indicate
("sizeof" . SIZEOF)
("void" . VOID)
("char" . CHAR)
+ ("wchar_t" . WCHAR)
("short" . SHORT)
("int" . INT)
("long" . LONG)
@@ -1006,6 +1108,7 @@ Optional argument STAR and REF indicate
("enum" summary "Enumeration Type Declaration: enum [name] { ...
};")
("typedef" summary "Arbitrary Type Declaration: typedef
<typedeclaration> <name>;")
("class" summary "Class Declaration: class <name>[:parents] {
... };")
+ ("typename" summary "typename is used to handle a qualified name as a
typename;")
("namespace" summary "Namespace Declaration: namespace <name> {
... };")
("using" summary "using <namespace>;")
("template" summary "template <class TYPE ...>
TYPE_OR_FUNCTION")
@@ -1025,6 +1128,7 @@ Optional argument STAR and REF indicate
("sizeof" summary "Compile time macro: sizeof(<type or
variable>) // size in bytes")
("void" summary "Built in typeless type: void")
("char" summary "Integral Character Type: (0 to 256)")
+ ("wchar_t" summary "Wide Character Type")
("short" summary "Integral Primitive Type: (-32768 to 32767)")
("int" summary "Integral Primitive Type: (-2147483648 to
2147483647)")
("long" summary "Integral primitive type (-9223372036854775808 to
9223372036854775807)")
1.2 +1 -0 XEmacs/packages/xemacs-packages/semantic/semantic-cb.el
Index: semantic-cb.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/semantic-cb.el,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- semantic-cb.el 2002/08/12 03:26:24 1.1
+++ semantic-cb.el 2006/02/27 22:43:06 1.2
@@ -36,6 +36,7 @@
;; nearly no effort.
(require 'semantic)
+(require 'semanticdb) ;; XEmacs change: from upstream cedet
(require 'eieio-speedbar)
(require 'eieio-base)
1.3 +1 -0 XEmacs/packages/xemacs-packages/semantic/semantic-ia.el
Index: semantic-ia.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/semantic-ia.el,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- semantic-ia.el 2002/08/12 03:26:24 1.2
+++ semantic-ia.el 2006/02/27 22:43:06 1.3
@@ -28,6 +28,7 @@
;; Interactive access to `semantic-analyze'.
;;
+(require 'senator) ;; XEmacs change: from upstream cedet
(require 'semantic-analyze)
;;; Code:
1.5 +5 -2 XEmacs/packages/xemacs-packages/semantic/semantic-load.el
Index: semantic-load.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/semantic-load.el,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- semantic-load.el 2002/08/12 03:26:25 1.4
+++ semantic-load.el 2006/02/27 22:43:06 1.5
@@ -1,9 +1,9 @@
;;; semantic-load.el --- Autoload definitions for Semantic
-;;; Copyright (C) 1999, 2000, 2001, 2002 Eric M. Ludlam
+;;; Copyright (C) 1999, 2000, 2001, 2002, 2003 Eric M. Ludlam
;; Author: Eric M. Ludlam <zappo(a)gnu.org>
-;; X-RCS: $Id: semantic-load.el,v 1.18 2002/06/18 21:31:02 ponced Exp $
+;; X-RCS: $Id: semantic-load.el,v 1.18.2.1 2003/04/07 22:09:20 zappo Exp $
;; Semantic is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -267,6 +267,9 @@ other criteria.")
(global-semantic-auto-parse-mode 1)
(global-semanticdb-minor-mode 1)
(global-semantic-summary-mode 1)
+
+ (if (boundp 'default-header-line-format)
+ (global-semantic-stickyfunc-mode 1))
)
(provide 'semantic-load)
1.5 +142 -2 XEmacs/packages/xemacs-packages/semantic/semantic-util-modes.el
Index: semantic-util-modes.el
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/semantic-util-modes.el,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- semantic-util-modes.el 2003/01/06 12:12:48 1.4
+++ semantic-util-modes.el 2006/02/27 22:43:06 1.5
@@ -1,12 +1,12 @@
;;; semantic-util-modes.el --- Semantic minor modes
-;;; Copyright (C) 2000, 2001 Eric M. Ludlam
+;;; Copyright (C) 2000, 2001, 2003 Eric M. Ludlam
;;; Copyright (C) 2001 David Ponce
;; Author: Eric M. Ludlam <zappo(a)gnu.org>
;; Author: David Ponce <david(a)dponce.com>
;; Keywords: syntax
-;; X-RCS: $Id: semantic-util-modes.el,v 1.17.4.1 2002/12/26 11:07:50 ponced Exp $
+;; X-RCS: $Id: semantic-util-modes.el,v 1.17.4.3 2003/04/11 07:53:24 berndl Exp $
;; This file is not part of GNU Emacs.
@@ -755,6 +755,146 @@ minor mode is enabled.
(semantic-add-minor-mode 'semantic-summary-mode
"" ;; Eldoc provides the mode indicator
semantic-summary-mode-map)
+
+;;;;
+;;;; Minor mode to make function decls sticky.
+;;;;
+
+;;;###autoload
+(defun global-semantic-stickyfunc-mode (&optional arg)
+ "Toggle global use of option `semantic-stickyfunc-mode'.
+If ARG is positive, enable, if it is negative, disable.
+If ARG is nil, then toggle."
+ (interactive "P")
+ (setq global-semantic-stickyfunc-mode
+ (semantic-toggle-minor-mode-globally
+ 'semantic-stickyfunc-mode arg)))
+
+;;;###autoload
+(defcustom global-semantic-stickyfunc-mode nil
+ "*If non-nil, enable global use of stickyfunc mode."
+:group 'semantic
+:type 'boolean
+:require 'semantic-util-modes
+:initialize 'custom-initialize-default
+:set (lambda (sym val)
+ (global-semantic-stickyfunc-mode (if val 1 -1))))
+
+(defcustom semantic-stickyfunc-mode-hook nil
+ "*Hook run at the end of function `semantic-stickyfunc-mode'."
+:group 'semantic
+:type 'hook)
+
+(defvar semantic-stickyfunc-mode-map
+ (let ((km (make-sparse-keymap)))
+ km)
+ "Keymap for stickyfunc minor mode.")
+
+(defvar semantic-stickyfunc-mode nil
+ "Non-nil if stickyfunc minor mode is enabled.
+Use the command `semantic-stickyfunc-mode' to change this variable.")
+(make-variable-buffer-local 'semantic-stickyfunc-mode)
+
+(defun semantic-stickyfunc-mode-setup ()
+ "Setup option `semantic-stickyfunc-mode'.
+For semantic enabled buffers, make the function declaration for the top most
+function \"sticky\". This is accomplished by putting the first line of
+text for that function in Emacs 21's header line."
+ (if semantic-stickyfunc-mode
+ (progn
+ (if (not (and (featurep 'semantic) (semantic-active-p)))
+ (progn
+ ;; Disable minor mode if semantic stuff not available
+ (setq semantic-stickyfunc-mode nil)
+ (error "Buffer %s was not set up for parsing"
+ (buffer-name))))
+ (if (not (boundp 'default-header-line-format))
+ (progn
+ ;; Disable if there are no header lines to use.
+ (setq semantic-stickyfunc-mode nil)
+ (error "Sticky Function mode requires Emacs 21")))
+ ;; Enable the mode
+ (setq header-line-format
+ '(" "
+ (:eval (semantic-stickyfunc-fetch-stickyline))))
+ )
+ ;; Disable sticky func mode
+ (setq header-line-format nil))
+ semantic-stickyfunc-mode)
+
+;;;###autoload
+(defun semantic-stickyfunc-mode (&optional arg)
+ "Minor mode to show useful things about tokens in echo area.
+Enables/disables making the header line of functions sticky.
+With prefix argument ARG, turn on if positive, otherwise off. The
+minor mode can be turned on only if semantic feature is available and
+the current buffer was set up for parsing. Return non-nil if the
+minor mode is enabled.
+
+\\{semantic-stickyfunc-mode-map}"
+ (interactive
+ (list (or current-prefix-arg
+ (if semantic-stickyfunc-mode 0 1))))
+ (setq semantic-stickyfunc-mode
+ (if arg
+ (>
+ (prefix-numeric-value arg)
+ 0)
+ (not semantic-stickyfunc-mode)))
+ (semantic-stickyfunc-mode-setup)
+ (run-hooks 'semantic-stickyfunc-mode-hook)
+ (if (interactive-p)
+ (message "Stickyfunc minor mode %sabled"
+ (if semantic-stickyfunc-mode "en" "dis")))
+ (semantic-mode-line-update)
+ semantic-stickyfunc-mode)
+
+(defvar semantic-stickyfunc-sticky-classes
+ '(function type)
+ "List of tag classes which sticky func will display in the header line.")
+
+
+(defun semantic-stickyfunc-fetch-stickyline ()
+ "Make the function at the top of the current window sticky.
+Capture it's function declaration, and place it in the header line.
+If there is no function, disable the header line."
+ (let ((str
+ (save-excursion
+ (goto-char (window-start (selected-window)))
+ (forward-line -1)
+ (end-of-line)
+ ;; Capture this function
+ (let ((tag (semantic-current-nonterminal)))
+ (if (or (not tag)
+ (not (member (semantic-token-token tag)
+ semantic-stickyfunc-sticky-classes)))
+ ;; Set it to be the text under the header line
+ (buffer-substring (point-at-bol) (point-at-eol))
+ ;; Get it
+ (goto-char (semantic-token-start tag))
+ ;; Klaus Berndl <klaus.berndl(a)sdm.de>:
+ ;; goto the tag name; this is especially needed for languages
+ ;; like c++ where a often used style is like:
+ ;; void
+ ;; ClassX::methodM(arg1...)
+ ;; {
+ ;; ...
+ ;; }
+ ;; Without going to the tag-name we would get"void" in the
+ ;; header line which is IMHO not really useful
+ (search-forward (semantic-token-name tag) nil t)
+ (buffer-substring (point-at-bol) (point-at-eol))
+ ))))
+ (start 0))
+ (while (string-match "%" str start)
+ (setq str (replace-match "%%" t t str 0)
+ start (1+ (match-end 0)))
+ )
+ str))
+
+(semantic-add-minor-mode 'semantic-stickyfunc-mode
+ "" ;; Don't need indicator. It's quite
visible
+ semantic-stickyfunc-mode-map)
(provide 'semantic-util-modes)
1.12 +13 -4 XEmacs/packages/xemacs-packages/semantic/semantic-util.el
Index: semantic-util.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/semantic-util.el,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- semantic-util.el 2003/01/06 12:12:48 1.11
+++ semantic-util.el 2006/02/27 22:43:06 1.12
@@ -4,7 +4,7 @@
;; Author: Eric M. Ludlam <zappo(a)gnu.org>
;; Keywords: syntax
-;; X-RCS: $Id: semantic-util.el,v 1.93.2.2 2002/12/26 11:08:29 ponced Exp $
+;; X-RCS: $Id: semantic-util.el,v 1.93.2.3 2003/04/08 12:53:23 ponced Exp $
;; This file is not part of GNU Emacs.
@@ -36,6 +36,7 @@
(condition-case nil
(require 'newcomment)
(error nil))
+ (require 'semanticdb) ;; XEmacs change: from upstream cedet
)
;;; Code:
@@ -1718,6 +1719,14 @@ Colorize the new text based on COLOR."
name)))
(t "")))
+(defmacro semantic-uml-nonterminal-protection (token &optional parent)
+ "Return protection information about TOKEN with optional PARENT.
+Check that TOKEN is a variable, function or type token.
+See also `semantic-nonterminal-protection'."
+ `(and (memq (semantic-token-token ,token)
+ '(variable function type))
+ (semantic-nonterminal-protection ,token ,parent)))
+
(defun semantic-uml-abbreviate-nonterminal (token &optional parent color)
"Return a UML style abbreviation for TOKEN.
Optional argument PARENT is the parent type if TOKEN is a detail.
@@ -1733,7 +1742,7 @@ Optional argument PARENT is the parent t
Optional argument COLOR means highlight the prototype with font-lock colors."
(let* ((text (semantic-uml-token-or-string-to-string
token parent nil color))
- (prot (semantic-nonterminal-protection token parent))
+ (prot (semantic-uml-nonterminal-protection token parent))
(protstr (semantic-uml-protection-to-string prot))
(text (concat protstr text)))
(if color
@@ -1769,7 +1778,7 @@ Optional argument PARENT is the parent t
Optional argument COLOR means highlight the prototype with font-lock colors."
(let* ((tok (semantic-token-token token))
(argtext nil)
- (prot (semantic-nonterminal-protection token parent))
+ (prot (semantic-uml-nonterminal-protection token parent))
(text nil)
)
(cond ((eq tok 'function)
@@ -1802,7 +1811,7 @@ Optional argument PARENT is the parent t
Optional argument COLOR means highlight the prototype with font-lock colors."
(let* ((cp (semantic-concise-prototype-nonterminal token parent color))
(type (semantic-token-type token))
- (prot (semantic-nonterminal-protection token parent))
+ (prot (semantic-uml-nonterminal-protection token parent))
(text nil)
)
(setq type
1.13 +2 -2 XEmacs/packages/xemacs-packages/semantic/semantic.el
Index: semantic.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/semantic.el,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -p -r1.12 -r1.13
--- semantic.el 2003/01/06 12:12:48 1.12
+++ semantic.el 2006/02/27 22:43:06 1.13
@@ -4,9 +4,9 @@
;; Author: Eric M. Ludlam <zappo(a)gnu.org>
;; Keywords: syntax
-;; X-RCS: $Id: semantic.el,v 1.142.2.2 2002/12/29 18:15:01 ponced Exp $
+;; X-RCS: $Id: semantic.el,v 1.142.2.4 2003/04/22 12:58:16 ponced Exp $
-(defvar semantic-version "1.4.2"
+(defvar semantic-version "1.4.4"
"Current version of Semantic.")
;; This file is not part of GNU Emacs.
1.5 +2 -2 XEmacs/packages/xemacs-packages/semantic/semanticdb.el
Index: semanticdb.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/semanticdb.el,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- semanticdb.el 2004/10/31 10:14:08 1.4
+++ semanticdb.el 2006/02/27 22:43:06 1.5
@@ -314,7 +314,7 @@ Uses `semanticdb-persistent-path' to det
nil)
))
-;; `subst-char-in-string' undefined in XEmacs <= 21.4
+;; XEmacs change: `subst-char-in-string' undefined in XEmacs <= 21.4
(unless (fboundp 'subst-char-in-string)
(defun subst-char-in-string (fromchar tochar string &optional inplace)
"Replace FROMCHAR with TOCHAR in STRING each time it occurs.
@@ -327,7 +327,7 @@ Unless optional argument INPLACE is non-
(aset newstr i tochar)))
newstr)))
-;; `replace-regexp-in-string' undefined in XEmacs <= 21.4
+;; XEmacs change: `replace-regexp-in-string' undefined in XEmacs <= 21.4
(unless (fboundp 'replace-regexp-in-string)
(defun replace-regexp-in-string (regexp rep string &optional
fixedcase literal subexp start)
1.5 +2 -5 XEmacs/packages/xemacs-packages/semantic/senator.el
Index: senator.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/senator.el,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- senator.el 2002/08/12 03:26:26 1.4
+++ senator.el 2006/02/27 22:43:06 1.5
@@ -6,7 +6,7 @@
;; Maintainer: David Ponce <david(a)dponce.com>
;; Created: 10 Nov 2000
;; Keywords: syntax
-;; X-RCS: $Id: senator.el,v 1.59 2002/06/18 21:32:36 ponced Exp $
+;; X-RCS: $Id: senator.el,v 1.59.2.1 2003/04/04 08:28:31 ponced Exp $
;; This file is not part of Emacs
@@ -2355,10 +2355,7 @@ Depending on the value of the variable `
(delq 'senator-try-expand-semantic
hippie-expand-try-functions-list)))))
-;; Setup semantic completion after hippie-exp was [auto]loaded
-(eval-after-load 'hippie-exp
- '(add-hook 'senator-minor-mode-hook 'senator-hippie-expand-hook)
- )
+(add-hook 'senator-minor-mode-hook 'senator-hippie-expand-hook)
;;;###autoload
(defun senator-try-expand-semantic (old)