URL:
https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog:
2008-09-19 Maxime van Noppen <yabo(a)lrde.epita.fr>
Pass function templates tests
* pp-cxx/CxxExp.str: Handle the CxxId constructor.
* scoolt/Declaration.str: Document and handle properly the one-line
* function sugar.
* scoolt/Function.str: Translate an expression in a return statement
* when being used with a one-line sugared function.
pp-cxx/CxxExp.str | 3 +++
scoolt/Declaration.str | 4 +++-
scoolt/Function.str | 5 +++++
3 files changed, 11 insertions(+), 1 deletion(-)
Index: branches/scool-ng/src/pp-cxx/CxxExp.str
===================================================================
--- branches/scool-ng/src/pp-cxx/CxxExp.str (revision 90)
+++ branches/scool-ng/src/pp-cxx/CxxExp.str (revision 91)
@@ -38,6 +38,9 @@
x -> x
where <is-string> x
+ CxxExpToStr:
+ CxxId(idf) -> idf
+
CxxExpToAbox:
x -> S(<CxxExpToStr> x)
Index: branches/scool-ng/src/scoolt/Declaration.str
===================================================================
--- branches/scool-ng/src/scoolt/Declaration.str (revision 90)
+++ branches/scool-ng/src/scoolt/Declaration.str (revision 91)
@@ -56,4 +56,6 @@
; <TypeToCxx> <GetReturnType> fun_type => cxx_ret_type
; <ParametersToCxx> <GetParameters> fun_type => cxx_params
; <ArgumentsToCxx> <GetArguments> fun_type => cxx_args
- ; <map (DeclarationToCxx <+ FunctionStatementToCxx) <+ ExpressionToCxx>
body => cxx_body
+ // body can either be a list of declarations and/or function statements,
+ // or be a single expression (because of the one-line function sugar)
+ ; <map (DeclarationToCxx <+ FunctionStatementToCxx) <+
FunctionStatementToCxx> body => cxx_body
Index: branches/scool-ng/src/scoolt/Function.str
===================================================================
--- branches/scool-ng/src/scoolt/Function.str (revision 90)
+++ branches/scool-ng/src/scoolt/Function.str (revision 91)
@@ -73,3 +73,8 @@
ExpressionStatement(exp) -> CxxExpStm(cxx_exp)
where
<ExpressionToCxx> exp => cxx_exp
+
+ FunctionStatementToCxx:
+ exp -> [CxxExpStm(CxxKeyword("return", cxx_exp))]
+ where
+ <ExpressionToCxx> exp => cxx_exp
--
\__/ \__/
(00) Maxime `yabo` van Noppen (00)
___) \ Epita 2009 / (___
(_____/ \_____)