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>
* test/disambiguate/using-ns-01.detcc,
......
......@@ -53,7 +53,8 @@ strategies
; !(<id>, [ <id> ])
; foldl ({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> ]])
})
; write-to
......@@ -74,6 +75,8 @@ strategies
; ?[ symtab | content ]
; < table-putlist > ("$maplist", symtab)
; < map ({x, y:
?[x | y]; < table-putlist > (x, y)
?[x | y]
; if-verbose4 (< debug (!"restore (table, cont): ") > (x, y))
; < table-putlist > (x, y)
})
> content
......@@ -93,7 +93,7 @@ strategies
loukup' = Lookup'(table)
lookup-first(table) = (Lookup-stop;
Lookup-current(table)) <+
(Lookup-current(table) <+ Lookup-inherit(table))) <+
(not (Lookup-stop);
(Lookup-current(table) <+ Lookup-inherit(table) <+ Lookup-recurse(table)))
......
......@@ -74,6 +74,7 @@ SRCS = \
TypeDefinition.str \
TypeDefinitionCandidate.str \
UsingDefinition.str \
UsingNamespace.str \
VariableDeclarator.str \
VariableDeclaratorCandidate.str \
VariableDefinition.str \
......@@ -138,6 +139,7 @@ METAS = \
TypeDefinition.meta \
TypeDefinitionCandidate.meta \
UsingDefinition.meta \
UsingNamespace.meta \
VariableDeclarator.meta \
VariableDeclaratorCandidate.meta \
VariableDefinition.meta \
......
......@@ -32,6 +32,9 @@ imports
ClassOrNamespaceAmbiguity
ClassTraverse
CompoundStatement
DeclaratorIdAmbiguity
InitDeclaratorAmbiguity
FunctionDefinitionAmbiguity
MemInitializerIdAmbiguity
NamespaceTraverse
NamespaceNameAmbiguity
......@@ -43,11 +46,9 @@ imports
TypeAmbiguity
TemplateIdAmbiguity
TemplateFunctionTraverse
DeclaratorIdAmbiguity
UsingNamespace
SimpleDeclarationAmbiguity
SizeofAmbiguity
InitDeclaratorAmbiguity
FunctionDefinitionAmbiguity
strategies
......@@ -68,6 +69,7 @@ strategies
primary-expression-stop(s) <+
compound-statement-stop(s) <+
templateid-ambiguity-stop(s) <+
using-namespace-stop(s) <+
namespace-name-ambiguity-stop(s) <+
ambiguity-stop(s)
......@@ -88,6 +90,7 @@ strategies
primary-expression <+
compound-statement <+
templateid-ambiguity <+
using-namespace <+
namespace-name-ambiguity <+
// ambiguity <+
not (namespace-traverse-candidate <+
......@@ -107,6 +110,7 @@ strategies
primary-expression-candidate <+
compound-statement-candidate <+
templateid-ambiguity-candidate <+
using-namespace-candidate <+
namespace-name-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 = \
variable-01
XFAIL_TESTS = \
anonym-02 \
array-01 \
class-07 \
class-08 \
class-09 \
class-10 \
inherit-10 \
namespace-10 \
simple-decl-03 \
template-13 \
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