Commit 968bf3dd authored by gourne_o's avatar gourne_o
Browse files

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

	* test/disambiguate/Makefile.am: Update.
	* lib/prelude/ScopedFiniteMap.str: Add debug information.
	* src/disamb/disambiguate/UsingNamespace.meta,
	* src/disamb/disambiguate/UsingNamespace.str: New.
	* src/disamb/disambiguate/Resolve.str: Call UsingNamespace.
	* src/disamb/disambiguate/Makefile.am: Update.
	* src/disamb/disambiguate/Lookup.str: Fix bug.

2004-05-16  Olivier Gournet  <gourne_o@lrde.epita.fr>
parent baeaddee
2004-05-16 Olivier Gournet <gourne_o@lrde.epita.fr>
* test/disambiguate/Makefile.am: Update.
* lib/prelude/ScopedFiniteMap.str: Add debug information.
* src/disamb/disambiguate/UsingNamespace.meta,
* src/disamb/disambiguate/UsingNamespace.str: New.
* src/disamb/disambiguate/Resolve.str: Call UsingNamespace.
* src/disamb/disambiguate/Makefile.am: Update.
* src/disamb/disambiguate/Lookup.str: Fix bug.
2004-05-16 Olivier Gournet <gourne_o@lrde.epita.fr> 2004-05-16 Olivier Gournet <gourne_o@lrde.epita.fr>
* test/disambiguate/using-ns-01.detcc, * test/disambiguate/using-ns-01.detcc,
......
...@@ -53,7 +53,8 @@ strategies ...@@ -53,7 +53,8 @@ strategies
; !(<id>, [ <id> ]) ; !(<id>, [ <id> ])
; foldl ({x, y, z: ; foldl ({x, y, z:
?((x, y), z) ?((x, y), z)
; <table-getlist> (x) ; < table-getlist > (x)
; where (if-verbose4 (< debug (!"dump (table, cont): ") > (x, <id>)))
; <conc> (z, [[ x | <id> ]]) ; <conc> (z, [[ x | <id> ]])
}) })
; write-to ; write-to
...@@ -74,6 +75,8 @@ strategies ...@@ -74,6 +75,8 @@ strategies
; ?[ symtab | content ] ; ?[ symtab | content ]
; < table-putlist > ("$maplist", symtab) ; < table-putlist > ("$maplist", symtab)
; < map ({x, y: ; < map ({x, y:
?[x | y]; < table-putlist > (x, y) ?[x | y]
; if-verbose4 (< debug (!"restore (table, cont): ") > (x, y))
; < table-putlist > (x, y)
}) })
> content > content
...@@ -93,7 +93,7 @@ strategies ...@@ -93,7 +93,7 @@ strategies
loukup' = Lookup'(table) loukup' = Lookup'(table)
lookup-first(table) = (Lookup-stop; lookup-first(table) = (Lookup-stop;
Lookup-current(table)) <+ (Lookup-current(table) <+ Lookup-inherit(table))) <+
(not (Lookup-stop); (not (Lookup-stop);
(Lookup-current(table) <+ Lookup-inherit(table) <+ Lookup-recurse(table))) (Lookup-current(table) <+ Lookup-inherit(table) <+ Lookup-recurse(table)))
......
...@@ -74,6 +74,7 @@ SRCS = \ ...@@ -74,6 +74,7 @@ SRCS = \
TypeDefinition.str \ TypeDefinition.str \
TypeDefinitionCandidate.str \ TypeDefinitionCandidate.str \
UsingDefinition.str \ UsingDefinition.str \
UsingNamespace.str \
VariableDeclarator.str \ VariableDeclarator.str \
VariableDeclaratorCandidate.str \ VariableDeclaratorCandidate.str \
VariableDefinition.str \ VariableDefinition.str \
...@@ -138,6 +139,7 @@ METAS = \ ...@@ -138,6 +139,7 @@ METAS = \
TypeDefinition.meta \ TypeDefinition.meta \
TypeDefinitionCandidate.meta \ TypeDefinitionCandidate.meta \
UsingDefinition.meta \ UsingDefinition.meta \
UsingNamespace.meta \
VariableDeclarator.meta \ VariableDeclarator.meta \
VariableDeclaratorCandidate.meta \ VariableDeclaratorCandidate.meta \
VariableDefinition.meta \ VariableDefinition.meta \
......
...@@ -32,6 +32,9 @@ imports ...@@ -32,6 +32,9 @@ imports
ClassOrNamespaceAmbiguity ClassOrNamespaceAmbiguity
ClassTraverse ClassTraverse
CompoundStatement CompoundStatement
DeclaratorIdAmbiguity
InitDeclaratorAmbiguity
FunctionDefinitionAmbiguity
MemInitializerIdAmbiguity MemInitializerIdAmbiguity
NamespaceTraverse NamespaceTraverse
NamespaceNameAmbiguity NamespaceNameAmbiguity
...@@ -43,11 +46,9 @@ imports ...@@ -43,11 +46,9 @@ imports
TypeAmbiguity TypeAmbiguity
TemplateIdAmbiguity TemplateIdAmbiguity
TemplateFunctionTraverse TemplateFunctionTraverse
DeclaratorIdAmbiguity UsingNamespace
SimpleDeclarationAmbiguity SimpleDeclarationAmbiguity
SizeofAmbiguity SizeofAmbiguity
InitDeclaratorAmbiguity
FunctionDefinitionAmbiguity
strategies strategies
...@@ -68,6 +69,7 @@ strategies ...@@ -68,6 +69,7 @@ strategies
primary-expression-stop(s) <+ primary-expression-stop(s) <+
compound-statement-stop(s) <+ compound-statement-stop(s) <+
templateid-ambiguity-stop(s) <+ templateid-ambiguity-stop(s) <+
using-namespace-stop(s) <+
namespace-name-ambiguity-stop(s) <+ namespace-name-ambiguity-stop(s) <+
ambiguity-stop(s) ambiguity-stop(s)
...@@ -88,6 +90,7 @@ strategies ...@@ -88,6 +90,7 @@ strategies
primary-expression <+ primary-expression <+
compound-statement <+ compound-statement <+
templateid-ambiguity <+ templateid-ambiguity <+
using-namespace <+
namespace-name-ambiguity <+ namespace-name-ambiguity <+
// ambiguity <+ // ambiguity <+
not (namespace-traverse-candidate <+ not (namespace-traverse-candidate <+
...@@ -107,6 +110,7 @@ strategies ...@@ -107,6 +110,7 @@ strategies
primary-expression-candidate <+ primary-expression-candidate <+
compound-statement-candidate <+ compound-statement-candidate <+
templateid-ambiguity-candidate <+ templateid-ambiguity-candidate <+
using-namespace-candidate <+
namespace-name-ambiguity-candidate <+ namespace-name-ambiguity-candidate <+
ambiguity-candidate) ambiguity-candidate)
......
/*
* UsingNamespace.str:
* this file is a part of CxxGrammar from the Transformers project.
* Copyright (C) 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
module UsingNamespace
imports
lib
imports
AsFix
Cxx
Identifier
Kinds
rules
UsingNamespace: |UsingDirective[
using namespace Dummy0-opt ID ; ]|
-> |UsingDirective[
using namespace Dummy0-opt ~OriginalNamespaceName: |OriginalNamespaceName[ ID ]| ~ ; ]|
where
< UsingNamespace-core > (None, ID)
UsingNamespace: |UsingDirective[
using namespace Dummy0-opt NestedNameSpecifier ID ; ]|
-> |UsingDirective[
using namespace Dummy0-opt NestedNameSpecifier' ~OriginalNamespaceName: |OriginalNamespaceName[ ID ]| ~ ; ]|
where
< UsingNamespace-core > (Some (NestedNameSpecifier), ID) => Some (NestedNameSpecifier')
(*
** FIXME: concat nested with inherit
*)
UsingNamespace-core: (nested, ident) -> nested'
where
< identifier > ident => ident'
(* ; < opt-apply (nested-name-specifier) > nested => nested' *) ; !nested => nested'
; < rewrite (!"$namespace") > "$value" => base
; < ?list-key (xs); !xs > base => base'
; < conc; ?x; !list-key (x) > ([], [string-key (ident')]) => inherit
; < rewrite (!base) <+ (!Nil) > "$inherit" => inherits
; < conc > (inherits, [inherit]) => inherits'
; < my-assert (!base) > ("$inherit", inherits')
strategies
using-namespace = using-namespace-candidate; UsingNamespace
using-namespace-candidate =
?|UsingDirective[
using namespace Dummy0-opt NestedNameSpecifier-opt NamespaceName ; ]|
; where (<ifdebug (debug)> "Candidate for using namespace")
using-namespace-stop(s) = using-namespace-candidate
...@@ -102,13 +102,13 @@ TESTS = \ ...@@ -102,13 +102,13 @@ TESTS = \
variable-01 variable-01
XFAIL_TESTS = \ XFAIL_TESTS = \
anonym-02 \
array-01 \ array-01 \
class-07 \ class-07 \
class-08 \ class-08 \
class-09 \ class-09 \
class-10 \ class-10 \
inherit-10 \ inherit-10 \
namespace-10 \
simple-decl-03 \ simple-decl-03 \
template-13 \ template-13 \
template-14 \ template-14 \
......
Markdown is supported
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