URL:
https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog:
2008-09-24 Maxime van Noppen <yabo(a)lrde.epita.fr>
Handle the 'final' keyword
* scoolt/Class.str: New.
* scoolt/Declaration.str: Don't add the Exact type parameter when the
* class is final.
Class.str | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
Declaration.str | 4 ++--
2 files changed, 52 insertions(+), 2 deletions(-)
Index: branches/scool-ng/src/scoolt/Class.str
===================================================================
--- branches/scool-ng/src/scoolt/Class.str (revision 0)
+++ branches/scool-ng/src/scoolt/Class.str (revision 103)
@@ -0,0 +1,50 @@
+module Class
+
+imports libstratego-lib Cxx Scool Declaration
+
+rules
+
+ // Translate class body
+
+ ClassBodyToCxx:
+ body -> cxx_body
+ where
+ <map (ClassStatementToCxx)> body => cxx_body
+
+
+ // Translate class statements
+
+ ClassStatementToCxx:
+ AccessBlock(Public, body) -> CxxPublic(cxx_body)
+ where
+ <ClassStatementToCxx> body => cxx_body
+
+ ClassStatementToCxx:
+ AccessBlock(Protected, body) -> CxxProtected(cxx_body)
+ where
+ <ClassStatementToCxx> body => cxx_body
+
+ ClassStatementToCxx:
+ AccessBlock(Private, body) -> CxxPrivate(cxx_body)
+ where
+ <ClassStatementToCxx> body => cxx_body
+
+ ClassStatementToCxx:
+ decl -> cxx_decl
+ where
+ <map (DeclarationToCxx)> decl => cxx_decl
+
+
+ // Add the exact type parameter if the class is not final
+ AddExactType(|cqualif):
+ cxx_params -> new_cxx_params
+ where
+ <conc> (<ExactType> cqualif, cxx_params) => new_cxx_params
+
+ ExactType:
+ Some("final") -> []
+
+ ExactType:
+ cqualif -> [(CxxType("typename"), "Exact")]
+ where
+ <?Some("abstract") <+ ?None()> cqualif
Index: branches/scool-ng/src/scoolt/Declaration.str
===================================================================
--- branches/scool-ng/src/scoolt/Declaration.str (revision 102)
+++ branches/scool-ng/src/scoolt/Declaration.str (revision 103)
@@ -64,9 +64,9 @@
////////////////////////////////////////////////////////////////////////////////
DeclarationToCxx:
- ClassDefinition(None, idf, wclause, ClassBlock(body)) -> CxxClassDecl(cxx_params,
cxx_idf, [], cxx_body)
+ ClassDefinition(cqualif, idf, wclause, ClassBlock(body)) ->
CxxClassDecl(cxx_params, cxx_idf, [], cxx_body)
where
- ![(CxxType("typename"), "T")] => cxx_params
+ <AddExactType(|cqualif)> [] => cxx_params
; <IdentifierToCxx> idf => cxx_idf
; <?None> wclause
; <ClassBodyToCxx> body => cxx_body
--
\__/ \__/
(00) Maxime `yabo` van Noppen (00)
___) \ Epita 2009 / (___
(_____/ \_____)