Commit 84664b99 authored by david_v's avatar david_v
Browse files

from Valentin David <valentin@lrde.epita.fr>

	* src/disamb/disambiguate/NamespaceDefinition.str,
	* src/disamb/disambiguate/NamespaceDefinitionCandidate.str:
	Handle namespace aliases.

	* test/disambiguate/namespace-07.detcc: Disambiguate.

	* test/disambiguate/namespace-08.cc,
	* test/disambiguate/namespace-08.detcc,
	* test/disambiguate/namespace-09.cc,
	* test/disambiguate/namespace-09.detcc,
	* test/disambiguate/namespace-10.cc,
	* test/disambiguate/namespace-10.detcc,
	* test/disambiguate/namespace-11.cc,
	* test/disambiguate/namespace-11.detcc: New.

	* test/disambiguate/Makefile.am (TESTS): Update.

	* src/disamb/disambiguate/NamespaceNameAmbiguity.str,
	* src/disamb/disambiguate/TypeDefinition.str: Remove trailing debug.
parent 59026087
2004-03-30 Valentin David <valentin@lrde.epita.fr>
* src/disamb/disambiguate/NamespaceDefinition.str,
* src/disamb/disambiguate/NamespaceDefinitionCandidate.str:
Handle namespace aliases.
* test/disambiguate/namespace-07.detcc: Disambiguate.
* test/disambiguate/namespace-08.cc,
* test/disambiguate/namespace-08.detcc,
* test/disambiguate/namespace-09.cc,
* test/disambiguate/namespace-09.detcc,
* test/disambiguate/namespace-10.cc,
* test/disambiguate/namespace-10.detcc,
* test/disambiguate/namespace-11.cc,
* test/disambiguate/namespace-11.detcc: New.
* test/disambiguate/Makefile.am (TESTS): Update.
* src/disamb/disambiguate/NamespaceNameAmbiguity.str,
* src/disamb/disambiguate/TypeDefinition.str: Remove trailing debug.
2004-03-29 Valentin David <valentin@lrde.epita.fr>
* src/syn/notemplate.str: New.
......
/*
* Copyright (C) 2003 EPITA Research and Development Laboratory
* Copyright (C) 2003, 2004 EPITA Research and Development Laboratory
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -85,17 +85,40 @@ rules
; < end-scope (!"$namespace") > a // Restore old current namespace name.
; < concat-strings; ifdebug (debug) > ["- Extension of namespace", " ", e']
NamespaceDefinition-a: |NamespaceAliasDefinition[ namespace la1 ID la2 = la3 Dummy0-opt la4 NestedNameSpecifier-opt la5 NamespaceName la6 ; ]| ->
|NamespaceAliasDefinition[ namespace la1 ID la2 = la3 Dummy0-opt la4 NestedNameSpecifier-opt' la5 NamespaceName la6 ; ]|
where scope(!"$namespace",
< local-or-global > Dummy0-opt
; < try(
?|NestedNameSpecifier?[ ~NestedNameSpecifier: nested~ ]|;
!nested; nested-name-specifier; ?nested';
!|NestedNameSpecifier?[ ~NestedNameSpecifier: nested'~ ]|)
> NestedNameSpecifier-opt => NestedNameSpecifier-opt'
; < rewrite (!"$namespace") > "$value" => d
; < try(namespace-name-ambiguity) > NamespaceName
=> NamespaceName'
; collect(?|Identifier[ ID' ]|)
; !ID' => alias)
; < identifier > ID => c
; < assert (!d) > (c, alias-kind)
; < assert (!alias-table(d)) > (c, alias)
strategies
namespace-definition-o = NamespaceDefinition-o
namespace-definition-e = NamespaceDefinition-e
namespace-definition-a = NamespaceDefinition-a
namespace-definition-candidate = (namespace-definition-candidate-o +
namespace-definition-candidate-e)
namespace-definition-candidate-e +
namespace-definition-candidate-a)
namespace-definition-stop(s) = namespace-definition-candidate
namespace-definition = (namespace-definition-candidate-o;
namespace-definition-o) +
(namespace-definition-candidate-e;
namespace-definition-e)
namespace-definition-e) +
(namespace-definition-candidate-a;
namespace-definition-a)
......@@ -45,7 +45,11 @@ rules
]|~ ]| -> a
where < ifdebug (debug) > "Candidate for namespace extension"
NamespaceDefinitionCandidate-a: a@|NamespaceAliasDefinition[ namespace ID = Dummy0-opt NestedNameSpecifier-opt NamespaceName ; ]| -> a
where < ifdebug (debug) > "Candidate for namespace alias"
strategies
namespace-definition-candidate-o = NamespaceDefinitionCandidate-o
namespace-definition-candidate-e = NamespaceDefinitionCandidate-e
namespace-definition-candidate-a = NamespaceDefinitionCandidate-a
......@@ -34,7 +34,7 @@ imports
rules
NamespaceNameAmbiguity : amb (a) -> b
where < getfirst (debug; check-namespace-name) > a => b
where < getfirst (check-namespace-name) > a => b
strategies
......
......@@ -36,7 +36,7 @@ imports
rules
TypeDefinition-0 : a@|SimpleDeclaration[ DeclSpecifierSeq-opt la1 InitDeclaratorList-opt la2 ; ]| -> |SimpleDeclaration[ DeclSpecifierSeq-opt la1 InitDeclaratorList-opt' la2 ; ]|
where <ifdebug (debug (!"1"))> a; (( <collect(?|SimpleTypeSpecifier[ Dummy0-opt NestedNameSpecifier-opt TypeName ]|)> DeclSpecifierSeq-opt => [n]
where (( <collect(?|SimpleTypeSpecifier[ Dummy0-opt NestedNameSpecifier-opt TypeName ]|)> DeclSpecifierSeq-opt => [n]
; <resolve> n
; SimpleTypeSpecifier-GetKey
<+ ![]) => alias )
......@@ -47,7 +47,7 @@ rules
; type-declarator(!alias) => InitDeclaratorList-opt'
TypeDefinition-1 : a@|MemberDeclaration[ DeclSpecifierSeq-opt la1 MemberDeclaratorList-opt la2 ; ]| -> |MemberDeclaration[ DeclSpecifierSeq-opt la1 MemberDeclaratorList-opt' la2 ; ]|
where <ifdebug (debug (!"2"))> a; (( <collect(?|SimpleTypeSpecifier[ Dummy0-opt NestedNameSpecifier-opt TypeName ]|)> DeclSpecifierSeq-opt => [n]
where (( <collect(?|SimpleTypeSpecifier[ Dummy0-opt NestedNameSpecifier-opt TypeName ]|)> DeclSpecifierSeq-opt => [n]
; <resolve> n
; SimpleTypeSpecifier-GetKey
<+ ![]) => alias )
......
......@@ -41,6 +41,10 @@ TESTS = \
namespace-05 \
namespace-06 \
namespace-07 \
namespace-08 \
namespace-09 \
namespace-10 \
namespace-11 \
parameter-01 \
parameter-02 \
parameter-03 \
......@@ -78,7 +82,4 @@ TESTS = \
union-01 \
variable-01
XFAIL_TESTS = \
namespace-07
EXTRA_DIST = test $(TESTS:=.cc) $(TESTS:=.detcc)
namespace a {
typedef int b;
namespace /*<org>*/a/*</org>*/ {
typedef int /*<uid>*/b/*</uid>*/;
}
namespace c = a;
namespace c = /*<ns>*/a/*</ns>*/;
namespace d {
using c::b;
namespace /*<org>*/d/*</org>*/ {
using /*<al>*/c/*</al>*/::b;
}
namespace a {
typedef int b;
}
namespace c = a;
c::b d;
namespace /*<org>*/a/*</org>*/ {
typedef int /*<uid>*/b/*</uid>*/;
}
namespace c = /*<ns>*/a/*</ns>*/;
/*<al>*/c/*</al>*/::/*<tn>*/b/*</tn>*/ /*<uid>*/d/*</uid>*/;
namespace a {
typedef int b;
}
namespace d {
using a::b;
b e;
}
namespace /*<org>*/a/*</org>*/ {
typedef int /*<uid>*/b/*</uid>*/;
}
namespace /*<org>*/d/*</org>*/ {
using /*<ns>*/a/*</ns>*/::b;
/*<tn>*/b/*</tn>*/ /*<uid>*/e/*</uid>*/;
}
namespace a {
typedef int b;
}
namespace d {
using namespace a;
b e;
}
namespace /*<org>*/a/*</org>*/ {
typedef int /*<uid>*/b/*</uid>*/;
}
namespace /*<org>*/d/*</org>*/ {
using namespace /*<ns>*/a/*</ns>*/;
/*<tn>*/b/*</tn>*/ /*<uid>*/e/*</uid>*/;
}
namespace a {
typedef int b;
}
namespace c = a;
namespace d {
using c::b;
b e;
}
namespace /*<org>*/a/*</org>*/ {
typedef int /*<uid>*/b/*</uid>*/;
}
namespace c = /*<ns>*/a/*</ns>*/;
namespace /*<org>*/d/*</org>*/ {
using /*<al>*/c/*</al>*/::b;
/*<tn>*/b/*</tn>*/ /*<uid>*/e/*</uid>*/;
}
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