Commit 36bda291 authored by gourne_o's avatar gourne_o
Browse files

from Olivier Gournet <gourne_o@lrde.epita.fr>

	* test/disambiguate/anonym-01.detcc,
	* test/disambiguate/anonym-02.detcc,
	* test/disambiguate/Makefile.am: Fix tests.
	* src/disamb/anonymous/AnonymousClass.str,
	* src/disamb/anonymous/afcxx-anonymous.str,
	* src/disamb/anonymous/AnonymousNamespace.str: Update.
	* src/parser/parse-cxx.str: Change anonymous filter call order.
parent 971ef5b5
2004-04-22 Olivier Gournet <gourne_o@lrde.epita.fr>
* test/disambiguate/anonym-01.detcc,
* test/disambiguate/anonym-02.detcc,
* test/disambiguate/Makefile.am: Fix tests.
* src/disamb/anonymous/AnonymousClass.str,
* src/disamb/anonymous/afcxx-anonymous.str,
* src/disamb/anonymous/AnonymousNamespace.str: Update.
* src/parser/parse-cxx.str: Change anonymous filter call order.
2004-04-21 Olivier Gournet <gourne_o@lrde.epita.fr>
* test/check-rules.mk: Fix.
......
......@@ -32,6 +32,14 @@ rules
where
!|Identifier?[ ~ID: <concat-strings> ["#", <new>] ~ ]| => Identifier-opt'
AClassUnsetName : |ClassHead[ ClassKey1 ~ID: name ~ BaseClause1-opt ]|
-> |ClassHead[ ClassKey1 BaseClause1-opt ]|
where
<explode-string> name
; ?[ 35 | r ]
strategies
anonymous-class = AClassSetName
anonymous-class-set = AClassSetName
anonymous-class-unset = AClassUnsetName
......@@ -31,28 +31,55 @@ signature
rules
ExplodeANamespace : |Declaration[ namespace { NamespaceBody } ]| -> |Declaration+[
ExplodeANamespace : |Declaration[ namespace la1 { la2 NamespaceBody la3 } ]| -> |Declaration+[
~NamespaceDefinition: |NamespaceDefinition[ namespace Identifier1 { } ]| ~
~Declaration: |Declaration[ using namespace ~Dummy0?: None ~ ~NestedNameSpecifier?: None ~ OriginalNamespaceName1 ; ]| ~
~NamespaceDefinition: |NamespaceDefinition[ namespace OriginalNamespaceName1 { NamespaceBody } ]| ~
~NamespaceDefinition: |NamespaceDefinition[ namespace OriginalNamespaceName1 la1 { la2 NamespaceBody la3 } ]| ~
]|
where <concat-strings> ["#", <new>] => name
; if-verbose2 (<concat-strings; debug> ["catch unamed namespace -> ", name])
; !|OriginalNamespaceName[ ~ID: name ~ ]| => OriginalNamespaceName1
; !ID(name) => Identifier1
CatchANamespace : |Declaration+[ Declaration ]| -> |Declaration+[ Declaration-iter' ]|
CatchANamespace : |Declaration+[ Declaration ]| -> |Declaration+[ Declaration-iter' ]|
where <ExplodeANamespace> Declaration => Declaration-iter'
CatchANamespace : |Declaration+[ Declaration1-iter Declaration ]| -> |Declaration+[ Declaration1-iter Declaration-iter' ]|
CatchANamespace : |Declaration+[ Declaration1-iter la Declaration ]| -> |Declaration+[ Declaration1-iter la Declaration-iter' ]|
where <ExplodeANamespace> Declaration => Declaration-iter'
ImplodeANamespace : |Declaration+[ Declaration1-iter la
~NamespaceDefinition: |NamespaceDefinition[ namespace Identifier1 { } ]| ~
~Declaration: |Declaration[ using namespace ~Dummy0?: None ~ ~NestedNameSpecifier?: None ~ OriginalNamespaceName1 ; ]| ~
~NamespaceDefinition: |NamespaceDefinition[ namespace OriginalNamespaceName1 la1 { la2 NamespaceBody la3 } ]| ~
]|
-> |Declaration+[ Declaration1-iter la namespace la1 { la2 NamespaceBody la3 } ]|
where
!Identifier1
; ?ID(name)
; <explode-string> name
; ?[ 35 | r ]
ImplodeANamespace : |Declaration+[
~NamespaceDefinition: |NamespaceDefinition[ namespace Identifier1 { } ]| ~
~Declaration: |Declaration[ using namespace ~Dummy0?: None ~ ~NestedNameSpecifier?: None ~ OriginalNamespaceName1 ; ]| ~
~NamespaceDefinition: |NamespaceDefinition[ namespace OriginalNamespaceName1 la1 { la2 NamespaceBody la3 } ]| ~
]|
-> |Declaration+[ namespace la1 { la2 NamespaceBody la3 } ]|
where
!Identifier1
; ?ID(name)
; <explode-string> name
; ?[ 35 | r ]
Split-Declaration : |DeclarationSeq?[ ~Declaration+: Declaration1 ~ ]| -> |DeclarationSeq?[ ~Declaration+: Declaration2 ~ ]|
Split-Declaration(s) : |DeclarationSeq?[ ~Declaration+: Declaration1 ~ ]| -> |DeclarationSeq?[ ~Declaration+: Declaration2 ~ ]|
where
<topdown (try (CatchANamespace))> Declaration1 => Declaration2
<topdown (try (s))> Declaration1 => Declaration2
strategies
anonymous-namespace = Split-Declaration
anonymous-namespace-set = Split-Declaration (CatchANamespace)
anonymous-namespace-unset = Split-Declaration (ImplodeANamespace)
......@@ -32,5 +32,15 @@ imports
strategies
afcxx-anonymous = iowrap (alltd (anonymous-namespace);
alltd (anonymous-class))
afcxx-anonymous = io-wrap (unset-option,
test (<get-config> "--unset")
< alltd (anonymous-namespace-unset)
; alltd (anonymous-class-unset)
+ alltd (anonymous-namespace-set)
; alltd (anonymous-class-set))
unset-option =
Option("-u" + "--unset"
, where (<set-config> ("--unset", <id>))
, !"-u | --unset Remove dummy name"
)
......@@ -70,10 +70,10 @@ strategies
parse = xtc-transform(!"ambdown", pass-verbose)
; xtc-transform(!"afcxx-desugar", pass-verbose)
; xtc-transform(!"afcxx-anonymous", pass-verbose)
; xtc-transform(!"afcxx-simpledeclaration", pass-verbose)
; xtc-transform(!"afcxx-purespecifier", pass-verbose)
; xtc-transform(!"afcxx-namespace", pass-verbose)
; xtc-transform(!"afcxx-anonymous", pass-verbose)
; xtc-transform(!"afcxx-declaration", pass-verbose)
; xtc-transform(!"afcxx-resolve", pass-verbose)
; xtc-transform(!"afcxx-classparam", pass-verbose)
......@@ -82,6 +82,7 @@ strategies
; xtc-transform(!"afcxx-validtypes", pass-verbose)
; xtc-transform(!"afcxx-resolve", pass-verbose)
; xtc-transform(!"afcxx-disambiguate", pass-verbose)
; xtc-transform(!"afcxx-anonymous", <conc> (["--unset"], <pass-verbose>))
io-parse-cxx =
xtc-io-wrap(amb-option + pp-option + out-option + disamb-option,
......
......@@ -89,8 +89,6 @@ TESTS = \
variable-01
XFAIL_TESTS = \
anonym-01 \
anonym-02 \
namespace-10 \
template-13
......
union a_0 {
union {
};
class b_0 {
class {
};
struct c_0 {
struct {
};
union d_0 {
union {
int /*<uid>*/i/*</uid>*/ ;
float /*<uid>*/f/*</uid>*/ ;
};
class e_0 {
class {
void /*<uid>*/f/*</uid>*/() ;
};
struct f_0 {
struct {
void /*<uid>*/f/*</uid>*/() ;
};
namespace /*<org>*/c_0/*</org>*/ { }
using namespace /*<ns>*/c_0/*</ns>*/ ;
namespace /*<ns>*/c_0/*</ns>*/ { } namespace /*<org>*/b_0/*</org>*/ { }
using namespace /*<ns>*/b_0/*</ns>*/ ;
namespace /*<ns>*/b_0/*</ns>*/ { namespace /*<org>*/d_0/*</org>*/ { }
using namespace /*<ns>*/d_0/*</ns>*/ ;
namespace /*<ns>*/d_0/*</ns>*/ { int /*<uid>*/i/*</uid>*/; } } namespace /*<org>*/a_0/*</org>*/ { }
using namespace /*<ns>*/a_0/*</ns>*/ ;
namespace /*<ns>*/a_0/*</ns>*/ { int /*<uid>*/j/*</uid>*/ = i; }
namespace {}
namespace { namespace { int /*<uid>*/i/*</uid>*/; } }
namespace {
int /*<uid>*/main/*</uid>*/()
{
/*<expr>*/i = 3/*</expr>*/;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment