
URL: https://svn.lrde.epita.fr/svn/scool/branches/scool-ng ChangeLog: 2009-02-12 Corentin Gallet <gallet@lrde.epita.fr> Constructor Declaration. * src/scl-syn/Declaration.sdf: A new declaration : the constructor. * src/scl-syn/Lexical.sdf: A new keyword : 'made' (name of the constructors). * tests/examples/scool_src/point1d.scl: Fix an error in one example. --- src/scl-syn/Declaration.sdf | 4 +++- src/scl-syn/Lexical.sdf | 1 + tests/examples/scool_src/point1d.scl | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) Index: branches/scool-ng/tests/examples/scool_src/point1d.scl =================================================================== --- branches/scool-ng/tests/examples/scool_src/point1d.scl (revision 140) +++ branches/scool-ng/tests/examples/scool_src/point1d.scl (revision 141) @@ -6,7 +6,7 @@ point_type: type = int; make : () = { x_ = 0; } - make(x : point_type) = { x_ = x; } + make : (x : point_type) = { x_ = x; } get_x : () -> point_type = { -> x; } mutable set_x : (x : point_type) -> point_type = { x_ = x; } Index: branches/scool-ng/src/scl-syn/Declaration.sdf =================================================================== --- branches/scool-ng/src/scl-syn/Declaration.sdf (revision 140) +++ branches/scool-ng/src/scl-syn/Declaration.sdf (revision 141) @@ -27,9 +27,11 @@ SimpleQualifier? Identifier ":" "type" StaticExpressionInitialiser ";" -> SimpleDeclaration {cons("TypeDefinition")} FunctionQualifier? Identifier ":" FunctionType ";" -> Declaration {cons("FunctionDeclaration")} - FunctionQualifier? Identifier ":" FunctionType "=" FunctionBlock -> Declaration {cons("FunctionDefinition")} + %% Constructor Declaration + "make" ":" ParametersDeclaration? ArgumentsDeclaration "=" FunctionBlock -> Declaration {cons("ConstructorDeclaration")} + Identifier ":" ParametersDeclaration "->" "type" "=" StaticBlock -> StaticFunction {cons("StaticTypeFunction")} Identifier ":" ParametersDeclaration "->" ClassQualifier? "class" "=" StaticClassBlock -> StaticFunction {cons("StaticClassFunction")} Index: branches/scool-ng/src/scl-syn/Lexical.sdf =================================================================== --- branches/scool-ng/src/scl-syn/Lexical.sdf (revision 140) +++ branches/scool-ng/src/scl-syn/Lexical.sdf (revision 141) @@ -47,6 +47,7 @@ "protected" -> Keyword "private" -> Keyword "where" -> Keyword + "make" -> Keyword context-free syntax