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
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.
2004-01-15 Valentin David <valentin@lrde.epita.fr>
* lib/prelude/Makefile.am: Fix.
......
......@@ -2,3 +2,4 @@
* debug filters (except disambiguate which will be rewritten)
* list different bugs in test/g++/ files parsing
* correct the pretty print informations
* check for all unknown ambiguities (list them is a good job)
......@@ -12,12 +12,14 @@ CXX_PP_AF=$(top_builddir)/src/syn/Cxx.pp.af
# Disambiguation
.ptcc.disambcc:
$(top_builddir)/src/disamb/namespace/afcxx-namespace -S \
-i $< | \
$(top_builddir)/src/disamb/ambdown/ambdown -i $< | \
$(top_builddir)/src/disamb/simpledeclaration/afcxx-simpledeclaration -S | \
$(top_builddir)/src/disamb/namespace/afcxx-namespace -S | \
$(top_builddir)/src/disamb/declaration/afcxx-declaration -S | \
$(top_builddir)/src/disamb/resolve/afcxx-resolve -S | \
$(top_builddir)/src/disamb/declarator/afcxx-declarator -S | \
$(top_builddir)/src/disamb/bitfield/afcxx-bitfield -S | \
$(top_builddir)/src/disamb/classparam/afcxx-classparam -S | \
$(top_builddir)/src/disamb/resolve/afcxx-resolve -S | \
$(top_builddir)/src/disamb/specifier/afcxx-specifier -S | \
$(top_builddir)/src/disamb/disambiguate/afcxx-disambiguate -S \
......
......@@ -109,6 +109,9 @@ AC_CONFIG_FILES([Makefile
src/disamb/resolve/Makefile
src/disamb/specifier/Makefile
src/disamb/bitfield/Makefile
src/disamb/classparam/Makefile
src/disamb/simpledeclaration/Makefile
src/disamb/ambdown/Makefile
test/Makefile
test/disambiguate/Makefile
test/expressions/Makefile
......
This diff is collapsed.
......@@ -7,6 +7,9 @@ SUBDIRS = \
namespace \
resolve \
specifier \
bitfield
bitfield \
classparam \
simpledeclaration \
ambdown
BOOTCLEAN_SUBDIRS = $(SUBDIRS)
include $(top_srcdir)/config/Makefile.xt
-include ambdown.c.dep
SRCS = \
ambdown.str
SCFLAGS = --main $* --verbose 0 --asfix
STRINCLUDES = -I $(ASFIX_TOOLS)/share/asfix-tools
bin_PROGRAMS = ambdown
BOOTCLEANFILES = ambdown.c
EXTRA_DIST = $(SRCS)
CLEANFILES = ambdown.c.dep
module ambdown
imports
lib
AsFix2-Syntax
signature
constructors
amb : List(Term) -> Term
appl : Term * Term -> Term
strategies
merge = rec x(
([], [])
; ![]
<+ {l1, l2:
?([l1], [l2])
; ![<conc> ([l1], l2)]
}
<+ {l1, l2, l1s, l2s:
?([l1|l1s], [l2|l2s])
; <conc> ([<conc> ([l1], l2)], <x> (l1s, l2s))
})
myzip = rec x(
[]
<+ [id]
; {l:
[ map(![<id>])
; ?l]
; !l
}
<+ {l, ls:
?[l|ls]
; <x> ls
; <merge> (l, <id>)
})
only-one(s) = rec x([s|id] < [id|map(not(s))] + [id|x])
putdown = amb(map(?appl(pr,_)))
; amb(map({e: ?appl(_,e); !e })
; myzip
; map(uniq)
; map({e: ?[e]; !e} <+ !amb(<id>)); ?ambs)
; !ambs
; only-one(amb(not(map(appl(prod(id,cf(opt(layout)),id),id)))))
; !appl(pr, ambs)
delete-last-layout =
rec x(
[]
<+ ([appl(prod(id,cf(opt(layout)),id),id),
appl(prod([],cf(opt(id)),id), id)]
; [appl(prod(![], id, id), ![]), id])
<+ [id|x])
delete-misplaced-layout =
alltd(amb(map(try(appl(prod(at-last(cf(opt(id))), id, id), id)
; delete-last-layout))))
empty-layout = appl(prod([],cf(opt(layout)),no-attrs),[])
clean-layout = amb(filter(not(empty-layout)))
; ?amb([l])
; !l
replace-each-layout =
rec x(
[]
<+ (try({l, ls, m, ms:
?[l|ls]
; !ls
; ?[m|ms]
; !m
; amb(map(appl(prod(id, cf(opt(layout)), id), id)))
; <delete-misplaced-layout> l => l'
; <clean-layout> m => m'
; ![l'|[m'|ms]] })
; [id|x]))
replace-layout = appl(id, one(amb(map(appl(prod(id,
cf(opt(layout)),
id), id))))
; replace-each-layout)
ambdown = iowrap(topdown(repeat(putdown))
; topdown(try(replace-layout)))
include $(top_srcdir)/config/Makefile.xt
-include afcxx-classparam.c.dep
-include afcxx-classparam-ast.c.dep
SRCS = \
afcxx-classparam.str \
afcxx-classparam.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-classparam afcxx-classparam-ast
BOOTCLEANFILES = afcxx-classparam.c afcxx-classparam-ast.c
EXTRA_DIST = $(SRCS)
CLEANFILES = afcxx-classparam.c.dep afcxx-classparam-ast.c.dep
afcxx-classparam-ast.c: afcxx-classparam.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
*
*/
module afcxx-classparam
imports
lib
AsFix2-Syntax asfix Cxx
strategies
template-parameter-candidate = ?|TemplateParameter[ class Identifier-opt ]|
template-parameter-candidate = ?|TemplateParameter[ class Identifier-opt = TypeId ]|
template-parameter-candidate = ?|TemplateParameter[ typename Identifier-opt ]|
template-parameter-candidate = ?|TemplateParameter[ typename Identifier-opt = TypeId ]|
template-parameter-candidate = ?|TemplateParameter[ ParameterDeclaration ]|
template-parameter-candidate = ?|TemplateParameter[ template < TemplateParameterList > class Identifier-opt ]|
template-parameter-candidate = ?|TemplateParameter[ template < TemplateParameterList > class Identifier-opt = IdExpression ]|
class-param = ?|TemplateParameter[ class Identifier-opt ]|
class-param = ?|TemplateParameter[ ParameterDeclaration ]|
bad = ?|TemplateParameter[ ParameterDeclaration ]|
only-class = ?|TemplateParameter[ class Identifier-opt ]|
template-declaration = ?|TemplateDeclaration[ Dummy2-opt template < TemplateParameterList > Declaration ]|
last-param = collect(template-parameter-candidate); at-last(?[p]); !p
last-rec-param = ?|TemplateParameter[ template < TemplateParameterList > class Identifier-opt ]|; !TemplateParameterList; last-param
last-rec-param = ?|TemplateParameter[ template < TemplateParameterList > class Identifier-opt = IdExpression ]|; !TemplateParameterList; last-param
template-declaration-amb = amb(map(template-declaration); ?org; filter(where(last-param; not(bad)); [] < !org + id))
rec-template-parameter-amb = amb(map(template-parameter-candidate); ?org; filter(where(last-rec-param; not(bad)); [] < !org + id))
afcxx-classparam = iowrap(topdown(try(amb(map(class-param); filter(only-class)) <+ template-declaration-amb <+ rec-template-parameter-amb)))
/*
* 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
......@@ -30,7 +30,7 @@ imports
rules
AmbiguityCandidate : a@amb (_) -> a
where < ifdebug (debug) > "Candidate for ambiguity"
where < ifdebug (debug(!"Candidate for unsupported ambiguity : ")) > a
strategies
......
/*
* 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
......@@ -80,9 +80,7 @@ rules
; < rewrite (!"$namespace") > "$value" => base
; < ?list-key (xs); !xs > base => base'
; < conc; ?x; !list-key (x) > (base', [string-key (ID')]) => inherit
; < debug > inherit
; < rewrite (!local) <+ (!Nil) > "$inherit" => inherits
; < debug > inherits
; < conc > (inherits, [inherit]) => inherits'
; < assert (!local) > ("$inherit", inherits')
......
/*
* 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
......@@ -37,7 +37,7 @@ rules
strategies
class-or-namespace-ambiguity-stop = class-or-namespace-ambiguity-candidate
class-or-namespace-ambiguity-stop(s) = class-or-namespace-ambiguity-candidate
class-or-namespace-ambiguity = (class-or-namespace-ambiguity-candidate;
ClassOrNamespaceAmbiguity)
/*
* 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
......@@ -56,6 +56,8 @@ rules
-> a
where < identifier > ID => c
; < rewrite (!"$namespace") > "$value" => d
; < scope (!"$namespace", lookup) > c => class-template-kind (l)
; < template-arguments-resolve(!l) > TemplateArgumentList-opt => TemplateArgumentList-opt'
; < template-arguments > TemplateArgumentList-opt => g
; < id > template-key (c, g) => f
; < ?list-key (as); !as > d => d'
......@@ -68,4 +70,4 @@ strategies
class-or-namespace-traverse = ClassOrNamespaceTraverse-0 <+
ClassOrNamespaceTraverse-1 <+
ClassOrNamespaceTraverse-2
try(oncetd(templateid-ambiguity)); ClassOrNamespaceTraverse-2
/*
* 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
......@@ -33,12 +33,15 @@ imports
TypeDefinition
VariableDefinition
EnumDefinition
TemplateFunctionDefinition
strategies
definition-stop(s) = namespace-definition-stop(s) <+
definition-stop(s) =
namespace-definition-stop(s) <+
template-definition-stop(s) <+
template-class-definition-stop(s) <+
template-function-definition-stop(s) <+
class-definition-stop(s) <+
enum-definition-stop(s) <+
compound-statement-candidate
......@@ -46,6 +49,7 @@ strategies
definition-single = namespace-definition <+
template-definition <+
template-class-definition <+
template-function-definition <+
class-definition <+
enum-definition <+
type-definition <+
......@@ -53,6 +57,7 @@ strategies
not (namespace-definition-candidate <+
template-definition-candidate <+
template-class-definition-candidate <+
template-function-definition-candidate <+
class-definition-candidate <+
enum-definition-candidate <+
type-definition-candidate <+
......
/*
* 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
......@@ -36,7 +36,7 @@ rules
build-template-params: type-kind -> "typename"
build-template-params: class-kind -> "class"
build-template-params: value-kind -> "val"
build-template-params: variable-kind -> "val"
insert-between-0: ([], e) -> []
insert-between-1: ([a], e) -> [a]
......
......@@ -29,3 +29,5 @@ signature
namespace-kind : Kind
type-kind : Kind
variable-kind : Kind
function-kind : Kind
function-template-kind : Term -> Kind
......@@ -23,6 +23,7 @@ SRCS = \
EnumDefinition.str \
EnumDefinitionCandidate.str \
IfDebug.str \
Keys.str \
Kinds.str \
LocalOrGlobal.str \
Lookup.str \
......@@ -31,17 +32,30 @@ SRCS = \
NamespaceDefinitionCandidate.str \
NamespaceTraverse.str \
NestedNameSpecifier.str \
Parameter.str \
PostfixExpressionAmbiguity.str \
PostfixExpressionAmbiguityCandidate.str \
PrimaryExpression.str \
PrimaryExpressionCandidate.str \
Resolve.str \
ResolveCompound.str \
SimpleTypeSpecifier.str \
SimpleTypeSpecifierCandidate.str \
StatementAmbiguity.str \
TemplateArguments.str \
TemplateClassDefinition.str \
TemplateClassDefinitionCandidate.str \
TemplateClassTraverse.str \
TemplateDefinition.str \
TemplateDefinitionCandidate.str \
TemplateIdAmbiguity.str \
TemplateIdAmbiguityCandidate.str \
TemplateIdAmbiguityCut.str \
TemplateFunctionDefinition.str \
TemplateFunctionDefinitionCandidate.str \
TemplateFunctionTraverse.str \
TemplateTraverse.str \
TemplateTraverseCandidate.str \
TypeAmbiguity.str \
TypeAmbiguityCandidate.str \
TypeAmbiguityCut.str \
......
/*
* 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
......@@ -32,10 +32,49 @@ imports
rules
ParameterClass : |TemplateParameter[ class Identifier-opt ]| -> class-kind
ParameterClassDef : |TemplateParameter[ class Identifier-opt = TypeId ]| -> class-kind
ParameterTypename : |TemplateParameter[ class Identifier-opt ]| -> type-kind
ParameterTypenameDef : |TemplateParameter[ class Identifier-opt = TypeId ]| -> type-kind
ParameterClass : |TemplateParameter[ class Identifier-opt ]| -> (idt, type-kind)
where <?|Identifier?[ ID ]|> Identifier-opt
; !ID
; identifier => idt
<+ "" => idt
ParameterClassDef : |TemplateParameter[ class Identifier-opt = TypeId ]| -> (idt, type-kind)
where <?|Identifier?[ ID ]|> Identifier-opt
; !ID
; identifier => idt
<+ "" => idt
ParameterTypename : |TemplateParameter[ typename Identifier-opt ]| -> (idt, type-kind)
where <?|Identifier?[ ID ]|> Identifier-opt
; !ID
; identifier => idt
<+ "" => idt
ParameterTypenameDef : |TemplateParameter[ typename Identifier-opt = TypeId ]| -> (idt, type-kind)
where <?|Identifier?[ ID ]|> Identifier-opt
; !ID
; identifier => idt
<+ "" => idt
ParameterValue : |TemplateParameter[ ParameterDeclaration ]| -> (idt, variable-kind)
where <oncetd(?|Declarator[ ID ]|)> ParameterDeclaration
; !ID
; identifier => idt
<+ "" => idt
ParameterTemplate : |TemplateParameter[ template< TemplateParameterList > class Identifier-opt ]| -> (idt, class-template-kind(l))
where <parameters-normalize-rec> TemplateParameterList => l
; <?|Identifier?[ ID ]|> Identifier-opt
; !ID
; identifier => idt
<+ "" => idt
ParameterTemplateDef : |TemplateParameter[ template< TemplateParameterList > class Identifier-opt = IdExpression ]| -> (idt, class-template-kind(l))
where <parameters-normalize-rec> TemplateParameterList => l
; <?|Identifier?[ ID ]|> Identifier-opt
; !ID
; identifier => idt
<+ "" => idt
ParameterNormalize : a -> b
where < parameter-normalize > a => b
......@@ -45,12 +84,41 @@ rules
strategies
template-parameter-candidate = ?|TemplateParameter[ class Identifier-opt ]|
template-parameter-candidate = ?|TemplateParameter[ class Identifier-opt = TypeId ]|
template-parameter-candidate = ?|TemplateParameter[ typename Identifier-opt ]|
template-parameter-candidate = ?|TemplateParameter[ typename Identifier-opt = TypeId ]|
template-parameter-candidate = ?|TemplateParameter[ ParameterDeclaration ]|
template-parameter-candidate = ?|TemplateParameter[ template< TemplateParameterList > class Identifier-opt ]|
template-parameter-candidate = ?|TemplateParameter[ template< TemplateParameterList > class Identifier-opt = IdExpression ]|
parameter-normalize = ParameterClass +
ParameterClassDef +
ParameterTypename +
ParameterTypenameDef
ParameterTypenameDef +
ParameterValue +
ParameterTemplate +
ParameterTemplateDef
parameters-normalize = parameters-decl;
map({x: ?(_,x); !x})
parameters-normalize-rec = where (new;
!("$", <id>);
conc-strings;
?save;
<table-get> ("$parameters-normalize", "$a");
<table-put> ("$parameters-normalize", save, <id>)
)
; parameters-normalize
; where (
<table-get> ("$parameters-normalize", save)
; <table-put> ("$parameters-normalize", "$a", <id>)
; <table-remove> ("$parameters-normalize", save)
)
parameters-normalize = where (< table-create > "$parameters-normalize";
< table-put > ("$parameters-normalize", "$a", []));
topdown (try (ParameterNormalize));
< table-get > ("$parameters-normalize", "$a")
parameters-decl = where (< table-put > ("$parameters-normalize", "$a", []));
collect (template-parameter-candidate);
map(ParameterNormalize);
< table-get > ("$parameters-normalize", "$a")
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