diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2018-05-17 19:57:02 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2018-05-17 19:57:02 +0100 |
commit | 0cfd53cff784650b1de490209f0b305bd9e7e570 (patch) | |
tree | cff492821ddc739aadb03ebdcd7a851a5f7dd511 /Source/CParse/parser.y | |
parent | b7f78dd5a71306be019fcb5d96742ae996993196 (diff) | |
parent | 3eb41c9beb4b420bc58b9c2b97316f35dc3be7be (diff) | |
download | swig-0cfd53cff784650b1de490209f0b305bd9e7e570.tar.gz |
Merge branch 'master' into vadz-doxygen
* master:
Add Octave 4.4 to Travis allow_failures
Fixes for appveyor image changes
Javascript test-suite Makefile parallel jobs
Add changes entry for csconstruct, dconstruct and javaconstruct fix
Fix lookup of csconstruct, dconstructor and javaconstruct typemaps
Javascript %nspace fix in generated C++ code
Add C++17 documentation chapter
Add changes notes for C++17 nested namespaces support
Test for invalid C++17 nested namespace aliases
Test c++17 nested namespaces and %nspace
Add c++17 nested namespaces runtime test for C#
Add c++17 nested namespaces runtime test for Python
Add support for c++17 nested namespaces
Update CHANGES.current
.travis.yml: test against Octave 4.4
Examples/test-suite/register_par.i: rename 'tree' to 'swig_tree'
Examples/octave/module_load/runme.m: update 'exist()' statements for Octave >= 4.4
Examples/octave/module_load/runme.m: do not use duplicate function names
Examples/Makefile.in: unset OCTAVE_PATH when running Octave for tests
Lib/octave: fix getting/setting global variables for Octave >= 4.4
Lib/octave: use new class for function member dereference with Octave >= 4.4
Lib/octave: fix operator installation for Octave >= 4.4
Lib/Octave: in Octave >= 4.4, assign reference to base class in subclass
Lib/octave: fix call to mlock() for Octave >= 4.4
Lib/octave: fix call to octave::call_stack::current() for Octave >= 4.4
Lib/octave: 'octave_exit' not longer exists in Octave >= 4.4
Lib/octave: replace is_bool_type() with islogical() for Octave >= 4.4
Lib/octave: replace is_numeric_type() with isnumeric() for Octave >= 4.4
Lib/octave: replace is_cell() with iscell() for Octave >= 4.4
Lib/octave: call octave::feval() instead of feval() for Octave >= 4.4
Lib/octave: fix function name passed to unwind_protect::begin_frame()
C#, D, Java methodmodifiers on destructors
Javascript assert.h - move to header section
Appveyor cl compiler warning fixes during configure
Java vector wrappers cast correction
test-suite fixes (Java directors) for compilers that don't support varargs
Go - use director.swg like other languages
test-suite fixes (2) for compilers that don't support varargs
Consistent spacing in generated exception specifications
test-suite fixes for compilers that don't support vararg macros
Enhance Travis testing to use gcc 8 and test C++17 and C17
Enhance SWIG_isfinite for older standards: C++03/C++98/C89
test-suite support for gcc-8 targeting C++11 and C++14
Scilab portability fixes - remove use of strdup
Scilab array overbounds fix handling char type exceptions
test-suite fix for c++17 and throw macro
Remove use of 'register' in C source
test-suite support for C++17: switch testing of the deprecated C++17 'register' keyword from C++ to C
Examples update to support C++17: exception specification throw removal
Cosmetic syntax tweak using throw in Octave directors
test-suite support for C++17 (Java): exception specification throw removal
test-suite support for C++17: exception specification throw removal
__cplusplus macro usage tweak
Improve detection of Python's 2to3 tool
Correct C shared library creation when specifing CC to configure
Remove superfluous parens in generated Python scripts.
[ci] guile 2.2 build no longer expected to fail
guile - resstructure some configure tests
Disable guile configuration if guile-config and guile report a different version
Fix guile executable detection on early 2.0.x guile versions
guile - drop GDB_INTERFACE related stuff
guile - replace obsolete scm_listify with scm_list_n
guile - use more reliable method of finding guile executable based on guile-config
Fix go version matching in configure for go1.10
[Python] Suppress new pycodestyle warning
Add if-no-present action for jsv8inc arg
Fix typo in help --with-jscoreinc and --with-jscorelib
Fix off-by-one error
* Makefile.in (configfiles): Update URLs for latest configfiles.
Add changes entry for Ruby %alias fix for global functions
[Ruby] Pass Qnil instead of NULL to rb_funcall()
Fix typo
Fix ruby %alias directive for native c functions
Stop testing Python on Appveyor msys/mingw
Fix -Wimplicit-fallthrough gcc-7.3 warning
Diffstat (limited to 'Source/CParse/parser.y')
-rw-r--r-- | Source/CParse/parser.y | 75 |
1 files changed, 52 insertions, 23 deletions
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 3152882f0..46a106c47 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -4465,32 +4465,61 @@ cpp_using_decl : USING idcolon SEMI { cpp_namespace_decl : NAMESPACE idcolon LBRACE { Hash *h; - $1 = Swig_symbol_current(); - h = Swig_symbol_clookup($2,0); - if (h && ($1 == Getattr(h,"sym:symtab")) && (Strcmp(nodeType(h),"namespace") == 0)) { - if (Getattr(h,"alias")) { - h = Getattr(h,"namespace"); - Swig_warning(WARN_PARSE_NAMESPACE_ALIAS, cparse_file, cparse_line, "Namespace alias '%s' not allowed here. Assuming '%s'\n", - $2, Getattr(h,"name")); - $2 = Getattr(h,"name"); + Node *parent_ns = 0; + List *scopes = Swig_scopename_tolist($2); + int ilen = Len(scopes); + int i; + +/* +Printf(stdout, "==== Namespace %s creation...\n", $2); +*/ + $<node>$ = 0; + for (i = 0; i < ilen; i++) { + Node *ns = new_node("namespace"); + Symtab *current_symtab = Swig_symbol_current(); + String *scopename = Getitem(scopes, i); + Setattr(ns, "name", scopename); + $<node>$ = ns; + if (parent_ns) + appendChild(parent_ns, ns); + parent_ns = ns; + h = Swig_symbol_clookup(scopename, 0); + if (h && (current_symtab == Getattr(h, "sym:symtab")) && (Strcmp(nodeType(h), "namespace") == 0)) { +/* +Printf(stdout, " Scope %s [found C++17 style]\n", scopename); +*/ + if (Getattr(h, "alias")) { + h = Getattr(h, "namespace"); + Swig_warning(WARN_PARSE_NAMESPACE_ALIAS, cparse_file, cparse_line, "Namespace alias '%s' not allowed here. Assuming '%s'\n", + scopename, Getattr(h, "name")); + scopename = Getattr(h, "name"); + } + Swig_symbol_setscope(Getattr(h, "symtab")); + } else { +/* +Printf(stdout, " Scope %s [creating single scope C++17 style]\n", scopename); +*/ + h = Swig_symbol_newscope(); + Swig_symbol_setscopename(scopename); } - Swig_symbol_setscope(Getattr(h,"symtab")); - } else { - Swig_symbol_newscope(); - Swig_symbol_setscopename($2); + Delete(Namespaceprefix); + Namespaceprefix = Swig_symbol_qualifiedscopename(0); } - Delete(Namespaceprefix); - Namespaceprefix = Swig_symbol_qualifiedscopename(0); + Delete(scopes); } interface RBRACE { - Node *n = $5; - set_nodeType(n,"namespace"); - Setattr(n,"name",$2); - Setattr(n,"symtab", Swig_symbol_popscope()); - Swig_symbol_setscope($1); - $$ = n; - Delete(Namespaceprefix); - Namespaceprefix = Swig_symbol_qualifiedscopename(0); - add_symbols($$); + Node *n = $<node>4; + Node *top_ns = 0; + do { + Setattr(n, "symtab", Swig_symbol_popscope()); + Delete(Namespaceprefix); + Namespaceprefix = Swig_symbol_qualifiedscopename(0); + add_symbols(n); + top_ns = n; + n = parentNode(n); + } while(n); + appendChild($<node>4, firstChild($5)); + Delete($5); + $$ = top_ns; } | NAMESPACE LBRACE { Hash *h; |