Commit 39e61dd1 authored by david_v's avatar david_v
Browse files

2004-01-22 Valentin David <valentin@lrde.epita.fr>

	* configure.ac, src/disamb/Makefile.am: Update.

	* TODO: Update.

	* src/syn/TemplateParameters.sdf: Add tag for deterministic syntax.

	* test/disambiguate/template-05.cc,
	* test/disambiguate/template-10.detcc,
	* test/disambiguate/template-09.detcc,
	* test/disambiguate/template-05.detcc: Fix.

	* test/disambiguate/test.test, test/disambiguate/Makefile.am,
	* test/expressions/Makefile.am, test/expressions/test.test,
	* test/g++/template/Makefile.am, test/g++/template/test.test,
	* test/g++/parse/Makefile.am, test/g++/parse/test.test,
	* test/g++/overload/Makefile.am, test/g++/overload/test.test,
	* test/g++/other/Makefile.am, test/g++/other/test.test,
	* test/g++/opt/Makefile.am, test/g++/opt/test.test,
	* test/g++/lookup/Makefile.am, test/g++/lookup/test.test,
	* test/g++/init/Makefile.am, test/g++/init/test.test,
	* test/g++/inherit/Makefile.am, test/g++/inherit/test.test,
	* test/g++/eh/Makefile.am, test/g++/eh/test.test,
	* test/g++/debug/Makefile.am, test/g++/debug/test.test,
	* test/g++/abi/Makefile.am, test/g++/abi/test.test: Fix and update.

	* src/disamb/disambiguate/TemplateArguments.str,
	* src/disamb/disambiguate/TemplateTraverse.str,
	* src/disamb/disambiguate/TemplateDefinition.str,
	* src/disamb/disambiguate/TemplateClassTraverse.str,
	* src/disamb/disambiguate/TemplateClassDefinition.str,
	* src/disamb/disambiguate/SimpleTypeSpecifier.str,
	* src/disamb/disambiguate/ResolveCompound.str,
	* src/disamb/disambiguate/Resolve.str,
	* src/disamb/disambiguate/PrimaryExpression.str,
	* src/disamb/disambiguate/Parameter.str,
	* src/disamb/disambiguate/Makefile.am,
	* src/disamb/disambiguate/afcxx-disambiguate.str,
	* src/disamb/disambiguate/Kinds.str,
	* src/disamb/disambiguate/Keys.str,
	* src/disamb/disambiguate/Definition.str,
	* src/disamb/disambiguate/ClassOrNamespaceTraverse.str,
	* src/disamb/disambiguate/ClassOrNamespaceAmbiguity.str,
	* src/disamb/disambiguate/BaseTraverse.str,
	* src/disamb/disambiguate/AmbiguityCandidate.str: Fix several bugs.

	* src/parser/parse-cxx.str, config/check-rules.mk: Update.

	* src/disamb/simpledeclaration/Makefile.am,
	* src/disamb/simpledeclaration/afcxx-simpledeclaration.str,
	* src/disamb/simpledeclaration/afcxx-simpledeclaration.meta: New.

	* src/disamb/classparam/Makefile.am,
	* src/disamb/classparam/afcxx-classparam.str,
	* src/disamb/classparam/afcxx-classparam.meta: New.

	* src/disamb/disambiguate/PostfixExpressionAmbiguity.str,
	* src/disamb/disambiguate/PostfixExpressionAmbiguity.meta,
	* src/disamb/disambiguate/PostfixExpressionAmbiguityCandidate.str,
	* src/disamb/disambiguate/PostfixExpressionAmbiguityCandidate.meta,
	* src/disamb/disambiguate/TemplateIdAmbiguityCut.str,
	* src/disamb/disambiguate/TemplateIdAmbiguityCandidate.str,
	* src/disamb/disambiguate/TemplateIdAmbiguity.str,
	* src/disamb/disambiguate/TemplateIdAmbiguityCut.meta,
	* src/disamb/disambiguate/TemplateIdAmbiguityCandidate.meta,
	* src/disamb/disambiguate/TemplateIdAmbiguity.meta,
	* src/disamb/disambiguate/TemplateFunctionDefinitionCandidate.str,
	* src/disamb/disambiguate/TemplateFunctionDefinition.str,
	* src/disamb/disambiguate/TemplateFunctionDefinitionCandidate.meta,
	* src/disamb/disambiguate/TemplateFunctionDefinition.meta,
	* src/disamb/disambiguate/TemplateFunctionTraverse.str,
	* src/disamb/disambiguate/TemplateFunctionTraverse.meta: New.

	* src/disamb/ambdown/ambdown.str, src/disamb/ambdown/Makefile.am: New.
parent b21eb4fe
/*
* 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 TemplateIdAmbiguityCandidate
imports
lib
imports
AsFix2-Syntax
asfix
Cxx
IfDebug
rules
TemplateIdAmbiguityCandidate : a@amb (l) -> a
where <map({TemplateName, TemplateArgumentList-opt :
?|TemplateId[ TemplateName < TemplateArgumentList-opt > ]| })> l
; < ifdebug (debug) > "Candidate for template id ambiguity"
TemplateIdAmbiguityCandidate : a -> a
where <?|TemplateId[ TemplateName < TemplateArgumentList-opt > ]|> a
; < ifdebug (debug) > "Candidate for template id ambiguity"
strategies
templateid-ambiguity-candidate = TemplateIdAmbiguityCandidate
/*
* 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 TemplateIdAmbiguityCut
imports
lib
imports
AsFix2-Syntax
TemplateArguments
Identifier
Kinds
rules
TemplateIdAmbiguityCut : a@|TemplateId[ ID < TemplateArgumentList-opt > ]| -> |TemplateId[ ID < TemplateArgumentList-opt' > ]|
where < identifier > ID => c
; < rewrite (!"$namespace") > "$value" => d
; < scope (!"$namespace", lookup) > c
; (?class-template-kind (l)
<+ ?function-template-kind(l))
; < template-arguments-resolve(!l) > TemplateArgumentList-opt => TemplateArgumentList-opt'
; < print-key > d => e
; < print-key > template-key (c, l) => tk
; < concat-strings ; debug > ["Resolved ambiguity on template id argument list ", " ", tk, " ",
"in namespace", " ", e]
strategies
templateid-ambiguity-cut = TemplateIdAmbiguityCut
/*
* 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
......@@ -38,8 +38,11 @@ rules
TemplateTraverse : a@|TemplateDeclaration[ Dummy2-opt la1 template la2 < la3 TemplateParameterList la4 > la5 Declaration ]|
-> |TemplateDeclaration[ Dummy2-opt la1 template la2 < la3 TemplateParameterList la4 > la5 Declaration' ]|
where < begin-scope (!"$template") > a
; < parameters-normalize > TemplateParameterList => TemplateParameterList'
; < assert (!"$template") > ("$value", TemplateParameterList')
; < begin-scope (!"$template-parameters") > a
; < parameters-decl > TemplateParameterList => TemplateParameterList'
; < assert (!"$template") > ("$value", <map({x: ?(_,x); !x})> TemplateParameterList')
; < assert (!"$template-parameters") > ("$value", TemplateParameterList')
; < topdown (not (?amb(xs))) > TemplateParameterList
; < resolve > Declaration => Declaration'
......
/*
* 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
......@@ -41,7 +41,8 @@ strategies
init = Init
finish = Finish
afcxx-disambiguate = iowrap (init-name-space (!"$namespace");
afcxx-disambiguate = iowrap (where(< table-create > "$parameters-normalize");
init-name-space (!"$namespace");
init-name-space (!"$template");
begin-scope (!"$namespace");
begin-scope (!"$template");
......
include $(top_srcdir)/config/Makefile.xt
-include afcxx-simpledeclaration.c.dep
-include afcxx-simpledeclaration-ast.c.dep
SRCS = \
afcxx-simpledeclaration.str \
afcxx-simpledeclaration.meta
SCFLAGS = --main $* --verbose 0 --asfix
STRINCLUDES = -I $(ASFIX_TOOLS)/share/asfix-tools \
-I $(top_builddir)/src/sig \
-I $(top_builddir)/src/strategocxx
bin_PROGRAMS = afcxx-simpledeclaration afcxx-simpledeclaration-ast
BOOTCLEANFILES = afcxx-simpledeclaration.c afcxx-simpledeclaration-ast.c
EXTRA_DIST = $(SRCS)
CLEANFILES = afcxx-simpledeclaration.c.dep afcxx-simpledeclaration-ast.c.dep
afcxx-simpledeclaration-ast.c: afcxx-simpledeclaration.str
$(SCOMPILE) $(STRINCLUDES) --main afcxx-simpledeclaration --verbose 0 -i $< -o $@ -c
/*
* 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
*
*/
// This filter delete illegal case of use empty type specifier in simple
// declaration when it is not a function declaration.
module afcxx-simpledeclaration
imports
lib
AsFix2-Syntax
asfix
Cxx
strategies
check(stop, if, check) =
rec x(stop <+ (if < check + id); all(x))
check-each-declarator(rec) =
oncetd(?|Declarator[ DirectDeclarator ]|)
; !DirectDeclarator
; (?|DirectDeclarator[ DirectDeclarator2
( ParameterDeclarationClause )
CvQualifierSeq-opt
ExceptionSpecification-opt ]|
<+ ?|DirectDeclarator[ ( Declarator ) ]|; !Declarator; rec)
check-declarator =
rec x(check-each-declarator(x))
check-simpledeclarations =
check(amb(id),
{InitDeclaratorList-opt:
?|SimpleDeclaration[ InitDeclaratorList-opt ; ]|},
where(
{InitDeclaratorList-opt:
?|SimpleDeclaration[ InitDeclaratorList-opt ; ]|
; !InitDeclaratorList-opt}
; collect({Declarator, Initializer-opt:
?|InitDeclarator[ Declarator Initializer-opt ]|})
; map({Declarator, Initializer-opt:
?|InitDeclarator[ Declarator Initializer-opt ]|
; !Declarator
; check-declarator})))
afcxx-simpledeclaration = iowrap(
topdown(
try(
amb(filter(check-simpledeclarations))
)
)
)
......@@ -19,15 +19,18 @@
module parse-cxx
imports xtc-lib stratego-xt-xtc-tools
strategies
io-parse-cxx =
xtc-io-wrap(
xtc-transform(!"sglr", !["-2", "-fi", "-p", <!"Cxx.tbl"; xtc-find> ]);
xtc-transform(!"ambdown");
xtc-transform(!"afcxx-simpledeclaration");
xtc-transform(!"afcxx-namespace");
xtc-transform(!"afcxx-declaration");
xtc-transform(!"afcxx-resolve");
xtc-transform(!"afcxx-declarator");
xtc-transform(!"afcxx-bitfield");
xtc-transform(!"afcxx-classparam");
xtc-transform(!"afcxx-resolve");
xtc-transform(!"afcxx-specifier");
xtc-transform(!"afcxx-disambiguate");
......
......@@ -19,7 +19,7 @@ exports
%% 14.1 [temp.param]
"class" Identifier? -> TemplateParameter
{pp(H[KW["class"] _1])}
{pp(H[KW["class"] _1]), dettag("tp")}
"class" Identifier? "=" TypeId -> TemplateParameter
{pp(H[KW["class"] _1 KW["="] _2])}
"typename" Identifier? -> TemplateParameter
......@@ -29,4 +29,4 @@ exports
"template" "<" TemplateParameterList ">" "class" Identifier? -> TemplateParameter
{pp(H[KW["template"] H hs=0[KW["<"] _1 KW[">"]] H[KW["class"] _2]])}
"template" "<" TemplateParameterList ">" "class" Identifier? "=" IdExpression -> TemplateParameter
{pp(H[KW["template"] H hs=0[KW["<"] _1 KW[">"]] H[KW["class"] _2 KW["="]] _3])}
\ No newline at end of file
{pp(H[KW["template"] H hs=0[KW["<"] _1 KW[">"]] H[KW["class"] _2 KW["="]] _3])}
......@@ -2,7 +2,7 @@ include $(top_srcdir)/config/Makefile.xt
include $(top_srcdir)/config/check-rules.mk
# Each test case depends on defs.
check_SCRIPTS = defs
check_SCRIPTS = defs dirs
defs: $(top_builddir)/config/defs
ln -s $(top_builddir)/config/defs .
......@@ -10,11 +10,11 @@ defs: $(top_builddir)/config/defs
$(TESTS): test.test
for i in $(TESTS); do ln -fs $< $$i; done
dirs:
echo "SRCDIR=\"$(srcdir)\"" >dirs
XFAIL_TESTS = \
template-04.test \
template-05.test \
template-09.test \
template-10.test
template-08.test
TESTS = \
class-01.test \
......@@ -84,6 +84,7 @@ TESTS = \
EXTRA_DIST = test.test $(TESTS:.test=.cc)
CLEANFILES = defs \
dirs \
$(TESTS) \
$(TESTS:.test=.visamb) \
$(TESTS:.test=.disambcc) \
......
template < typename T >
struct Traits
{
typedef int a_t;
};
template < typename T >
......
template < typename T >
struct Traits
{
typedef int /*<uid>*/a_t/*</uid>*/;
};
template < typename T >
......
template < class T, int /*<uid>*/i/*</uid>*/, typename C >
template < /*<tp>*/class T/*</tp>*/, int /*<uid>*/i/*</uid>*/, typename C >
struct Traits
{
typedef int /*<uid>*/a_t/*</uid>*/;
};
typedef Traits< int, 5, float >::/*<tn>*/a_t/*</tn>*/ /*<uid>*/b_t/*</uid>*/;
typedef /*<ds>*/Traits< int, 5, float >::/*<tn>*/a_t/*</tn>*//*</ds>*/ /*<uid>*/b_t/*</uid>*/;
template < class T >
template < /*<tp>*/class T/*</tp>*/ >
class a
{
};
template < class K, class V, template < class T > class C = a >
template < /*<tp>*/class K/*</tp>*/, /*<tp>*/class V/*</tp>*/, template < /*<tp>*/class T/*</tp>*/ > class C = a >
class b
{
C/*</*<cl>*/K/*</cl>*/> /*<uid>*/c/*</uid>*/;
C/*</*<cl>*/V/*</cl>*/> /*<uid>*/d/*</uid>*/;
C</*<tn>*/K/*</tn>*/> /*<uid>*/c/*</uid>*/;
C</*<tn>*/V/*</tn>*/> /*<uid>*/d/*</uid>*/;
};
#! /bin/sh
. ./defs || exit 1
. ./dirs || exit 1
rm -f $me.visamb $me.disambcc $me.diff
if g++ -ansi -pedantic -fsyntax-only "$me.cc" &> /dev/null; then
if g++ -ansi -pedantic -fsyntax-only "${SRCDIR}"/"$me.cc" &> /dev/null; then
if make $me.visamb $me.diff; then
exit 0
else
......
......@@ -2,11 +2,14 @@ include $(top_srcdir)/config/Makefile.xt
include $(top_srcdir)/config/check-rules.mk
# Each test case depends on defs.
check_SCRIPTS = defs
check_SCRIPTS = defs dirs
defs: $(top_builddir)/config/defs
ln -s $(top_builddir)/config/defs .
dirs:
echo "SRCDIR=\"$(srcdir)\"" >dirs
$(TESTS): test.test
for i in $(TESTS); do ln -fs $< $$i; done
......
#! /bin/sh
. ./defs || exit 1
. ./dirs || exit 1
rm $me.visamb $me.disambcc
if g++ -ansi -pedantic -fsyntax-only "$me.cc" -o /dev/null &> /dev/null; then
if g++ -ansi -pedantic -fsyntax-only "${SRCDIR}"/"$me.cc" -o /dev/null &> /dev/null; then
if make $me.visamb; then
exit 0
else
......
......@@ -2,18 +2,23 @@ include $(top_srcdir)/config/Makefile.xt
include $(top_srcdir)/config/check-rules.mk
# Each test case depends on defs.
check_SCRIPTS = defs
check_SCRIPTS = defs dirs
defs: $(top_builddir)/config/defs
ln -s $(top_builddir)/config/defs .
dirs:
echo "SRCDIR=\"$(srcdir)\"" >dirs
$(TESTS): test.test
for i in $(TESTS); do ln -fs $< $$i; done
XFAIL_TESTS = \
empty4.test \
mangle3.test \
mangle6.test
mangle5.test \
mangle6.test \
vthunk1.test
TESTS = \
bitfield1.test \
......@@ -39,6 +44,7 @@ TESTS = \
EXTRA_DIST = test.test $(TESTS:.test=.C)
CLEANFILES = defs \
dirs \
$(TESTS) \
$(TESTS:.test=.visamb) \
$(TESTS:.test=.disambcc) \
......
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