From 030333d38aa4869ecebb289f7b6704d434f25807 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Thu, 2 Mar 2023 10:10:00 +0100 Subject: [PATCH 01/56] Update version to 0.18.0-SNAPSHOT --- build.sbt | 2 +- docs/RELEASE-NOTES.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ce99e0e1..719da418 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,7 @@ lazy val scala3_2 = "3.2.2" lazy val commonSettings = Seq( organization := "se.umu.cs.rai.soda", - version := "0.17.0", + version := "0.18.0-SNAPSHOT", description := "Functional language to describe ethical problems", homepage := Some(url("https://bitbucket.org/mendezjulian/soda")), startYear := Some(2020), diff --git a/docs/RELEASE-NOTES.md b/docs/RELEASE-NOTES.md index dfacbba6..5e990e6b 100644 --- a/docs/RELEASE-NOTES.md +++ b/docs/RELEASE-NOTES.md @@ -1,4 +1,8 @@ --- +- - version: v0.18.0 + - date: unreleased + - build: sbt '++ 3.2.2' clean compile test package assembly + - release: target/scala-3.2.2/soda-0.18.0.jar - - version: v0.17.0 - date: '2023-03-01' - build: sbt '++ 3.2.2' clean compile test package assembly From 5338117777c81d6ac4f57cb17f4d5bb2b27647e9 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Thu, 2 Mar 2023 10:10:14 +0100 Subject: [PATCH 02/56] Update examples --- .../src/main/scala/soda/example/mathematics/FiboExample.soda | 2 +- .../scala/soda/example/mathematics/FiboUnicodeExample.soda | 2 +- .../src/main/scala/soda/example/mathematics/Package.scala | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/src/main/scala/soda/example/mathematics/FiboExample.soda b/examples/src/main/scala/soda/example/mathematics/FiboExample.soda index b4ed46dd..56fc5f5f 100644 --- a/examples/src/main/scala/soda/example/mathematics/FiboExample.soda +++ b/examples/src/main/scala/soda/example/mathematics/FiboExample.soda @@ -1,7 +1,7 @@ class FiboExampleInSoda - apply (n : Int) = + apply (n : Int) : Int = _rec (n) (0) (1) _rec (m : Int) (a : Int) (b : Int) : Int = diff --git a/examples/src/main/scala/soda/example/mathematics/FiboUnicodeExample.soda b/examples/src/main/scala/soda/example/mathematics/FiboUnicodeExample.soda index 5085cb98..9e33a1d6 100644 --- a/examples/src/main/scala/soda/example/mathematics/FiboUnicodeExample.soda +++ b/examples/src/main/scala/soda/example/mathematics/FiboUnicodeExample.soda @@ -1,7 +1,7 @@ ⎾ FiboUnicodeExample - apply (n : Int) = + apply (n : Int) : Int = _rec (n) (0) (1) _rec (m : Int) (a : Int) (b : Int) : Int = diff --git a/examples/src/main/scala/soda/example/mathematics/Package.scala b/examples/src/main/scala/soda/example/mathematics/Package.scala index 49eaa783..987d1a9c 100644 --- a/examples/src/main/scala/soda/example/mathematics/Package.scala +++ b/examples/src/main/scala/soda/example/mathematics/Package.scala @@ -62,7 +62,7 @@ case class FactorialWithFold_ () extends FactorialWithFold trait FiboExampleInSoda { - def apply (n : Int) = + def apply (n : Int) : Int = _rec (n) (0) (1) private def _rec (m : Int) (a : Int) (b : Int) : Int = @@ -78,7 +78,7 @@ case class FiboExampleInSoda_ () extends FiboExampleInSoda trait FiboUnicodeExample { - def apply (n : Int) = + def apply (n : Int) : Int = _rec (n) (0) (1) private def _rec (m : Int) (a : Int) (b : Int) : Int = From bb7cf8eb90599fc518a07124ee9f543c82d072cc Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Thu, 2 Mar 2023 10:25:09 +0100 Subject: [PATCH 03/56] Change default configuration of Scala translator --- docs/RELEASE-NOTES.md | 2 ++ .../soda/translator/documentation/help.txt | 22 ++++++++-------- .../extension/toscala/Package.scala | 26 +++++++++++-------- .../extension/toscala/TranslatorToScala.soda | 26 +++++++++++-------- 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/docs/RELEASE-NOTES.md b/docs/RELEASE-NOTES.md index 5e990e6b..e74902ff 100644 --- a/docs/RELEASE-NOTES.md +++ b/docs/RELEASE-NOTES.md @@ -3,6 +3,8 @@ - date: unreleased - build: sbt '++ 3.2.2' clean compile test package assembly - release: target/scala-3.2.2/soda-0.18.0.jar + - new_features: + - assumes translation to `Package.scala` files as default configuration for the Scala translator - - version: v0.17.0 - date: '2023-03-01' - build: sbt '++ 3.2.2' clean compile test package assembly diff --git a/translator/src/main/resources/soda/translator/documentation/help.txt b/translator/src/main/resources/soda/translator/documentation/help.txt index e9c0f2a8..dd7233a3 100644 --- a/translator/src/main/resources/soda/translator/documentation/help.txt +++ b/translator/src/main/resources/soda/translator/documentation/help.txt @@ -12,19 +12,19 @@ Usage: where EXTENSION can be: - scala calls the Soda-to-Scala translator + scala call the Soda-to-Scala translator - coq calls the Soda-to-Coq translator (only for snippets) + coq call the Soda-to-Coq translator (only for snippets) - doc creates LaTeX documents based on Soda files + doc create LaTeX documents based on Soda files - manual outputs the manual, which is written in Soda + manual output the manual, which is written in Soda - license outputs the license + license output the license - help shows this help + help show this help - . calls the Soda-to-Scala translator + . call the Soda-to-Scala translator --- Soda-to-Scala translator @@ -39,8 +39,8 @@ where SODA_SCALA_INPUT is used to create the Soda input file and Scala output file. If it is a directory, it scans recursively the directory to translate Soda files. If the extension is .soda, the output file has extension .scala . -Otherwise, the extension .soda and .scala are appended to the input and output files respectively. - +In the default configuration, the translator visits each Soda package, and for each package, +translates all Soda source files into a single Package.scala file. SODA_INPUT is the Soda input file, regardless of the extension @@ -49,8 +49,8 @@ Otherwise, the extension .soda and .scala are appended to the input and output f OPTION: - -p, --package - visit each Soda package and for each package, translate all Soda source files into a single Package.scala file. + -s, --single + translate every single Soda input file to its corresponding Scala output file --- diff --git a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala index d532a543..0ce50583 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala @@ -1131,9 +1131,9 @@ trait TranslatorToScala lazy val prelude_file_body : String = new_line + "trait Package" + append_separation - lazy val package_option_1 = "-p" + lazy val single_files_option_1 = "-s" - lazy val package_option_2 = "--package" + lazy val single_files_option_2 = "--single" private lazy val _translator = BlockProcessor_ ( @@ -1148,12 +1148,16 @@ trait TranslatorToScala def execute_for (arguments : Seq [String] ) : Boolean = arguments.length match { - case 0 => _process_directory (_default_argument) - case 1 => _process_directory (arguments (0) ) + case 0 => _process_directory_with_package_option (_default_argument) + case 1 => _process_directory_with_package_option (arguments.apply (0) ) case 2 => - if ( _is_package_option (arguments (0) ) - ) _process_directory_with_package_option (arguments (1) ) - else _translate (arguments (0) ) (arguments (1) ) + if ( _is_single_files_option (arguments.apply (0) ) + ) _process_directory (arguments.apply (1) ) + else false + case 3 => + if ( _is_single_files_option (arguments.apply (0) ) + ) _translate (arguments.apply (1) ) (arguments.apply (2) ) + else false case x => false } @@ -1172,11 +1176,11 @@ trait TranslatorToScala private def _process_soda_file_with_package_option (file : File) : Boolean = if ( file.getName == package_file_name ) _process_soda_file (file) - else _process_soda_file_with_package_option_with ( + else _process_soda_file_with_single_files_option_with ( get_input_output_file_names_with_package_option (file.getAbsolutePath) (file.getParent) ) - private def _process_soda_file_with_package_option_with (pair : FileNamePair) : Boolean = + private def _process_soda_file_with_single_files_option_with (pair : FileNamePair) : Boolean = _translate_append (pair.input_file_name) (pair.output_file_name) def get_input_output_file_names (input_name : String) : FileNamePair = @@ -1223,8 +1227,8 @@ trait TranslatorToScala private def _is_a_prelude_file (input_file_name : String) : Boolean = package_file_name == ( ( new File (input_file_name) ) .getName) - private def _is_package_option (s : String) : Boolean = - (s == package_option_1) || (s == package_option_2) + private def _is_single_files_option (s : String) : Boolean = + (s == single_files_option_1) || (s == single_files_option_2) } diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda index 1de115f5..d22b0b68 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda @@ -37,9 +37,9 @@ class TranslatorToScala prelude_file_body : String = new_line + "trait Package" + append_separation - package_option_1 = "-p" + single_files_option_1 = "-s" - package_option_2 = "--package" + single_files_option_2 = "--single" _translator = BlockProcessor_ ( @@ -54,12 +54,16 @@ class TranslatorToScala execute_for (arguments : Seq [String] ) : Boolean = match arguments.length - case 0 ==> _process_directory (_default_argument) - case 1 ==> _process_directory (arguments (0) ) + case 0 ==> _process_directory_with_package_option (_default_argument) + case 1 ==> _process_directory_with_package_option (arguments.apply (0) ) case 2 ==> - if _is_package_option (arguments (0) ) - then _process_directory_with_package_option (arguments (1) ) - else _translate (arguments (0) ) (arguments (1) ) + if _is_single_files_option (arguments.apply (0) ) + then _process_directory (arguments.apply (1) ) + else false + case 3 ==> + if _is_single_files_option (arguments.apply (0) ) + then _translate (arguments.apply (1) ) (arguments.apply (2) ) + else false case x ==> false _process_directory (start : String) : Boolean = @@ -77,11 +81,11 @@ class TranslatorToScala _process_soda_file_with_package_option (file : File) : Boolean = if file.getName == package_file_name then _process_soda_file (file) - else _process_soda_file_with_package_option_with ( + else _process_soda_file_with_single_files_option_with ( get_input_output_file_names_with_package_option (file.getAbsolutePath) (file.getParent) ) - _process_soda_file_with_package_option_with (pair : FileNamePair) : Boolean = + _process_soda_file_with_single_files_option_with (pair : FileNamePair) : Boolean = _translate_append (pair.input_file_name) (pair.output_file_name) get_input_output_file_names (input_name : String) : FileNamePair = @@ -128,8 +132,8 @@ class TranslatorToScala _is_a_prelude_file (input_file_name : String) : Boolean = package_file_name == ( ( @new File (input_file_name) ) .getName) - _is_package_option (s : String) : Boolean = - (s == package_option_1) or (s == package_option_2) + _is_single_files_option (s : String) : Boolean = + (s == single_files_option_1) or (s == single_files_option_2) end From ad655e066b5b726cd9606a315c88a3e246069d4e Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sat, 4 Mar 2023 09:57:49 +0100 Subject: [PATCH 04/56] Update unit tests --- .../toscala/MicroTranslatorToScalaSpec.soda | 17 +++++++++++++++-- .../translator/extension/toscala/Package.scala | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda index 28a4f8b5..2e8862d0 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda @@ -277,7 +277,7 @@ class MicroTranslatorToScalaSpec () ) ) - test ("should translate an explicit lambda expression") ( + test ("should translate an explicit lambda expression using lambda") ( check ( obtained := instance.translate ("plus_1 : Int = lambda (x : Int) --> x + 1" + "\n" @@ -288,7 +288,7 @@ class MicroTranslatorToScalaSpec () ) ) - test ("should translate another explicit lambda expression") ( + test ("should translate another explicit lambda expression using any") ( check ( obtained := instance.translate ("plus_1 : Int = any (x : Int) --> x + 1" + "\n" @@ -299,5 +299,18 @@ class MicroTranslatorToScalaSpec () ) ) + test ("should translate another explicit lambda expression containing parentheses") ( + check ( + obtained := instance.translate ("plus_1 (s : Seq [Int] ) : Seq [Int] =" + + "\n s .map ( lambda x --> x + 1)" + + "\n" + ) + ) ( + expected := "def plus_1 (s : Seq [Int] ) : Seq [Int] =" + + "\n s .map ( x => x + 1)" + + "\n" + ) + ) + end diff --git a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala index f78bab5d..3c68fc18 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala @@ -650,7 +650,7 @@ case class MicroTranslatorToScalaSpec () ) ) - test ("should translate an explicit lambda expression") ( + test ("should translate an explicit lambda expression using lambda") ( check ( obtained = instance.translate ("plus_1 : Int = lambda (x : Int) --> x + 1" + "\n" @@ -661,7 +661,7 @@ case class MicroTranslatorToScalaSpec () ) ) - test ("should translate another explicit lambda expression") ( + test ("should translate another explicit lambda expression using any") ( check ( obtained = instance.translate ("plus_1 : Int = any (x : Int) --> x + 1" + "\n" @@ -672,6 +672,19 @@ case class MicroTranslatorToScalaSpec () ) ) + test ("should translate another explicit lambda expression containing parentheses") ( + check ( + obtained = instance.translate ("plus_1 (s : Seq [Int] ) : Seq [Int] =" + + "\n s .map ( lambda x --> x + 1)" + + "\n" + ) + ) ( + expected = "def plus_1 (s : Seq [Int] ) : Seq [Int] =" + + "\n s .map ( x => x + 1)" + + "\n" + ) + ) + } From 630ffd702dec28a537e5ce9b9368092d214e15fa Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sun, 5 Mar 2023 09:30:06 +0100 Subject: [PATCH 05/56] Fix parsing of reserved words after opening parenthesis --- docs/RELEASE-NOTES.md | 4 +++- .../main/scala/soda/translator/blocktr/Package.scala | 7 +++++-- .../soda/translator/blocktr/TableTranslator.soda | 7 +++++-- .../scala/soda/translator/replacement/Package.scala | 11 ++++++++++- .../soda/translator/replacement/Replacement.soda | 11 ++++++++++- .../extension/toscala/MicroTranslatorToScalaSpec.soda | 4 ++-- .../soda/translator/extension/toscala/Package.scala | 4 ++-- 7 files changed, 37 insertions(+), 11 deletions(-) diff --git a/docs/RELEASE-NOTES.md b/docs/RELEASE-NOTES.md index e74902ff..5b85e516 100644 --- a/docs/RELEASE-NOTES.md +++ b/docs/RELEASE-NOTES.md @@ -4,7 +4,9 @@ - build: sbt '++ 3.2.2' clean compile test package assembly - release: target/scala-3.2.2/soda-0.18.0.jar - new_features: - - assumes translation to `Package.scala` files as default configuration for the Scala translator + - assumes translation to `Package.scala` files as default configuration for the Scala translator + - bug_fixes: + - fixes translation of reserved words after opening parenthesis - - version: v0.17.0 - date: '2023-03-01' - build: sbt '++ 3.2.2' clean compile test package assembly diff --git a/translator/src/main/scala/soda/translator/blocktr/Package.scala b/translator/src/main/scala/soda/translator/blocktr/Package.scala index ab682842..32ed0dcc 100644 --- a/translator/src/main/scala/soda/translator/blocktr/Package.scala +++ b/translator/src/main/scala/soda/translator/blocktr/Package.scala @@ -27,11 +27,14 @@ trait TableTranslator def table : Seq [Tuple2 [String, String] ] - lazy val keys = table.map ( pair => pair._1) + lazy val keys : Seq [String] = table.map ( pair => pair._1) lazy val translate : String => String = word => - table.toMap.get (word).getOrElse (word) + table + .toMap + .get (word) + .getOrElse (word) } diff --git a/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda b/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda index c594434d..228bb8f7 100644 --- a/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda +++ b/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda @@ -14,11 +14,14 @@ class TableTranslator abstract table : Seq [Tuple2 [String, String] ] - keys = table.map ( lambda pair --> pair._1) + keys : Seq [String] = table.map ( lambda pair --> pair._1) translate : String -> String = lambda word --> - table.toMap.get (word).getOrElse (word) + table + .toMap + .get (word) + .getOrElse (word) end diff --git a/translator/src/main/scala/soda/translator/replacement/Package.scala b/translator/src/main/scala/soda/translator/replacement/Package.scala index 06b752b9..4344cdb1 100644 --- a/translator/src/main/scala/soda/translator/replacement/Package.scala +++ b/translator/src/main/scala/soda/translator/replacement/Package.scala @@ -317,6 +317,10 @@ trait ReplacementWithTranslator lazy val scala_space = aux.scala_space + lazy val soda_opening_parenthesis_symbol = "(" + + lazy val scala_opening_parenthesis_symbol = "(" + private lazy val _fold = Fold_ () def replace_at_beginning (line : String) (index : Int) : String = @@ -335,8 +339,13 @@ trait ReplacementWithTranslator _fold.apply (translator.keys) (initial_value = line) (next_value_function = _next_replace) private def _next_replace (line : String) (reserved_word : String) : String = + _replace_if_found (soda_opening_parenthesis_symbol) (reserved_word) ( + _replace_if_found (soda_space) (reserved_word) (line) + ) + + private def _replace_if_found (previous_character : String) (reserved_word : String) (line : String) : String = aux.replace_if_found (line) ( - soda_space + reserved_word + soda_space) (scala_space + translator.translate (reserved_word) + scala_space) + previous_character + reserved_word + soda_space) (previous_character + translator.translate (reserved_word) + scala_space) } diff --git a/translator/src/main/scala/soda/translator/replacement/Replacement.soda b/translator/src/main/scala/soda/translator/replacement/Replacement.soda index b77ba2c4..9c6c7bfc 100644 --- a/translator/src/main/scala/soda/translator/replacement/Replacement.soda +++ b/translator/src/main/scala/soda/translator/replacement/Replacement.soda @@ -123,6 +123,10 @@ class ReplacementWithTranslator scala_space = aux.scala_space + soda_opening_parenthesis_symbol = "(" + + scala_opening_parenthesis_symbol = "(" + _fold = Fold_ () replace_at_beginning (line : String) (index : Int) : String = @@ -141,8 +145,13 @@ class ReplacementWithTranslator _fold.apply (translator.keys) (initial_value := line) (next_value_function := _next_replace) _next_replace (line : String) (reserved_word : String) : String = + _replace_if_found (soda_opening_parenthesis_symbol) (reserved_word) ( + _replace_if_found (soda_space) (reserved_word) (line) + ) + + _replace_if_found (previous_character : String) (reserved_word : String) (line : String) : String = aux.replace_if_found (line) ( - soda_space + reserved_word + soda_space) (scala_space + translator.translate (reserved_word) + scala_space) + previous_character + reserved_word + soda_space) (previous_character + translator.translate (reserved_word) + scala_space) end diff --git a/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda index 2e8862d0..928b6356 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda @@ -302,12 +302,12 @@ class MicroTranslatorToScalaSpec () test ("should translate another explicit lambda expression containing parentheses") ( check ( obtained := instance.translate ("plus_1 (s : Seq [Int] ) : Seq [Int] =" + - "\n s .map ( lambda x --> x + 1)" + + "\n s .map (lambda x --> x + 1)" + "\n" ) ) ( expected := "def plus_1 (s : Seq [Int] ) : Seq [Int] =" + - "\n s .map ( x => x + 1)" + + "\n s .map ( x => x + 1)" + "\n" ) ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala index 3c68fc18..00488a19 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala @@ -675,12 +675,12 @@ case class MicroTranslatorToScalaSpec () test ("should translate another explicit lambda expression containing parentheses") ( check ( obtained = instance.translate ("plus_1 (s : Seq [Int] ) : Seq [Int] =" + - "\n s .map ( lambda x --> x + 1)" + + "\n s .map (lambda x --> x + 1)" + "\n" ) ) ( expected = "def plus_1 (s : Seq [Int] ) : Seq [Int] =" + - "\n s .map ( x => x + 1)" + + "\n s .map ( x => x + 1)" + "\n" ) ) From dc13b559333740d618d4ca44dd2c6f74dde57ffa Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sun, 5 Mar 2023 10:20:05 +0100 Subject: [PATCH 06/56] Remove space between opening parenthesis and Soda reserved words --- .../soda/example/algorithms/FizzBuzz.soda | 2 +- .../algorithms/FizzBuzzPatternMatching.soda | 2 +- .../soda/example/algorithms/Package.scala | 22 +++---- .../soda/example/algorithms/SaladMaker.soda | 2 +- .../soda/example/algorithms/SortExample.soda | 16 ++--- .../ethicalissues/pricemonitor/Package.scala | 2 +- .../pricemonitor/Requirement3Monitor.soda | 2 +- .../example/forcoq/algorithms/Package.scala | 2 +- .../forcoq/algorithms/RecursionForCoq.soda | 2 +- .../mathematics/FactorialWithFold.soda | 2 +- .../soda/example/mathematics/Package.scala | 2 +- .../soda/example/miniexample/MiniExample.soda | 2 +- .../soda/example/miniexample/Package.scala | 2 +- .../soda/example/algorithms/Package.scala | 4 +- .../example/algorithms/SortExampleSpec.soda | 4 +- .../mathematics/FactorialForCoqSpec.soda | 6 +- .../FiboExampleInSodaForCoqSpec.soda | 6 +- .../example/forcoq/mathematics/Package.scala | 18 +++--- .../TriangularNumberForCoqSpec.soda | 6 +- .../example/mathematics/FactorialSpec.soda | 12 ++-- .../example/mathematics/FiboExampleSpec.soda | 4 +- .../soda/example/mathematics/Package.scala | 16 ++--- .../src/main/scala/soda/collection/Min.soda | 4 +- .../main/scala/soda/collection/Package.scala | 4 +- .../soda/collection/example/ListExample.soda | 16 ++--- .../scala/soda/collection/example/Main.soda | 2 +- .../soda/collection/example/Package.scala | 18 +++--- .../test/scala/soda/collection/MinSpec.soda | 58 +++++++++---------- .../test/scala/soda/collection/Package.scala | 58 +++++++++---------- .../collection/example/ListExampleSpec.soda | 16 ++--- .../soda/collection/example/Package.scala | 16 ++--- .../lib/soda/lib/CartesianProduct.soda | 6 +- .../main/resources/lib/soda/lib/Package.scala | 8 +-- .../resources/lib/soda/lib/Recursion.soda | 2 +- .../soda/translator/documentation/Manual.soda | 6 +- .../main/scala/soda/lib/CartesianProduct.soda | 6 +- .../src/main/scala/soda/lib/Package.scala | 8 +-- .../src/main/scala/soda/lib/Recursion.soda | 2 +- .../scala/soda/translator/block/Block.soda | 4 +- .../block/BlockSequenceTranslator.soda | 2 +- .../scala/soda/translator/block/Package.scala | 6 +- .../soda/translator/blocktr/Package.scala | 18 +++--- .../translator/blocktr/TableTranslator.soda | 2 +- .../blocktr/TokenizedBlockTranslator.soda | 16 ++--- .../soda/translator/extension/help/Help.soda | 4 +- .../translator/extension/help/Package.scala | 4 +- .../CoqClassConstructorBlockTranslator.soda | 8 +-- .../CoqClassDeclarationBlockTranslator.soda | 4 +- .../tocoq/CoqClassEndBlockTranslator.soda | 2 +- .../tocoq/CoqDefinitionBlockTranslator.soda | 4 +- .../CoqImportDeclarationBlockTranslator.soda | 8 +-- .../tocoq/DefinitionLineTranslator.soda | 6 +- .../tocoq/MatchCaseBlockTranslator.soda | 10 ++-- .../translator/extension/tocoq/Package.scala | 46 +++++++-------- .../tocoq/TranslationConstantToCoq.soda | 4 +- .../extension/todoc/DocBlockTranslator.soda | 2 +- .../translator/extension/todoc/Package.scala | 2 +- .../AbstractDeclarationBlockTranslator.soda | 2 +- .../ClassConstructorBlockTranslator.soda | 10 ++-- .../ClassDeclarationBlockTranslator.soda | 4 +- .../toscala/ClassEndBlockTranslator.soda | 2 +- .../FunctionDefinitionBlockTranslator.soda | 4 +- .../FunctionDefinitionLineDetector.soda | 6 +- .../ImportDeclarationBlockTranslator.soda | 4 +- .../toscala/MainClassBlockTranslator.soda | 4 +- .../toscala/MatchCaseBlockTranslator.soda | 8 +-- .../extension/toscala/Package.scala | 48 +++++++-------- .../toscala/TranslationConstantToScala.soda | 4 +- .../translator/io/DirectoryProcessor.soda | 16 ++--- .../soda/translator/io/LibraryDeployer.soda | 10 ++-- .../scala/soda/translator/io/Package.scala | 34 +++++------ .../scala/soda/translator/io/SimpleIO.soda | 8 +-- .../translator/parser/BlockProcessor.soda | 12 ++-- .../soda/translator/parser/Package.scala | 14 ++--- .../PreprocessorSequenceTranslator.soda | 2 +- .../AbstractDeclarationAnnotation.soda | 2 +- .../parser/annotation/AnnotationFactory.soda | 2 +- .../annotation/BlockAnnotationParser.soda | 2 +- .../annotation/ClassBeginningAnnotation.soda | 6 +- .../parser/annotation/CommentAnnotation.soda | 2 +- .../FunctionDefinitionAnnotation.soda | 6 +- .../parser/annotation/Package.scala | 20 +++---- .../soda/translator/replacement/Package.scala | 4 +- .../translator/replacement/Replacement.soda | 4 +- .../translator/documentation/Manual.scala | 6 +- .../soda/translator/documentation/Manual.soda | 6 +- .../soda/translator/documentation/Manual.tex | 6 +- .../example/algorithms/FizzBuzz.scala | 2 +- .../example/algorithms/FizzBuzz.soda | 2 +- .../algorithms/FizzBuzzPatternMatching.soda | 2 +- .../example/algorithms/SaladMaker.scala | 2 +- .../example/algorithms/SaladMaker.soda | 2 +- .../example/algorithms/SortExample.soda | 16 ++--- .../pricemonitor/Requirement3Monitor.soda | 2 +- .../forcoq/algorithms/RecursionForCoq.soda | 2 +- .../mathematics/FactorialWithFold.scala | 2 +- .../mathematics/FactorialWithFold.soda | 2 +- .../example/miniexample/MiniExample.scala | 2 +- .../example/miniexample/MiniExample.soda | 2 +- .../src/test/scala/soda/lib/EnumSpec.soda | 2 +- .../src/test/scala/soda/lib/OptionSDSpec.soda | 6 +- .../src/test/scala/soda/lib/Package.scala | 8 +-- .../translator/io/DirectoryScannerSpec.soda | 2 +- .../scala/soda/translator/io/Package.scala | 2 +- .../soda/translator/parser/Package.scala | 2 + .../PreprocessorSequenceTranslatorSpec.soda | 2 + .../annotation/BlockAnnotationSpec.soda | 4 +- .../ClassBeginningAnnotationSpec.soda | 2 +- .../parser/annotation/Package.scala | 6 +- .../translator/replacement/CharTypeSpec.soda | 2 +- .../soda/translator/replacement/Package.scala | 2 +- 111 files changed, 429 insertions(+), 425 deletions(-) diff --git a/examples/src/main/scala/soda/example/algorithms/FizzBuzz.soda b/examples/src/main/scala/soda/example/algorithms/FizzBuzz.soda index 8ffcf06e..b1326734 100644 --- a/examples/src/main/scala/soda/example/algorithms/FizzBuzz.soda +++ b/examples/src/main/scala/soda/example/algorithms/FizzBuzz.soda @@ -9,7 +9,7 @@ class FizzBuzz apply : Seq [String] = _range.apply (100) - .map ( lambda (x : Int) --> x + 1) + .map (lambda (x : Int) --> x + 1) .map (_get_fizz_buzz_term) _get_fizz_buzz_term (n : Int) : String = diff --git a/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda b/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda index dee9d93b..361ab4b8 100644 --- a/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda +++ b/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda @@ -9,7 +9,7 @@ class FizzBuzzPatternMatching apply : Seq [String] = _range.apply (100) - .map ( lambda (x : Int) --> x + 1) + .map (lambda (x : Int) --> x + 1) .map (_get_fizz_buzz_term) _get_fizz_buzz_term (n : Int) : String = diff --git a/examples/src/main/scala/soda/example/algorithms/Package.scala b/examples/src/main/scala/soda/example/algorithms/Package.scala index 6f740332..82591407 100644 --- a/examples/src/main/scala/soda/example/algorithms/Package.scala +++ b/examples/src/main/scala/soda/example/algorithms/Package.scala @@ -18,7 +18,7 @@ trait FizzBuzz lazy val apply : Seq [String] = _range.apply (100) - .map ( (x : Int) => x + 1) + .map ( (x : Int) => x + 1) .map (_get_fizz_buzz_term) private def _get_fizz_buzz_term (n : Int) : String = @@ -46,7 +46,7 @@ trait FizzBuzzPatternMatching lazy val apply : Seq [String] = _range.apply (100) - .map ( (x : Int) => x + 1) + .map ( (x : Int) => x + 1) .map (_get_fizz_buzz_term) private def _get_fizz_buzz_term (n : Int) : String = @@ -199,7 +199,7 @@ trait SaladMaker (next_ingredient_function : Salad => Ingredient => Salad) (condition_to_continue : Salad => Ingredient => Boolean) : Salad = - if ( ingredients_so_far.isEmpty || ( ! condition_to_continue (salad_so_far) (ingredients_so_far.head) ) + if ( ingredients_so_far.isEmpty || (! condition_to_continue (salad_so_far) (ingredients_so_far.head) ) ) salad_so_far else _tailrec_prepare_salad (ingredients_so_far.tail) (next_ingredient_function (salad_so_far) (ingredients_so_far.head) ) (next_ingredient_function) (condition_to_continue) @@ -266,8 +266,8 @@ trait SortExampleWithAt def is_sorted_for (sequence : Seq [Int] ) : Boolean = sequence .indices - .filter ( index => index > 0) - .forall ( index => sequence.apply (index - 1) <= sequence.apply (index) ) + .filter ( index => index > 0) + .forall ( index => sequence.apply (index - 1) <= sequence.apply (index) ) } @@ -284,7 +284,7 @@ trait SortExampleWithZip def is_sorted_for (sequence : Seq [Int] ) : Boolean = sequence .zip (sequence.tail) - .forall ( pair => (pair._1 <= pair._2) ) + .forall ( pair => (pair._1 <= pair._2) ) } @@ -323,9 +323,9 @@ trait SortAlgorithmExampleWithFold def insert_sorted (sequence : Seq [Int] ) (element : Int) : Seq [Int] = concatenate ( - first_part = sequence.takeWhile ( x => x < element) ) ( + first_part = sequence.takeWhile ( x => x < element) ) ( middle = Seq (element) ) ( - last_part = sequence.dropWhile ( x => x < element) + last_part = sequence.dropWhile ( x => x < element) ) def concatenate (first_part : Seq [Int] ) (middle : Seq [Int] ) (last_part : Seq [Int] ) : Seq [Int] = @@ -427,13 +427,13 @@ trait NonEmptySortedSequenceAux [A <: Comparable [A] ] def is_sorted (other_sequence : Seq [A] ) : Boolean = other_sequence .zip (other_sequence.tail) - .forall ( pair => is_less_than (pair._1) (pair._2) ) + .forall ( pair => is_less_than (pair._1) (pair._2) ) def insert_sorted (original_sequence : Seq [A] ) (element : A) : Seq [A] = concatenate ( - first_part = original_sequence.takeWhile ( x => is_less_than (x) (element) ) ) ( + first_part = original_sequence.takeWhile ( x => is_less_than (x) (element) ) ) ( middle = Seq (element) ) ( - last_part = original_sequence.dropWhile ( x => is_less_than (x) (element) ) + last_part = original_sequence.dropWhile ( x => is_less_than (x) (element) ) ) def concatenate (first_part : Seq [A] ) (middle : Seq [A] ) (last_part : Seq [A] ) : Seq [A] = diff --git a/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda b/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda index c04b7652..b76f18d1 100644 --- a/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda +++ b/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda @@ -16,7 +16,7 @@ class SaladMaker (next_ingredient_function : Salad -> Ingredient -> Salad) (condition_to_continue : Salad -> Ingredient -> Boolean) : Salad = - if ingredients_so_far.isEmpty or ( not condition_to_continue (salad_so_far) (ingredients_so_far.head) ) + if ingredients_so_far.isEmpty or (not condition_to_continue (salad_so_far) (ingredients_so_far.head) ) then salad_so_far else _tailrec_prepare_salad (ingredients_so_far.tail) (next_ingredient_function (salad_so_far) (ingredients_so_far.head) ) (next_ingredient_function) (condition_to_continue) diff --git a/examples/src/main/scala/soda/example/algorithms/SortExample.soda b/examples/src/main/scala/soda/example/algorithms/SortExample.soda index 05125dfc..27f7f374 100644 --- a/examples/src/main/scala/soda/example/algorithms/SortExample.soda +++ b/examples/src/main/scala/soda/example/algorithms/SortExample.soda @@ -16,8 +16,8 @@ class SortExampleWithAt is_sorted_for (sequence : Seq [Int] ) : Boolean = sequence .indices - .filter ( lambda index --> index > 0) - .forall ( lambda index --> sequence.apply (index - 1) <= sequence.apply (index) ) + .filter (lambda index --> index > 0) + .forall (lambda index --> sequence.apply (index - 1) <= sequence.apply (index) ) end @@ -31,7 +31,7 @@ class SortExampleWithZip is_sorted_for (sequence : Seq [Int] ) : Boolean = sequence .zip (sequence.tail) - .forall ( lambda pair --> (pair._1 <= pair._2) ) + .forall (lambda pair --> (pair._1 <= pair._2) ) end @@ -66,9 +66,9 @@ class SortAlgorithmExampleWithFold insert_sorted (sequence : Seq [Int] ) (element : Int) : Seq [Int] = concatenate ( - first_part := sequence.takeWhile ( lambda x --> x < element) ) ( + first_part := sequence.takeWhile (lambda x --> x < element) ) ( middle := Seq (element) ) ( - last_part := sequence.dropWhile ( lambda x --> x < element) + last_part := sequence.dropWhile (lambda x --> x < element) ) concatenate (first_part : Seq [Int] ) (middle : Seq [Int] ) (last_part : Seq [Int] ) : Seq [Int] = @@ -156,13 +156,13 @@ class NonEmptySortedSequenceAux [A subtype Comparable [A] ] is_sorted (other_sequence : Seq [A] ) : Boolean = other_sequence .zip (other_sequence.tail) - .forall ( lambda pair --> is_less_than (pair._1) (pair._2) ) + .forall (lambda pair --> is_less_than (pair._1) (pair._2) ) insert_sorted (original_sequence : Seq [A] ) (element : A) : Seq [A] = concatenate ( - first_part := original_sequence.takeWhile ( lambda x --> is_less_than (x) (element) ) ) ( + first_part := original_sequence.takeWhile (lambda x --> is_less_than (x) (element) ) ) ( middle := Seq (element) ) ( - last_part := original_sequence.dropWhile ( lambda x --> is_less_than (x) (element) ) + last_part := original_sequence.dropWhile (lambda x --> is_less_than (x) (element) ) ) concatenate (first_part : Seq [A] ) (middle : Seq [A] ) (last_part : Seq [A] ) : Seq [A] = diff --git a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala index 22ede3e6..038425dc 100644 --- a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala +++ b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala @@ -179,7 +179,7 @@ trait Requirement3Monitor sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight).segments) (date_in_days) ) def get_prices_of_segments (customer : Customer) (segments : Seq [Segment] ) (date_in_days : Int) : Seq [Int] = - segments.map ( segment => get_price (customer) (segment) (date_in_days) ) + segments.map ( segment => get_price (customer) (segment) (date_in_days) ) def sum_prices (prices : Seq [Int] ) : Int = prices.sum diff --git a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda index bf157075..b9368b1c 100644 --- a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda +++ b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda @@ -28,7 +28,7 @@ class Requirement3Monitor sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight).segments) (date_in_days) ) get_prices_of_segments (customer : Customer) (segments : Seq [Segment] ) (date_in_days : Int) : Seq [Int] = - segments.map ( lambda segment --> get_price (customer) (segment) (date_in_days) ) + segments.map (lambda segment --> get_price (customer) (segment) (date_in_days) ) sum_prices (prices : Seq [Int] ) : Int = prices.sum diff --git a/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala b/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala index 6667b9e5..e062fb2b 100644 --- a/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala +++ b/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala @@ -18,7 +18,7 @@ trait RecursionForCoq private def _tailrec_fold4 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = sequence match { case (head) :: (tail) => - if ( ( ! (condition (current_value) (head) ) ) + if ( (! (condition (current_value) (head) ) ) ) current_value else _tailrec_fold4 (tail) (next_value_function (current_value) (head)) (next_value_function) (condition) case x => current_value diff --git a/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda b/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda index eb562420..88a14fec 100644 --- a/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda +++ b/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda @@ -9,7 +9,7 @@ class RecursionForCoq _tailrec_fold4 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = match sequence case (head) :: (tail) ==> - if ( not (condition (current_value) (head) ) ) + if (not (condition (current_value) (head) ) ) then current_value else _tailrec_fold4 (tail) (next_value_function (current_value) (head)) (next_value_function) (condition) case x ==> current_value diff --git a/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda b/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda index f9215b62..e47e3d0a 100644 --- a/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda +++ b/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda @@ -6,7 +6,7 @@ class FactorialWithFold _range = soda.lib.Range_ () apply (n : Int) : Int = - _fold.apply (_range.apply (n) ) (1) ( any product --> any k --> (product * (k + 1) ) ) + _fold.apply (_range.apply (n) ) (1) (any product --> any k --> (product * (k + 1) ) ) end diff --git a/examples/src/main/scala/soda/example/mathematics/Package.scala b/examples/src/main/scala/soda/example/mathematics/Package.scala index 987d1a9c..bcfc3464 100644 --- a/examples/src/main/scala/soda/example/mathematics/Package.scala +++ b/examples/src/main/scala/soda/example/mathematics/Package.scala @@ -52,7 +52,7 @@ trait FactorialWithFold private lazy val _range = soda.lib.Range_ () def apply (n : Int) : Int = - _fold.apply (_range.apply (n) ) (1) ( product => k => (product * (k + 1) ) ) + _fold.apply (_range.apply (n) ) (1) ( product => k => (product * (k + 1) ) ) } diff --git a/examples/src/main/scala/soda/example/miniexample/MiniExample.soda b/examples/src/main/scala/soda/example/miniexample/MiniExample.soda index 6732873a..69ef7143 100644 --- a/examples/src/main/scala/soda/example/miniexample/MiniExample.soda +++ b/examples/src/main/scala/soda/example/miniexample/MiniExample.soda @@ -8,7 +8,7 @@ class MiniExample run () : Seq [Unit] = _range.apply (50) - .map ( any x --> print (" " + (2 * x + 1) ) ) + .map (any x --> print (" " + (2 * x + 1) ) ) end diff --git a/examples/src/main/scala/soda/example/miniexample/Package.scala b/examples/src/main/scala/soda/example/miniexample/Package.scala index 4b47fe6f..e0a5c141 100644 --- a/examples/src/main/scala/soda/example/miniexample/Package.scala +++ b/examples/src/main/scala/soda/example/miniexample/Package.scala @@ -15,7 +15,7 @@ trait MiniExample def run () : Seq [Unit] = _range.apply (50) - .map ( x => print (" " + (2 * x + 1) ) ) + .map ( x => print (" " + (2 * x + 1) ) ) } diff --git a/examples/src/test/scala/soda/example/algorithms/Package.scala b/examples/src/test/scala/soda/example/algorithms/Package.scala index 8e9e558f..b6f23f05 100644 --- a/examples/src/test/scala/soda/example/algorithms/Package.scala +++ b/examples/src/test/scala/soda/example/algorithms/Package.scala @@ -255,9 +255,9 @@ case class SortExampleSpec () check ( obtained = SortedSequenceBuilder_ [Integer] () - .build ( Seq (3, 5, 1, 9, 8, 4).map ( x => Integer.valueOf (x) ) ) + .build ( Seq (3, 5, 1, 9, 8, 4).map ( x => Integer.valueOf (x) ) ) .sequence - .map ( x => x.intValue) + .map ( x => x.intValue) ) ( expected = Seq (1, 3, 4, 5, 8 ,9) ) diff --git a/examples/src/test/scala/soda/example/algorithms/SortExampleSpec.soda b/examples/src/test/scala/soda/example/algorithms/SortExampleSpec.soda index 22c4aa06..47e7bfcb 100644 --- a/examples/src/test/scala/soda/example/algorithms/SortExampleSpec.soda +++ b/examples/src/test/scala/soda/example/algorithms/SortExampleSpec.soda @@ -81,9 +81,9 @@ class SortExampleSpec () check ( obtained := SortedSequenceBuilder_ [Integer] () - .build ( Seq (3, 5, 1, 9, 8, 4).map ( lambda x -> Integer.valueOf (x) ) ) + .build ( Seq (3, 5, 1, 9, 8, 4).map (lambda x -> Integer.valueOf (x) ) ) .sequence - .map ( lambda x --> x.intValue) + .map (lambda x --> x.intValue) ) ( expected := Seq (1, 3, 4, 5, 8 ,9) ) diff --git a/examples/src/test/scala/soda/example/forcoq/mathematics/FactorialForCoqSpec.soda b/examples/src/test/scala/soda/example/forcoq/mathematics/FactorialForCoqSpec.soda index 63e41706..bbed5d51 100644 --- a/examples/src/test/scala/soda/example/forcoq/mathematics/FactorialForCoqSpec.soda +++ b/examples/src/test/scala/soda/example/forcoq/mathematics/FactorialForCoqSpec.soda @@ -16,15 +16,15 @@ class FactorialForCoqSpec () factorial_values_with_nat : Seq [ Tuple2 [nat, nat] ] = factorial_values - .map ( lambda pair --> + .map (lambda pair --> Tuple2 ( IntNat_ ().from_non_negative (pair._1), IntNat_ ().from_non_negative (pair._2) ) ) test ("should test the factorial function for Coq") ( check ( obtained := factorial_values_with_nat - .map ( lambda pair --> pair._1) - .map ( lambda n --> Tuple2 (n, FactorialForCoq_ ().get_factorial (n) ) ) + .map (lambda pair --> pair._1) + .map (lambda n --> Tuple2 (n, FactorialForCoq_ ().get_factorial (n) ) ) ) ( expected := factorial_values_with_nat ) diff --git a/examples/src/test/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoqSpec.soda b/examples/src/test/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoqSpec.soda index 5c55e9a8..47adb253 100644 --- a/examples/src/test/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoqSpec.soda +++ b/examples/src/test/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoqSpec.soda @@ -16,15 +16,15 @@ class FiboExampleInSodaForCoqSpec () fibonacci_values_with_nat : Seq [ Tuple2 [nat, nat] ] = fibonacci_values - .map ( lambda pair --> + .map (lambda pair --> Tuple2 ( IntNat_ ().from_non_negative (pair._1), IntNat_ ().from_non_negative (pair._2) ) ) test ("should test the fibonacci function for Coq") ( check ( obtained := fibonacci_values_with_nat - .map ( lambda pair --> pair._1) - .map ( lambda n --> Tuple2 (n, FiboExampleInSodaForCoq_ ().fib (n) ) ) + .map (lambda pair --> pair._1) + .map (lambda n --> Tuple2 (n, FiboExampleInSodaForCoq_ ().fib (n) ) ) ) ( expected := fibonacci_values_with_nat ) diff --git a/examples/src/test/scala/soda/example/forcoq/mathematics/Package.scala b/examples/src/test/scala/soda/example/forcoq/mathematics/Package.scala index b303d89d..914c4467 100644 --- a/examples/src/test/scala/soda/example/forcoq/mathematics/Package.scala +++ b/examples/src/test/scala/soda/example/forcoq/mathematics/Package.scala @@ -23,15 +23,15 @@ case class FactorialForCoqSpec () lazy val factorial_values_with_nat : Seq [ Tuple2 [nat, nat] ] = factorial_values - .map ( pair => + .map ( pair => Tuple2 ( IntNat_ ().from_non_negative (pair._1), IntNat_ ().from_non_negative (pair._2) ) ) test ("should test the factorial function for Coq") ( check ( obtained = factorial_values_with_nat - .map ( pair => pair._1) - .map ( n => Tuple2 (n, FactorialForCoq_ ().get_factorial (n) ) ) + .map ( pair => pair._1) + .map ( n => Tuple2 (n, FactorialForCoq_ ().get_factorial (n) ) ) ) ( expected = factorial_values_with_nat ) @@ -57,15 +57,15 @@ case class FiboExampleInSodaForCoqSpec () lazy val fibonacci_values_with_nat : Seq [ Tuple2 [nat, nat] ] = fibonacci_values - .map ( pair => + .map ( pair => Tuple2 ( IntNat_ ().from_non_negative (pair._1), IntNat_ ().from_non_negative (pair._2) ) ) test ("should test the fibonacci function for Coq") ( check ( obtained = fibonacci_values_with_nat - .map ( pair => pair._1) - .map ( n => Tuple2 (n, FiboExampleInSodaForCoq_ ().fib (n) ) ) + .map ( pair => pair._1) + .map ( n => Tuple2 (n, FiboExampleInSodaForCoq_ ().fib (n) ) ) ) ( expected = fibonacci_values_with_nat ) @@ -91,15 +91,15 @@ case class TriangularNumberForCoqSpec () lazy val triangular_number_with_nat : Seq [ Tuple2 [nat, nat] ] = triangular_number_values - .map ( pair => + .map ( pair => Tuple2 ( IntNat_ ().from_non_negative (pair._1), IntNat_ ().from_non_negative (pair._2) ) ) test ("should test the triangular for Coq") ( check ( obtained = triangular_number_with_nat - .map ( pair => pair._1) - .map ( n => Tuple2 (n, TriangularNumberForCoq_ ().get_number (n) ) ) + .map ( pair => pair._1) + .map ( n => Tuple2 (n, TriangularNumberForCoq_ ().get_number (n) ) ) ) ( expected = triangular_number_with_nat ) diff --git a/examples/src/test/scala/soda/example/forcoq/mathematics/TriangularNumberForCoqSpec.soda b/examples/src/test/scala/soda/example/forcoq/mathematics/TriangularNumberForCoqSpec.soda index 0b47560e..fbfe17c6 100644 --- a/examples/src/test/scala/soda/example/forcoq/mathematics/TriangularNumberForCoqSpec.soda +++ b/examples/src/test/scala/soda/example/forcoq/mathematics/TriangularNumberForCoqSpec.soda @@ -16,15 +16,15 @@ class TriangularNumberForCoqSpec () triangular_number_with_nat : Seq [ Tuple2 [nat, nat] ] = triangular_number_values - .map ( lambda pair --> + .map (lambda pair --> Tuple2 ( IntNat_ ().from_non_negative (pair._1), IntNat_ ().from_non_negative (pair._2) ) ) test ("should test the triangular for Coq") ( check ( obtained := triangular_number_with_nat - .map ( lambda pair --> pair._1) - .map ( lambda n --> Tuple2 (n, TriangularNumberForCoq_ ().get_number (n) ) ) + .map (lambda pair --> pair._1) + .map (lambda n --> Tuple2 (n, TriangularNumberForCoq_ ().get_number (n) ) ) ) ( expected := triangular_number_with_nat ) diff --git a/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda b/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda index c75a383f..d3c7a9af 100644 --- a/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda +++ b/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda @@ -19,8 +19,8 @@ class FactorialSpec () test ("should test the factorial - concise version") ( check ( obtained := factorial_values - .map ( lambda pair --> pair._1) - .map ( lambda n --> Tuple2 (n, _factorial_concise.apply (n) ) ) + .map (lambda pair --> pair._1) + .map (lambda n --> Tuple2 (n, _factorial_concise.apply (n) ) ) ) ( expected := factorial_values ) @@ -29,8 +29,8 @@ class FactorialSpec () test ("should test the factorial - with pattern matching") ( check ( obtained := factorial_values - .map ( lambda pair --> pair._1) - .map ( lambda n --> Tuple2 (n, _factorial_patten_matching.apply (n) ) ) + .map (lambda pair --> pair._1) + .map (lambda n --> Tuple2 (n, _factorial_patten_matching.apply (n) ) ) ) ( expected := factorial_values ) @@ -39,8 +39,8 @@ class FactorialSpec () test ("should test the factorial - with fold") ( check ( obtained := factorial_values - .map ( lambda pair --> pair._1) - .map ( lambda n --> Tuple2 (n, _factorial_with_fold.apply (n) ) ) + .map (lambda pair --> pair._1) + .map (lambda n --> Tuple2 (n, _factorial_with_fold.apply (n) ) ) ) ( expected := factorial_values ) diff --git a/examples/src/test/scala/soda/example/mathematics/FiboExampleSpec.soda b/examples/src/test/scala/soda/example/mathematics/FiboExampleSpec.soda index 7e5e2c47..ce9d3e63 100644 --- a/examples/src/test/scala/soda/example/mathematics/FiboExampleSpec.soda +++ b/examples/src/test/scala/soda/example/mathematics/FiboExampleSpec.soda @@ -15,8 +15,8 @@ class FiboExampleSpec () test ("should test the fibonacci function") ( check ( obtained := fibonacci_values - .map ( lambda pair --> pair._1) - .map ( lambda n --> Tuple2 (n, _fibo_example_in_soda.apply (n) ) ) + .map (lambda pair --> pair._1) + .map (lambda n --> Tuple2 (n, _fibo_example_in_soda.apply (n) ) ) ) ( expected := fibonacci_values ) diff --git a/examples/src/test/scala/soda/example/mathematics/Package.scala b/examples/src/test/scala/soda/example/mathematics/Package.scala index 8e3eb827..a4a62f19 100644 --- a/examples/src/test/scala/soda/example/mathematics/Package.scala +++ b/examples/src/test/scala/soda/example/mathematics/Package.scala @@ -27,8 +27,8 @@ case class FactorialSpec () test ("should test the factorial - concise version") ( check ( obtained = factorial_values - .map ( pair => pair._1) - .map ( n => Tuple2 (n, _factorial_concise.apply (n) ) ) + .map ( pair => pair._1) + .map ( n => Tuple2 (n, _factorial_concise.apply (n) ) ) ) ( expected = factorial_values ) @@ -37,8 +37,8 @@ case class FactorialSpec () test ("should test the factorial - with pattern matching") ( check ( obtained = factorial_values - .map ( pair => pair._1) - .map ( n => Tuple2 (n, _factorial_patten_matching.apply (n) ) ) + .map ( pair => pair._1) + .map ( n => Tuple2 (n, _factorial_patten_matching.apply (n) ) ) ) ( expected = factorial_values ) @@ -47,8 +47,8 @@ case class FactorialSpec () test ("should test the factorial - with fold") ( check ( obtained = factorial_values - .map ( pair => pair._1) - .map ( n => Tuple2 (n, _factorial_with_fold.apply (n) ) ) + .map ( pair => pair._1) + .map ( n => Tuple2 (n, _factorial_with_fold.apply (n) ) ) ) ( expected = factorial_values ) @@ -74,8 +74,8 @@ case class FiboExampleSpec () test ("should test the fibonacci function") ( check ( obtained = fibonacci_values - .map ( pair => pair._1) - .map ( n => Tuple2 (n, _fibo_example_in_soda.apply (n) ) ) + .map ( pair => pair._1) + .map ( n => Tuple2 (n, _fibo_example_in_soda.apply (n) ) ) ) ( expected = fibonacci_values ) diff --git a/library/src/main/scala/soda/collection/Min.soda b/library/src/main/scala/soda/collection/Min.soda index 6e8afa8c..3ac98fc0 100644 --- a/library/src/main/scala/soda/collection/Min.soda +++ b/library/src/main/scala/soda/collection/Min.soda @@ -66,7 +66,7 @@ class Min [A] MSeqRec_ [A] ().fold_while [B] (s) (initial_value) (next_value) (condition) foldLeft [B] (s : MSeq [A] ) (initial_value : B) (next_value : B -> A -> B) : B = - foldLeftWhile (s) (initial_value) (next_value) ( lambda (acc : B) --> lambda (elem : A) --> true) + foldLeftWhile (s) (initial_value) (next_value) (lambda (acc : B) --> lambda (elem : A) --> true) reverse (s : MSeq [A] ) : MSeq [A] = s.opt [MSeq [A] ] ( @@ -124,7 +124,7 @@ class Min [A] at (s : MSeq [A] ) (n : Int) : OptionSD [A] = s.opt [OptionSD [A] ] ( ifEmpty := NoneSD_ [A] () ) ( - ifNonEmpty := ( lambda neseq --> _retrieve_if_in_range (neseq) (n) ) + ifNonEmpty := (lambda neseq --> _retrieve_if_in_range (neseq) (n) ) ) _retrieve_if_in_range (xs : NESeq [A] ) (n : Int) : OptionSD [A] = diff --git a/library/src/main/scala/soda/collection/Package.scala b/library/src/main/scala/soda/collection/Package.scala index 3554295e..dacece6e 100644 --- a/library/src/main/scala/soda/collection/Package.scala +++ b/library/src/main/scala/soda/collection/Package.scala @@ -159,7 +159,7 @@ trait Min [A] MSeqRec_ [A] ().fold_while [B] (s) (initial_value) (next_value) (condition) def foldLeft [B] (s : MSeq [A] ) (initial_value : B) (next_value : B => A => B) : B = - foldLeftWhile (s) (initial_value) (next_value) ( (acc : B) => (elem : A) => true) + foldLeftWhile (s) (initial_value) (next_value) ( (acc : B) => (elem : A) => true) def reverse (s : MSeq [A] ) : MSeq [A] = s.opt [MSeq [A] ] ( @@ -217,7 +217,7 @@ trait Min [A] def at (s : MSeq [A] ) (n : Int) : OptionSD [A] = s.opt [OptionSD [A] ] ( ifEmpty = NoneSD_ [A] () ) ( - ifNonEmpty = ( neseq => _retrieve_if_in_range (neseq) (n) ) + ifNonEmpty = ( neseq => _retrieve_if_in_range (neseq) (n) ) ) private def _retrieve_if_in_range (xs : NESeq [A] ) (n : Int) : OptionSD [A] = diff --git a/library/src/main/scala/soda/collection/example/ListExample.soda b/library/src/main/scala/soda/collection/example/ListExample.soda index 2a72c7cf..c0e2f4db 100644 --- a/library/src/main/scala/soda/collection/example/ListExample.soda +++ b/library/src/main/scala/soda/collection/example/ListExample.soda @@ -26,7 +26,7 @@ class ListExample Pair_("a.takeRight(3)", a.takeRight (3) ) takeWhile_example : Pair [Seq [Char] ] = - Pair_("a.takeWhile( lambda x --> not (x == 'E'))", a.takeWhile ( lambda x --> not (x == 'E') ) ) + Pair_("a.takeWhile(lambda x --> not (x == 'E'))", a.takeWhile (lambda x --> not (x == 'E') ) ) drop_example : Pair [Seq [Char] ] = Pair_("a.drop(2)", a.drop (2)) @@ -35,7 +35,7 @@ class ListExample Pair_("a.dropRight(2)", a.dropRight (2)) dropWhile_example : Pair [Seq [Char] ] = - Pair_("a.dropWhile( lambda x --> not (x == 'E'))", a.dropWhile ( lambda x --> not (x == 'E') ) ) + Pair_("a.dropWhile(lambda x --> not (x == 'E'))", a.dropWhile (lambda x --> not (x == 'E') ) ) splitAt_example : Pair [(Seq [Char], Seq [Char] ) ] = Pair_("a.splitAt(3)", a.splitAt (3) ) @@ -68,22 +68,22 @@ class ListExample Pair_("a.map(_.toInt).++(b)", a.map (_.toInt).++ (b) ) span_example : Pair [(Seq [Char], Seq [Char])] = - Pair_("a.span( lambda x --> not (x == 'D'))", a.span ( lambda x --> not (x == 'D') ) ) + Pair_("a.span(lambda x --> not (x == 'D'))", a.span (lambda x --> not (x == 'D') ) ) map_example : Pair [Seq [Int] ] = - Pair_("a.map( lambda x --> x.toInt)", a.map ( lambda x --> x.toInt) ) + Pair_("a.map(lambda x --> x.toInt)", a.map (lambda x --> x.toInt) ) filter_example : Pair [Seq [Char] ] = - Pair_("a.filter( lambda x --> x.toInt % 2 == 0)", a.filter ( lambda x --> x.toInt % 2 == 0) ) + Pair_("a.filter(lambda x --> x.toInt % 2 == 0)", a.filter (lambda x --> x.toInt % 2 == 0) ) fold_example : Pair [Int] = - Pair_("b.fold(0)( lambda (a, b) --> a + b)", b.fold (0)( lambda (a, b) --> a + b) ) + Pair_("b.fold(0)(lambda (a, b) --> a + b)", b.fold (0)(lambda (a, b) --> a + b) ) foldLeft_example : Pair [Seq [Char] ] = - Pair_("a.foldLeft(Seq('*'))( lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", a.foldLeft (Seq ('*') )( lambda (list, elem) --> "(" + list + " :+ " + elem + ")") ) + Pair_("a.foldLeft(Seq('*'))(lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", a.foldLeft (Seq ('*') )(lambda (list, elem) --> "(" + list + " :+ " + elem + ")") ) foldRight_example : Pair [Seq [Char] ] = - Pair_("a.foldRight(Seq('*'))( lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", a.foldRight (Seq ('*') )( lambda (elem, list) --> "(" + elem + " +: " + list + ")") ) + Pair_("a.foldRight(Seq('*'))(lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", a.foldRight (Seq ('*') )(lambda (elem, list) --> "(" + elem + " +: " + list + ")") ) end diff --git a/library/src/main/scala/soda/collection/example/Main.soda b/library/src/main/scala/soda/collection/example/Main.soda index e0f5f9b7..d61110e7 100644 --- a/library/src/main/scala/soda/collection/example/Main.soda +++ b/library/src/main/scala/soda/collection/example/Main.soda @@ -28,7 +28,7 @@ class Main e.foldLeft_example, e.foldRight_example ) - .map ( lambda pair --> pair.name + " = " + pair.result.toString) + .map (lambda pair --> pair.name + " = " + pair.result.toString) .mkString ("\n") main (arguments : Array [String] ) : Unit = diff --git a/library/src/main/scala/soda/collection/example/Package.scala b/library/src/main/scala/soda/collection/example/Package.scala index e30ccee4..7db46788 100644 --- a/library/src/main/scala/soda/collection/example/Package.scala +++ b/library/src/main/scala/soda/collection/example/Package.scala @@ -36,7 +36,7 @@ trait ListExample Pair_("a.takeRight(3)", a.takeRight (3) ) lazy val takeWhile_example : Pair [Seq [Char] ] = - Pair_("a.takeWhile( lambda x --> not (x == 'E'))", a.takeWhile ( x => ! (x == 'E') ) ) + Pair_("a.takeWhile(lambda x --> not (x == 'E'))", a.takeWhile ( x => ! (x == 'E') ) ) lazy val drop_example : Pair [Seq [Char] ] = Pair_("a.drop(2)", a.drop (2)) @@ -45,7 +45,7 @@ trait ListExample Pair_("a.dropRight(2)", a.dropRight (2)) lazy val dropWhile_example : Pair [Seq [Char] ] = - Pair_("a.dropWhile( lambda x --> not (x == 'E'))", a.dropWhile ( x => ! (x == 'E') ) ) + Pair_("a.dropWhile(lambda x --> not (x == 'E'))", a.dropWhile ( x => ! (x == 'E') ) ) lazy val splitAt_example : Pair [(Seq [Char], Seq [Char] ) ] = Pair_("a.splitAt(3)", a.splitAt (3) ) @@ -78,22 +78,22 @@ trait ListExample Pair_("a.map(_.toInt).++(b)", a.map (_.toInt).++ (b) ) lazy val span_example : Pair [(Seq [Char], Seq [Char])] = - Pair_("a.span( lambda x --> not (x == 'D'))", a.span ( x => ! (x == 'D') ) ) + Pair_("a.span(lambda x --> not (x == 'D'))", a.span ( x => ! (x == 'D') ) ) lazy val map_example : Pair [Seq [Int] ] = - Pair_("a.map( lambda x --> x.toInt)", a.map ( x => x.toInt) ) + Pair_("a.map(lambda x --> x.toInt)", a.map ( x => x.toInt) ) lazy val filter_example : Pair [Seq [Char] ] = - Pair_("a.filter( lambda x --> x.toInt % 2 == 0)", a.filter ( x => x.toInt % 2 == 0) ) + Pair_("a.filter(lambda x --> x.toInt % 2 == 0)", a.filter ( x => x.toInt % 2 == 0) ) lazy val fold_example : Pair [Int] = - Pair_("b.fold(0)( lambda (a, b) --> a + b)", b.fold (0)( (a, b) => a + b) ) + Pair_("b.fold(0)(lambda (a, b) --> a + b)", b.fold (0)( (a, b) => a + b) ) lazy val foldLeft_example : Pair [Seq [Char] ] = - Pair_("a.foldLeft(Seq('*'))( lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", a.foldLeft (Seq ('*') )( (list, elem) => "(" + list + " :+ " + elem + ")") ) + Pair_("a.foldLeft(Seq('*'))(lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", a.foldLeft (Seq ('*') )( (list, elem) => "(" + list + " :+ " + elem + ")") ) lazy val foldRight_example : Pair [Seq [Char] ] = - Pair_("a.foldRight(Seq('*'))( lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", a.foldRight (Seq ('*') )( (elem, list) => "(" + elem + " +: " + list + ")") ) + Pair_("a.foldRight(Seq('*'))(lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", a.foldRight (Seq ('*') )( (elem, list) => "(" + elem + " +: " + list + ")") ) } @@ -130,7 +130,7 @@ trait Main e.foldLeft_example, e.foldRight_example ) - .map ( pair => pair.name + " = " + pair.result.toString) + .map ( pair => pair.name + " = " + pair.result.toString) .mkString ("\n") def main (arguments : Array [String] ) : Unit = diff --git a/library/src/test/scala/soda/collection/MinSpec.soda b/library/src/test/scala/soda/collection/MinSpec.soda index 7a8d6c24..09f0a885 100644 --- a/library/src/test/scala/soda/collection/MinSpec.soda +++ b/library/src/test/scala/soda/collection/MinSpec.soda @@ -206,7 +206,7 @@ class MinSpec () test ("takeWhile with Seq") ( check ( - obtained := exampleSeq.takeWhile ( lambda e --> not (e == 3) ) + obtained := exampleSeq.takeWhile (lambda e --> not (e == 3) ) ) ( expected := Seq (0, 1, 1, 2) ) @@ -214,7 +214,7 @@ class MinSpec () test ("takeWhile") ( check ( - obtained := Min_ ().takeWhile (example) ( lambda e --> not (e == 3) ) + obtained := Min_ ().takeWhile (example) (lambda e --> not (e == 3) ) ) ( expected := MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2) ) ) @@ -222,7 +222,7 @@ class MinSpec () test ("dropWhile with Seq") ( check ( - obtained := exampleSeq.dropWhile ( lambda e --> not (e == 3) ) + obtained := exampleSeq.dropWhile (lambda e --> not (e == 3) ) ) ( expected := Seq (3, 5, 8) ) @@ -230,7 +230,7 @@ class MinSpec () test ("dropWhile") ( check ( - obtained := Min_ ().dropWhile (example) ( lambda e --> not (e == 3) ) + obtained := Min_ ().dropWhile (example) (lambda e --> not (e == 3) ) ) ( expected := MSeqTranslator_ ().asMSeq (Seq (3, 5, 8) ) ) @@ -254,7 +254,7 @@ class MinSpec () test ("span with Seq") ( check ( - obtained := exampleSeq.span ( lambda x --> not (x == 5) ) + obtained := exampleSeq.span (lambda x --> not (x == 5) ) ) ( expected := Tuple2 (Seq (0, 1, 1, 2, 3), Seq (5, 8) ) ) @@ -262,7 +262,7 @@ class MinSpec () test ("span") ( check ( - obtained := Min_ ().span (example) ( lambda (x : Int) --> not (x == 5) ) + obtained := Min_ ().span (example) (lambda (x : Int) --> not (x == 5) ) ) ( expected := MSeqPair_ (MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2, 3) ), MSeqTranslator_ ().asMSeq (Seq (5, 8) ) ) ) @@ -390,7 +390,7 @@ class MinSpec () test ("forall with Seq 0") ( check ( - obtained := exampleSeq.forall ( lambda x --> not (x == 7) ) + obtained := exampleSeq.forall (lambda x --> not (x == 7) ) ) ( expected := true ) @@ -398,7 +398,7 @@ class MinSpec () test ("forall with Seq 1") ( check ( - obtained := exampleSeq.forall ( lambda x --> x < 7) + obtained := exampleSeq.forall (lambda x --> x < 7) ) ( expected := false ) @@ -406,7 +406,7 @@ class MinSpec () test ("forall with Seq 2") ( check ( - obtained := Seq ().forall ( lambda x --> x == 7) + obtained := Seq ().forall (lambda x --> x == 7) ) ( expected := true ) @@ -414,7 +414,7 @@ class MinSpec () test ("forall 0") ( check ( - obtained := Min_ ().forall (example) ( lambda x --> not (x == 7) ) + obtained := Min_ ().forall (example) (lambda x --> not (x == 7) ) ) ( expected := true ) @@ -422,7 +422,7 @@ class MinSpec () test ("forall 1") ( check ( - obtained := Min_ ().forall (example) ( lambda x --> x < 7) + obtained := Min_ ().forall (example) (lambda x --> x < 7) ) ( expected := false ) @@ -430,7 +430,7 @@ class MinSpec () test ("forall 2") ( check ( - obtained := Min_ ().forall (empty) ( lambda x --> x == 7) + obtained := Min_ ().forall (empty) (lambda x --> x == 7) ) ( expected := true ) @@ -438,7 +438,7 @@ class MinSpec () test ("exists with Seq 0") ( check ( - obtained := exampleSeq.exists ( lambda x --> x == 8) + obtained := exampleSeq.exists (lambda x --> x == 8) ) ( expected := true ) @@ -446,7 +446,7 @@ class MinSpec () test ("exists with Seq 1") ( check ( - obtained := exampleSeq.exists ( lambda x --> x == 7) + obtained := exampleSeq.exists (lambda x --> x == 7) ) ( expected := false ) @@ -454,7 +454,7 @@ class MinSpec () test ("exists with Seq 2") ( check ( - obtained := Seq ().exists ( lambda x --> x == 7) + obtained := Seq ().exists (lambda x --> x == 7) ) ( expected := false ) @@ -462,7 +462,7 @@ class MinSpec () test ("exists 0") ( check ( - obtained := Min_ ().exists (example) ( lambda x --> x == 8) + obtained := Min_ ().exists (example) (lambda x --> x == 8) ) ( expected := true ) @@ -470,7 +470,7 @@ class MinSpec () test ("exists 1") ( check ( - obtained := Min_ ().exists (example) ( lambda x --> x == 7) + obtained := Min_ ().exists (example) (lambda x --> x == 7) ) ( expected := false ) @@ -478,7 +478,7 @@ class MinSpec () test ("exists 2") ( check ( - obtained := Min_ ().exists (empty) ( lambda x --> x == 7) + obtained := Min_ ().exists (empty) (lambda x --> x == 7) ) ( expected := false ) @@ -486,7 +486,7 @@ class MinSpec () test ("find with Seq 0") ( check ( - obtained := exampleSeq.find ( lambda x --> not (x == 7) ) + obtained := exampleSeq.find (lambda x --> not (x == 7) ) ) ( expected := Some (0) ) @@ -494,7 +494,7 @@ class MinSpec () test ("find with Seq 1") ( check ( - obtained := exampleSeq.find ( lambda x --> x == 8) + obtained := exampleSeq.find (lambda x --> x == 8) ) ( expected := Some (8) ) @@ -502,7 +502,7 @@ class MinSpec () test ("find with Seq 2") ( check ( - obtained := Seq ().find ( lambda x --> x == 7) + obtained := Seq ().find (lambda x --> x == 7) ) ( expected := None ) @@ -510,7 +510,7 @@ class MinSpec () test ("find 0") ( check ( - obtained := Min_ ().find (example) ( lambda x --> not (x == 7) ) + obtained := Min_ ().find (example) (lambda x --> not (x == 7) ) ) ( expected := SomeSD_ (0) ) @@ -518,7 +518,7 @@ class MinSpec () test ("find 1") ( check ( - obtained := Min_ ().find (example) ( lambda x --> x == 8) + obtained := Min_ ().find (example) (lambda x --> x == 8) ) ( expected := SomeSD_ (8) ) @@ -526,7 +526,7 @@ class MinSpec () test ("find 2") ( check ( - obtained := Min_ ().find (empty) ( lambda x --> x == 7) + obtained := Min_ ().find (empty) (lambda x --> x == 7) ) ( expected := NoneSD_ () ) @@ -534,7 +534,7 @@ class MinSpec () test ("filter with Seq") ( check ( - obtained := exampleSeq.filter ( lambda x --> x % 3 == 0) + obtained := exampleSeq.filter (lambda x --> x % 3 == 0) ) ( expected := Seq (0, 3) ) @@ -542,7 +542,7 @@ class MinSpec () test ("filter") ( check ( - obtained := Min_ ().filter (example) ( lambda x --> x % 3 == 0) + obtained := Min_ ().filter (example) (lambda x --> x % 3 == 0) ) ( expected := MSeqTranslator_ ().asMSeq (Seq (0, 3) ) ) @@ -550,7 +550,7 @@ class MinSpec () test ("map with Seq") ( check ( - obtained := exampleSeq.map ( lambda x --> x + 100) + obtained := exampleSeq.map (lambda x --> x + 100) ) ( expected := Seq (100, 101, 101, 102, 103, 105, 108) ) @@ -558,7 +558,7 @@ class MinSpec () test ("map in the same type") ( check ( - obtained := Min_ ().map0 (example) ( lambda x --> x + 100) + obtained := Min_ ().map0 (example) (lambda x --> x + 100) ) ( expected := MSeqTranslator_ ().asMSeq (Seq (100, 101, 101, 102, 103, 105, 108) ) ) @@ -566,7 +566,7 @@ class MinSpec () test ("foldLeft with Seq") ( check ( - obtained := exampleSeq.foldLeft (Seq [Int] () ) ( lambda (s : Seq [Int], e : Int) --> s.+: ( (e + 100) ) ) + obtained := exampleSeq.foldLeft (Seq [Int] () ) (lambda (s : Seq [Int], e : Int) --> s.+: ( (e + 100) ) ) ) ( expected := Seq (108, 105, 103, 102, 101, 101, 100) ) diff --git a/library/src/test/scala/soda/collection/Package.scala b/library/src/test/scala/soda/collection/Package.scala index 4f1e56ac..e3ed14ca 100644 --- a/library/src/test/scala/soda/collection/Package.scala +++ b/library/src/test/scala/soda/collection/Package.scala @@ -213,7 +213,7 @@ case class MinSpec () test ("takeWhile with Seq") ( check ( - obtained = exampleSeq.takeWhile ( e => ! (e == 3) ) + obtained = exampleSeq.takeWhile ( e => ! (e == 3) ) ) ( expected = Seq (0, 1, 1, 2) ) @@ -221,7 +221,7 @@ case class MinSpec () test ("takeWhile") ( check ( - obtained = Min_ ().takeWhile (example) ( e => ! (e == 3) ) + obtained = Min_ ().takeWhile (example) ( e => ! (e == 3) ) ) ( expected = MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2) ) ) @@ -229,7 +229,7 @@ case class MinSpec () test ("dropWhile with Seq") ( check ( - obtained = exampleSeq.dropWhile ( e => ! (e == 3) ) + obtained = exampleSeq.dropWhile ( e => ! (e == 3) ) ) ( expected = Seq (3, 5, 8) ) @@ -237,7 +237,7 @@ case class MinSpec () test ("dropWhile") ( check ( - obtained = Min_ ().dropWhile (example) ( e => ! (e == 3) ) + obtained = Min_ ().dropWhile (example) ( e => ! (e == 3) ) ) ( expected = MSeqTranslator_ ().asMSeq (Seq (3, 5, 8) ) ) @@ -261,7 +261,7 @@ case class MinSpec () test ("span with Seq") ( check ( - obtained = exampleSeq.span ( x => ! (x == 5) ) + obtained = exampleSeq.span ( x => ! (x == 5) ) ) ( expected = Tuple2 (Seq (0, 1, 1, 2, 3), Seq (5, 8) ) ) @@ -269,7 +269,7 @@ case class MinSpec () test ("span") ( check ( - obtained = Min_ ().span (example) ( (x : Int) => ! (x == 5) ) + obtained = Min_ ().span (example) ( (x : Int) => ! (x == 5) ) ) ( expected = MSeqPair_ (MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2, 3) ), MSeqTranslator_ ().asMSeq (Seq (5, 8) ) ) ) @@ -397,7 +397,7 @@ case class MinSpec () test ("forall with Seq 0") ( check ( - obtained = exampleSeq.forall ( x => ! (x == 7) ) + obtained = exampleSeq.forall ( x => ! (x == 7) ) ) ( expected = true ) @@ -405,7 +405,7 @@ case class MinSpec () test ("forall with Seq 1") ( check ( - obtained = exampleSeq.forall ( x => x < 7) + obtained = exampleSeq.forall ( x => x < 7) ) ( expected = false ) @@ -413,7 +413,7 @@ case class MinSpec () test ("forall with Seq 2") ( check ( - obtained = Seq ().forall ( x => x == 7) + obtained = Seq ().forall ( x => x == 7) ) ( expected = true ) @@ -421,7 +421,7 @@ case class MinSpec () test ("forall 0") ( check ( - obtained = Min_ ().forall (example) ( x => ! (x == 7) ) + obtained = Min_ ().forall (example) ( x => ! (x == 7) ) ) ( expected = true ) @@ -429,7 +429,7 @@ case class MinSpec () test ("forall 1") ( check ( - obtained = Min_ ().forall (example) ( x => x < 7) + obtained = Min_ ().forall (example) ( x => x < 7) ) ( expected = false ) @@ -437,7 +437,7 @@ case class MinSpec () test ("forall 2") ( check ( - obtained = Min_ ().forall (empty) ( x => x == 7) + obtained = Min_ ().forall (empty) ( x => x == 7) ) ( expected = true ) @@ -445,7 +445,7 @@ case class MinSpec () test ("exists with Seq 0") ( check ( - obtained = exampleSeq.exists ( x => x == 8) + obtained = exampleSeq.exists ( x => x == 8) ) ( expected = true ) @@ -453,7 +453,7 @@ case class MinSpec () test ("exists with Seq 1") ( check ( - obtained = exampleSeq.exists ( x => x == 7) + obtained = exampleSeq.exists ( x => x == 7) ) ( expected = false ) @@ -461,7 +461,7 @@ case class MinSpec () test ("exists with Seq 2") ( check ( - obtained = Seq ().exists ( x => x == 7) + obtained = Seq ().exists ( x => x == 7) ) ( expected = false ) @@ -469,7 +469,7 @@ case class MinSpec () test ("exists 0") ( check ( - obtained = Min_ ().exists (example) ( x => x == 8) + obtained = Min_ ().exists (example) ( x => x == 8) ) ( expected = true ) @@ -477,7 +477,7 @@ case class MinSpec () test ("exists 1") ( check ( - obtained = Min_ ().exists (example) ( x => x == 7) + obtained = Min_ ().exists (example) ( x => x == 7) ) ( expected = false ) @@ -485,7 +485,7 @@ case class MinSpec () test ("exists 2") ( check ( - obtained = Min_ ().exists (empty) ( x => x == 7) + obtained = Min_ ().exists (empty) ( x => x == 7) ) ( expected = false ) @@ -493,7 +493,7 @@ case class MinSpec () test ("find with Seq 0") ( check ( - obtained = exampleSeq.find ( x => ! (x == 7) ) + obtained = exampleSeq.find ( x => ! (x == 7) ) ) ( expected = Some (0) ) @@ -501,7 +501,7 @@ case class MinSpec () test ("find with Seq 1") ( check ( - obtained = exampleSeq.find ( x => x == 8) + obtained = exampleSeq.find ( x => x == 8) ) ( expected = Some (8) ) @@ -509,7 +509,7 @@ case class MinSpec () test ("find with Seq 2") ( check ( - obtained = Seq ().find ( x => x == 7) + obtained = Seq ().find ( x => x == 7) ) ( expected = None ) @@ -517,7 +517,7 @@ case class MinSpec () test ("find 0") ( check ( - obtained = Min_ ().find (example) ( x => ! (x == 7) ) + obtained = Min_ ().find (example) ( x => ! (x == 7) ) ) ( expected = SomeSD_ (0) ) @@ -525,7 +525,7 @@ case class MinSpec () test ("find 1") ( check ( - obtained = Min_ ().find (example) ( x => x == 8) + obtained = Min_ ().find (example) ( x => x == 8) ) ( expected = SomeSD_ (8) ) @@ -533,7 +533,7 @@ case class MinSpec () test ("find 2") ( check ( - obtained = Min_ ().find (empty) ( x => x == 7) + obtained = Min_ ().find (empty) ( x => x == 7) ) ( expected = NoneSD_ () ) @@ -541,7 +541,7 @@ case class MinSpec () test ("filter with Seq") ( check ( - obtained = exampleSeq.filter ( x => x % 3 == 0) + obtained = exampleSeq.filter ( x => x % 3 == 0) ) ( expected = Seq (0, 3) ) @@ -549,7 +549,7 @@ case class MinSpec () test ("filter") ( check ( - obtained = Min_ ().filter (example) ( x => x % 3 == 0) + obtained = Min_ ().filter (example) ( x => x % 3 == 0) ) ( expected = MSeqTranslator_ ().asMSeq (Seq (0, 3) ) ) @@ -557,7 +557,7 @@ case class MinSpec () test ("map with Seq") ( check ( - obtained = exampleSeq.map ( x => x + 100) + obtained = exampleSeq.map ( x => x + 100) ) ( expected = Seq (100, 101, 101, 102, 103, 105, 108) ) @@ -565,7 +565,7 @@ case class MinSpec () test ("map in the same type") ( check ( - obtained = Min_ ().map0 (example) ( x => x + 100) + obtained = Min_ ().map0 (example) ( x => x + 100) ) ( expected = MSeqTranslator_ ().asMSeq (Seq (100, 101, 101, 102, 103, 105, 108) ) ) @@ -573,7 +573,7 @@ case class MinSpec () test ("foldLeft with Seq") ( check ( - obtained = exampleSeq.foldLeft (Seq [Int] () ) ( (s : Seq [Int], e : Int) => s.+: ( (e + 100) ) ) + obtained = exampleSeq.foldLeft (Seq [Int] () ) ( (s : Seq [Int], e : Int) => s.+: ( (e + 100) ) ) ) ( expected = Seq (108, 105, 103, 102, 101, 101, 100) ) diff --git a/library/src/test/scala/soda/collection/example/ListExampleSpec.soda b/library/src/test/scala/soda/collection/example/ListExampleSpec.soda index 9894fe35..b73b899c 100644 --- a/library/src/test/scala/soda/collection/example/ListExampleSpec.soda +++ b/library/src/test/scala/soda/collection/example/ListExampleSpec.soda @@ -42,7 +42,7 @@ class ListExampleSpec () check ( obtained := ListExample_ ().takeWhile_example ) ( - expected := Pair_ ("a.takeWhile( lambda x --> not (x == 'E'))", List ('A', 'B', 'C', 'D')) + expected := Pair_ ("a.takeWhile(lambda x --> not (x == 'E'))", List ('A', 'B', 'C', 'D')) ) ) @@ -66,7 +66,7 @@ class ListExampleSpec () check ( obtained := ListExample_ ().dropWhile_example ) ( - expected := Pair_ ("a.dropWhile( lambda x --> not (x == 'E'))", List ('E', 'F')) + expected := Pair_ ("a.dropWhile(lambda x --> not (x == 'E'))", List ('E', 'F')) ) ) @@ -138,7 +138,7 @@ class ListExampleSpec () check ( obtained := ListExample_ ().span_example ) ( - expected := Pair_ ("a.span( lambda x --> not (x == 'D'))", (List ('A', 'B', 'C'), List ('D', 'E', 'F'))) + expected := Pair_ ("a.span(lambda x --> not (x == 'D'))", (List ('A', 'B', 'C'), List ('D', 'E', 'F'))) ) ) @@ -146,7 +146,7 @@ class ListExampleSpec () check ( obtained := ListExample_ ().map_example ) ( - expected := Pair_ ("a.map( lambda x --> x.toInt)", List (65, 66, 67, 68, 69, 70)) + expected := Pair_ ("a.map(lambda x --> x.toInt)", List (65, 66, 67, 68, 69, 70)) ) ) @@ -154,7 +154,7 @@ class ListExampleSpec () check ( obtained := ListExample_ ().filter_example ) ( - expected := Pair_ ("a.filter( lambda x --> x.toInt % 2 == 0)", List ('B', 'D', 'F')) + expected := Pair_ ("a.filter(lambda x --> x.toInt % 2 == 0)", List ('B', 'D', 'F')) ) ) @@ -162,7 +162,7 @@ class ListExampleSpec () check ( obtained := ListExample_ ().fold_example ) ( - expected := Pair_ ("b.fold(0)( lambda (a, b) --> a + b)", 210) + expected := Pair_ ("b.fold(0)(lambda (a, b) --> a + b)", 210) ) ) @@ -170,7 +170,7 @@ class ListExampleSpec () check ( obtained := ListExample_ ().foldLeft_example ) ( - expected := Pair_ ("a.foldLeft(Seq('*'))( lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", "((((((List(*) :+ A) :+ B) :+ C) :+ D) :+ E) :+ F)".toCharArray.toSeq) + expected := Pair_ ("a.foldLeft(Seq('*'))(lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", "((((((List(*) :+ A) :+ B) :+ C) :+ D) :+ E) :+ F)".toCharArray.toSeq) ) ) @@ -178,7 +178,7 @@ class ListExampleSpec () check ( obtained := ListExample_ ().foldRight_example ) ( - expected := Pair_ ("a.foldRight(Seq('*'))( lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", "(A +: (B +: (C +: (D +: (E +: (F +: List(*)))))))".toCharArray.toSeq) + expected := Pair_ ("a.foldRight(Seq('*'))(lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", "(A +: (B +: (C +: (D +: (E +: (F +: List(*)))))))".toCharArray.toSeq) ) ) diff --git a/library/src/test/scala/soda/collection/example/Package.scala b/library/src/test/scala/soda/collection/example/Package.scala index e0dc44e5..3c9f2d0e 100644 --- a/library/src/test/scala/soda/collection/example/Package.scala +++ b/library/src/test/scala/soda/collection/example/Package.scala @@ -50,7 +50,7 @@ case class ListExampleSpec () check ( obtained = ListExample_ ().takeWhile_example ) ( - expected = Pair_ ("a.takeWhile( lambda x --> not (x == 'E'))", List ('A', 'B', 'C', 'D')) + expected = Pair_ ("a.takeWhile(lambda x --> not (x == 'E'))", List ('A', 'B', 'C', 'D')) ) ) @@ -74,7 +74,7 @@ case class ListExampleSpec () check ( obtained = ListExample_ ().dropWhile_example ) ( - expected = Pair_ ("a.dropWhile( lambda x --> not (x == 'E'))", List ('E', 'F')) + expected = Pair_ ("a.dropWhile(lambda x --> not (x == 'E'))", List ('E', 'F')) ) ) @@ -146,7 +146,7 @@ case class ListExampleSpec () check ( obtained = ListExample_ ().span_example ) ( - expected = Pair_ ("a.span( lambda x --> not (x == 'D'))", (List ('A', 'B', 'C'), List ('D', 'E', 'F'))) + expected = Pair_ ("a.span(lambda x --> not (x == 'D'))", (List ('A', 'B', 'C'), List ('D', 'E', 'F'))) ) ) @@ -154,7 +154,7 @@ case class ListExampleSpec () check ( obtained = ListExample_ ().map_example ) ( - expected = Pair_ ("a.map( lambda x --> x.toInt)", List (65, 66, 67, 68, 69, 70)) + expected = Pair_ ("a.map(lambda x --> x.toInt)", List (65, 66, 67, 68, 69, 70)) ) ) @@ -162,7 +162,7 @@ case class ListExampleSpec () check ( obtained = ListExample_ ().filter_example ) ( - expected = Pair_ ("a.filter( lambda x --> x.toInt % 2 == 0)", List ('B', 'D', 'F')) + expected = Pair_ ("a.filter(lambda x --> x.toInt % 2 == 0)", List ('B', 'D', 'F')) ) ) @@ -170,7 +170,7 @@ case class ListExampleSpec () check ( obtained = ListExample_ ().fold_example ) ( - expected = Pair_ ("b.fold(0)( lambda (a, b) --> a + b)", 210) + expected = Pair_ ("b.fold(0)(lambda (a, b) --> a + b)", 210) ) ) @@ -178,7 +178,7 @@ case class ListExampleSpec () check ( obtained = ListExample_ ().foldLeft_example ) ( - expected = Pair_ ("a.foldLeft(Seq('*'))( lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", "((((((List(*) :+ A) :+ B) :+ C) :+ D) :+ E) :+ F)".toCharArray.toSeq) + expected = Pair_ ("a.foldLeft(Seq('*'))(lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", "((((((List(*) :+ A) :+ B) :+ C) :+ D) :+ E) :+ F)".toCharArray.toSeq) ) ) @@ -186,7 +186,7 @@ case class ListExampleSpec () check ( obtained = ListExample_ ().foldRight_example ) ( - expected = Pair_ ("a.foldRight(Seq('*'))( lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", "(A +: (B +: (C +: (D +: (E +: (F +: List(*)))))))".toCharArray.toSeq) + expected = Pair_ ("a.foldRight(Seq('*'))(lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", "(A +: (B +: (C +: (D +: (E +: (F +: List(*)))))))".toCharArray.toSeq) ) ) diff --git a/translator/src/main/resources/lib/soda/lib/CartesianProduct.soda b/translator/src/main/resources/lib/soda/lib/CartesianProduct.soda index 68697f27..399c86a8 100644 --- a/translator/src/main/resources/lib/soda/lib/CartesianProduct.soda +++ b/translator/src/main/resources/lib/soda/lib/CartesianProduct.soda @@ -20,11 +20,11 @@ class CartesianProduct _fold = Fold_ () _initial_value [A] (seq : Seq [A] ) : Seq [Seq [A] ] = - seq.map ( lambda elem --> Seq [A] (elem) ) + seq.map (lambda elem --> Seq [A] (elem) ) _next_value [A] (accum : Seq [Seq [A] ] ) (seq_a : Seq [A] ) : Seq [Seq [A] ] = - seq_a.flatMap ( lambda elem_a --> - accum.map ( lambda seq_b --> seq_b.+: (elem_a) ) ) + seq_a.flatMap (lambda elem_a --> + accum.map (lambda seq_b --> seq_b.+: (elem_a) ) ) end diff --git a/translator/src/main/resources/lib/soda/lib/Package.scala b/translator/src/main/resources/lib/soda/lib/Package.scala index f4c7893e..ed408246 100644 --- a/translator/src/main/resources/lib/soda/lib/Package.scala +++ b/translator/src/main/resources/lib/soda/lib/Package.scala @@ -36,11 +36,11 @@ trait CartesianProduct private lazy val _fold = Fold_ () private def _initial_value [A] (seq : Seq [A] ) : Seq [Seq [A] ] = - seq.map ( elem => Seq [A] (elem) ) + seq.map ( elem => Seq [A] (elem) ) private def _next_value [A] (accum : Seq [Seq [A] ] ) (seq_a : Seq [A] ) : Seq [Seq [A] ] = - seq_a.flatMap ( elem_a => - accum.map ( seq_b => seq_b.+: (elem_a) ) ) + seq_a.flatMap ( elem_a => + accum.map ( seq_b => seq_b.+: (elem_a) ) ) } @@ -249,7 +249,7 @@ trait FoldWhile import scala.annotation.tailrec @tailrec final private def _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = - if ( sequence.isEmpty || ( ! condition (current_value) (sequence.head) ) + if ( sequence.isEmpty || (! condition (current_value) (sequence.head) ) ) current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) diff --git a/translator/src/main/resources/lib/soda/lib/Recursion.soda b/translator/src/main/resources/lib/soda/lib/Recursion.soda index 85c35416..45142479 100644 --- a/translator/src/main/resources/lib/soda/lib/Recursion.soda +++ b/translator/src/main/resources/lib/soda/lib/Recursion.soda @@ -19,7 +19,7 @@ class FoldWhile @tailrec _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - if sequence.isEmpty or ( not condition (current_value) (sequence.head) ) + if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) diff --git a/translator/src/main/resources/soda/translator/documentation/Manual.soda b/translator/src/main/resources/soda/translator/documentation/Manual.soda index 6b222fea..791c6143 100644 --- a/translator/src/main/resources/soda/translator/documentation/Manual.soda +++ b/translator/src/main/resources/soda/translator/documentation/Manual.soda @@ -186,12 +186,12 @@ class Manual * Lambda functions are declared with `lambda` and a long right arrow (`-->`). */ plus_one (sequence : Seq [Int] ) : Seq [Int] = - sequence.map ( lambda element --> element + 1) + sequence.map (lambda element --> element + 1) /* A synonym for `lambda` is `any`, which sometimes brings more readability. */ plus_two (sequence : Seq [Int] ) : Seq [Int] = - sequence.map ( any element --> element + 2) + sequence.map (any element --> element + 2) /* Boolean values `false` and `true` are available. */ @@ -256,7 +256,7 @@ class FoldWhile @tailrec _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - if sequence.isEmpty or ( not condition (current_value) (sequence.head) ) + if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) diff --git a/translator/src/main/scala/soda/lib/CartesianProduct.soda b/translator/src/main/scala/soda/lib/CartesianProduct.soda index 7f48e50e..30e5b952 100644 --- a/translator/src/main/scala/soda/lib/CartesianProduct.soda +++ b/translator/src/main/scala/soda/lib/CartesianProduct.soda @@ -20,10 +20,10 @@ class CartesianProduct _fold = Fold_ () _initial_value [A] (seq : Seq [A] ) : Seq [Seq [A] ] = - seq.map ( lambda elem --> Seq [A] (elem) ) + seq.map (lambda elem --> Seq [A] (elem) ) _next_value [A] (accum : Seq [Seq [A] ] ) (seq_a : Seq [A] ) : Seq [Seq [A] ] = - seq_a.flatMap ( lambda elem_a --> - accum.map ( lambda seq_b --> seq_b.+: (elem_a) ) ) + seq_a.flatMap (lambda elem_a --> + accum.map (lambda seq_b --> seq_b.+: (elem_a) ) ) end diff --git a/translator/src/main/scala/soda/lib/Package.scala b/translator/src/main/scala/soda/lib/Package.scala index 41ef2996..4ca7ea0c 100644 --- a/translator/src/main/scala/soda/lib/Package.scala +++ b/translator/src/main/scala/soda/lib/Package.scala @@ -34,11 +34,11 @@ trait CartesianProduct private lazy val _fold = Fold_ () private def _initial_value [A] (seq : Seq [A] ) : Seq [Seq [A] ] = - seq.map ( elem => Seq [A] (elem) ) + seq.map ( elem => Seq [A] (elem) ) private def _next_value [A] (accum : Seq [Seq [A] ] ) (seq_a : Seq [A] ) : Seq [Seq [A] ] = - seq_a.flatMap ( elem_a => - accum.map ( seq_b => seq_b.+: (elem_a) ) ) + seq_a.flatMap ( elem_a => + accum.map ( seq_b => seq_b.+: (elem_a) ) ) } @@ -247,7 +247,7 @@ trait FoldWhile import scala.annotation.tailrec @tailrec final private def _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = - if ( sequence.isEmpty || ( ! condition (current_value) (sequence.head) ) + if ( sequence.isEmpty || (! condition (current_value) (sequence.head) ) ) current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) diff --git a/translator/src/main/scala/soda/lib/Recursion.soda b/translator/src/main/scala/soda/lib/Recursion.soda index 948e495f..be68d862 100644 --- a/translator/src/main/scala/soda/lib/Recursion.soda +++ b/translator/src/main/scala/soda/lib/Recursion.soda @@ -19,7 +19,7 @@ class FoldWhile @tailrec _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - if sequence.isEmpty or ( not condition (current_value) (sequence.head) ) + if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) diff --git a/translator/src/main/scala/soda/translator/block/Block.soda b/translator/src/main/scala/soda/translator/block/Block.soda index a6343aa3..5fc9aa01 100644 --- a/translator/src/main/scala/soda/translator/block/Block.soda +++ b/translator/src/main/scala/soda/translator/block/Block.soda @@ -16,11 +16,11 @@ class Block lines : Seq [String] = annotated_lines - .map ( lambda x --> x.line) + .map (lambda x --> x.line) readable_lines : Seq [AnnotatedLine] = annotated_lines - .filter ( lambda line --> not line.is_comment) + .filter (lambda line --> not line.is_comment) end diff --git a/translator/src/main/scala/soda/translator/block/BlockSequenceTranslator.soda b/translator/src/main/scala/soda/translator/block/BlockSequenceTranslator.soda index ea945fdd..aa5fc680 100644 --- a/translator/src/main/scala/soda/translator/block/BlockSequenceTranslator.soda +++ b/translator/src/main/scala/soda/translator/block/BlockSequenceTranslator.soda @@ -15,7 +15,7 @@ class DefaultBlockSequenceTranslator translate : Seq [AnnotatedBlock] -> Seq [AnnotatedBlock] = lambda block_sequence --> - block_sequence.map ( lambda block --> translator.translate (block) ) + block_sequence.map (lambda block --> translator.translate (block) ) end diff --git a/translator/src/main/scala/soda/translator/block/Package.scala b/translator/src/main/scala/soda/translator/block/Package.scala index 43290e14..580609a1 100644 --- a/translator/src/main/scala/soda/translator/block/Package.scala +++ b/translator/src/main/scala/soda/translator/block/Package.scala @@ -40,11 +40,11 @@ trait Block lazy val lines : Seq [String] = annotated_lines - .map ( x => x.line) + .map ( x => x.line) lazy val readable_lines : Seq [AnnotatedLine] = annotated_lines - .filter ( line => ! line.is_comment) + .filter ( line => ! line.is_comment) } @@ -131,7 +131,7 @@ trait DefaultBlockSequenceTranslator lazy val translate : Seq [AnnotatedBlock] => Seq [AnnotatedBlock] = block_sequence => - block_sequence.map ( block => translator.translate (block) ) + block_sequence.map ( block => translator.translate (block) ) } diff --git a/translator/src/main/scala/soda/translator/blocktr/Package.scala b/translator/src/main/scala/soda/translator/blocktr/Package.scala index 32ed0dcc..1802bdb1 100644 --- a/translator/src/main/scala/soda/translator/blocktr/Package.scala +++ b/translator/src/main/scala/soda/translator/blocktr/Package.scala @@ -27,7 +27,7 @@ trait TableTranslator def table : Seq [Tuple2 [String, String] ] - lazy val keys : Seq [String] = table.map ( pair => pair._1) + lazy val keys : Seq [String] = table.map ( pair => pair._1) lazy val translate : String => String = word => @@ -85,7 +85,7 @@ trait TokenizedBlockTranslator BlockBuilder_ ().build ( block .annotated_lines - .map ( annotated_line => _translate_if_not_a_comment (annotated_line) ) + .map ( annotated_line => _translate_if_not_a_comment (annotated_line) ) ) ) @@ -96,16 +96,16 @@ trait TokenizedBlockTranslator private def _translate_non_comment (line : String) : String = SomeSD_ (line) - .map ( x => Replacement_ (x).add_space_to_soda_line ().line) - .map ( x => Tokenizer_ (x).tokens) - .map ( x => _translate_line (x) ) - .map ( x => _join_tokens (x) ) - .map ( x => Replacement_ (x).remove_space_from_scala_line ().line) + .map ( x => Replacement_ (x).add_space_to_soda_line ().line) + .map ( x => Tokenizer_ (x).tokens) + .map ( x => _translate_line (x) ) + .map ( x => _join_tokens (x) ) + .map ( x => Replacement_ (x).remove_space_from_scala_line ().line) .getOrElse ("") private def _translate_line (tokens : Seq [Token] ) : Seq [Token] = tokens - .map ( token => _get_token_translated_if_in_state (token) ) + .map ( token => _get_token_translated_if_in_state (token) ) private def _get_token_translated_if_in_state (token : Token) : Token = if ( token.parser_state == ParserStateEnum_ ().plain @@ -114,7 +114,7 @@ trait TokenizedBlockTranslator private def _join_tokens (tokens : Seq [Token] ) : String = tokens - .map ( token => token.text) + .map ( token => token.text) .mkString ("") } diff --git a/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda b/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda index 228bb8f7..a86eb470 100644 --- a/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda +++ b/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda @@ -14,7 +14,7 @@ class TableTranslator abstract table : Seq [Tuple2 [String, String] ] - keys : Seq [String] = table.map ( lambda pair --> pair._1) + keys : Seq [String] = table.map (lambda pair --> pair._1) translate : String -> String = lambda word --> diff --git a/translator/src/main/scala/soda/translator/blocktr/TokenizedBlockTranslator.soda b/translator/src/main/scala/soda/translator/blocktr/TokenizedBlockTranslator.soda index 94778310..df8abb51 100644 --- a/translator/src/main/scala/soda/translator/blocktr/TokenizedBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/blocktr/TokenizedBlockTranslator.soda @@ -28,7 +28,7 @@ class TokenizedBlockTranslator BlockBuilder_ ().build ( block .annotated_lines - .map ( lambda annotated_line --> _translate_if_not_a_comment (annotated_line) ) + .map (lambda annotated_line --> _translate_if_not_a_comment (annotated_line) ) ) ) @@ -39,16 +39,16 @@ class TokenizedBlockTranslator _translate_non_comment (line : String) : String = SomeSD_ (line) - .map ( lambda x --> Replacement_ (x).add_space_to_soda_line ().line) - .map ( lambda x --> Tokenizer_ (x).tokens) - .map ( lambda x --> _translate_line (x) ) - .map ( lambda x --> _join_tokens (x) ) - .map ( lambda x --> Replacement_ (x).remove_space_from_scala_line ().line) + .map (lambda x --> Replacement_ (x).add_space_to_soda_line ().line) + .map (lambda x --> Tokenizer_ (x).tokens) + .map (lambda x --> _translate_line (x) ) + .map (lambda x --> _join_tokens (x) ) + .map (lambda x --> Replacement_ (x).remove_space_from_scala_line ().line) .getOrElse ("") _translate_line (tokens : Seq [Token] ) : Seq [Token] = tokens - .map ( lambda token --> _get_token_translated_if_in_state (token) ) + .map (lambda token --> _get_token_translated_if_in_state (token) ) _get_token_translated_if_in_state (token : Token) : Token = if token.parser_state == ParserStateEnum_ ().plain @@ -57,7 +57,7 @@ class TokenizedBlockTranslator _join_tokens (tokens : Seq [Token] ) : String = tokens - .map ( lambda token --> token.text) + .map (lambda token --> token.text) .mkString ("") end diff --git a/translator/src/main/scala/soda/translator/extension/help/Help.soda b/translator/src/main/scala/soda/translator/extension/help/Help.soda index 8d9139d1..c1c290ec 100644 --- a/translator/src/main/scala/soda/translator/extension/help/Help.soda +++ b/translator/src/main/scala/soda/translator/extension/help/Help.soda @@ -25,8 +25,8 @@ class AbstractHelp output_content (content : String) : Boolean = SomeSD_ (content) - .map ( lambda x --> println (x) ) - .map ( lambda x --> true) + .map (lambda x --> println (x) ) + .map (lambda x --> true) .getOrElse (false) end diff --git a/translator/src/main/scala/soda/translator/extension/help/Package.scala b/translator/src/main/scala/soda/translator/extension/help/Package.scala index f11675e9..e9a4ff07 100644 --- a/translator/src/main/scala/soda/translator/extension/help/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/help/Package.scala @@ -33,8 +33,8 @@ trait AbstractHelp def output_content (content : String) : Boolean = SomeSD_ (content) - .map ( x => println (x) ) - .map ( x => true) + .map ( x => println (x) ) + .map ( x => true) .getOrElse (false) } diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda index 5a58529d..760e6911 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda @@ -87,7 +87,7 @@ class CoqClassConstructorBlockTranslator _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references - .flatMap ( lambda block --> _get_as_class_beginning_annotation (block) ) + .flatMap (lambda block --> _get_as_class_beginning_annotation (block) ) .headOption _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = @@ -97,8 +97,8 @@ class CoqClassConstructorBlockTranslator _get_types_of_abstract_functions (block : AbstractDeclarationAnnotation) : Seq [String] = block.abstract_functions - .map ( lambda annotated_line --> _translate_type_symbols (annotated_line.line).trim ) - .map ( lambda line --> _remove_variable (line) ) + .map (lambda annotated_line --> _translate_type_symbols (annotated_line.line).trim ) + .map (lambda line --> _remove_variable (line) ) _remove_variable (line : String) : String = _remove_variable_with (line) (line.indexOf (_sc.type_membership_symbol) ) @@ -118,7 +118,7 @@ class CoqClassConstructorBlockTranslator _get_initial_spaces_with (_get_first_line (block) ) _get_initial_spaces_with (line : String) : String = - line.takeWhile ( lambda ch --> ch.isSpaceChar) + line.takeWhile (lambda ch --> ch.isSpaceChar) _get_first_line (block : AnnotatedBlock) : String = block.lines.headOption.getOrElse ("") diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda index 06204b8a..57da28d8 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda @@ -65,7 +65,7 @@ class CoqClassDeclarationBlockTranslator _process_after_extends (block : Block) : Seq [String] = if (get_first_line (block).trim.nonEmpty) - then block.lines.map ( lambda line --> _tc.coq_import_reserved_word + _tc.coq_space + line.trim + _tc.coq_space + _tc.coq_end_symbol) + then block.lines.map (lambda line --> _tc.coq_import_reserved_word + _tc.coq_space + line.trim + _tc.coq_space + _tc.coq_end_symbol) else Seq [String] () remove_first_line (block : Block) : Block = @@ -83,7 +83,7 @@ class CoqClassDeclarationBlockTranslator get_initial_spaces_for (get_first_line (block) ) get_initial_spaces_for (line : String) : String = - line.takeWhile ( lambda ch --> ch.isSpaceChar) + line.takeWhile (lambda ch --> ch.isSpaceChar) contains_equals (line : String) : Boolean = line.trim.contains (_sc.function_definition_symbol) diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda index 57aeee8b..7ea35b26 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda @@ -50,7 +50,7 @@ class CoqClassEndBlockTranslator _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references - .flatMap ( lambda block --> _get_as_class_beginning_annotation (block) ) + .flatMap (lambda block --> _get_as_class_beginning_annotation (block) ) .headOption _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda index bf7cd75e..fb64c954 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda @@ -45,14 +45,14 @@ class CoqDefinitionBlockTranslator ) is_a_recursive_definition (block : Block) : Boolean = - _tc.coq_recursive_function_prefixes.exists ( lambda prefix --> first_line (block).startsWith (prefix) ) + _tc.coq_recursive_function_prefixes.exists (lambda prefix --> first_line (block).startsWith (prefix) ) first_line (block : Block) : String = block.lines.headOption.getOrElse ("").trim is_a_definition (block : Block) : Boolean = not is_a_recursive_definition (block) and - not _tc.non_definition_block_prefixes.exists ( lambda prefix --> block.contents.trim.startsWith (prefix) ) + not _tc.non_definition_block_prefixes.exists (lambda prefix --> block.contents.trim.startsWith (prefix) ) end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda index 28f2762e..28d383c8 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda @@ -32,14 +32,14 @@ class CoqImportDeclarationBlockTranslator get_number_of_spaces_at_beginning (get_first_line (block) ) ) ( coq_import_declaration_pattern) ( block.imported_items - .filter( lambda annotated_line --> not annotated_line.is_comment) - .map ( lambda annotated_line --> AnnotatedLine_ (annotated_line.line + _tc.coq_space + _tc.coq_end_symbol, false) ) + .filter(lambda annotated_line --> not annotated_line.is_comment) + .map (lambda annotated_line --> AnnotatedLine_ (annotated_line.line + _tc.coq_space + _tc.coq_end_symbol, false) ) ) ) prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = BlockBuilder_ ().build ( - annotated_lines.map ( lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + annotated_lines.map (lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : String = @@ -49,7 +49,7 @@ class CoqImportDeclarationBlockTranslator get_number_of_spaces_at_beginning (line : String) : Int = line - .takeWhile ( lambda ch --> ch.isSpaceChar) + .takeWhile (lambda ch --> ch.isSpaceChar) .length get_first_line (block : AnnotatedBlock) : String = diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/DefinitionLineTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/DefinitionLineTranslator.soda index fd3343d0..591b67f0 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/DefinitionLineTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/DefinitionLineTranslator.soda @@ -94,11 +94,11 @@ class DefinitionLineTranslator _position_of_first_opening_parenthesis.isEmpty _is_val_definition_case_2 (initial_position : Int) = - _position_of_first_opening_parenthesis.opt (false) ( lambda position --> (position > initial_position) ) + _position_of_first_opening_parenthesis.opt (false) (lambda position --> (position > initial_position) ) _is_val_definition_case_3 = (get_index (line) (_sc.type_membership_symbol) ).opt (ifEmpty := false) (ifNonEmpty := lambda other_position --> - _position_of_first_opening_parenthesis.opt (false) ( lambda position --> (position > other_position) ) + _position_of_first_opening_parenthesis.opt (false) (lambda position --> (position > other_position) ) ) _is_val_definition_case_4 = @@ -122,7 +122,7 @@ class DefinitionLineTranslator get_index_from (line : String) (pattern : String) (start : Int) : OptionSD [Int] = SomeSD_ (line.indexOf (pattern, start) ) - .filter ( lambda position --> not (position == -1) ) + .filter (lambda position --> not (position == -1) ) end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda index 3b9d9a08..207cf673 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda @@ -44,7 +44,7 @@ class MatchCaseBlockTranslator else block _is_a_match_case_structure (block : AnnotatedBlock) : Boolean = - block.lines.exists ( lambda line --> _is_a_match_line (line) ) + block.lines.exists (lambda line --> _is_a_match_line (line) ) _is_a_match_line (line : String) : Boolean = line.trim.startsWith (_soda_match_pattern) @@ -54,15 +54,15 @@ class MatchCaseBlockTranslator _get_tabulation_of_match (block : AnnotatedBlock) : String = block.lines - .find ( lambda line --> _is_a_match_line (line) ) - .map ( lambda line --> _left_part (line.indexOf (_soda_match_pattern) ) (line) ) + .find (lambda line --> _is_a_match_line (line) ) + .map (lambda line --> _left_part (line.indexOf (_soda_match_pattern) ) (line) ) .getOrElse (_tc.coq_space) _translate_match_case_structure (block: AnnotatedBlock) (tabulation : String) : Block = BlockBuilder_ ().build ( block.lines - .map ( lambda line --> _append_with_after_match (line) ) - .map ( lambda line --> _replace_case (line) ) + .map (lambda line --> _append_with_after_match (line) ) + .map (lambda line --> _replace_case (line) ) .++ ( Seq [String] () .+: (tabulation + _tc.coq_match_end_translation) ) ) diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala b/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala index b37658d4..dd5dce1d 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala @@ -97,7 +97,7 @@ trait CoqClassConstructorBlockTranslator private def _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references - .flatMap ( block => _get_as_class_beginning_annotation (block) ) + .flatMap ( block => _get_as_class_beginning_annotation (block) ) .headOption private def _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = @@ -108,8 +108,8 @@ trait CoqClassConstructorBlockTranslator private def _get_types_of_abstract_functions (block : AbstractDeclarationAnnotation) : Seq [String] = block.abstract_functions - .map ( annotated_line => _translate_type_symbols (annotated_line.line).trim ) - .map ( line => _remove_variable (line) ) + .map ( annotated_line => _translate_type_symbols (annotated_line.line).trim ) + .map ( line => _remove_variable (line) ) private def _remove_variable (line : String) : String = _remove_variable_with (line) (line.indexOf (_sc.type_membership_symbol) ) @@ -129,7 +129,7 @@ trait CoqClassConstructorBlockTranslator _get_initial_spaces_with (_get_first_line (block) ) private def _get_initial_spaces_with (line : String) : String = - line.takeWhile ( ch => ch.isSpaceChar) + line.takeWhile ( ch => ch.isSpaceChar) private def _get_first_line (block : AnnotatedBlock) : String = block.lines.headOption.getOrElse ("") @@ -206,7 +206,7 @@ trait CoqClassDeclarationBlockTranslator private def _process_after_extends (block : Block) : Seq [String] = if ( (get_first_line (block).trim.nonEmpty) - ) block.lines.map ( line => _tc.coq_import_reserved_word + _tc.coq_space + line.trim + _tc.coq_space + _tc.coq_end_symbol) + ) block.lines.map ( line => _tc.coq_import_reserved_word + _tc.coq_space + line.trim + _tc.coq_space + _tc.coq_end_symbol) else Seq [String] () def remove_first_line (block : Block) : Block = @@ -224,7 +224,7 @@ trait CoqClassDeclarationBlockTranslator get_initial_spaces_for (get_first_line (block) ) def get_initial_spaces_for (line : String) : String = - line.takeWhile ( ch => ch.isSpaceChar) + line.takeWhile ( ch => ch.isSpaceChar) def contains_equals (line : String) : Boolean = line.trim.contains (_sc.function_definition_symbol) @@ -289,7 +289,7 @@ trait CoqClassEndBlockTranslator private def _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references - .flatMap ( block => _get_as_class_beginning_annotation (block) ) + .flatMap ( block => _get_as_class_beginning_annotation (block) ) .headOption private def _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = @@ -350,14 +350,14 @@ trait CoqDefinitionBlockTranslator ) def is_a_recursive_definition (block : Block) : Boolean = - _tc.coq_recursive_function_prefixes.exists ( prefix => first_line (block).startsWith (prefix) ) + _tc.coq_recursive_function_prefixes.exists ( prefix => first_line (block).startsWith (prefix) ) def first_line (block : Block) : String = block.lines.headOption.getOrElse ("").trim def is_a_definition (block : Block) : Boolean = ! is_a_recursive_definition (block) && - ! _tc.non_definition_block_prefixes.exists ( prefix => block.contents.trim.startsWith (prefix) ) + ! _tc.non_definition_block_prefixes.exists ( prefix => block.contents.trim.startsWith (prefix) ) } @@ -398,14 +398,14 @@ trait CoqImportDeclarationBlockTranslator get_number_of_spaces_at_beginning (get_first_line (block) ) ) ( coq_import_declaration_pattern) ( block.imported_items - .filter( annotated_line => ! annotated_line.is_comment) - .map ( annotated_line => AnnotatedLine_ (annotated_line.line + _tc.coq_space + _tc.coq_end_symbol, false) ) + .filter( annotated_line => ! annotated_line.is_comment) + .map ( annotated_line => AnnotatedLine_ (annotated_line.line + _tc.coq_space + _tc.coq_end_symbol, false) ) ) ) def prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = BlockBuilder_ ().build ( - annotated_lines.map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + annotated_lines.map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) def prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : String = @@ -415,7 +415,7 @@ trait CoqImportDeclarationBlockTranslator def get_number_of_spaces_at_beginning (line : String) : Int = line - .takeWhile ( ch => ch.isSpaceChar) + .takeWhile ( ch => ch.isSpaceChar) .length def get_first_line (block : AnnotatedBlock) : String = @@ -663,11 +663,11 @@ trait DefinitionLineTranslator _position_of_first_opening_parenthesis.isEmpty private def _is_val_definition_case_2 (initial_position : Int) = - _position_of_first_opening_parenthesis.opt (false) ( position => (position > initial_position) ) + _position_of_first_opening_parenthesis.opt (false) ( position => (position > initial_position) ) private lazy val _is_val_definition_case_3 = (get_index (line) (_sc.type_membership_symbol) ).opt (ifEmpty = false) (ifNonEmpty = other_position => - _position_of_first_opening_parenthesis.opt (false) ( position => (position > other_position) ) + _position_of_first_opening_parenthesis.opt (false) ( position => (position > other_position) ) ) private lazy val _is_val_definition_case_4 = @@ -691,7 +691,7 @@ trait DefinitionLineTranslator def get_index_from (line : String) (pattern : String) (start : Int) : OptionSD [Int] = SomeSD_ (line.indexOf (pattern, start) ) - .filter ( position => ! (position == -1) ) + .filter ( position => ! (position == -1) ) } @@ -744,7 +744,7 @@ trait MatchCaseBlockTranslator else block private def _is_a_match_case_structure (block : AnnotatedBlock) : Boolean = - block.lines.exists ( line => _is_a_match_line (line) ) + block.lines.exists ( line => _is_a_match_line (line) ) private def _is_a_match_line (line : String) : Boolean = line.trim.startsWith (_soda_match_pattern) @@ -754,15 +754,15 @@ trait MatchCaseBlockTranslator private def _get_tabulation_of_match (block : AnnotatedBlock) : String = block.lines - .find ( line => _is_a_match_line (line) ) - .map ( line => _left_part (line.indexOf (_soda_match_pattern) ) (line) ) + .find ( line => _is_a_match_line (line) ) + .map ( line => _left_part (line.indexOf (_soda_match_pattern) ) (line) ) .getOrElse (_tc.coq_space) private def _translate_match_case_structure (block: AnnotatedBlock) (tabulation : String) : Block = BlockBuilder_ ().build ( block.lines - .map ( line => _append_with_after_match (line) ) - .map ( line => _replace_case (line) ) + .map ( line => _append_with_after_match (line) ) + .map ( line => _replace_case (line) ) .++ ( Seq [String] () .+: (tabulation + _tc.coq_match_end_translation) ) ) @@ -1085,8 +1085,8 @@ trait TranslationConstantToCoq lazy val coq_non_soda : Seq [Tuple2 [String, String] ] = coq_reserved_words - .filter ( x => ! soda_constant.soda_reserved_words.contains (x)) - .map ( x => Tuple2 (x, prefix_coq_non_soda + x) ) + .filter ( x => ! soda_constant.soda_reserved_words.contains (x)) + .map ( x => Tuple2 (x, prefix_coq_non_soda + x) ) def is_coq_word (word : String) : Boolean = coq_reserved_words.contains (word) diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/TranslationConstantToCoq.soda b/translator/src/main/scala/soda/translator/extension/tocoq/TranslationConstantToCoq.soda index a4a2ac65..491d9a0a 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/TranslationConstantToCoq.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/TranslationConstantToCoq.soda @@ -245,8 +245,8 @@ class TranslationConstantToCoq coq_non_soda : Seq [Tuple2 [String, String] ] = coq_reserved_words - .filter ( lambda x --> not soda_constant.soda_reserved_words.contains (x)) - .map ( lambda x --> Tuple2 (x, prefix_coq_non_soda + x) ) + .filter (lambda x --> not soda_constant.soda_reserved_words.contains (x)) + .map (lambda x --> Tuple2 (x, prefix_coq_non_soda + x) ) is_coq_word (word : String) : Boolean = coq_reserved_words.contains (word) diff --git a/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda index 1a1267cd..0c5c886a 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda @@ -75,7 +75,7 @@ class DocBlockTranslator else _prepend (_remove_suffix_in_line (_sc.comment_closing_symbol) (content.head) ) (content.tail) _remove_comment_line_prefix (content : Seq [String] ) : Seq [String] = - content.map ( lambda line --> _remove_prefix_in_line (_comment_line_prefix) (line) ) + content.map (lambda line --> _remove_prefix_in_line (_comment_line_prefix) (line) ) _remove_prefix_in_line (prefix : String) (line : String) : String = _remove_prefix_in_line_at (line.indexOf (prefix) ) (prefix) (line) diff --git a/translator/src/main/scala/soda/translator/extension/todoc/Package.scala b/translator/src/main/scala/soda/translator/extension/todoc/Package.scala index 75b064ec..c4dd912a 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/todoc/Package.scala @@ -85,7 +85,7 @@ trait DocBlockTranslator else _prepend (_remove_suffix_in_line (_sc.comment_closing_symbol) (content.head) ) (content.tail) private def _remove_comment_line_prefix (content : Seq [String] ) : Seq [String] = - content.map ( line => _remove_prefix_in_line (_comment_line_prefix) (line) ) + content.map ( line => _remove_prefix_in_line (_comment_line_prefix) (line) ) private def _remove_prefix_in_line (prefix : String) (line : String) : String = _remove_prefix_in_line_at (line.indexOf (prefix) ) (prefix) (line) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda index df337fdf..74bef5aa 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda @@ -38,7 +38,7 @@ class AbstractDeclarationBlockTranslator prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = Block_ ( - annotated_lines.map ( lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + annotated_lines.map (lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : AnnotatedLine = diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda index 9c303a11..ecb8f37c 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda @@ -77,7 +77,7 @@ class ClassConstructorBlockTranslator _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references - .flatMap ( lambda block --> _get_as_class_beginning_annotation (block) ) + .flatMap (lambda block --> _get_as_class_beginning_annotation (block) ) .headOption _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = @@ -87,9 +87,9 @@ class ClassConstructorBlockTranslator _get_abstract_functions (references : Seq [AnnotatedBlock] ) : Seq [String] = references - .flatMap ( lambda block --> _get_as_abstract_declaration_annotation (block) ) - .flatMap ( lambda block --> block.abstract_functions) - .map ( lambda annotated_line --> _translate_type_symbols (annotated_line.line).trim ) + .flatMap (lambda block --> _get_as_abstract_declaration_annotation (block) ) + .flatMap (lambda block --> block.abstract_functions) + .map (lambda annotated_line --> _translate_type_symbols (annotated_line.line).trim ) _get_as_abstract_declaration_annotation (block : AnnotatedBlock) : Option [AbstractDeclarationAnnotation] = match block @@ -106,7 +106,7 @@ class ClassConstructorBlockTranslator _get_initial_spaces_with (_get_first_line (block) ) _get_initial_spaces_with (line : String) : String = - line.takeWhile ( lambda ch --> ch.isSpaceChar) + line.takeWhile (lambda ch --> ch.isSpaceChar) _get_first_line (block : AnnotatedBlock) : String = block.lines.headOption.getOrElse ("") diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda index 0412357a..1fb132d1 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda @@ -74,7 +74,7 @@ class ClassDeclarationBlockTranslator _process_after_extends (block : Block) : Seq [String] = if (get_first_line (block).trim.nonEmpty) - then Seq [String] (get_first_line (block) ) ++ remove_first_line (block).lines.map ( lambda line --> get_initial_spaces_for (line) + _tc.scala_with_translation + _tc.scala_space + line.trim) + then Seq [String] (get_first_line (block) ) ++ remove_first_line (block).lines.map (lambda line --> get_initial_spaces_for (line) + _tc.scala_with_translation + _tc.scala_space + line.trim) else Seq [String] () remove_first_line (block : Block) : Block = @@ -91,7 +91,7 @@ class ClassDeclarationBlockTranslator get_initial_spaces_for (get_first_line (block) ) get_initial_spaces_for (line : String) : String = - line.takeWhile ( lambda ch --> ch.isSpaceChar) + line.takeWhile (lambda ch --> ch.isSpaceChar) ends_with_equals (line : String) : Boolean = false diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda index 3e61e63a..2aff5a3b 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda @@ -37,7 +37,7 @@ class ClassEndBlockTranslator _get_initial_spaces_with (_get_first_line (block) ) _get_initial_spaces_with (line : String) : String = - line.takeWhile ( lambda ch --> ch.isSpaceChar) + line.takeWhile (lambda ch --> ch.isSpaceChar) _get_first_line (block : AnnotatedBlock) : String = block.lines.headOption.getOrElse ("") diff --git a/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda index 7bc6bac5..d3104546 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda @@ -61,10 +61,10 @@ class FunctionDefinitionBlockTranslator ) _get_initial_comment (lines : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = - lines.takeWhile ( lambda annotated_line --> annotated_line.is_comment ) + lines.takeWhile (lambda annotated_line --> annotated_line.is_comment ) _get_part_without_initial_comment (lines : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = - lines.dropWhile ( lambda annotated_line --> annotated_line.is_comment ) + lines.dropWhile (lambda annotated_line --> annotated_line.is_comment ) _translate_val_definition (line : String) : String = Replacement_ (line) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionLineDetector.soda b/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionLineDetector.soda index 2a2e80ca..65033e77 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionLineDetector.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionLineDetector.soda @@ -62,11 +62,11 @@ class FunctionDefinitionLineDetector _position_of_first_opening_parenthesis.isEmpty _is_val_definition_case_2 (initial_position : Int) = - _position_of_first_opening_parenthesis.opt (false) ( lambda position --> position > initial_position) + _position_of_first_opening_parenthesis.opt (false) (lambda position --> position > initial_position) _is_val_definition_case_3 = (_get_index (line) (_sc.type_membership_symbol) ).opt (ifEmpty := false) (ifNonEmpty := lambda other_position --> - _position_of_first_opening_parenthesis.opt (false) ( lambda position --> position > other_position) + _position_of_first_opening_parenthesis.opt (false) (lambda position --> position > other_position) ) _is_val_definition_case_4 = @@ -89,7 +89,7 @@ class FunctionDefinitionLineDetector _get_index_from (line : String) (pattern : String) (start : Int) : OptionSD [Int] = SomeSD_ (line.indexOf (pattern, start) ) - .filter ( lambda position --> not (position == -1) ) + .filter (lambda position --> not (position == -1) ) end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda index b711af82..1aa1b318 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda @@ -36,7 +36,7 @@ class ImportDeclarationBlockTranslator prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = BlockBuilder_ ().build ( - annotated_lines.map ( lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + annotated_lines.map (lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : String = @@ -46,7 +46,7 @@ class ImportDeclarationBlockTranslator get_number_of_spaces_at_beginning (line : String) : Int = line - .takeWhile ( lambda ch --> ch.isSpaceChar) + .takeWhile (lambda ch --> ch.isSpaceChar) .length get_first_line (block : AnnotatedBlock) : String = diff --git a/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda index 1e52a5b6..142c22de 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda @@ -39,12 +39,12 @@ class MainClassBlockTranslator _get_class_name (references : Seq [AnnotatedBlock] ) : String = _get_class_beginning (references) - .map ( lambda x --> x.class_name) + .map (lambda x --> x.class_name) .getOrElse ("") _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references - .flatMap ( lambda block --> _get_as_class_beginning_annotation (block) ) + .flatMap (lambda block --> _get_as_class_beginning_annotation (block) ) .headOption _get_as_class_beginning_annotation (block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = diff --git a/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda index 2e58e25c..d5d4c6ec 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda @@ -41,21 +41,21 @@ class MatchCaseBlockTranslator else block _is_a_match_case_structure (block : AnnotatedBlock) : Boolean = - block.lines.exists ( lambda line --> _is_a_match_line (line) ) + block.lines.exists (lambda line --> _is_a_match_line (line) ) _is_a_match_line (line : String) : Boolean = line.trim.startsWith (_soda_match_pattern) _get_tabulation_of_match (block : AnnotatedBlock) : String = block.lines - .find ( lambda line --> _is_a_match_line (line) ) - .map ( lambda line --> _left_part (line.indexOf (_soda_match_pattern) ) (line) ) + .find (lambda line --> _is_a_match_line (line) ) + .map (lambda line --> _left_part (line.indexOf (_soda_match_pattern) ) (line) ) .getOrElse (_tc.scala_space) _translate_match_case_structure (block: AnnotatedBlock) (tabulation : String) : Block = BlockBuilder_ ().build ( block.lines - .map ( lambda line --> _insert_match_before_brace_if_found (line) ) + .map (lambda line --> _insert_match_before_brace_if_found (line) ) .++ ( Seq [String] () .+: (tabulation + _tc.scala_match_end_translation) ) ) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala index 0ce50583..f98de363 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala @@ -48,7 +48,7 @@ trait AbstractDeclarationBlockTranslator def prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = Block_ ( - annotated_lines.map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + annotated_lines.map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) def prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : AnnotatedLine = @@ -148,7 +148,7 @@ trait ClassConstructorBlockTranslator private def _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references - .flatMap ( block => _get_as_class_beginning_annotation (block) ) + .flatMap ( block => _get_as_class_beginning_annotation (block) ) .headOption private def _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = @@ -159,9 +159,9 @@ trait ClassConstructorBlockTranslator private def _get_abstract_functions (references : Seq [AnnotatedBlock] ) : Seq [String] = references - .flatMap ( block => _get_as_abstract_declaration_annotation (block) ) - .flatMap ( block => block.abstract_functions) - .map ( annotated_line => _translate_type_symbols (annotated_line.line).trim ) + .flatMap ( block => _get_as_abstract_declaration_annotation (block) ) + .flatMap ( block => block.abstract_functions) + .map ( annotated_line => _translate_type_symbols (annotated_line.line).trim ) private def _get_as_abstract_declaration_annotation (block : AnnotatedBlock) : Option [AbstractDeclarationAnnotation] = block match { @@ -179,7 +179,7 @@ trait ClassConstructorBlockTranslator _get_initial_spaces_with (_get_first_line (block) ) private def _get_initial_spaces_with (line : String) : String = - line.takeWhile ( ch => ch.isSpaceChar) + line.takeWhile ( ch => ch.isSpaceChar) private def _get_first_line (block : AnnotatedBlock) : String = block.lines.headOption.getOrElse ("") @@ -265,7 +265,7 @@ trait ClassDeclarationBlockTranslator private def _process_after_extends (block : Block) : Seq [String] = if ( (get_first_line (block).trim.nonEmpty) - ) Seq [String] (get_first_line (block) ) ++ remove_first_line (block).lines.map ( line => get_initial_spaces_for (line) + _tc.scala_with_translation + _tc.scala_space + line.trim) + ) Seq [String] (get_first_line (block) ) ++ remove_first_line (block).lines.map ( line => get_initial_spaces_for (line) + _tc.scala_with_translation + _tc.scala_space + line.trim) else Seq [String] () def remove_first_line (block : Block) : Block = @@ -282,7 +282,7 @@ trait ClassDeclarationBlockTranslator get_initial_spaces_for (get_first_line (block) ) def get_initial_spaces_for (line : String) : String = - line.takeWhile ( ch => ch.isSpaceChar) + line.takeWhile ( ch => ch.isSpaceChar) def ends_with_equals (line : String) : Boolean = false @@ -338,7 +338,7 @@ trait ClassEndBlockTranslator _get_initial_spaces_with (_get_first_line (block) ) private def _get_initial_spaces_with (line : String) : String = - line.takeWhile ( ch => ch.isSpaceChar) + line.takeWhile ( ch => ch.isSpaceChar) private def _get_first_line (block : AnnotatedBlock) : String = block.lines.headOption.getOrElse ("") @@ -412,10 +412,10 @@ trait FunctionDefinitionBlockTranslator ) private def _get_initial_comment (lines : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = - lines.takeWhile ( annotated_line => annotated_line.is_comment ) + lines.takeWhile ( annotated_line => annotated_line.is_comment ) private def _get_part_without_initial_comment (lines : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = - lines.dropWhile ( annotated_line => annotated_line.is_comment ) + lines.dropWhile ( annotated_line => annotated_line.is_comment ) private def _translate_val_definition (line : String) : String = Replacement_ (line) @@ -520,11 +520,11 @@ trait FunctionDefinitionLineDetector _position_of_first_opening_parenthesis.isEmpty private def _is_val_definition_case_2 (initial_position : Int) = - _position_of_first_opening_parenthesis.opt (false) ( position => position > initial_position) + _position_of_first_opening_parenthesis.opt (false) ( position => position > initial_position) private lazy val _is_val_definition_case_3 = (_get_index (line) (_sc.type_membership_symbol) ).opt (ifEmpty = false) (ifNonEmpty = other_position => - _position_of_first_opening_parenthesis.opt (false) ( position => position > other_position) + _position_of_first_opening_parenthesis.opt (false) ( position => position > other_position) ) private lazy val _is_val_definition_case_4 = @@ -547,7 +547,7 @@ trait FunctionDefinitionLineDetector private def _get_index_from (line : String) (pattern : String) (start : Int) : OptionSD [Int] = SomeSD_ (line.indexOf (pattern, start) ) - .filter ( position => ! (position == -1) ) + .filter ( position => ! (position == -1) ) } @@ -592,7 +592,7 @@ trait ImportDeclarationBlockTranslator def prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = BlockBuilder_ ().build ( - annotated_lines.map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + annotated_lines.map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) def prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : String = @@ -602,7 +602,7 @@ trait ImportDeclarationBlockTranslator def get_number_of_spaces_at_beginning (line : String) : Int = line - .takeWhile ( ch => ch.isSpaceChar) + .takeWhile ( ch => ch.isSpaceChar) .length def get_first_line (block : AnnotatedBlock) : String = @@ -654,12 +654,12 @@ trait MainClassBlockTranslator private def _get_class_name (references : Seq [AnnotatedBlock] ) : String = _get_class_beginning (references) - .map ( x => x.class_name) + .map ( x => x.class_name) .getOrElse ("") private def _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references - .flatMap ( block => _get_as_class_beginning_annotation (block) ) + .flatMap ( block => _get_as_class_beginning_annotation (block) ) .headOption private def _get_as_class_beginning_annotation (block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = @@ -716,21 +716,21 @@ trait MatchCaseBlockTranslator else block private def _is_a_match_case_structure (block : AnnotatedBlock) : Boolean = - block.lines.exists ( line => _is_a_match_line (line) ) + block.lines.exists ( line => _is_a_match_line (line) ) private def _is_a_match_line (line : String) : Boolean = line.trim.startsWith (_soda_match_pattern) private def _get_tabulation_of_match (block : AnnotatedBlock) : String = block.lines - .find ( line => _is_a_match_line (line) ) - .map ( line => _left_part (line.indexOf (_soda_match_pattern) ) (line) ) + .find ( line => _is_a_match_line (line) ) + .map ( line => _left_part (line.indexOf (_soda_match_pattern) ) (line) ) .getOrElse (_tc.scala_space) private def _translate_match_case_structure (block: AnnotatedBlock) (tabulation : String) : Block = BlockBuilder_ ().build ( block.lines - .map ( line => _insert_match_before_brace_if_found (line) ) + .map ( line => _insert_match_before_brace_if_found (line) ) .++ ( Seq [String] () .+: (tabulation + _tc.scala_match_end_translation) ) ) @@ -1079,8 +1079,8 @@ trait TranslationConstantToScala lazy val scala_non_soda : Seq [Tuple2 [String, String] ] = scala_reserved_words - .filter ( x => ! soda_constant.soda_reserved_words.contains (x)) - .map ( x => Tuple2 (x, prefix_scala_non_soda + x) ) + .filter ( x => ! soda_constant.soda_reserved_words.contains (x)) + .map ( x => Tuple2 (x, prefix_scala_non_soda + x) ) def is_scala_word (word : String) : Boolean = scala_reserved_words.contains (word) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TranslationConstantToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/TranslationConstantToScala.soda index b67b37b0..f229bd1e 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/TranslationConstantToScala.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/TranslationConstantToScala.soda @@ -220,8 +220,8 @@ class TranslationConstantToScala scala_non_soda : Seq [Tuple2 [String, String] ] = scala_reserved_words - .filter ( lambda x --> not soda_constant.soda_reserved_words.contains (x)) - .map ( lambda x --> Tuple2 (x, prefix_scala_non_soda + x) ) + .filter (lambda x --> not soda_constant.soda_reserved_words.contains (x)) + .map (lambda x --> Tuple2 (x, prefix_scala_non_soda + x) ) is_scala_word (word : String) : Boolean = scala_reserved_words.contains (word) diff --git a/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda b/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda index cdf2a811..9775912f 100644 --- a/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda +++ b/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda @@ -27,19 +27,19 @@ class DirectoryProcessor _all_soda_files : Seq [File] = _all_files - .filter ( lambda x --> x.isFile) - .filter ( lambda x --> x.getName.endsWith (soda_suffix)) + .filter (lambda x --> x.isFile) + .filter (lambda x --> x.getName.endsWith (soda_suffix)) _package_files : Seq [File] = _all_files - .filter ( lambda x --> x.isFile) - .filter ( lambda x --> x.getName == package_file_name) + .filter (lambda x --> x.isFile) + .filter (lambda x --> x.getName == package_file_name) _sorted_package_files : Seq [File] = _package_files.sorted _soda_non_package_files : Seq [File] = _all_soda_files - .filter ( lambda x --> not (x.getName == package_file_name) ) + .filter (lambda x --> not (x.getName == package_file_name) ) _sorted_soda_non_package_files : Seq [File] = _soda_non_package_files.sorted @@ -48,14 +48,14 @@ class DirectoryProcessor _lib_files : Seq [File] = _all_files - .filter ( lambda x --> x.isFile) - .filter ( lambda file --> file.getName == LibraryDeployer_ ().library_marker_file) + .filter (lambda x --> x.isFile) + .filter (lambda file --> file.getName == LibraryDeployer_ ().library_marker_file) process () : Boolean = LibraryDeployer_ ().expand_library (_lib_files) and _soda_files .map (process_soda_file) - .forall ( lambda x --> x) + .forall (lambda x --> x) end diff --git a/translator/src/main/scala/soda/translator/io/LibraryDeployer.soda b/translator/src/main/scala/soda/translator/io/LibraryDeployer.soda index 563cf497..8b8841f9 100644 --- a/translator/src/main/scala/soda/translator/io/LibraryDeployer.soda +++ b/translator/src/main/scala/soda/translator/io/LibraryDeployer.soda @@ -16,18 +16,18 @@ class LibraryDeployer expand_library (lib_files : Seq [File] ) : Boolean = lib_files - .map ( lambda lib_file --> lib_file.getParent) - .map ( lambda parent_directory --> _expand_files (parent_directory) ) - .forall ( lambda x --> x) + .map (lambda lib_file --> lib_file.getParent) + .map (lambda parent_directory --> _expand_files (parent_directory) ) + .forall (lambda x --> x) _expand_files (parent_directory : String) : Boolean = _library_content_files - .map ( lambda lib_file_name --> + .map (lambda lib_file_name --> SimpleFileWriter_ ().write_file_with ( file := SimpleFileWriter_ ().create_file (parent_directory) (lib_file_name) ) ( content := SimpleFileReader_ ().read_resource (_library_directory_in_jar + lib_file_name) ) ) - .forall ( lambda x --> x) + .forall (lambda x --> x) end diff --git a/translator/src/main/scala/soda/translator/io/Package.scala b/translator/src/main/scala/soda/translator/io/Package.scala index f0b0e56f..897030cf 100644 --- a/translator/src/main/scala/soda/translator/io/Package.scala +++ b/translator/src/main/scala/soda/translator/io/Package.scala @@ -38,19 +38,19 @@ trait DirectoryProcessor private lazy val _all_soda_files : Seq [File] = _all_files - .filter ( x => x.isFile) - .filter ( x => x.getName.endsWith (soda_suffix)) + .filter ( x => x.isFile) + .filter ( x => x.getName.endsWith (soda_suffix)) private lazy val _package_files : Seq [File] = _all_files - .filter ( x => x.isFile) - .filter ( x => x.getName == package_file_name) + .filter ( x => x.isFile) + .filter ( x => x.getName == package_file_name) private lazy val _sorted_package_files : Seq [File] = _package_files.sorted private lazy val _soda_non_package_files : Seq [File] = _all_soda_files - .filter ( x => ! (x.getName == package_file_name) ) + .filter ( x => ! (x.getName == package_file_name) ) private lazy val _sorted_soda_non_package_files : Seq [File] = _soda_non_package_files.sorted @@ -59,14 +59,14 @@ trait DirectoryProcessor private lazy val _lib_files : Seq [File] = _all_files - .filter ( x => x.isFile) - .filter ( file => file.getName == LibraryDeployer_ ().library_marker_file) + .filter ( x => x.isFile) + .filter ( file => file.getName == LibraryDeployer_ ().library_marker_file) def process () : Boolean = LibraryDeployer_ ().expand_library (_lib_files) && _soda_files .map (process_soda_file) - .forall ( x => x) + .forall ( x => x) } @@ -129,18 +129,18 @@ trait LibraryDeployer def expand_library (lib_files : Seq [File] ) : Boolean = lib_files - .map ( lib_file => lib_file.getParent) - .map ( parent_directory => _expand_files (parent_directory) ) - .forall ( x => x) + .map ( lib_file => lib_file.getParent) + .map ( parent_directory => _expand_files (parent_directory) ) + .forall ( x => x) private def _expand_files (parent_directory : String) : Boolean = _library_content_files - .map ( lib_file_name => + .map ( lib_file_name => SimpleFileWriter_ ().write_file_with ( file = SimpleFileWriter_ ().create_file (parent_directory) (lib_file_name) ) ( content = SimpleFileReader_ ().read_resource (_library_directory_in_jar + lib_file_name) ) ) - .forall ( x => x) + .forall ( x => x) } @@ -205,10 +205,10 @@ trait SimpleFileWriter private def _write_content (writer : Writer) (content : String) : Boolean = SomeSD_ (true) - .map ( x => writer.write (content) ) - .map ( x => writer.flush () ) - .map ( x => writer.close () ) - .map ( x => true ) + .map ( x => writer.write (content) ) + .map ( x => writer.flush () ) + .map ( x => writer.close () ) + .map ( x => true ) .getOrElse (false) def create_file (parent_directory : String) (file_name : String) : File = diff --git a/translator/src/main/scala/soda/translator/io/SimpleIO.soda b/translator/src/main/scala/soda/translator/io/SimpleIO.soda index 91f92db6..2ae8a4b2 100644 --- a/translator/src/main/scala/soda/translator/io/SimpleIO.soda +++ b/translator/src/main/scala/soda/translator/io/SimpleIO.soda @@ -55,10 +55,10 @@ class SimpleFileWriter _write_content (writer : Writer) (content : String) : Boolean = SomeSD_ (true) - .map ( lambda x --> writer.write (content) ) - .map ( lambda x --> writer.flush () ) - .map ( lambda x --> writer.close () ) - .map ( lambda x --> true ) + .map (lambda x --> writer.write (content) ) + .map (lambda x --> writer.flush () ) + .map (lambda x --> writer.close () ) + .map (lambda x --> true ) .getOrElse (false) create_file (parent_directory : String) (file_name : String) : File = diff --git a/translator/src/main/scala/soda/translator/parser/BlockProcessor.soda b/translator/src/main/scala/soda/translator/parser/BlockProcessor.soda index b01377b9..b7415bb0 100644 --- a/translator/src/main/scala/soda/translator/parser/BlockProcessor.soda +++ b/translator/src/main/scala/soda/translator/parser/BlockProcessor.soda @@ -30,8 +30,8 @@ class BlockProcessor join_translated_blocks ( translator_with_preprocessor.translate ( split_blocks (program) - .map ( lambda block --> process_unicode_symbols_in_block (block) ) - .map ( lambda block --> make_block (block) ) + .map (lambda block --> process_unicode_symbols_in_block (block) ) + .map (lambda block --> make_block (block) ) ) ) @@ -43,7 +43,7 @@ class BlockProcessor process_unicode_symbols_in_block (block : String) : String = Tokenizer_ (block) .tokens - .map ( lambda token --> process_unicode_symbols_in_token (token) ) + .map (lambda token --> process_unicode_symbols_in_token (token) ) .mkString process_unicode_symbols_in_token (token : Token) : String = @@ -60,7 +60,7 @@ class BlockProcessor .line make_blocks (blocks: Seq [String] ) : Seq[AnnotatedBlock] = - blocks.map ( lambda paragraph --> make_block (paragraph) ) + blocks.map (lambda paragraph --> make_block (paragraph) ) make_block (paragraph : String) : AnnotatedBlock = AnnotationFactory_ ().annotate ( @@ -71,12 +71,12 @@ class BlockProcessor join_translated_blocks (blocks : Seq [AnnotatedBlock] ) : String = blocks - .map ( lambda x --> x.contents) + .map (lambda x --> x.contents) .mkString (double_new_line) + new_line remove_empty_lines (lines : Seq [String] ) : Seq [String] = lines - .filter ( lambda line --> line.trim.nonEmpty) + .filter (lambda line --> line.trim.nonEmpty) end diff --git a/translator/src/main/scala/soda/translator/parser/Package.scala b/translator/src/main/scala/soda/translator/parser/Package.scala index ff3e58f8..98c7f0b5 100644 --- a/translator/src/main/scala/soda/translator/parser/Package.scala +++ b/translator/src/main/scala/soda/translator/parser/Package.scala @@ -104,8 +104,8 @@ trait BlockProcessor join_translated_blocks ( translator_with_preprocessor.translate ( split_blocks (program) - .map ( block => process_unicode_symbols_in_block (block) ) - .map ( block => make_block (block) ) + .map ( block => process_unicode_symbols_in_block (block) ) + .map ( block => make_block (block) ) ) ) @@ -117,7 +117,7 @@ trait BlockProcessor def process_unicode_symbols_in_block (block : String) : String = Tokenizer_ (block) .tokens - .map ( token => process_unicode_symbols_in_token (token) ) + .map ( token => process_unicode_symbols_in_token (token) ) .mkString def process_unicode_symbols_in_token (token : Token) : String = @@ -134,7 +134,7 @@ trait BlockProcessor .line def make_blocks (blocks: Seq [String] ) : Seq[AnnotatedBlock] = - blocks.map ( paragraph => make_block (paragraph) ) + blocks.map ( paragraph => make_block (paragraph) ) def make_block (paragraph : String) : AnnotatedBlock = AnnotationFactory_ ().annotate ( @@ -145,12 +145,12 @@ trait BlockProcessor def join_translated_blocks (blocks : Seq [AnnotatedBlock] ) : String = blocks - .map ( x => x.contents) + .map ( x => x.contents) .mkString (double_new_line) + new_line def remove_empty_lines (lines : Seq [String] ) : Seq [String] = lines - .filter ( line => line.trim.nonEmpty) + .filter ( line => line.trim.nonEmpty) } @@ -196,7 +196,7 @@ trait PreprocessorSequenceTranslator ) private def _get_first_pass (block_sequence : Seq [AnnotatedBlock] ) : Seq [AnnotatedBlock] = - block_sequence.map ( block => block_annotator.translate (block) ) + block_sequence.map ( block => block_annotator.translate (block) ) private def _get_second_pass (block_sequence : Seq [AnnotatedBlock] ) : Seq [AnnotatedBlock] = _fold.apply (block_sequence.indices) (_get_second_pass_initial_value (block_sequence) ) (_get_second_pass_next_value_function) diff --git a/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda b/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda index 752a36bd..26766722 100644 --- a/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda +++ b/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda @@ -39,7 +39,7 @@ class PreprocessorSequenceTranslator ) _get_first_pass (block_sequence : Seq [AnnotatedBlock] ) : Seq [AnnotatedBlock] = - block_sequence.map ( lambda block --> block_annotator.translate (block) ) + block_sequence.map (lambda block --> block_annotator.translate (block) ) _get_second_pass (block_sequence : Seq [AnnotatedBlock] ) : Seq [AnnotatedBlock] = _fold.apply (block_sequence.indices) (_get_second_pass_initial_value (block_sequence) ) (_get_second_pass_next_value_function) diff --git a/translator/src/main/scala/soda/translator/parser/annotation/AbstractDeclarationAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/AbstractDeclarationAnnotation.soda index 14d0da73..b851dc61 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/AbstractDeclarationAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/AbstractDeclarationAnnotation.soda @@ -23,7 +23,7 @@ class AbstractDeclarationAnnotation abstract_functions : Seq [AnnotatedLine] = abstract_functions_with_comments - .filter ( lambda line --> not line.is_comment) + .filter (lambda line --> not line.is_comment) end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda b/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda index 3a048799..6d0c200e 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda @@ -55,7 +55,7 @@ class AnnotationFactory _find_candidates (block : Block) : Seq [BlockAnnotationParser] = _detectors (block) - .filter ( lambda detector --> detector.applies) + .filter (lambda detector --> detector.applies) _get_first_or_undefined (candidates : Seq [BlockAnnotationParser] ) (block : Block) : AnnotatedBlock = if candidates.length == 1 diff --git a/translator/src/main/scala/soda/translator/parser/annotation/BlockAnnotationParser.soda b/translator/src/main/scala/soda/translator/parser/annotation/BlockAnnotationParser.soda index 46aae4a3..724c80e2 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/BlockAnnotationParser.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/BlockAnnotationParser.soda @@ -34,7 +34,7 @@ class BlockAnnotationParser block .annotated_lines .tail - .filter ( lambda x -> not x.line.trim.isEmpty) + .filter (lambda x -> not x.line.trim.isEmpty) first_readable_line : AnnotatedLine = block.readable_lines.headOption.getOrElse (default_annotated_line) diff --git a/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda index 3ec770ec..6895af56 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda @@ -34,12 +34,12 @@ class ClassBeginningAnnotation remove_brackets (skip_first_word (_class_name_and_type_parameters) ) .split (sc.parameter_separator_symbol) .toIndexedSeq - .map ( lambda parameter --> parameter.trim) - .filter ( lambda parameter --> not parameter.isEmpty) + .map (lambda parameter --> parameter.trim) + .filter (lambda parameter --> not parameter.isEmpty) type_parameters : Seq [String] = type_parameters_and_bounds - .map ( lambda parameter --> get_first_word (parameter) ) + .map (lambda parameter --> get_first_word (parameter) ) remove_brackets (text : String) : String = remove_brackets_with (text.trim) diff --git a/translator/src/main/scala/soda/translator/parser/annotation/CommentAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/CommentAnnotation.soda index 422e1a35..2ab72f35 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/CommentAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/CommentAnnotation.soda @@ -14,7 +14,7 @@ class CommentAnnotation applies : Boolean = block .annotated_lines - .forall ( lambda annotated_line --> annotated_line.is_comment) + .forall (lambda annotated_line --> annotated_line.is_comment) end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/FunctionDefinitionAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/FunctionDefinitionAnnotation.soda index 44b2c26d..e5e2ba53 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/FunctionDefinitionAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/FunctionDefinitionAnnotation.soda @@ -36,13 +36,13 @@ class FunctionDefinitionAnnotation contains_the_equals_symbol : Boolean = block.readable_lines.nonEmpty and block.readable_lines - .filter ( lambda annotated_line --> not annotated_line.is_comment) - .exists ( lambda annotated_line --> _contains_the_equals_symbol_in_line (annotated_line.line) ) + .filter (lambda annotated_line --> not annotated_line.is_comment) + .exists (lambda annotated_line --> _contains_the_equals_symbol_in_line (annotated_line.line) ) _contains_the_equals_symbol_in_line (line : String) : Boolean = Tokenizer_ (line) .tokens - .exists ( lambda token --> + .exists (lambda token --> token.parser_state == _plain_state and _contains_the_equals_symbol_in_token (token.text) ) diff --git a/translator/src/main/scala/soda/translator/parser/annotation/Package.scala b/translator/src/main/scala/soda/translator/parser/annotation/Package.scala index b0f9deb1..29fd613f 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/Package.scala +++ b/translator/src/main/scala/soda/translator/parser/annotation/Package.scala @@ -29,7 +29,7 @@ trait AbstractDeclarationAnnotation lazy val abstract_functions : Seq [AnnotatedLine] = abstract_functions_with_comments - .filter ( line => ! line.is_comment) + .filter ( line => ! line.is_comment) } @@ -94,7 +94,7 @@ trait AnnotationFactory private def _find_candidates (block : Block) : Seq [BlockAnnotationParser] = _detectors (block) - .filter ( detector => detector.applies) + .filter ( detector => detector.applies) private def _get_first_or_undefined (candidates : Seq [BlockAnnotationParser] ) (block : Block) : AnnotatedBlock = if ( candidates.length == 1 @@ -140,7 +140,7 @@ trait BlockAnnotationParser block .annotated_lines .tail - .filter ( x => ! x.line.trim.isEmpty) + .filter ( x => ! x.line.trim.isEmpty) lazy val first_readable_line : AnnotatedLine = block.readable_lines.headOption.getOrElse (default_annotated_line) @@ -226,12 +226,12 @@ trait ClassBeginningAnnotation remove_brackets (skip_first_word (_class_name_and_type_parameters) ) .split (sc.parameter_separator_symbol) .toIndexedSeq - .map ( parameter => parameter.trim) - .filter ( parameter => ! parameter.isEmpty) + .map ( parameter => parameter.trim) + .filter ( parameter => ! parameter.isEmpty) lazy val type_parameters : Seq [String] = type_parameters_and_bounds - .map ( parameter => get_first_word (parameter) ) + .map ( parameter => get_first_word (parameter) ) def remove_brackets (text : String) : String = remove_brackets_with (text.trim) @@ -285,7 +285,7 @@ trait CommentAnnotation lazy val applies : Boolean = block .annotated_lines - .forall ( annotated_line => annotated_line.is_comment) + .forall ( annotated_line => annotated_line.is_comment) } @@ -328,13 +328,13 @@ trait FunctionDefinitionAnnotation lazy val contains_the_equals_symbol : Boolean = block.readable_lines.nonEmpty && block.readable_lines - .filter ( annotated_line => ! annotated_line.is_comment) - .exists ( annotated_line => _contains_the_equals_symbol_in_line (annotated_line.line) ) + .filter ( annotated_line => ! annotated_line.is_comment) + .exists ( annotated_line => _contains_the_equals_symbol_in_line (annotated_line.line) ) private def _contains_the_equals_symbol_in_line (line : String) : Boolean = Tokenizer_ (line) .tokens - .exists ( token => + .exists ( token => token.parser_state == _plain_state && _contains_the_equals_symbol_in_token (token.text) ) diff --git a/translator/src/main/scala/soda/translator/replacement/Package.scala b/translator/src/main/scala/soda/translator/replacement/Package.scala index 4344cdb1..3f951ec4 100644 --- a/translator/src/main/scala/soda/translator/replacement/Package.scala +++ b/translator/src/main/scala/soda/translator/replacement/Package.scala @@ -258,7 +258,7 @@ trait ReplacementAux def add_spaces_to_symbols (line : String) (symbols : Set [Char] ) : String = line .indices - .map ( index => _add_spaces_to_symbols_with (line (index) ) (index ) (line) (symbols) ) + .map ( index => _add_spaces_to_symbols_with (line (index) ) (index ) (line) (symbols) ) .mkString ("") private def _add_spaces_to_symbols_with (ch : Char) (index : Int) (line : String) (symbols : Set [Char] ) : String = @@ -298,7 +298,7 @@ trait ReplacementAux private def _get_prefix_length (line : String) (pattern : String) : Int = if ( line.trim.startsWith (pattern) ) line.indexOf (pattern) + pattern.length - else line.takeWhile ( ch => ch.isSpaceChar).length + else line.takeWhile ( ch => ch.isSpaceChar).length } diff --git a/translator/src/main/scala/soda/translator/replacement/Replacement.soda b/translator/src/main/scala/soda/translator/replacement/Replacement.soda index 9c6c7bfc..5bbee689 100644 --- a/translator/src/main/scala/soda/translator/replacement/Replacement.soda +++ b/translator/src/main/scala/soda/translator/replacement/Replacement.soda @@ -65,7 +65,7 @@ class ReplacementAux add_spaces_to_symbols (line : String) (symbols : Set [Char] ) : String = line .indices - .map ( lambda index --> _add_spaces_to_symbols_with (line (index) ) (index ) (line) (symbols) ) + .map (lambda index --> _add_spaces_to_symbols_with (line (index) ) (index ) (line) (symbols) ) .mkString ("") _add_spaces_to_symbols_with (ch : Char) (index : Int) (line : String) (symbols : Set [Char] ) : String = @@ -105,7 +105,7 @@ class ReplacementAux _get_prefix_length (line : String) (pattern : String) : Int = if line.trim.startsWith (pattern) then line.indexOf (pattern) + pattern.length - else line.takeWhile ( lambda ch --> ch.isSpaceChar).length + else line.takeWhile (lambda ch --> ch.isSpaceChar).length end diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.scala b/translator/src/test/resources/soda/translator/documentation/Manual.scala index b469ccd8..83e41065 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.scala +++ b/translator/src/test/resources/soda/translator/documentation/Manual.scala @@ -212,12 +212,12 @@ trait Manual * Lambda functions are declared with `lambda` and a long right arrow (`-->`). */ def plus_one (sequence : Seq [Int] ) : Seq [Int] = - sequence.map ( element => element + 1) + sequence.map ( element => element + 1) /* A synonym for `lambda` is `any`, which sometimes brings more readability. */ def plus_two (sequence : Seq [Int] ) : Seq [Int] = - sequence.map ( element => element + 2) + sequence.map ( element => element + 2) /* Boolean values `false` and `true` are available. */ @@ -292,7 +292,7 @@ trait FoldWhile import scala.annotation.tailrec @tailrec final private def _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = - if ( sequence.isEmpty || ( ! condition (current_value) (sequence.head) ) + if ( sequence.isEmpty || (! condition (current_value) (sequence.head) ) ) current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.soda b/translator/src/test/resources/soda/translator/documentation/Manual.soda index 6b222fea..791c6143 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.soda +++ b/translator/src/test/resources/soda/translator/documentation/Manual.soda @@ -186,12 +186,12 @@ class Manual * Lambda functions are declared with `lambda` and a long right arrow (`-->`). */ plus_one (sequence : Seq [Int] ) : Seq [Int] = - sequence.map ( lambda element --> element + 1) + sequence.map (lambda element --> element + 1) /* A synonym for `lambda` is `any`, which sometimes brings more readability. */ plus_two (sequence : Seq [Int] ) : Seq [Int] = - sequence.map ( any element --> element + 2) + sequence.map (any element --> element + 2) /* Boolean values `false` and `true` are available. */ @@ -256,7 +256,7 @@ class FoldWhile @tailrec _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - if sequence.isEmpty or ( not condition (current_value) (sequence.head) ) + if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.tex b/translator/src/test/resources/soda/translator/documentation/Manual.tex index 2b1f812b..792f31ed 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.tex +++ b/translator/src/test/resources/soda/translator/documentation/Manual.tex @@ -332,7 +332,7 @@ plus_one (sequence : Seq [Int] ) : Seq [Int] = - sequence.map ( lambda element --> element + 1) + sequence.map (lambda element --> element + 1) \end{lstlisting} @@ -344,7 +344,7 @@ plus_two (sequence : Seq [Int] ) : Seq [Int] = - sequence.map ( any element --> element + 2) + sequence.map (any element --> element + 2) \end{lstlisting} @@ -442,7 +442,7 @@ @tailrec _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - if sequence.isEmpty or ( not condition (current_value) (sequence.head) ) + if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.scala b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.scala index 27b904ff..e4a255f6 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.scala +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.scala @@ -9,7 +9,7 @@ trait FizzBuzz lazy val apply : Seq [String] = _range.apply (100) - .map ( (x : Int) => x + 1) + .map ( (x : Int) => x + 1) .map (_get_fizz_buzz_term) private def _get_fizz_buzz_term (n : Int) : String = diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.soda b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.soda index 8ffcf06e..b1326734 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.soda @@ -9,7 +9,7 @@ class FizzBuzz apply : Seq [String] = _range.apply (100) - .map ( lambda (x : Int) --> x + 1) + .map (lambda (x : Int) --> x + 1) .map (_get_fizz_buzz_term) _get_fizz_buzz_term (n : Int) : String = diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda index dee9d93b..361ab4b8 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda @@ -9,7 +9,7 @@ class FizzBuzzPatternMatching apply : Seq [String] = _range.apply (100) - .map ( lambda (x : Int) --> x + 1) + .map (lambda (x : Int) --> x + 1) .map (_get_fizz_buzz_term) _get_fizz_buzz_term (n : Int) : String = diff --git a/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.scala b/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.scala index 5978c48e..f0715fac 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.scala +++ b/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.scala @@ -17,7 +17,7 @@ trait SaladMaker (next_ingredient_function : Salad => Ingredient => Salad) (condition_to_continue : Salad => Ingredient => Boolean) : Salad = - if ( ingredients_so_far.isEmpty || ( ! condition_to_continue (salad_so_far) (ingredients_so_far.head) ) + if ( ingredients_so_far.isEmpty || (! condition_to_continue (salad_so_far) (ingredients_so_far.head) ) ) salad_so_far else _tailrec_prepare_salad (ingredients_so_far.tail) (next_ingredient_function (salad_so_far) (ingredients_so_far.head) ) (next_ingredient_function) (condition_to_continue) diff --git a/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda b/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda index c04b7652..b76f18d1 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda @@ -16,7 +16,7 @@ class SaladMaker (next_ingredient_function : Salad -> Ingredient -> Salad) (condition_to_continue : Salad -> Ingredient -> Boolean) : Salad = - if ingredients_so_far.isEmpty or ( not condition_to_continue (salad_so_far) (ingredients_so_far.head) ) + if ingredients_so_far.isEmpty or (not condition_to_continue (salad_so_far) (ingredients_so_far.head) ) then salad_so_far else _tailrec_prepare_salad (ingredients_so_far.tail) (next_ingredient_function (salad_so_far) (ingredients_so_far.head) ) (next_ingredient_function) (condition_to_continue) diff --git a/translator/src/test/resources/soda/translator/example/algorithms/SortExample.soda b/translator/src/test/resources/soda/translator/example/algorithms/SortExample.soda index 05125dfc..27f7f374 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/SortExample.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/SortExample.soda @@ -16,8 +16,8 @@ class SortExampleWithAt is_sorted_for (sequence : Seq [Int] ) : Boolean = sequence .indices - .filter ( lambda index --> index > 0) - .forall ( lambda index --> sequence.apply (index - 1) <= sequence.apply (index) ) + .filter (lambda index --> index > 0) + .forall (lambda index --> sequence.apply (index - 1) <= sequence.apply (index) ) end @@ -31,7 +31,7 @@ class SortExampleWithZip is_sorted_for (sequence : Seq [Int] ) : Boolean = sequence .zip (sequence.tail) - .forall ( lambda pair --> (pair._1 <= pair._2) ) + .forall (lambda pair --> (pair._1 <= pair._2) ) end @@ -66,9 +66,9 @@ class SortAlgorithmExampleWithFold insert_sorted (sequence : Seq [Int] ) (element : Int) : Seq [Int] = concatenate ( - first_part := sequence.takeWhile ( lambda x --> x < element) ) ( + first_part := sequence.takeWhile (lambda x --> x < element) ) ( middle := Seq (element) ) ( - last_part := sequence.dropWhile ( lambda x --> x < element) + last_part := sequence.dropWhile (lambda x --> x < element) ) concatenate (first_part : Seq [Int] ) (middle : Seq [Int] ) (last_part : Seq [Int] ) : Seq [Int] = @@ -156,13 +156,13 @@ class NonEmptySortedSequenceAux [A subtype Comparable [A] ] is_sorted (other_sequence : Seq [A] ) : Boolean = other_sequence .zip (other_sequence.tail) - .forall ( lambda pair --> is_less_than (pair._1) (pair._2) ) + .forall (lambda pair --> is_less_than (pair._1) (pair._2) ) insert_sorted (original_sequence : Seq [A] ) (element : A) : Seq [A] = concatenate ( - first_part := original_sequence.takeWhile ( lambda x --> is_less_than (x) (element) ) ) ( + first_part := original_sequence.takeWhile (lambda x --> is_less_than (x) (element) ) ) ( middle := Seq (element) ) ( - last_part := original_sequence.dropWhile ( lambda x --> is_less_than (x) (element) ) + last_part := original_sequence.dropWhile (lambda x --> is_less_than (x) (element) ) ) concatenate (first_part : Seq [A] ) (middle : Seq [A] ) (last_part : Seq [A] ) : Seq [A] = diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda index bf157075..b9368b1c 100644 --- a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda +++ b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda @@ -28,7 +28,7 @@ class Requirement3Monitor sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight).segments) (date_in_days) ) get_prices_of_segments (customer : Customer) (segments : Seq [Segment] ) (date_in_days : Int) : Seq [Int] = - segments.map ( lambda segment --> get_price (customer) (segment) (date_in_days) ) + segments.map (lambda segment --> get_price (customer) (segment) (date_in_days) ) sum_prices (prices : Seq [Int] ) : Int = prices.sum diff --git a/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda b/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda index eb562420..88a14fec 100644 --- a/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda +++ b/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda @@ -9,7 +9,7 @@ class RecursionForCoq _tailrec_fold4 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = match sequence case (head) :: (tail) ==> - if ( not (condition (current_value) (head) ) ) + if (not (condition (current_value) (head) ) ) then current_value else _tailrec_fold4 (tail) (next_value_function (current_value) (head)) (next_value_function) (condition) case x ==> current_value diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala index d350856e..02032bc3 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala +++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala @@ -6,7 +6,7 @@ trait FactorialWithFold private lazy val _range = soda.lib.Range_ () def apply (n : Int) : Int = - _fold.apply (_range.apply (n) ) (1) ( product => k => (product * (k + 1) ) ) + _fold.apply (_range.apply (n) ) (1) ( product => k => (product * (k + 1) ) ) } diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda index f9215b62..e47e3d0a 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda +++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda @@ -6,7 +6,7 @@ class FactorialWithFold _range = soda.lib.Range_ () apply (n : Int) : Int = - _fold.apply (_range.apply (n) ) (1) ( any product --> any k --> (product * (k + 1) ) ) + _fold.apply (_range.apply (n) ) (1) (any product --> any k --> (product * (k + 1) ) ) end diff --git a/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.scala b/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.scala index 2319b36d..972a35a8 100644 --- a/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.scala +++ b/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.scala @@ -7,7 +7,7 @@ trait MiniExample def run () : Seq [Unit] = _range.apply (50) - .map ( x => print (" " + (2 * x + 1) ) ) + .map ( x => print (" " + (2 * x + 1) ) ) } diff --git a/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.soda b/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.soda index 6732873a..69ef7143 100644 --- a/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.soda +++ b/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.soda @@ -8,7 +8,7 @@ class MiniExample run () : Seq [Unit] = _range.apply (50) - .map ( any x --> print (" " + (2 * x + 1) ) ) + .map (any x --> print (" " + (2 * x + 1) ) ) end diff --git a/translator/src/test/scala/soda/lib/EnumSpec.soda b/translator/src/test/scala/soda/lib/EnumSpec.soda index d1ae9d1c..ec7a92eb 100644 --- a/translator/src/test/scala/soda/lib/EnumSpec.soda +++ b/translator/src/test/scala/soda/lib/EnumSpec.soda @@ -46,7 +46,7 @@ class EnumSpec () test ("the names of the elements in enumerations") ( check ( - obtained := DayOfTheWeekEnum_ ().values.map ( lambda x --> x.toString) + obtained := DayOfTheWeekEnum_ ().values.map (lambda x --> x.toString) ) ( expected := Seq ("DayOfTheWeek_(0,Sunday)", "DayOfTheWeek_(1,Monday)", "DayOfTheWeek_(2,Tuesday)", "DayOfTheWeek_(3,Wednesday)", "DayOfTheWeek_(4,Thursday)", "DayOfTheWeek_(5,Friday)", "DayOfTheWeek_(6,Saturday)") ) diff --git a/translator/src/test/scala/soda/lib/OptionSDSpec.soda b/translator/src/test/scala/soda/lib/OptionSDSpec.soda index be15c977..9eb3c2f0 100644 --- a/translator/src/test/scala/soda/lib/OptionSDSpec.soda +++ b/translator/src/test/scala/soda/lib/OptionSDSpec.soda @@ -190,7 +190,7 @@ class OptionSDSpec () test ("filter should work for None") ( check ( - obtained := (NoneSD_ [Int] () ).filter ( lambda x --> true) + obtained := (NoneSD_ [Int] () ).filter (lambda x --> true) ) ( expected := NoneSD_ [Int] () ) @@ -198,7 +198,7 @@ class OptionSDSpec () test ("filter should work for Some, if predicate does not hold") ( check ( - obtained := (SomeSD_ [Int] (0) ).filter ( lambda x --> x > 0) + obtained := (SomeSD_ [Int] (0) ).filter (lambda x --> x > 0) ) ( expected := NoneSD_ [Int] () ) @@ -206,7 +206,7 @@ class OptionSDSpec () test ("filter should work for Some, if predicate holds") ( check ( - obtained := (SomeSD_ [Int] (1) ).filter ( lambda x --> x > 0) + obtained := (SomeSD_ [Int] (1) ).filter (lambda x --> x > 0) ) ( expected := SomeSD_ [Int] (1) ) diff --git a/translator/src/test/scala/soda/lib/Package.scala b/translator/src/test/scala/soda/lib/Package.scala index 8dc829c0..0369a4df 100644 --- a/translator/src/test/scala/soda/lib/Package.scala +++ b/translator/src/test/scala/soda/lib/Package.scala @@ -135,7 +135,7 @@ case class EnumSpec () test ("the names of the elements in enumerations") ( check ( - obtained = DayOfTheWeekEnum_ ().values.map ( x => x.toString) + obtained = DayOfTheWeekEnum_ ().values.map ( x => x.toString) ) ( expected = Seq ("DayOfTheWeek_(0,Sunday)", "DayOfTheWeek_(1,Monday)", "DayOfTheWeek_(2,Tuesday)", "DayOfTheWeek_(3,Wednesday)", "DayOfTheWeek_(4,Thursday)", "DayOfTheWeek_(5,Friday)", "DayOfTheWeek_(6,Saturday)") ) @@ -335,7 +335,7 @@ case class OptionSDSpec () test ("filter should work for None") ( check ( - obtained = (NoneSD_ [Int] () ).filter ( x => true) + obtained = (NoneSD_ [Int] () ).filter ( x => true) ) ( expected = NoneSD_ [Int] () ) @@ -343,7 +343,7 @@ case class OptionSDSpec () test ("filter should work for Some, if predicate does not hold") ( check ( - obtained = (SomeSD_ [Int] (0) ).filter ( x => x > 0) + obtained = (SomeSD_ [Int] (0) ).filter ( x => x > 0) ) ( expected = NoneSD_ [Int] () ) @@ -351,7 +351,7 @@ case class OptionSDSpec () test ("filter should work for Some, if predicate holds") ( check ( - obtained = (SomeSD_ [Int] (1) ).filter ( x => x > 0) + obtained = (SomeSD_ [Int] (1) ).filter ( x => x > 0) ) ( expected = SomeSD_ [Int] (1) ) diff --git a/translator/src/test/scala/soda/translator/io/DirectoryScannerSpec.soda b/translator/src/test/scala/soda/translator/io/DirectoryScannerSpec.soda index 1f69ce82..b859590f 100644 --- a/translator/src/test/scala/soda/translator/io/DirectoryScannerSpec.soda +++ b/translator/src/test/scala/soda/translator/io/DirectoryScannerSpec.soda @@ -37,7 +37,7 @@ class DirectoryScannerSpec () "otherexample/OtherExample.txt", "otherexample/Package.scala", "otherexample/Package.soda" - ).map ( lambda x --> @new File (start, x) ).toSet + ).map (lambda x --> @new File (start, x) ).toSet ) ) diff --git a/translator/src/test/scala/soda/translator/io/Package.scala b/translator/src/test/scala/soda/translator/io/Package.scala index 2d485be8..43787091 100644 --- a/translator/src/test/scala/soda/translator/io/Package.scala +++ b/translator/src/test/scala/soda/translator/io/Package.scala @@ -44,7 +44,7 @@ case class DirectoryScannerSpec () "otherexample/OtherExample.txt", "otherexample/Package.scala", "otherexample/Package.soda" - ).map ( x => new File (start, x) ).toSet + ).map ( x => new File (start, x) ).toSet ) ) diff --git a/translator/src/test/scala/soda/translator/parser/Package.scala b/translator/src/test/scala/soda/translator/parser/Package.scala index dc948be2..dff4d45e 100644 --- a/translator/src/test/scala/soda/translator/parser/Package.scala +++ b/translator/src/test/scala/soda/translator/parser/Package.scala @@ -85,6 +85,7 @@ case class PreprocessorSequenceTranslatorSpec () "\n" + "\n process (sequence : Seq [Int]) : Seq [Int] =" + "\n sequence" + + "\n .map (\u03BB elem \u27F6 my_function (x \u2254 elem) (y \u2254 my_constant) )" + "\n .map ( \u03BB elem \u27F6 my_function (x \u2254 elem) (y \u2254 my_constant) )" + "\n" + "\n my_xor (x : Boolean) (y : Boolean) : Boolean =" + @@ -135,6 +136,7 @@ case class PreprocessorSequenceTranslatorSpec () "\n" + "\n process (sequence : Seq [Int]) : Seq [Int] =" + "\n sequence" + + "\n .map (lambda elem --> my_function (x := elem) (y := my_constant) )" + "\n .map ( lambda elem --> my_function (x := elem) (y := my_constant) )" + "\n" + "\n my_xor (x : Boolean) (y : Boolean) : Boolean =" + diff --git a/translator/src/test/scala/soda/translator/parser/PreprocessorSequenceTranslatorSpec.soda b/translator/src/test/scala/soda/translator/parser/PreprocessorSequenceTranslatorSpec.soda index ef55823a..435e4167 100644 --- a/translator/src/test/scala/soda/translator/parser/PreprocessorSequenceTranslatorSpec.soda +++ b/translator/src/test/scala/soda/translator/parser/PreprocessorSequenceTranslatorSpec.soda @@ -38,6 +38,7 @@ class PreprocessorSequenceTranslatorSpec () "\n" + "\n process (sequence : Seq [Int]) : Seq [Int] =" + "\n sequence" + + "\n .map (\u03BB elem \u27F6 my_function (x \u2254 elem) (y \u2254 my_constant) )" + "\n .map ( \u03BB elem \u27F6 my_function (x \u2254 elem) (y \u2254 my_constant) )" + "\n" + "\n my_xor (x : Boolean) (y : Boolean) : Boolean =" + @@ -88,6 +89,7 @@ class PreprocessorSequenceTranslatorSpec () "\n" + "\n process (sequence : Seq [Int]) : Seq [Int] =" + "\n sequence" + + "\n .map (lambda elem --> my_function (x := elem) (y := my_constant) )" + "\n .map ( lambda elem --> my_function (x := elem) (y := my_constant) )" + "\n" + "\n my_xor (x : Boolean) (y : Boolean) : Boolean =" + diff --git a/translator/src/test/scala/soda/translator/parser/annotation/BlockAnnotationSpec.soda b/translator/src/test/scala/soda/translator/parser/annotation/BlockAnnotationSpec.soda index 8415e4f9..6e033c14 100644 --- a/translator/src/test/scala/soda/translator/parser/annotation/BlockAnnotationSpec.soda +++ b/translator/src/test/scala/soda/translator/parser/annotation/BlockAnnotationSpec.soda @@ -31,7 +31,7 @@ class BlockAnnotationSpec () ) apply_detectors (block : Block) : Seq [Boolean] = - detectors (block).map ( lambda detector --> detector.applies) + detectors (block).map (lambda detector --> detector.applies) test ("should detect a package declaration") ( check ( @@ -147,7 +147,7 @@ class BlockAnnotationSpec () test ("should be ordered by the identifier ordinal") ( check ( - obtained := detectors (example_blocks (0) ).map ( lambda detector --> detector.identifier.ordinal) + obtained := detectors (example_blocks (0) ).map (lambda detector --> detector.identifier.ordinal) ) ( expected := Seq [Int] (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) ) diff --git a/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda b/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda index e133d678..992213f3 100644 --- a/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda +++ b/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda @@ -65,7 +65,7 @@ class ClassBeginningAnnotationSpec () test ("should find the right block for ClassBeginningAnnotation") ( check ( - obtained := example_blocks.map ( lambda block --> ClassBeginningAnnotation_ (block).applies ) + obtained := example_blocks.map (lambda block --> ClassBeginningAnnotation_ (block).applies ) ) ( expected := Seq [Boolean] (false, false, true, false, false, false, false, false, false, false, false, false, false) ) diff --git a/translator/src/test/scala/soda/translator/parser/annotation/Package.scala b/translator/src/test/scala/soda/translator/parser/annotation/Package.scala index 4737ccf7..7ff1cf12 100644 --- a/translator/src/test/scala/soda/translator/parser/annotation/Package.scala +++ b/translator/src/test/scala/soda/translator/parser/annotation/Package.scala @@ -38,7 +38,7 @@ case class BlockAnnotationSpec () ) def apply_detectors (block : Block) : Seq [Boolean] = - detectors (block).map ( detector => detector.applies) + detectors (block).map ( detector => detector.applies) test ("should detect a package declaration") ( check ( @@ -154,7 +154,7 @@ case class BlockAnnotationSpec () test ("should be ordered by the identifier ordinal") ( check ( - obtained = detectors (example_blocks (0) ).map ( detector => detector.identifier.ordinal) + obtained = detectors (example_blocks (0) ).map ( detector => detector.identifier.ordinal) ) ( expected = Seq [Int] (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) ) @@ -229,7 +229,7 @@ case class ClassBeginningAnnotationSpec () test ("should find the right block for ClassBeginningAnnotation") ( check ( - obtained = example_blocks.map ( block => ClassBeginningAnnotation_ (block).applies ) + obtained = example_blocks.map ( block => ClassBeginningAnnotation_ (block).applies ) ) ( expected = Seq [Boolean] (false, false, true, false, false, false, false, false, false, false, false, false, false) ) diff --git a/translator/src/test/scala/soda/translator/replacement/CharTypeSpec.soda b/translator/src/test/scala/soda/translator/replacement/CharTypeSpec.soda index a04953bf..63869a7e 100644 --- a/translator/src/test/scala/soda/translator/replacement/CharTypeSpec.soda +++ b/translator/src/test/scala/soda/translator/replacement/CharTypeSpec.soda @@ -42,7 +42,7 @@ class CharTypeSpec () check ( obtained := "This is plain text with symbols. 0123456789 _ . !?" - .map ( lambda ch --> CharTypeEnum_ ().get_char_type (ch) ) + .map (lambda ch --> CharTypeEnum_ ().get_char_type (ch) ) .toSet .toSeq ) ( diff --git a/translator/src/test/scala/soda/translator/replacement/Package.scala b/translator/src/test/scala/soda/translator/replacement/Package.scala index 1d7ba888..2c777dc4 100644 --- a/translator/src/test/scala/soda/translator/replacement/Package.scala +++ b/translator/src/test/scala/soda/translator/replacement/Package.scala @@ -50,7 +50,7 @@ case class CharTypeSpec () check ( obtained = "This is plain text with symbols. 0123456789 _ . !?" - .map ( ch => CharTypeEnum_ ().get_char_type (ch) ) + .map ( ch => CharTypeEnum_ ().get_char_type (ch) ) .toSet .toSeq ) ( From 0ab70b0c9d875996e016254fbd43b6ffeac707ca Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sun, 5 Mar 2023 10:42:51 +0100 Subject: [PATCH 07/56] Update example --- .../soda/translator/example/mathematics/FiboExample.scala | 2 +- .../soda/translator/example/mathematics/FiboExample.soda | 2 +- .../soda/translator/example/mathematics/FiboUnicodeExample.soda | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FiboExample.scala b/translator/src/test/resources/soda/translator/example/mathematics/FiboExample.scala index 071af16d..e6c78b93 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FiboExample.scala +++ b/translator/src/test/resources/soda/translator/example/mathematics/FiboExample.scala @@ -1,7 +1,7 @@ trait FiboExampleInSoda { - def apply (n : Int) = + def apply (n : Int) : Int = _rec (n) (0) (1) private def _rec (m : Int) (a : Int) (b : Int) : Int = diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FiboExample.soda b/translator/src/test/resources/soda/translator/example/mathematics/FiboExample.soda index b4ed46dd..56fc5f5f 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FiboExample.soda +++ b/translator/src/test/resources/soda/translator/example/mathematics/FiboExample.soda @@ -1,7 +1,7 @@ class FiboExampleInSoda - apply (n : Int) = + apply (n : Int) : Int = _rec (n) (0) (1) _rec (m : Int) (a : Int) (b : Int) : Int = diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FiboUnicodeExample.soda b/translator/src/test/resources/soda/translator/example/mathematics/FiboUnicodeExample.soda index 5085cb98..9e33a1d6 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FiboUnicodeExample.soda +++ b/translator/src/test/resources/soda/translator/example/mathematics/FiboUnicodeExample.soda @@ -1,7 +1,7 @@ ⎾ FiboUnicodeExample - apply (n : Int) = + apply (n : Int) : Int = _rec (n) (0) (1) _rec (m : Int) (a : Int) (b : Int) : Int = From 8f9fbd19554e6b7cb212e19a7c9e6adf53d6e3bb Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sat, 11 Mar 2023 12:23:19 +0100 Subject: [PATCH 08/56] Refactor TranslatorToScala --- .../extension/toscala/Package.scala | 104 ++++++++++-------- .../extension/toscala/TranslatorToScala.soda | 101 +++++++++-------- 2 files changed, 115 insertions(+), 90 deletions(-) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala index f98de363..d0af4732 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala @@ -1093,6 +1093,8 @@ trait TranslationConstantToScala case class TranslationConstantToScala_ () extends TranslationConstantToScala + + /** * This translates Soda source code to Scala source code. */ @@ -1109,31 +1111,11 @@ trait TranslatorToScala import soda.translator.parser.BlockProcessor_ import java.io.File - private lazy val _soda_extension : String = ".soda" + lazy val tc = TranslatorToScalaConstant_ () - private lazy val _scala_extension : String = ".scala" + lazy val reader = SimpleFileReader_ () - private lazy val _default_argument = "." - - lazy val package_file_prefix : String = "Package" - - lazy val package_file_name : String = package_file_prefix + _soda_extension - - lazy val package_scala_file_name : String = package_file_prefix + _scala_extension - - lazy val file_separator : String = File.separator - - lazy val default_prelude : String = "" - - lazy val new_line : String = "\n" - - lazy val append_separation : String = new_line + new_line - - lazy val prelude_file_body : String = new_line + "trait Package" + append_separation - - lazy val single_files_option_1 = "-s" - - lazy val single_files_option_2 = "--single" + lazy val writer = SimpleFileWriter_ () private lazy val _translator = BlockProcessor_ ( @@ -1148,7 +1130,7 @@ trait TranslatorToScala def execute_for (arguments : Seq [String] ) : Boolean = arguments.length match { - case 0 => _process_directory_with_package_option (_default_argument) + case 0 => _process_directory_with_package_option (tc.default_argument) case 1 => _process_directory_with_package_option (arguments.apply (0) ) case 2 => if ( _is_single_files_option (arguments.apply (0) ) @@ -1174,7 +1156,7 @@ trait TranslatorToScala DirectoryProcessor_ (start, _process_soda_file_with_package_option).process () private def _process_soda_file_with_package_option (file : File) : Boolean = - if ( file.getName == package_file_name + if ( file.getName == tc.package_file_name ) _process_soda_file (file) else _process_soda_file_with_single_files_option_with ( get_input_output_file_names_with_package_option (file.getAbsolutePath) (file.getParent) @@ -1184,56 +1166,88 @@ trait TranslatorToScala _translate_append (pair.input_file_name) (pair.output_file_name) def get_input_output_file_names (input_name : String) : FileNamePair = - if ( input_name.endsWith (_soda_extension) - ) FileNamePair_ (input_name, input_name.substring (0, input_name.length - _soda_extension.length) + _scala_extension) - else FileNamePair_ (input_name + _soda_extension, input_name + _scala_extension) + if ( input_name.endsWith (tc.soda_extension) + ) FileNamePair_ (input_name, input_name.substring (0, input_name.length - tc.soda_extension.length) + tc.scala_extension) + else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) def get_input_output_file_names_with_package_option (input_name : String) (parent_name : String) : FileNamePair = - if ( input_name.endsWith (_soda_extension) - ) FileNamePair_ (input_name , parent_name + file_separator + package_scala_file_name ) - else FileNamePair_ (input_name + _soda_extension, input_name + _scala_extension) + if ( input_name.endsWith (tc.soda_extension) + ) FileNamePair_ (input_name , parent_name + tc.file_separator + tc.package_scala_file_name ) + else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) private def _translate (input_file_name : String) (output_file_name : String) : Boolean = - _translate_with_input ( _read_input_with_prelude (input_file_name) ) (output_file_name) + _translate_with_input (_read_input_with_prelude (input_file_name) ) (output_file_name) private def _translate_with_input (input : String) (output_file_name : String) : Boolean = - SimpleFileWriter_ ().write_file (output_file_name) (content = _translator.translate (input) ) + writer.write_file (output_file_name) (content = _translator.translate (input) ) private def _translate_append (input_file_name : String) (output_file_name : String) : Boolean = - _translate_append_with_input ( _read_input (input_file_name) ) (output_file_name) + _translate_append_with_input (reader.read_file (input_file_name) ) (output_file_name) private def _translate_append_with_input (input : String) (output_file_name : String) : Boolean = - SimpleFileWriter_ ().append_file (output_file_name) (content = new_line + _translator.translate (input) + new_line) + writer.append_file (output_file_name) (content = tc.new_line + _translator.translate (input) + tc.new_line) private def _read_input_with_prelude (input_file_name : String) : String = if ( _is_a_prelude_file (input_file_name) - ) _read_input (input_file_name) + prelude_file_body - else _get_prelude (input_file_name) + _read_input (input_file_name) - - private def _read_input (input_file_name : String) : String = - SimpleFileReader_ ().read_file (input_file_name) + ) reader.read_file (input_file_name) + tc.prelude_file_body + else _get_prelude (input_file_name) + reader.read_file (input_file_name) private def _get_prelude (input_file_name : String) : String = _get_prelude_with (_get_prelude_file (input_file_name) ) private def _get_prelude_with (prelude_file : File) : String = if ( prelude_file.exists - ) (SimpleFileReader_ ().read_file (prelude_file.getAbsolutePath) ) + append_separation - else default_prelude + ) (reader.read_file (prelude_file.getAbsolutePath) ) + tc.append_separation + else tc.default_prelude private def _get_prelude_file (input_file_name : String) : File = - new File ( new File (input_file_name) .getParentFile , package_file_name ) + new File ( new File (input_file_name) .getParentFile , tc.package_file_name ) private def _is_a_prelude_file (input_file_name : String) : Boolean = - package_file_name == ( ( new File (input_file_name) ) .getName) + tc.package_file_name == ( ( new File (input_file_name) ) .getName) private def _is_single_files_option (s : String) : Boolean = - (s == single_files_option_1) || (s == single_files_option_2) + (s == tc.single_files_option_1) || (s == tc.single_files_option_2) } case class TranslatorToScala_ () extends TranslatorToScala +trait TranslatorToScalaConstant +{ + + import java.io.File + + lazy val soda_extension : String = ".soda" + + lazy val scala_extension : String = ".scala" + + lazy val default_argument = "." + + lazy val package_file_prefix : String = "Package" + + lazy val package_file_name : String = package_file_prefix + soda_extension + + lazy val package_scala_file_name : String = package_file_prefix + scala_extension + + lazy val file_separator : String = File.separator + + lazy val default_prelude : String = "" + + lazy val new_line : String = "\n" + + lazy val append_separation : String = new_line + new_line + + lazy val prelude_file_body : String = new_line + "trait Package" + append_separation + + lazy val single_files_option_1 = "-s" + + lazy val single_files_option_2 = "--single" + +} + +case class TranslatorToScalaConstant_ () extends TranslatorToScalaConstant + trait FileNamePair { diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda index d22b0b68..06b8fd3c 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda @@ -1,4 +1,5 @@ + /** * This translates Soda source code to Scala source code. */ @@ -15,31 +16,11 @@ class TranslatorToScala soda.translator.parser.BlockProcessor_ java.io.File - _soda_extension : String = ".soda" - - _scala_extension : String = ".scala" - - _default_argument = "." - - package_file_prefix : String = "Package" - - package_file_name : String = package_file_prefix + _soda_extension - - package_scala_file_name : String = package_file_prefix + _scala_extension - - file_separator : String = File.separator - - default_prelude : String = "" - - new_line : String = "\n" - - append_separation : String = new_line + new_line + tc = TranslatorToScalaConstant_ () - prelude_file_body : String = new_line + "trait Package" + append_separation - - single_files_option_1 = "-s" + reader = SimpleFileReader_ () - single_files_option_2 = "--single" + writer = SimpleFileWriter_ () _translator = BlockProcessor_ ( @@ -54,7 +35,7 @@ class TranslatorToScala execute_for (arguments : Seq [String] ) : Boolean = match arguments.length - case 0 ==> _process_directory_with_package_option (_default_argument) + case 0 ==> _process_directory_with_package_option (tc.default_argument) case 1 ==> _process_directory_with_package_option (arguments.apply (0) ) case 2 ==> if _is_single_files_option (arguments.apply (0) ) @@ -79,7 +60,7 @@ class TranslatorToScala DirectoryProcessor_ (start, _process_soda_file_with_package_option).process () _process_soda_file_with_package_option (file : File) : Boolean = - if file.getName == package_file_name + if file.getName == tc.package_file_name then _process_soda_file (file) else _process_soda_file_with_single_files_option_with ( get_input_output_file_names_with_package_option (file.getAbsolutePath) (file.getParent) @@ -89,51 +70,81 @@ class TranslatorToScala _translate_append (pair.input_file_name) (pair.output_file_name) get_input_output_file_names (input_name : String) : FileNamePair = - if input_name.endsWith (_soda_extension) - then FileNamePair_ (input_name, input_name.substring (0, input_name.length - _soda_extension.length) + _scala_extension) - else FileNamePair_ (input_name + _soda_extension, input_name + _scala_extension) + if input_name.endsWith (tc.soda_extension) + then FileNamePair_ (input_name, input_name.substring (0, input_name.length - tc.soda_extension.length) + tc.scala_extension) + else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) get_input_output_file_names_with_package_option (input_name : String) (parent_name : String) : FileNamePair = - if input_name.endsWith (_soda_extension) - then FileNamePair_ (input_name , parent_name + file_separator + package_scala_file_name ) - else FileNamePair_ (input_name + _soda_extension, input_name + _scala_extension) + if input_name.endsWith (tc.soda_extension) + then FileNamePair_ (input_name , parent_name + tc.file_separator + tc.package_scala_file_name ) + else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) _translate (input_file_name : String) (output_file_name : String) : Boolean = - _translate_with_input ( _read_input_with_prelude (input_file_name) ) (output_file_name) + _translate_with_input (_read_input_with_prelude (input_file_name) ) (output_file_name) _translate_with_input (input : String) (output_file_name : String) : Boolean = - SimpleFileWriter_ ().write_file (output_file_name) (content := _translator.translate (input) ) + writer.write_file (output_file_name) (content := _translator.translate (input) ) _translate_append (input_file_name : String) (output_file_name : String) : Boolean = - _translate_append_with_input ( _read_input (input_file_name) ) (output_file_name) + _translate_append_with_input (reader.read_file (input_file_name) ) (output_file_name) _translate_append_with_input (input : String) (output_file_name : String) : Boolean = - SimpleFileWriter_ ().append_file (output_file_name) (content := new_line + _translator.translate (input) + new_line) + writer.append_file (output_file_name) (content := tc.new_line + _translator.translate (input) + tc.new_line) _read_input_with_prelude (input_file_name : String) : String = if _is_a_prelude_file (input_file_name) - then _read_input (input_file_name) + prelude_file_body - else _get_prelude (input_file_name) + _read_input (input_file_name) - - _read_input (input_file_name : String) : String = - SimpleFileReader_ ().read_file (input_file_name) + then reader.read_file (input_file_name) + tc.prelude_file_body + else _get_prelude (input_file_name) + reader.read_file (input_file_name) _get_prelude (input_file_name : String) : String = _get_prelude_with (_get_prelude_file (input_file_name) ) _get_prelude_with (prelude_file : File) : String = if prelude_file.exists - then (SimpleFileReader_ ().read_file (prelude_file.getAbsolutePath) ) + append_separation - else default_prelude + then (reader.read_file (prelude_file.getAbsolutePath) ) + tc.append_separation + else tc.default_prelude _get_prelude_file (input_file_name : String) : File = - @new File ( @new File (input_file_name) .getParentFile , package_file_name ) + @new File ( @new File (input_file_name) .getParentFile , tc.package_file_name ) _is_a_prelude_file (input_file_name : String) : Boolean = - package_file_name == ( ( @new File (input_file_name) ) .getName) + tc.package_file_name == ( ( @new File (input_file_name) ) .getName) _is_single_files_option (s : String) : Boolean = - (s == single_files_option_1) or (s == single_files_option_2) + (s == tc.single_files_option_1) or (s == tc.single_files_option_2) + +end + +class TranslatorToScalaConstant + + import + java.io.File + + soda_extension : String = ".soda" + + scala_extension : String = ".scala" + + default_argument = "." + + package_file_prefix : String = "Package" + + package_file_name : String = package_file_prefix + soda_extension + + package_scala_file_name : String = package_file_prefix + scala_extension + + file_separator : String = File.separator + + default_prelude : String = "" + + new_line : String = "\n" + + append_separation : String = new_line + new_line + + prelude_file_body : String = new_line + "trait Package" + append_separation + + single_files_option_1 = "-s" + + single_files_option_2 = "--single" end From b559bae1b157b58f13f7ae59aa357fbc14266b4c Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sat, 11 Mar 2023 12:39:04 +0100 Subject: [PATCH 09/56] Refactor TranslatorToScala --- .../extension/toscala/Package.scala | 127 +++++++++++------- .../extension/toscala/TranslatorToScala.soda | 121 ++++++++++------- .../extension/toscala/Package.scala | 2 +- .../toscala/TranslatorToScalaSpec.soda | 2 +- 4 files changed, 159 insertions(+), 93 deletions(-) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala index d0af4732..a9cef254 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala @@ -1104,11 +1104,9 @@ trait TranslatorToScala soda.translator.extension.common.Extension { - import soda.translator.block.DefaultBlockSequenceTranslator_ import soda.translator.io.DirectoryProcessor_ import soda.translator.io.SimpleFileReader_ import soda.translator.io.SimpleFileWriter_ - import soda.translator.parser.BlockProcessor_ import java.io.File lazy val tc = TranslatorToScalaConstant_ () @@ -1117,13 +1115,6 @@ trait TranslatorToScala lazy val writer = SimpleFileWriter_ () - private lazy val _translator = - BlockProcessor_ ( - DefaultBlockSequenceTranslator_ ( - MicroTranslatorToScala_ () - ) - ) - lazy val execute : Seq [String] => Boolean = arguments => execute_for (arguments) @@ -1134,58 +1125,54 @@ trait TranslatorToScala case 1 => _process_directory_with_package_option (arguments.apply (0) ) case 2 => if ( _is_single_files_option (arguments.apply (0) ) - ) _process_directory (arguments.apply (1) ) + ) _process_directory_with_single_files_option (arguments.apply (1) ) else false case 3 => if ( _is_single_files_option (arguments.apply (0) ) - ) _translate (arguments.apply (1) ) (arguments.apply (2) ) + ) IndividualProcessor_ ().translate (arguments.apply (1) ) (arguments.apply (2) ) else false case x => false } - private def _process_directory (start : String) : Boolean = - DirectoryProcessor_ (start, _process_soda_file).process () - - private def _process_soda_file (file : File) : Boolean = - _process_soda_file_with (get_input_output_file_names (file.getAbsolutePath) ) - - private def _process_soda_file_with (pair : FileNamePair) : Boolean = - _translate (pair.input_file_name) (pair.output_file_name) + private def _process_directory_with_single_files_option (start : String) : Boolean = + DirectoryProcessor_ (start , IndividualProcessor_ ().process_soda_file).process () private def _process_directory_with_package_option (start : String) : Boolean = - DirectoryProcessor_ (start, _process_soda_file_with_package_option).process () + DirectoryProcessor_ (start , process_soda_file_with_package_option).process () - private def _process_soda_file_with_package_option (file : File) : Boolean = + def process_soda_file_with_package_option (file : File) : Boolean = if ( file.getName == tc.package_file_name - ) _process_soda_file (file) - else _process_soda_file_with_single_files_option_with ( - get_input_output_file_names_with_package_option (file.getAbsolutePath) (file.getParent) - ) + ) IndividualProcessor_ ().process_soda_file (file) + else PackageProcessor_ ().process_soda_file (file) - private def _process_soda_file_with_single_files_option_with (pair : FileNamePair) : Boolean = - _translate_append (pair.input_file_name) (pair.output_file_name) + private def _is_single_files_option (s : String) : Boolean = + (s == tc.single_files_option_1) || (s == tc.single_files_option_2) - def get_input_output_file_names (input_name : String) : FileNamePair = - if ( input_name.endsWith (tc.soda_extension) - ) FileNamePair_ (input_name, input_name.substring (0, input_name.length - tc.soda_extension.length) + tc.scala_extension) - else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) +} - def get_input_output_file_names_with_package_option (input_name : String) (parent_name : String) : FileNamePair = - if ( input_name.endsWith (tc.soda_extension) - ) FileNamePair_ (input_name , parent_name + tc.file_separator + tc.package_scala_file_name ) - else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) +case class TranslatorToScala_ () extends TranslatorToScala - private def _translate (input_file_name : String) (output_file_name : String) : Boolean = - _translate_with_input (_read_input_with_prelude (input_file_name) ) (output_file_name) +trait IndividualProcessor +{ - private def _translate_with_input (input : String) (output_file_name : String) : Boolean = - writer.write_file (output_file_name) (content = _translator.translate (input) ) + import soda.translator.io.SimpleFileReader_ + import soda.translator.io.SimpleFileWriter_ + import java.io.File - private def _translate_append (input_file_name : String) (output_file_name : String) : Boolean = - _translate_append_with_input (reader.read_file (input_file_name) ) (output_file_name) + lazy val tc = TranslatorToScalaConstant_ () - private def _translate_append_with_input (input : String) (output_file_name : String) : Boolean = - writer.append_file (output_file_name) (content = tc.new_line + _translator.translate (input) + tc.new_line) + lazy val reader = SimpleFileReader_ () + + lazy val writer = SimpleFileWriter_ () + + def process_soda_file (file : File) : Boolean = + process_soda_file_with (get_input_output_file_names (file.getAbsolutePath) ) + + def process_soda_file_with (pair : FileNamePair) : Boolean = + translate (pair.input_file_name) (pair.output_file_name) + + def translate (input_file_name : String) (output_file_name : String) : Boolean = + _translate_with_input (_read_input_with_prelude (input_file_name) ) (output_file_name) private def _read_input_with_prelude (input_file_name : String) : String = if ( _is_a_prelude_file (input_file_name) @@ -1206,16 +1193,57 @@ trait TranslatorToScala private def _is_a_prelude_file (input_file_name : String) : Boolean = tc.package_file_name == ( ( new File (input_file_name) ) .getName) - private def _is_single_files_option (s : String) : Boolean = - (s == tc.single_files_option_1) || (s == tc.single_files_option_2) + private def _translate_with_input (input : String) (output_file_name : String) : Boolean = + writer.write_file (output_file_name) (content = tc.translator.translate (input) ) + + def get_input_output_file_names (input_name : String) : FileNamePair = + if ( input_name.endsWith (tc.soda_extension) + ) FileNamePair_ (input_name, input_name.substring (0, input_name.length - tc.soda_extension.length) + tc.scala_extension) + else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) } -case class TranslatorToScala_ () extends TranslatorToScala +case class IndividualProcessor_ () extends IndividualProcessor + +trait PackageProcessor +{ + + import soda.translator.io.SimpleFileReader_ + import soda.translator.io.SimpleFileWriter_ + import java.io.File + + lazy val tc = TranslatorToScalaConstant_ () + + lazy val reader = SimpleFileReader_ () + + lazy val writer = SimpleFileWriter_ () + + def process_soda_file (file : File) : Boolean = + process_soda_file_with (get_input_output_file_names (file.getAbsolutePath) (file.getParent) ) + + def process_soda_file_with (pair : FileNamePair) : Boolean = + translate_append (pair.input_file_name) (pair.output_file_name) + + def get_input_output_file_names (input_name : String) (parent_name : String) : FileNamePair = + if ( input_name.endsWith (tc.soda_extension) + ) FileNamePair_ (input_name , parent_name + tc.file_separator + tc.package_scala_file_name ) + else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) + + def translate_append (input_file_name : String) (output_file_name : String) : Boolean = + _translate_append_with_input (reader.read_file (input_file_name) ) (output_file_name) + + private def _translate_append_with_input (input : String) (output_file_name : String) : Boolean = + writer.append_file (output_file_name) (content = tc.new_line + tc.translator.translate (input) + tc.new_line) + +} + +case class PackageProcessor_ () extends PackageProcessor trait TranslatorToScalaConstant { + import soda.translator.parser.BlockProcessor_ + import soda.translator.block.DefaultBlockSequenceTranslator_ import java.io.File lazy val soda_extension : String = ".soda" @@ -1244,6 +1272,13 @@ trait TranslatorToScalaConstant lazy val single_files_option_2 = "--single" + lazy val translator = + BlockProcessor_ ( + DefaultBlockSequenceTranslator_ ( + MicroTranslatorToScala_ () + ) + ) + } case class TranslatorToScalaConstant_ () extends TranslatorToScalaConstant diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda index 06b8fd3c..47f3b160 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda @@ -9,11 +9,9 @@ class TranslatorToScala soda.translator.extension.common.Extension import - soda.translator.block.DefaultBlockSequenceTranslator_ soda.translator.io.DirectoryProcessor_ soda.translator.io.SimpleFileReader_ soda.translator.io.SimpleFileWriter_ - soda.translator.parser.BlockProcessor_ java.io.File tc = TranslatorToScalaConstant_ () @@ -22,13 +20,6 @@ class TranslatorToScala writer = SimpleFileWriter_ () - _translator = - BlockProcessor_ ( - DefaultBlockSequenceTranslator_ ( - MicroTranslatorToScala_ () - ) - ) - execute : Seq [String] -> Boolean = lambda arguments --> execute_for (arguments) @@ -39,57 +30,51 @@ class TranslatorToScala case 1 ==> _process_directory_with_package_option (arguments.apply (0) ) case 2 ==> if _is_single_files_option (arguments.apply (0) ) - then _process_directory (arguments.apply (1) ) + then _process_directory_with_single_files_option (arguments.apply (1) ) else false case 3 ==> if _is_single_files_option (arguments.apply (0) ) - then _translate (arguments.apply (1) ) (arguments.apply (2) ) + then IndividualProcessor_ ().translate (arguments.apply (1) ) (arguments.apply (2) ) else false case x ==> false - _process_directory (start : String) : Boolean = - DirectoryProcessor_ (start, _process_soda_file).process () - - _process_soda_file (file : File) : Boolean = - _process_soda_file_with (get_input_output_file_names (file.getAbsolutePath) ) - - _process_soda_file_with (pair : FileNamePair) : Boolean = - _translate (pair.input_file_name) (pair.output_file_name) + _process_directory_with_single_files_option (start : String) : Boolean = + DirectoryProcessor_ (start , IndividualProcessor_ ().process_soda_file).process () _process_directory_with_package_option (start : String) : Boolean = - DirectoryProcessor_ (start, _process_soda_file_with_package_option).process () + DirectoryProcessor_ (start , process_soda_file_with_package_option).process () - _process_soda_file_with_package_option (file : File) : Boolean = + process_soda_file_with_package_option (file : File) : Boolean = if file.getName == tc.package_file_name - then _process_soda_file (file) - else _process_soda_file_with_single_files_option_with ( - get_input_output_file_names_with_package_option (file.getAbsolutePath) (file.getParent) - ) + then IndividualProcessor_ ().process_soda_file (file) + else PackageProcessor_ ().process_soda_file (file) - _process_soda_file_with_single_files_option_with (pair : FileNamePair) : Boolean = - _translate_append (pair.input_file_name) (pair.output_file_name) + _is_single_files_option (s : String) : Boolean = + (s == tc.single_files_option_1) or (s == tc.single_files_option_2) - get_input_output_file_names (input_name : String) : FileNamePair = - if input_name.endsWith (tc.soda_extension) - then FileNamePair_ (input_name, input_name.substring (0, input_name.length - tc.soda_extension.length) + tc.scala_extension) - else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) +end - get_input_output_file_names_with_package_option (input_name : String) (parent_name : String) : FileNamePair = - if input_name.endsWith (tc.soda_extension) - then FileNamePair_ (input_name , parent_name + tc.file_separator + tc.package_scala_file_name ) - else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) +class IndividualProcessor - _translate (input_file_name : String) (output_file_name : String) : Boolean = - _translate_with_input (_read_input_with_prelude (input_file_name) ) (output_file_name) + import + soda.translator.io.SimpleFileReader_ + soda.translator.io.SimpleFileWriter_ + java.io.File - _translate_with_input (input : String) (output_file_name : String) : Boolean = - writer.write_file (output_file_name) (content := _translator.translate (input) ) + tc = TranslatorToScalaConstant_ () - _translate_append (input_file_name : String) (output_file_name : String) : Boolean = - _translate_append_with_input (reader.read_file (input_file_name) ) (output_file_name) + reader = SimpleFileReader_ () - _translate_append_with_input (input : String) (output_file_name : String) : Boolean = - writer.append_file (output_file_name) (content := tc.new_line + _translator.translate (input) + tc.new_line) + writer = SimpleFileWriter_ () + + process_soda_file (file : File) : Boolean = + process_soda_file_with (get_input_output_file_names (file.getAbsolutePath) ) + + process_soda_file_with (pair : FileNamePair) : Boolean = + translate (pair.input_file_name) (pair.output_file_name) + + translate (input_file_name : String) (output_file_name : String) : Boolean = + _translate_with_input (_read_input_with_prelude (input_file_name) ) (output_file_name) _read_input_with_prelude (input_file_name : String) : String = if _is_a_prelude_file (input_file_name) @@ -110,14 +95,53 @@ class TranslatorToScala _is_a_prelude_file (input_file_name : String) : Boolean = tc.package_file_name == ( ( @new File (input_file_name) ) .getName) - _is_single_files_option (s : String) : Boolean = - (s == tc.single_files_option_1) or (s == tc.single_files_option_2) + _translate_with_input (input : String) (output_file_name : String) : Boolean = + writer.write_file (output_file_name) (content := tc.translator.translate (input) ) + + get_input_output_file_names (input_name : String) : FileNamePair = + if input_name.endsWith (tc.soda_extension) + then FileNamePair_ (input_name, input_name.substring (0, input_name.length - tc.soda_extension.length) + tc.scala_extension) + else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) + +end + +class PackageProcessor + + import + soda.translator.io.SimpleFileReader_ + soda.translator.io.SimpleFileWriter_ + java.io.File + + tc = TranslatorToScalaConstant_ () + + reader = SimpleFileReader_ () + + writer = SimpleFileWriter_ () + + process_soda_file (file : File) : Boolean = + process_soda_file_with (get_input_output_file_names (file.getAbsolutePath) (file.getParent) ) + + process_soda_file_with (pair : FileNamePair) : Boolean = + translate_append (pair.input_file_name) (pair.output_file_name) + + get_input_output_file_names (input_name : String) (parent_name : String) : FileNamePair = + if input_name.endsWith (tc.soda_extension) + then FileNamePair_ (input_name , parent_name + tc.file_separator + tc.package_scala_file_name ) + else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) + + translate_append (input_file_name : String) (output_file_name : String) : Boolean = + _translate_append_with_input (reader.read_file (input_file_name) ) (output_file_name) + + _translate_append_with_input (input : String) (output_file_name : String) : Boolean = + writer.append_file (output_file_name) (content := tc.new_line + tc.translator.translate (input) + tc.new_line) end class TranslatorToScalaConstant import + soda.translator.parser.BlockProcessor_ + soda.translator.block.DefaultBlockSequenceTranslator_ java.io.File soda_extension : String = ".soda" @@ -146,6 +170,13 @@ class TranslatorToScalaConstant single_files_option_2 = "--single" + translator = + BlockProcessor_ ( + DefaultBlockSequenceTranslator_ ( + MicroTranslatorToScala_ () + ) + ) + end class FileNamePair diff --git a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala index 00488a19..d7cfdeaf 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala @@ -868,7 +868,7 @@ case class MainSpec () org.scalatest.funsuite.AnyFunSuite { - lazy val instance = TranslatorToScala_ () + lazy val instance = IndividualProcessor_ () def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/TranslatorToScalaSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/TranslatorToScalaSpec.soda index bb6c3a75..c774786d 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/TranslatorToScalaSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/TranslatorToScalaSpec.soda @@ -3,7 +3,7 @@ class MainSpec () extends org.scalatest.funsuite.AnyFunSuite - instance = TranslatorToScala_ () + instance = IndividualProcessor_ () check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) From 9a14ca72dbc610c17036458e5115f156c7010d7f Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sat, 11 Mar 2023 21:15:52 +0100 Subject: [PATCH 10/56] Replace most of `case x` by `case otherwise` --- .../algorithms/FizzBuzzPatternMatching.soda | 2 +- .../example/algorithms/FizzBuzzUnicode.soda | 2 +- .../soda/example/algorithms/Package.scala | 8 +++--- .../example/algorithms/PatternMatching.soda | 4 +-- .../ethicalissues/pricemonitor/Package.scala | 2 +- .../pricemonitor/Requirement3Monitor.soda | 2 +- .../example/forcoq/algorithms/Package.scala | 4 +-- .../forcoq/algorithms/RecursionForCoq.soda | 4 +-- .../scala/soda/example/forcoq/lib/List.soda | 6 ++-- .../scala/soda/example/forcoq/lib/Nat.soda | 2 +- .../soda/example/forcoq/lib/Package.scala | 8 +++--- .../forcoq/mathematics/FactorialForCoq.soda | 2 +- .../mathematics/FiboExampleInSodaForCoq.soda | 2 +- .../example/forcoq/mathematics/Package.scala | 6 ++-- .../mathematics/TriangularNumberForCoq.soda | 2 +- .../src/main/scala/soda/collection/MSeq.soda | 4 +-- .../main/scala/soda/collection/Package.scala | 4 +-- .../main/resources/lib/soda/lib/OptionSD.soda | 12 ++++---- .../main/resources/lib/soda/lib/Package.scala | 14 +++++----- .../main/resources/lib/soda/lib/SeqSD.soda | 2 +- .../soda/translator/documentation/Manual.soda | 2 +- .../src/main/scala/soda/lib/OptionSD.soda | 12 ++++---- .../src/main/scala/soda/lib/Package.scala | 14 +++++----- translator/src/main/scala/soda/lib/SeqSD.soda | 2 +- .../CoqClassConstructorBlockTranslator.soda | 4 +-- .../CoqClassDeclarationBlockTranslator.soda | 2 +- .../tocoq/CoqClassEndBlockTranslator.soda | 4 +-- .../tocoq/CoqDefinitionBlockTranslator.soda | 2 +- .../CoqImportDeclarationBlockTranslator.soda | 2 +- .../CoqPackageDeclarationBlockTranslator.soda | 2 +- .../tocoq/CoqProofBlockTranslator.soda | 2 +- .../tocoq/CoqTheoremBlockTranslator.soda | 2 +- .../tocoq/MatchCaseBlockTranslator.soda | 2 +- .../translator/extension/tocoq/Package.scala | 24 ++++++++-------- .../extension/tocoq/TranslatorToCoq.soda | 2 +- .../translator/extension/todoc/Package.scala | 2 +- .../extension/todoc/TranslatorToDoc.soda | 2 +- .../AbstractDeclarationBlockTranslator.soda | 2 +- .../ClassConstructorBlockTranslator.soda | 6 ++-- .../ClassDeclarationBlockTranslator.soda | 2 +- .../toscala/ClassEndBlockTranslator.soda | 2 +- .../FunctionDefinitionBlockTranslator.soda | 4 +-- .../ImportDeclarationBlockTranslator.soda | 2 +- .../toscala/MainClassBlockTranslator.soda | 4 +-- .../toscala/MatchCaseBlockTranslator.soda | 2 +- .../extension/toscala/Package.scala | 28 +++++++++---------- .../TheoremAndProofBlockTranslator.soda | 2 +- .../extension/toscala/TranslatorToScala.soda | 2 +- .../soda/translator/parser/Package.scala | 2 +- .../PreprocessorSequenceTranslator.soda | 2 +- .../translator/documentation/Manual.scala | 2 +- .../soda/translator/documentation/Manual.soda | 2 +- .../soda/translator/documentation/Manual.tex | 2 +- .../algorithms/FizzBuzzPatternMatching.soda | 2 +- .../example/algorithms/FizzBuzzUnicode.scala | 2 +- .../example/algorithms/FizzBuzzUnicode.soda | 2 +- .../example/algorithms/PatternMatching.soda | 4 +-- .../pricemonitor/Requirement3Monitor.soda | 2 +- .../forcoq/algorithms/RecursionForCoq.soda | 4 +-- .../translator/example/forcoq/lib/List.soda | 6 ++-- .../translator/example/forcoq/lib/Nat.soda | 2 +- .../forcoq/mathematics/FactorialForCoq.soda | 2 +- .../mathematics/FiboExampleInSodaForCoq.soda | 2 +- .../mathematics/TriangularNumberForCoq.soda | 2 +- .../mathematics/TriangularNumberForCoq.v | 2 +- .../toscala/MicroTranslatorToScalaSpec.soda | 12 ++++---- .../extension/toscala/Package.scala | 12 ++++---- 67 files changed, 148 insertions(+), 148 deletions(-) diff --git a/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda b/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda index 361ab4b8..21f5ed9d 100644 --- a/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda +++ b/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda @@ -17,6 +17,6 @@ class FizzBuzzPatternMatching case Tuple2 (0, 0) ==> fizz + buzz case Tuple2 (0, x) ==> fizz case Tuple2 (x, 0) ==> buzz - case x ==> n.toString + case otherwise ==> n.toString end diff --git a/examples/src/main/scala/soda/example/algorithms/FizzBuzzUnicode.soda b/examples/src/main/scala/soda/example/algorithms/FizzBuzzUnicode.soda index 2913a29b..bfeaf8ac 100644 --- a/examples/src/main/scala/soda/example/algorithms/FizzBuzzUnicode.soda +++ b/examples/src/main/scala/soda/example/algorithms/FizzBuzzUnicode.soda @@ -17,6 +17,6 @@ case Tuple2 (0 , 0) ⟹ fizz + buzz case Tuple2 (0 , x) ⟹ fizz case Tuple2 (x , 0) ⟹ buzz - case x ⟹ n.toString + case otherwise ⟹ n.toString ⎿ diff --git a/examples/src/main/scala/soda/example/algorithms/Package.scala b/examples/src/main/scala/soda/example/algorithms/Package.scala index 82591407..7e21c25c 100644 --- a/examples/src/main/scala/soda/example/algorithms/Package.scala +++ b/examples/src/main/scala/soda/example/algorithms/Package.scala @@ -54,7 +54,7 @@ trait FizzBuzzPatternMatching case Tuple2 (0, 0) => fizz + buzz case Tuple2 (0, x) => fizz case Tuple2 (x, 0) => buzz - case x => n.toString + case otherwise => n.toString } } @@ -81,7 +81,7 @@ trait FizzBuzzPatternUnicode case Tuple2 (0 , 0) => fizz + buzz case Tuple2 (0 , x) => fizz case Tuple2 (x , 0) => buzz - case x => n.toString + case otherwise => n.toString } } @@ -122,7 +122,7 @@ trait PatternMatching case Singleton_ (x) => x case Pair_ (x, y) => (x + y) / 2 case Triplet_ (x, y, z) => (x + y + z) / 3 - case x => 0 + case otherwise => 0 } def get_type_name (p : Parameter) : String = @@ -130,7 +130,7 @@ trait PatternMatching case Singleton_ (x) => (Singleton_ (x) ).name + "(x)" case Pair_ (x, y) => (Pair_ (x, y) ).name + "(x, y)" case Triplet_ (x, y, z) => (Triplet_ (x, y, z) ).name + "(x, y, z)" - case x => "" + case otherwise => "" } } diff --git a/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda b/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda index d37ee2d6..f3e726a0 100644 --- a/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda +++ b/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda @@ -13,14 +13,14 @@ class PatternMatching case Singleton_ (x) ==> x case Pair_ (x, y) ==> (x + y) / 2 case Triplet_ (x, y, z) ==> (x + y + z) / 3 - case x ==> 0 + case otherwise ==> 0 get_type_name (p : Parameter) : String = match p case Singleton_ (x) ==> (Singleton_ (x) ).name + "(x)" case Pair_ (x, y) ==> (Pair_ (x, y) ).name + "(x, y)" case Triplet_ (x, y, z) ==> (Triplet_ (x, y, z) ).name + "(x, y, z)" - case x ==> "" + case otherwise ==> "" end diff --git a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala index 038425dc..2c81b2d9 100644 --- a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala +++ b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala @@ -213,7 +213,7 @@ trait SegmentsForFlight def rec_segments_multi (first_airport : String) (intermediate_stops : Seq [String] ) (last_airport : String) : Seq [Segment] = intermediate_stops match { case head :: tail => (rec_segments_multi (head) (tail) (last_airport) ).+: (Segment_ (first_airport, head) ) - case x => Nil.+: (Segment_ (first_airport, last_airport) ) + case otherwise => Nil.+: (Segment_ (first_airport, last_airport) ) } } diff --git a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda index b9368b1c..c7c038e8 100644 --- a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda +++ b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda @@ -58,7 +58,7 @@ class SegmentsForFlight rec_segments_multi (first_airport : String) (intermediate_stops : Seq [String] ) (last_airport : String) : Seq [Segment] = match intermediate_stops case head :: tail ==> (rec_segments_multi (head) (tail) (last_airport) ).+: (Segment_ (first_airport, head) ) - case x ==> Nil.+: (Segment_ (first_airport, last_airport) ) + case otherwise ==> Nil.+: (Segment_ (first_airport, last_airport) ) end diff --git a/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala b/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala index e062fb2b..3993d0bc 100644 --- a/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala +++ b/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala @@ -21,7 +21,7 @@ trait RecursionForCoq if ( (! (condition (current_value) (head) ) ) ) current_value else _tailrec_fold4 (tail) (next_value_function (current_value) (head)) (next_value_function) (condition) - case x => current_value + case otherwise => current_value } def fold4 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = @@ -32,7 +32,7 @@ trait RecursionForCoq private def _tailrec_fold3 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) : B = sequence match { case (head) :: (tail) => _tailrec_fold3 (tail) (next_value_function (current_value) (head)) (next_value_function) - case x => current_value + case otherwise => current_value } def fold3 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B => A => B) : B = diff --git a/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda b/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda index 88a14fec..eb3f11a0 100644 --- a/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda +++ b/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda @@ -12,7 +12,7 @@ class RecursionForCoq if (not (condition (current_value) (head) ) ) then current_value else _tailrec_fold4 (tail) (next_value_function (current_value) (head)) (next_value_function) (condition) - case x ==> current_value + case otherwise ==> current_value fold4 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = _tailrec_fold4 (sequence) (initial_value) (next_value_function) (condition) @@ -21,7 +21,7 @@ class RecursionForCoq _tailrec_fold3 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = match sequence case (head) :: (tail) ==> _tailrec_fold3 (tail) (next_value_function (current_value) (head)) (next_value_function) - case x ==> current_value + case otherwise ==> current_value fold3 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = _tailrec_fold3 (sequence) (initial_value) (next_value_function) diff --git a/examples/src/main/scala/soda/example/forcoq/lib/List.soda b/examples/src/main/scala/soda/example/forcoq/lib/List.soda index a2cad06a..81616d69 100644 --- a/examples/src/main/scala/soda/example/forcoq/lib/List.soda +++ b/examples/src/main/scala/soda/example/forcoq/lib/List.soda @@ -25,7 +25,7 @@ class SeqList _tailrec_reverse [A] (a : list [A] ) (b : list [A] ) : list [A] = match a case cons_ (e, s) ==> _tailrec_reverse (s) ( cons_ (e, b) ) - case x ==> b + case otherwise ==> b reverse [A] (s : list [A] ) : list [A] = _tailrec_reverse [A] (s) (nil_ [A] () ) @@ -34,7 +34,7 @@ class SeqList _tailrec_from_Seq [A] (a : Seq [A] ) (b : list [A] ) : list [A] = match a case (e) :: (s) ==> _tailrec_from_Seq (s) (cons_ (e, b) ) - case x ==> b + case otherwise ==> b from_Seq [A] (a : Seq [A] ) : list [A] = reverse (_tailrec_from_Seq (a) ( nil_ [A] () ) ) @@ -43,7 +43,7 @@ class SeqList _tailrec_to_Seq [A] (a : list [A] ) (b : Seq [A] ) : Seq [A] = match a case cons_ (e, s) ==> _tailrec_to_Seq (s) ( b .+: (e) ) - case x ==> b + case otherwise ==> b to_Seq [A] (a : list [A] ) : Seq [A] = (_tailrec_to_Seq (a) ( Seq [A]() ) ) .reverse diff --git a/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda b/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda index d6207e48..26b2af38 100644 --- a/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda +++ b/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda @@ -72,6 +72,6 @@ class IntNat to_Int (a : nat) : Int = match a case S_ (k) ==> 1 + to_Int (k) - case x ==> 0 + case otherwise ==> 0 end diff --git a/examples/src/main/scala/soda/example/forcoq/lib/Package.scala b/examples/src/main/scala/soda/example/forcoq/lib/Package.scala index 5f6aff28..98a66ad0 100644 --- a/examples/src/main/scala/soda/example/forcoq/lib/Package.scala +++ b/examples/src/main/scala/soda/example/forcoq/lib/Package.scala @@ -42,7 +42,7 @@ trait SeqList private def _tailrec_reverse [A] (a : list [A] ) (b : list [A] ) : list [A] = a match { case cons_ (e, s) => _tailrec_reverse (s) ( cons_ (e, b) ) - case x => b + case otherwise => b } def reverse [A] (s : list [A] ) : list [A] = @@ -53,7 +53,7 @@ trait SeqList private def _tailrec_from_Seq [A] (a : Seq [A] ) (b : list [A] ) : list [A] = a match { case (e) :: (s) => _tailrec_from_Seq (s) (cons_ (e, b) ) - case x => b + case otherwise => b } def from_Seq [A] (a : Seq [A] ) : list [A] = @@ -64,7 +64,7 @@ trait SeqList private def _tailrec_to_Seq [A] (a : list [A] ) (b : Seq [A] ) : Seq [A] = a match { case cons_ (e, s) => _tailrec_to_Seq (s) ( b .+: (e) ) - case x => b + case otherwise => b } def to_Seq [A] (a : list [A] ) : Seq [A] = @@ -156,7 +156,7 @@ trait IntNat def to_Int (a : nat) : Int = a match { case S_ (k) => 1 + to_Int (k) - case x => 0 + case otherwise => 0 } } diff --git a/examples/src/main/scala/soda/example/forcoq/mathematics/FactorialForCoq.soda b/examples/src/main/scala/soda/example/forcoq/mathematics/FactorialForCoq.soda index fdda5183..64befb43 100644 --- a/examples/src/main/scala/soda/example/forcoq/mathematics/FactorialForCoq.soda +++ b/examples/src/main/scala/soda/example/forcoq/mathematics/FactorialForCoq.soda @@ -10,7 +10,7 @@ class FactorialForCoq _tailrec_get_factorial (m : nat) (product : nat) : nat = match m case S_ (k) ==> _tailrec_get_factorial (k) (product .mul ( S_ (k) ) ) - case x ==> product + case otherwise ==> product get_factorial (n : nat) : nat = _tailrec_get_factorial (n) (S_ ( O_ () ) ) diff --git a/examples/src/main/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoq.soda b/examples/src/main/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoq.soda index 4b8e9fbd..9a473fd2 100644 --- a/examples/src/main/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoq.soda +++ b/examples/src/main/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoq.soda @@ -11,7 +11,7 @@ class FiboExampleInSodaForCoq match m case S_ (O_ () ) ==> b case S_ (k) ==> _tailrec_fib (k) (b) (a .add (b) ) - case x ==> a + case otherwise ==> a fib (n : nat) = _tailrec_fib (n) (O_ () ) ( S_ (O_ () ) ) diff --git a/examples/src/main/scala/soda/example/forcoq/mathematics/Package.scala b/examples/src/main/scala/soda/example/forcoq/mathematics/Package.scala index be1265af..66b7d8fa 100644 --- a/examples/src/main/scala/soda/example/forcoq/mathematics/Package.scala +++ b/examples/src/main/scala/soda/example/forcoq/mathematics/Package.scala @@ -18,7 +18,7 @@ trait FactorialForCoq private def _tailrec_get_factorial (m : nat) (product : nat) : nat = m match { case S_ (k) => _tailrec_get_factorial (k) (product .mul ( S_ (k) ) ) - case x => product + case otherwise => product } def get_factorial (n : nat) : nat = @@ -42,7 +42,7 @@ trait FiboExampleInSodaForCoq m match { case S_ (O_ () ) => b case S_ (k) => _tailrec_fib (k) (b) (a .add (b) ) - case x => a + case otherwise => a } def fib (n : nat) = @@ -65,7 +65,7 @@ trait TriangularNumberForCoq private def _tailrec_get_number (m : nat) (acc : nat) : nat = m match { case S_ (k) => _tailrec_get_number (k) (acc .add ( S_ (k) ) ) - case x => acc + case otherwise => acc } def get_number (n : nat) : nat = diff --git a/examples/src/main/scala/soda/example/forcoq/mathematics/TriangularNumberForCoq.soda b/examples/src/main/scala/soda/example/forcoq/mathematics/TriangularNumberForCoq.soda index 92de56a9..b6b58364 100644 --- a/examples/src/main/scala/soda/example/forcoq/mathematics/TriangularNumberForCoq.soda +++ b/examples/src/main/scala/soda/example/forcoq/mathematics/TriangularNumberForCoq.soda @@ -10,7 +10,7 @@ class TriangularNumberForCoq _tailrec_get_number (m : nat) (acc : nat) : nat = match m case S_ (k) ==> _tailrec_get_number (k) (acc .add ( S_ (k) ) ) - case x ==> acc + case otherwise ==> acc get_number (n : nat) : nat = _tailrec_get_number (n) ( O_ () ) diff --git a/library/src/main/scala/soda/collection/MSeq.soda b/library/src/main/scala/soda/collection/MSeq.soda index e84b2228..35e098c3 100644 --- a/library/src/main/scala/soda/collection/MSeq.soda +++ b/library/src/main/scala/soda/collection/MSeq.soda @@ -7,7 +7,7 @@ class MSeq [A] opt [B] (ifEmpty : B) (ifNonEmpty : NESeq [A] -> B) : B = match this case NESeq_ (head, tail) ==> ifNonEmpty (NESeq_ (head, tail) ) - case x ==> ifEmpty + case otherwise ==> ifEmpty end @@ -20,7 +20,7 @@ class MSeqRec [A] if not condition (current_value) (head) then current_value else _tailrec_fold_while (tail) (next_value_function (current_value) (head) ) (next_value_function) (condition) - case x ==> current_value + case otherwise ==> current_value fold_while [B] (sequence : MSeq [A] ) (initial_value : B) (next_value : B -> A -> B) (condition : B -> A -> Boolean) : B = _tailrec_fold_while (sequence) (initial_value) (next_value) (condition) diff --git a/library/src/main/scala/soda/collection/Package.scala b/library/src/main/scala/soda/collection/Package.scala index dacece6e..d560bf67 100644 --- a/library/src/main/scala/soda/collection/Package.scala +++ b/library/src/main/scala/soda/collection/Package.scala @@ -16,7 +16,7 @@ trait MSeq [A] def opt [B] (ifEmpty : B) (ifNonEmpty : NESeq [A] => B) : B = this match { case NESeq_ (head, tail) => ifNonEmpty (NESeq_ (head, tail) ) - case x => ifEmpty + case otherwise => ifEmpty } } @@ -34,7 +34,7 @@ trait MSeqRec [A] if ( ! condition (current_value) (head) ) current_value else _tailrec_fold_while (tail) (next_value_function (current_value) (head) ) (next_value_function) (condition) - case x => current_value + case otherwise => current_value } def fold_while [B] (sequence : MSeq [A] ) (initial_value : B) (next_value : B => A => B) (condition : B => A => Boolean) : B = diff --git a/translator/src/main/resources/lib/soda/lib/OptionSD.soda b/translator/src/main/resources/lib/soda/lib/OptionSD.soda index ee54da2c..9f414f52 100644 --- a/translator/src/main/resources/lib/soda/lib/OptionSD.soda +++ b/translator/src/main/resources/lib/soda/lib/OptionSD.soda @@ -19,27 +19,27 @@ class OptionSD [A] opt [B] (ifEmpty : B) (ifNonEmpty : A -> B) : B = match this case SomeSD_ (element) ==> ifNonEmpty (element) - case x ==> ifEmpty + case otherwise ==> ifEmpty map [B] (mapping : A -> B) : OptionSD [B] = match this case SomeSD_ (element) ==> SomeSD_ [B] (mapping (element) ) - case x ==> NoneSD_ [B] () + case otherwise ==> NoneSD_ [B] () getOrElse (default : A) : A = match this case SomeSD_ (element) ==> element - case x ==> default + case otherwise ==> default fold [B] (ifEmpty : B) (f : A -> B) : B = match this case SomeSD_ (element) ==> f (element) - case x ==> ifEmpty + case otherwise ==> ifEmpty flatMap [B] (mapping : A -> OptionSD [B] ) : OptionSD [B] = match this case SomeSD_ (element) ==> mapping (element) - case x ==> NoneSD_ () + case otherwise ==> NoneSD_ () bind [B] (mapping : A -> OptionSD [B] ) : OptionSD [B] = flatMap [B] (mapping) @@ -50,7 +50,7 @@ class OptionSD [A] if predicate (element) then this else NoneSD_ [A] () - case x ==> NoneSD_ () + case otherwise ==> NoneSD_ () end diff --git a/translator/src/main/resources/lib/soda/lib/Package.scala b/translator/src/main/resources/lib/soda/lib/Package.scala index ed408246..7cf9d189 100644 --- a/translator/src/main/resources/lib/soda/lib/Package.scala +++ b/translator/src/main/resources/lib/soda/lib/Package.scala @@ -113,31 +113,31 @@ trait OptionSD [A] def opt [B] (ifEmpty : B) (ifNonEmpty : A => B) : B = this match { case SomeSD_ (element) => ifNonEmpty (element) - case x => ifEmpty + case otherwise => ifEmpty } def map [B] (mapping : A => B) : OptionSD [B] = this match { case SomeSD_ (element) => SomeSD_ [B] (mapping (element) ) - case x => NoneSD_ [B] () + case otherwise => NoneSD_ [B] () } def getOrElse (default : A) : A = this match { case SomeSD_ (element) => element - case x => default + case otherwise => default } def fold [B] (ifEmpty : B) (f : A => B) : B = this match { case SomeSD_ (element) => f (element) - case x => ifEmpty + case otherwise => ifEmpty } def flatMap [B] (mapping : A => OptionSD [B] ) : OptionSD [B] = this match { case SomeSD_ (element) => mapping (element) - case x => NoneSD_ () + case otherwise => NoneSD_ () } def bind [B] (mapping : A => OptionSD [B] ) : OptionSD [B] = @@ -149,7 +149,7 @@ trait OptionSD [A] if ( predicate (element) ) this else NoneSD_ [A] () - case x => NoneSD_ () + case otherwise => NoneSD_ () } } @@ -335,7 +335,7 @@ trait SeqSD [A] def opt [B] (ifEmpty : B) (ifNonEmpty : NonEmptySeqSD [A] => B) : B = this match { case NonEmptySeqSD_ (toSeq) => ifNonEmpty (NonEmptySeqSD_ (toSeq) ) - case x => ifEmpty + case otherwise => ifEmpty } } diff --git a/translator/src/main/resources/lib/soda/lib/SeqSD.soda b/translator/src/main/resources/lib/soda/lib/SeqSD.soda index 24e78c7d..745e1ede 100644 --- a/translator/src/main/resources/lib/soda/lib/SeqSD.soda +++ b/translator/src/main/resources/lib/soda/lib/SeqSD.soda @@ -16,7 +16,7 @@ class SeqSD [A] opt [B] (ifEmpty : B) (ifNonEmpty : NonEmptySeqSD [A] -> B) : B = match this case NonEmptySeqSD_ (toSeq) ==> ifNonEmpty (NonEmptySeqSD_ (toSeq) ) - case x ==> ifEmpty + case otherwise ==> ifEmpty end diff --git a/translator/src/main/resources/soda/translator/documentation/Manual.soda b/translator/src/main/resources/soda/translator/documentation/Manual.soda index 791c6143..e3a95751 100644 --- a/translator/src/main/resources/soda/translator/documentation/Manual.soda +++ b/translator/src/main/resources/soda/translator/documentation/Manual.soda @@ -221,7 +221,7 @@ class Manual if_then_else [A] (condition : Boolean) (if_true : A) (if_false : A) : A = match condition case true ==> if_true - case x ==> if_false + case otherwise ==> if_false sum (n : Int) = _tailrec_ (n) (0) diff --git a/translator/src/main/scala/soda/lib/OptionSD.soda b/translator/src/main/scala/soda/lib/OptionSD.soda index 26474ac0..cb7aec2a 100644 --- a/translator/src/main/scala/soda/lib/OptionSD.soda +++ b/translator/src/main/scala/soda/lib/OptionSD.soda @@ -19,27 +19,27 @@ class OptionSD [A] opt [B] (ifEmpty : B) (ifNonEmpty : A -> B) : B = match this case SomeSD_ (element) ==> ifNonEmpty (element) - case x ==> ifEmpty + case otherwise ==> ifEmpty map [B] (mapping : A -> B) : OptionSD [B] = match this case SomeSD_ (element) ==> SomeSD_ [B] (mapping (element) ) - case x ==> NoneSD_ [B] () + case otherwise ==> NoneSD_ [B] () getOrElse (default : A) : A = match this case SomeSD_ (element) ==> element - case x ==> default + case otherwise ==> default fold [B] (ifEmpty : B) (f : A -> B) : B = match this case SomeSD_ (element) ==> f (element) - case x ==> ifEmpty + case otherwise ==> ifEmpty flatMap [B] (mapping : A -> OptionSD [B] ) : OptionSD [B] = match this case SomeSD_ (element) ==> mapping (element) - case x ==> NoneSD_ () + case otherwise ==> NoneSD_ () bind [B] (mapping : A -> OptionSD [B] ) : OptionSD [B] = flatMap [B] (mapping) @@ -50,7 +50,7 @@ class OptionSD [A] if predicate (element) then this else NoneSD_ [A] () - case x ==> NoneSD_ () + case otherwise ==> NoneSD_ () end diff --git a/translator/src/main/scala/soda/lib/Package.scala b/translator/src/main/scala/soda/lib/Package.scala index 4ca7ea0c..cb47abd7 100644 --- a/translator/src/main/scala/soda/lib/Package.scala +++ b/translator/src/main/scala/soda/lib/Package.scala @@ -111,31 +111,31 @@ trait OptionSD [A] def opt [B] (ifEmpty : B) (ifNonEmpty : A => B) : B = this match { case SomeSD_ (element) => ifNonEmpty (element) - case x => ifEmpty + case otherwise => ifEmpty } def map [B] (mapping : A => B) : OptionSD [B] = this match { case SomeSD_ (element) => SomeSD_ [B] (mapping (element) ) - case x => NoneSD_ [B] () + case otherwise => NoneSD_ [B] () } def getOrElse (default : A) : A = this match { case SomeSD_ (element) => element - case x => default + case otherwise => default } def fold [B] (ifEmpty : B) (f : A => B) : B = this match { case SomeSD_ (element) => f (element) - case x => ifEmpty + case otherwise => ifEmpty } def flatMap [B] (mapping : A => OptionSD [B] ) : OptionSD [B] = this match { case SomeSD_ (element) => mapping (element) - case x => NoneSD_ () + case otherwise => NoneSD_ () } def bind [B] (mapping : A => OptionSD [B] ) : OptionSD [B] = @@ -147,7 +147,7 @@ trait OptionSD [A] if ( predicate (element) ) this else NoneSD_ [A] () - case x => NoneSD_ () + case otherwise => NoneSD_ () } } @@ -333,7 +333,7 @@ trait SeqSD [A] def opt [B] (ifEmpty : B) (ifNonEmpty : NonEmptySeqSD [A] => B) : B = this match { case NonEmptySeqSD_ (toSeq) => ifNonEmpty (NonEmptySeqSD_ (toSeq) ) - case x => ifEmpty + case otherwise => ifEmpty } } diff --git a/translator/src/main/scala/soda/lib/SeqSD.soda b/translator/src/main/scala/soda/lib/SeqSD.soda index 7d6f355e..a2be6e78 100644 --- a/translator/src/main/scala/soda/lib/SeqSD.soda +++ b/translator/src/main/scala/soda/lib/SeqSD.soda @@ -16,7 +16,7 @@ class SeqSD [A] opt [B] (ifEmpty : B) (ifNonEmpty : NonEmptySeqSD [A] -> B) : B = match this case NonEmptySeqSD_ (toSeq) ==> ifNonEmpty (NonEmptySeqSD_ (toSeq) ) - case x ==> ifEmpty + case otherwise ==> ifEmpty end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda index 760e6911..f5d80815 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda @@ -23,7 +23,7 @@ class CoqClassConstructorBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case AbstractDeclarationAnnotation_ (block, references) ==> _translate_block (AbstractDeclarationAnnotation_ (block, references) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = _translate_block_with (_get_class_beginning (block.references) ) (block) @@ -93,7 +93,7 @@ class CoqClassConstructorBlockTranslator _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = match annotated_block case ClassBeginningAnnotation_ (b) ==> Some (ClassBeginningAnnotation_ (b) ) - case x ==> None + case otherwise ==> None _get_types_of_abstract_functions (block : AbstractDeclarationAnnotation) : Seq [String] = block.abstract_functions diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda index 57da28d8..bd0de0cc 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda @@ -29,7 +29,7 @@ class CoqClassDeclarationBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case ClassBeginningAnnotation_ (block) ==> _translate_class_beginning_block (ClassBeginningAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_class_beginning_block (block : ClassBeginningAnnotation) : ClassBeginningAnnotation = ClassBeginningAnnotation_ (_translate_block (block) ) diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda index 7ea35b26..731df9ce 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda @@ -21,7 +21,7 @@ class CoqClassEndBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case ClassEndAnnotation_ (block, references) ==> _translate_block (ClassEndAnnotation_ (block, references) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = _translate_block_with (_get_class_beginning (block.references) ) (block) @@ -56,7 +56,7 @@ class CoqClassEndBlockTranslator _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = match annotated_block case ClassBeginningAnnotation_ (b) ==> Some (ClassBeginningAnnotation_ (b) ) - case x ==> None + case otherwise ==> None end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda index fb64c954..aad97424 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda @@ -19,7 +19,7 @@ class CoqDefinitionBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case FunctionDefinitionAnnotation_ (block) ==> _translate_definition_block (FunctionDefinitionAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_definition_block (block : FunctionDefinitionAnnotation) : FunctionDefinitionAnnotation = FunctionDefinitionAnnotation_ (_translate_block (block) ) diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda index 28d383c8..37f6c18b 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda @@ -24,7 +24,7 @@ class CoqImportDeclarationBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case ImportDeclarationAnnotation_ (block) ==> _translate_block (ImportDeclarationAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : ImportDeclarationAnnotation) : ImportDeclarationAnnotation = ImportDeclarationAnnotation_ ( diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqPackageDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqPackageDeclarationBlockTranslator.soda index 82e20b4b..99080c15 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqPackageDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqPackageDeclarationBlockTranslator.soda @@ -19,7 +19,7 @@ class CoqPackageDeclarationBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case PackageDeclarationAnnotation_ (block) ==> _translate_block (PackageDeclarationAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : PackageDeclarationAnnotation) : PackageDeclarationAnnotation = PackageDeclarationAnnotation_ ( diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqProofBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqProofBlockTranslator.soda index 644440e2..42d7b0ca 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqProofBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqProofBlockTranslator.soda @@ -19,7 +19,7 @@ class CoqProofBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case ProofBlockAnnotation_ (block) ==> _translate_block (ProofBlockAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : ProofBlockAnnotation) : ProofBlockAnnotation = ProofBlockAnnotation_ ( diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqTheoremBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqTheoremBlockTranslator.soda index 6670b348..09230c5f 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqTheoremBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqTheoremBlockTranslator.soda @@ -19,7 +19,7 @@ class CoqTheoremBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case TheoremBlockAnnotation_ (block) ==> _translate_block (TheoremBlockAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : TheoremBlockAnnotation) : TheoremBlockAnnotation = TheoremBlockAnnotation_ ( diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda index 207cf673..11973a1a 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda @@ -30,7 +30,7 @@ class MatchCaseBlockTranslator match annotated_block case FunctionDefinitionAnnotation_ (block) ==> _translate_function_block (FunctionDefinitionAnnotation_ (block) ) case TestDeclarationAnnotation_ (block) ==> _translate_test_block (TestDeclarationAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_function_block (block : AnnotatedBlock) : FunctionDefinitionAnnotation = FunctionDefinitionAnnotation_ (_translate_block (block) ) diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala b/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala index dd5dce1d..20f6f1f8 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala @@ -32,7 +32,7 @@ trait CoqClassConstructorBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case AbstractDeclarationAnnotation_ (block, references) => _translate_block (AbstractDeclarationAnnotation_ (block, references) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = @@ -103,7 +103,7 @@ trait CoqClassConstructorBlockTranslator private def _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = annotated_block match { case ClassBeginningAnnotation_ (b) => Some (ClassBeginningAnnotation_ (b) ) - case x => None + case otherwise => None } private def _get_types_of_abstract_functions (block : AbstractDeclarationAnnotation) : Seq [String] = @@ -169,7 +169,7 @@ trait CoqClassDeclarationBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case ClassBeginningAnnotation_ (block) => _translate_class_beginning_block (ClassBeginningAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_class_beginning_block (block : ClassBeginningAnnotation) : ClassBeginningAnnotation = @@ -259,7 +259,7 @@ trait CoqClassEndBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case ClassEndAnnotation_ (block, references) => _translate_block (ClassEndAnnotation_ (block, references) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = @@ -295,7 +295,7 @@ trait CoqClassEndBlockTranslator private def _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = annotated_block match { case ClassBeginningAnnotation_ (b) => Some (ClassBeginningAnnotation_ (b) ) - case x => None + case otherwise => None } } @@ -323,7 +323,7 @@ trait CoqDefinitionBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case FunctionDefinitionAnnotation_ (block) => _translate_definition_block (FunctionDefinitionAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_definition_block (block : FunctionDefinitionAnnotation) : FunctionDefinitionAnnotation = @@ -389,7 +389,7 @@ trait CoqImportDeclarationBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case ImportDeclarationAnnotation_ (block) => _translate_block (ImportDeclarationAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : ImportDeclarationAnnotation) : ImportDeclarationAnnotation = @@ -446,7 +446,7 @@ trait CoqPackageDeclarationBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case PackageDeclarationAnnotation_ (block) => _translate_block (PackageDeclarationAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : PackageDeclarationAnnotation) : PackageDeclarationAnnotation = @@ -486,7 +486,7 @@ trait CoqProofBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case ProofBlockAnnotation_ (block) => _translate_block (ProofBlockAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : ProofBlockAnnotation) : ProofBlockAnnotation = @@ -537,7 +537,7 @@ trait CoqTheoremBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case TheoremBlockAnnotation_ (block) => _translate_block (TheoremBlockAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : TheoremBlockAnnotation) : TheoremBlockAnnotation = @@ -729,7 +729,7 @@ trait MatchCaseBlockTranslator annotated_block match { case FunctionDefinitionAnnotation_ (block) => _translate_function_block (FunctionDefinitionAnnotation_ (block) ) case TestDeclarationAnnotation_ (block) => _translate_test_block (TestDeclarationAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_function_block (block : AnnotatedBlock) : FunctionDefinitionAnnotation = @@ -1137,7 +1137,7 @@ trait TranslatorToCoq case 0 => _process_directory (_default_argument) case 1 => _process_directory (arguments (0) ) case 2 => _translate (arguments (0) ) (arguments (1) ) - case x => false + case otherwise => false } private def _process_directory (start : String) : Boolean = diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/TranslatorToCoq.soda b/translator/src/main/scala/soda/translator/extension/tocoq/TranslatorToCoq.soda index 3a770cd6..8a170b7a 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/TranslatorToCoq.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/TranslatorToCoq.soda @@ -37,7 +37,7 @@ class TranslatorToCoq case 0 ==> _process_directory (_default_argument) case 1 ==> _process_directory (arguments (0) ) case 2 ==> _translate (arguments (0) ) (arguments (1) ) - case x ==> false + case otherwise ==> false _process_directory (start : String) : Boolean = DirectoryProcessor_ (start, _process_soda_file).process () diff --git a/translator/src/main/scala/soda/translator/extension/todoc/Package.scala b/translator/src/main/scala/soda/translator/extension/todoc/Package.scala index c4dd912a..d6b0f430 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/todoc/Package.scala @@ -294,7 +294,7 @@ trait TranslatorToDoc case 0 => _process_directory (_default_argument) case 1 => _process_directory (arguments (0) ) case 2 => _translate (arguments (0) ) (arguments (1) ) - case x => false + case otherwise => false } def translate_content (input : String) : String = diff --git a/translator/src/main/scala/soda/translator/extension/todoc/TranslatorToDoc.soda b/translator/src/main/scala/soda/translator/extension/todoc/TranslatorToDoc.soda index 854cf323..8198aa12 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/TranslatorToDoc.soda +++ b/translator/src/main/scala/soda/translator/extension/todoc/TranslatorToDoc.soda @@ -39,7 +39,7 @@ class TranslatorToDoc case 0 ==> _process_directory (_default_argument) case 1 ==> _process_directory (arguments (0) ) case 2 ==> _translate (arguments (0) ) (arguments (1) ) - case x ==> false + case otherwise ==> false translate_content (input : String) : String = _tc.doc_header + _translator.translate (input) + _tc.doc_footer diff --git a/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda index 74bef5aa..7d06303e 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda @@ -24,7 +24,7 @@ class AbstractDeclarationBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case AbstractDeclarationAnnotation_ (block, references) ==> _translate_block (AbstractDeclarationAnnotation_ (block, references) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = AbstractDeclarationAnnotation_ ( diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda index ecb8f37c..0827a6a4 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda @@ -25,7 +25,7 @@ class ClassConstructorBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case ClassEndAnnotation_ (block, references) ==> _translate_block (ClassEndAnnotation_ (block, references) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = _translate_block_with (_get_class_beginning (block.references) ) (block) @@ -83,7 +83,7 @@ class ClassConstructorBlockTranslator _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = match annotated_block case ClassBeginningAnnotation_ (b) ==> Some (ClassBeginningAnnotation_ (b) ) - case x ==> None + case otherwise ==> None _get_abstract_functions (references : Seq [AnnotatedBlock] ) : Seq [String] = references @@ -94,7 +94,7 @@ class ClassConstructorBlockTranslator _get_as_abstract_declaration_annotation (block : AnnotatedBlock) : Option [AbstractDeclarationAnnotation] = match block case AbstractDeclarationAnnotation_ (b, references) ==> Some (AbstractDeclarationAnnotation_ (b, references) ) - case x ==> None + case otherwise ==> None _translate_type_symbols (line : String) : String = line diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda index 1fb132d1..ad7aaf8c 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda @@ -30,7 +30,7 @@ class ClassDeclarationBlockTranslator match annotated_block case ClassBeginningAnnotation_ (block) ==> _translate_class_beginning_block (ClassBeginningAnnotation_ (block) ) case ClassAliasAnnotation_ (block) ==> _translate_class_alias_block (ClassAliasAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_class_beginning_block (block : ClassBeginningAnnotation) : ClassBeginningAnnotation = ClassBeginningAnnotation_ (_translate_block (block) ) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda index 2aff5a3b..ef419eb2 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda @@ -18,7 +18,7 @@ class ClassEndBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case ClassEndAnnotation_ (block, references) ==> _translate_block (ClassEndAnnotation_ (block, references) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = ClassEndAnnotation_ ( diff --git a/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda index d3104546..d855da35 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda @@ -26,7 +26,7 @@ class FunctionDefinitionBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case FunctionDefinitionAnnotation_ (block) ==> _translate_function_definition_block (block) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_function_definition_block (block : Block) : FunctionDefinitionAnnotation = FunctionDefinitionAnnotation_ (_translate_block (block) ) @@ -48,7 +48,7 @@ class FunctionDefinitionBlockTranslator match detector.detect case detector.val_detected ==> _replace_on_val_block (_get_initial_comment (block.annotated_lines) ) (_get_part_without_initial_comment (block.annotated_lines) ) case detector.def_detected ==> _replace_on_def_block (_get_initial_comment (block.annotated_lines) ) (_get_part_without_initial_comment (block.annotated_lines) ) - case x ==> block + case otherwise ==> block _replace_on_val_block (initial_comments : Seq [AnnotatedLine] ) (main_block : Seq [AnnotatedLine] ) : Block = Block_ ( diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda index 1aa1b318..a6ff6aff 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda @@ -23,7 +23,7 @@ class ImportDeclarationBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case ImportDeclarationAnnotation_ (block) ==> _translate_block (ImportDeclarationAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : ImportDeclarationAnnotation) : ImportDeclarationAnnotation = ImportDeclarationAnnotation_ ( diff --git a/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda index 142c22de..23038e65 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda @@ -20,7 +20,7 @@ class MainClassBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case ClassEndAnnotation_ (block, references) ==> _translate_block (ClassEndAnnotation_ (block, references) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = if _get_class_name (block.references) == _tc.soda_main_class_name @@ -50,7 +50,7 @@ class MainClassBlockTranslator _get_as_class_beginning_annotation (block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = match block case ClassBeginningAnnotation_ (b) ==> Some (ClassBeginningAnnotation_ (b) ) - case x ==> None + case otherwise ==> None end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda index d5d4c6ec..f8cdf4f1 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda @@ -27,7 +27,7 @@ class MatchCaseBlockTranslator match annotated_block case FunctionDefinitionAnnotation_ (block) ==> _translate_function_block (FunctionDefinitionAnnotation_ (block) ) case TestDeclarationAnnotation_ (block) ==> _translate_test_block (TestDeclarationAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_function_block (block : AnnotatedBlock) : FunctionDefinitionAnnotation = FunctionDefinitionAnnotation_ (_translate_block (block) ) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala index a9cef254..32b2dc3d 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala @@ -33,7 +33,7 @@ trait AbstractDeclarationBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case AbstractDeclarationAnnotation_ (block, references) => _translate_block (AbstractDeclarationAnnotation_ (block, references) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = @@ -95,7 +95,7 @@ trait ClassConstructorBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case ClassEndAnnotation_ (block, references) => _translate_block (ClassEndAnnotation_ (block, references) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = @@ -154,7 +154,7 @@ trait ClassConstructorBlockTranslator private def _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = annotated_block match { case ClassBeginningAnnotation_ (b) => Some (ClassBeginningAnnotation_ (b) ) - case x => None + case otherwise => None } private def _get_abstract_functions (references : Seq [AnnotatedBlock] ) : Seq [String] = @@ -166,7 +166,7 @@ trait ClassConstructorBlockTranslator private def _get_as_abstract_declaration_annotation (block : AnnotatedBlock) : Option [AbstractDeclarationAnnotation] = block match { case AbstractDeclarationAnnotation_ (b, references) => Some (AbstractDeclarationAnnotation_ (b, references) ) - case x => None + case otherwise => None } private def _translate_type_symbols (line : String) : String = @@ -220,7 +220,7 @@ trait ClassDeclarationBlockTranslator annotated_block match { case ClassBeginningAnnotation_ (block) => _translate_class_beginning_block (ClassBeginningAnnotation_ (block) ) case ClassAliasAnnotation_ (block) => _translate_class_alias_block (ClassAliasAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_class_beginning_block (block : ClassBeginningAnnotation) : ClassBeginningAnnotation = @@ -318,7 +318,7 @@ trait ClassEndBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case ClassEndAnnotation_ (block, references) => _translate_block (ClassEndAnnotation_ (block, references) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = @@ -375,7 +375,7 @@ trait FunctionDefinitionBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case FunctionDefinitionAnnotation_ (block) => _translate_function_definition_block (block) - case x => annotated_block + case otherwise => annotated_block } private def _translate_function_definition_block (block : Block) : FunctionDefinitionAnnotation = @@ -398,7 +398,7 @@ trait FunctionDefinitionBlockTranslator detector.detect match { case detector.val_detected => _replace_on_val_block (_get_initial_comment (block.annotated_lines) ) (_get_part_without_initial_comment (block.annotated_lines) ) case detector.def_detected => _replace_on_def_block (_get_initial_comment (block.annotated_lines) ) (_get_part_without_initial_comment (block.annotated_lines) ) - case x => block + case otherwise => block } private def _replace_on_val_block (initial_comments : Seq [AnnotatedLine] ) (main_block : Seq [AnnotatedLine] ) : Block = @@ -578,7 +578,7 @@ trait ImportDeclarationBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case ImportDeclarationAnnotation_ (block) => _translate_block (ImportDeclarationAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : ImportDeclarationAnnotation) : ImportDeclarationAnnotation = @@ -634,7 +634,7 @@ trait MainClassBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case ClassEndAnnotation_ (block, references) => _translate_block (ClassEndAnnotation_ (block, references) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = @@ -665,7 +665,7 @@ trait MainClassBlockTranslator private def _get_as_class_beginning_annotation (block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = block match { case ClassBeginningAnnotation_ (b) => Some (ClassBeginningAnnotation_ (b) ) - case x => None + case otherwise => None } } @@ -701,7 +701,7 @@ trait MatchCaseBlockTranslator annotated_block match { case FunctionDefinitionAnnotation_ (block) => _translate_function_block (FunctionDefinitionAnnotation_ (block) ) case TestDeclarationAnnotation_ (block) => _translate_test_block (TestDeclarationAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_function_block (block : AnnotatedBlock) : FunctionDefinitionAnnotation = @@ -831,7 +831,7 @@ trait TheoremAndProofBlockTranslator annotated_block match { case TheoremBlockAnnotation_ (block) => _translate_theorem_block (TheoremBlockAnnotation_ (block) ) case ProofBlockAnnotation_ (block) => _translate_proof_block (ProofBlockAnnotation_ (block) ) - case x => annotated_block + case otherwise => annotated_block } private def _translate_theorem_block (block : AnnotatedBlock) : TheoremBlockAnnotation = @@ -1131,7 +1131,7 @@ trait TranslatorToScala if ( _is_single_files_option (arguments.apply (0) ) ) IndividualProcessor_ ().translate (arguments.apply (1) ) (arguments.apply (2) ) else false - case x => false + case otherwise => false } private def _process_directory_with_single_files_option (start : String) : Boolean = diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TheoremAndProofBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/TheoremAndProofBlockTranslator.soda index 249308cd..9c80acc4 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/TheoremAndProofBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/TheoremAndProofBlockTranslator.soda @@ -22,7 +22,7 @@ class TheoremAndProofBlockTranslator match annotated_block case TheoremBlockAnnotation_ (block) ==> _translate_theorem_block (TheoremBlockAnnotation_ (block) ) case ProofBlockAnnotation_ (block) ==> _translate_proof_block (ProofBlockAnnotation_ (block) ) - case x ==> annotated_block + case otherwise ==> annotated_block _translate_theorem_block (block : AnnotatedBlock) : TheoremBlockAnnotation = TheoremBlockAnnotation_ (_translate_block (block) ) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda index 47f3b160..3e44bf1a 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda @@ -36,7 +36,7 @@ class TranslatorToScala if _is_single_files_option (arguments.apply (0) ) then IndividualProcessor_ ().translate (arguments.apply (1) ) (arguments.apply (2) ) else false - case x ==> false + case otherwise ==> false _process_directory_with_single_files_option (start : String) : Boolean = DirectoryProcessor_ (start , IndividualProcessor_ ().process_soda_file).process () diff --git a/translator/src/main/scala/soda/translator/parser/Package.scala b/translator/src/main/scala/soda/translator/parser/Package.scala index 98c7f0b5..bf73adca 100644 --- a/translator/src/main/scala/soda/translator/parser/Package.scala +++ b/translator/src/main/scala/soda/translator/parser/Package.scala @@ -238,7 +238,7 @@ trait PreprocessorSequenceTranslator case ClassBeginningAnnotation_ (b) => current.references.+: (Seq [AnnotatedBlock] (ClassBeginningAnnotation_ (b) ) ) case AbstractDeclarationAnnotation_ (b, references) => _update_first_element (current.references) (AbstractDeclarationAnnotation_ (b, references) ) case ClassEndAnnotation_ (b, references) => _tail_non_empty (current.references) - case x => current.references + case otherwise => current.references } private def _update_first_element (s : Seq [Seq [AnnotatedBlock] ] ) (b : AnnotatedBlock) : Seq [Seq [AnnotatedBlock] ] = diff --git a/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda b/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda index 26766722..a50f5674 100644 --- a/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda +++ b/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda @@ -80,7 +80,7 @@ class PreprocessorSequenceTranslator case ClassBeginningAnnotation_ (b) ==> current.references.+: (Seq [AnnotatedBlock] (ClassBeginningAnnotation_ (b) ) ) case AbstractDeclarationAnnotation_ (b, references) ==> _update_first_element (current.references) (AbstractDeclarationAnnotation_ (b, references) ) case ClassEndAnnotation_ (b, references) ==> _tail_non_empty (current.references) - case x ==> current.references + case otherwise ==> current.references _update_first_element (s : Seq [Seq [AnnotatedBlock] ] ) (b : AnnotatedBlock) : Seq [Seq [AnnotatedBlock] ] = _tail_non_empty (s).+: (s.headOption.getOrElse (Seq [AnnotatedBlock] () ).+: (b) ) diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.scala b/translator/src/test/resources/soda/translator/documentation/Manual.scala index 83e41065..3fb03504 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.scala +++ b/translator/src/test/resources/soda/translator/documentation/Manual.scala @@ -247,7 +247,7 @@ trait Manual def if_then_else [A] (condition : Boolean) (if_true : A) (if_false : A) : A = condition match { case true => if_true - case x => if_false + case otherwise => if_false } def sum (n : Int) = diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.soda b/translator/src/test/resources/soda/translator/documentation/Manual.soda index 791c6143..e3a95751 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.soda +++ b/translator/src/test/resources/soda/translator/documentation/Manual.soda @@ -221,7 +221,7 @@ class Manual if_then_else [A] (condition : Boolean) (if_true : A) (if_false : A) : A = match condition case true ==> if_true - case x ==> if_false + case otherwise ==> if_false sum (n : Int) = _tailrec_ (n) (0) diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.tex b/translator/src/test/resources/soda/translator/documentation/Manual.tex index 792f31ed..90999155 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.tex +++ b/translator/src/test/resources/soda/translator/documentation/Manual.tex @@ -394,7 +394,7 @@ if_then_else [A] (condition : Boolean) (if_true : A) (if_false : A) : A = match condition case true ==> if_true - case x ==> if_false + case otherwise ==> if_false sum (n : Int) = _tailrec_ (n) (0) diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda index 361ab4b8..21f5ed9d 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda @@ -17,6 +17,6 @@ class FizzBuzzPatternMatching case Tuple2 (0, 0) ==> fizz + buzz case Tuple2 (0, x) ==> fizz case Tuple2 (x, 0) ==> buzz - case x ==> n.toString + case otherwise ==> n.toString end diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.scala b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.scala index 2763aebc..2dfb7fac 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.scala +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.scala @@ -17,7 +17,7 @@ trait FizzBuzzPatternUnicode case Tuple2 (0 , 0) => fizz + buzz case Tuple2 (0 , x) => fizz case Tuple2 (x , 0) => buzz - case x => n.toString + case otherwise => n.toString } } diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.soda b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.soda index 2913a29b..bfeaf8ac 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.soda @@ -17,6 +17,6 @@ case Tuple2 (0 , 0) ⟹ fizz + buzz case Tuple2 (0 , x) ⟹ fizz case Tuple2 (x , 0) ⟹ buzz - case x ⟹ n.toString + case otherwise ⟹ n.toString ⎿ diff --git a/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda b/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda index d37ee2d6..f3e726a0 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda @@ -13,14 +13,14 @@ class PatternMatching case Singleton_ (x) ==> x case Pair_ (x, y) ==> (x + y) / 2 case Triplet_ (x, y, z) ==> (x + y + z) / 3 - case x ==> 0 + case otherwise ==> 0 get_type_name (p : Parameter) : String = match p case Singleton_ (x) ==> (Singleton_ (x) ).name + "(x)" case Pair_ (x, y) ==> (Pair_ (x, y) ).name + "(x, y)" case Triplet_ (x, y, z) ==> (Triplet_ (x, y, z) ).name + "(x, y, z)" - case x ==> "" + case otherwise ==> "" end diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda index b9368b1c..c7c038e8 100644 --- a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda +++ b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda @@ -58,7 +58,7 @@ class SegmentsForFlight rec_segments_multi (first_airport : String) (intermediate_stops : Seq [String] ) (last_airport : String) : Seq [Segment] = match intermediate_stops case head :: tail ==> (rec_segments_multi (head) (tail) (last_airport) ).+: (Segment_ (first_airport, head) ) - case x ==> Nil.+: (Segment_ (first_airport, last_airport) ) + case otherwise ==> Nil.+: (Segment_ (first_airport, last_airport) ) end diff --git a/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda b/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda index 88a14fec..eb3f11a0 100644 --- a/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda +++ b/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda @@ -12,7 +12,7 @@ class RecursionForCoq if (not (condition (current_value) (head) ) ) then current_value else _tailrec_fold4 (tail) (next_value_function (current_value) (head)) (next_value_function) (condition) - case x ==> current_value + case otherwise ==> current_value fold4 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = _tailrec_fold4 (sequence) (initial_value) (next_value_function) (condition) @@ -21,7 +21,7 @@ class RecursionForCoq _tailrec_fold3 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = match sequence case (head) :: (tail) ==> _tailrec_fold3 (tail) (next_value_function (current_value) (head)) (next_value_function) - case x ==> current_value + case otherwise ==> current_value fold3 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = _tailrec_fold3 (sequence) (initial_value) (next_value_function) diff --git a/translator/src/test/resources/soda/translator/example/forcoq/lib/List.soda b/translator/src/test/resources/soda/translator/example/forcoq/lib/List.soda index a2cad06a..81616d69 100644 --- a/translator/src/test/resources/soda/translator/example/forcoq/lib/List.soda +++ b/translator/src/test/resources/soda/translator/example/forcoq/lib/List.soda @@ -25,7 +25,7 @@ class SeqList _tailrec_reverse [A] (a : list [A] ) (b : list [A] ) : list [A] = match a case cons_ (e, s) ==> _tailrec_reverse (s) ( cons_ (e, b) ) - case x ==> b + case otherwise ==> b reverse [A] (s : list [A] ) : list [A] = _tailrec_reverse [A] (s) (nil_ [A] () ) @@ -34,7 +34,7 @@ class SeqList _tailrec_from_Seq [A] (a : Seq [A] ) (b : list [A] ) : list [A] = match a case (e) :: (s) ==> _tailrec_from_Seq (s) (cons_ (e, b) ) - case x ==> b + case otherwise ==> b from_Seq [A] (a : Seq [A] ) : list [A] = reverse (_tailrec_from_Seq (a) ( nil_ [A] () ) ) @@ -43,7 +43,7 @@ class SeqList _tailrec_to_Seq [A] (a : list [A] ) (b : Seq [A] ) : Seq [A] = match a case cons_ (e, s) ==> _tailrec_to_Seq (s) ( b .+: (e) ) - case x ==> b + case otherwise ==> b to_Seq [A] (a : list [A] ) : Seq [A] = (_tailrec_to_Seq (a) ( Seq [A]() ) ) .reverse diff --git a/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda b/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda index d6207e48..26b2af38 100644 --- a/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda +++ b/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda @@ -72,6 +72,6 @@ class IntNat to_Int (a : nat) : Int = match a case S_ (k) ==> 1 + to_Int (k) - case x ==> 0 + case otherwise ==> 0 end diff --git a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FactorialForCoq.soda b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FactorialForCoq.soda index fdda5183..64befb43 100644 --- a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FactorialForCoq.soda +++ b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FactorialForCoq.soda @@ -10,7 +10,7 @@ class FactorialForCoq _tailrec_get_factorial (m : nat) (product : nat) : nat = match m case S_ (k) ==> _tailrec_get_factorial (k) (product .mul ( S_ (k) ) ) - case x ==> product + case otherwise ==> product get_factorial (n : nat) : nat = _tailrec_get_factorial (n) (S_ ( O_ () ) ) diff --git a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FiboExampleInSodaForCoq.soda b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FiboExampleInSodaForCoq.soda index 4b8e9fbd..9a473fd2 100644 --- a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FiboExampleInSodaForCoq.soda +++ b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FiboExampleInSodaForCoq.soda @@ -11,7 +11,7 @@ class FiboExampleInSodaForCoq match m case S_ (O_ () ) ==> b case S_ (k) ==> _tailrec_fib (k) (b) (a .add (b) ) - case x ==> a + case otherwise ==> a fib (n : nat) = _tailrec_fib (n) (O_ () ) ( S_ (O_ () ) ) diff --git a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.soda b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.soda index 92de56a9..b6b58364 100644 --- a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.soda +++ b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.soda @@ -10,7 +10,7 @@ class TriangularNumberForCoq _tailrec_get_number (m : nat) (acc : nat) : nat = match m case S_ (k) ==> _tailrec_get_number (k) (acc .add ( S_ (k) ) ) - case x ==> acc + case otherwise ==> acc get_number (n : nat) : nat = _tailrec_get_number (n) ( O_ () ) diff --git a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.v b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.v index 3003fa2f..4afe973c 100644 --- a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.v +++ b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.v @@ -8,7 +8,7 @@ Fixpoint @tailrec _tailrec_get_number (m : nat) (acc : nat) : nat := match m with | S_ (k) => _tailrec_get_number (k) (acc .add ( S_ (k) ) ) - | x => acc + | otherwise => acc end . diff --git a/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda index 928b6356..786b4569 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda @@ -224,7 +224,7 @@ class MicroTranslatorToScalaSpec () "\n match n" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + - "\n case x ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + "\n" ) ) ( @@ -232,7 +232,7 @@ class MicroTranslatorToScalaSpec () "\n n match {" + "\n case 0 => 1 " + "\n case 1 => 1 " + - "\n case x => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + "\n }" + "\n" ) @@ -244,7 +244,7 @@ class MicroTranslatorToScalaSpec () "\n match n" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + - "\n case x ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + "\n" ) ) ( @@ -252,7 +252,7 @@ class MicroTranslatorToScalaSpec () "\n n match {" + "\n case 0 => 1 " + "\n case 1 => 1 " + - "\n case x => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + "\n }" + "\n" ) @@ -264,7 +264,7 @@ class MicroTranslatorToScalaSpec () "\n n match" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + - "\n case x ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + "\n" ) ) ( @@ -272,7 +272,7 @@ class MicroTranslatorToScalaSpec () "\n n match" + "\n case 0 => 1 " + "\n case 1 => 1 " + - "\n case x => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + "\n" ) ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala index d7cfdeaf..d5d02b70 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala @@ -597,7 +597,7 @@ case class MicroTranslatorToScalaSpec () "\n match n" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + - "\n case x ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + "\n" ) ) ( @@ -605,7 +605,7 @@ case class MicroTranslatorToScalaSpec () "\n n match {" + "\n case 0 => 1 " + "\n case 1 => 1 " + - "\n case x => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + "\n }" + "\n" ) @@ -617,7 +617,7 @@ case class MicroTranslatorToScalaSpec () "\n match n" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + - "\n case x ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + "\n" ) ) ( @@ -625,7 +625,7 @@ case class MicroTranslatorToScalaSpec () "\n n match {" + "\n case 0 => 1 " + "\n case 1 => 1 " + - "\n case x => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + "\n }" + "\n" ) @@ -637,7 +637,7 @@ case class MicroTranslatorToScalaSpec () "\n n match" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + - "\n case x ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise ==> if x > 0 then fibo (x - 1) + fibo (x - 2) else 0" + "\n" ) ) ( @@ -645,7 +645,7 @@ case class MicroTranslatorToScalaSpec () "\n n match" + "\n case 0 => 1 " + "\n case 1 => 1 " + - "\n case x => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + + "\n case otherwise => if ( x > 0 ) fibo (x - 1) + fibo (x - 2) else 0" + "\n" ) ) From 7621bb56c0f04b32af93a001823d7e1fa0c92cec Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sat, 11 Mar 2023 22:02:01 +0100 Subject: [PATCH 11/56] Update example in Soda --- .../soda/example/mathematics/FactorialConcise.soda | 4 +++- .../mathematics/FactorialPatternMatching.soda | 4 +++- .../soda/example/mathematics/FactorialWithFold.soda | 4 +++- .../scala/soda/example/mathematics/Package.scala | 12 +++++++++--- .../soda/example/mathematics/FactorialSpec.soda | 2 +- .../scala/soda/example/mathematics/Package.scala | 2 +- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/examples/src/main/scala/soda/example/mathematics/FactorialConcise.soda b/examples/src/main/scala/soda/example/mathematics/FactorialConcise.soda index ee08b6ac..fce0c488 100644 --- a/examples/src/main/scala/soda/example/mathematics/FactorialConcise.soda +++ b/examples/src/main/scala/soda/example/mathematics/FactorialConcise.soda @@ -2,7 +2,9 @@ class FactorialConcise apply (n : Int) : Int = - _tailrec_get_factorial (n) (1) + if n < 0 + then 0 + else _tailrec_get_factorial (n) (1) @tailrec _tailrec_get_factorial (n : Int) (product : Int) : Int = diff --git a/examples/src/main/scala/soda/example/mathematics/FactorialPatternMatching.soda b/examples/src/main/scala/soda/example/mathematics/FactorialPatternMatching.soda index 9b932186..29b5964d 100644 --- a/examples/src/main/scala/soda/example/mathematics/FactorialPatternMatching.soda +++ b/examples/src/main/scala/soda/example/mathematics/FactorialPatternMatching.soda @@ -2,7 +2,9 @@ class FactorialPatternMatching apply (n : Int) : Int = - _tailrec_get_factorial (n) (1) + if n < 0 + then 0 + else _tailrec_get_factorial (n) (1) @tailrec _tailrec_get_factorial (n : Int) (product : Int) : Int = diff --git a/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda b/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda index e47e3d0a..16a4ac45 100644 --- a/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda +++ b/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda @@ -6,7 +6,9 @@ class FactorialWithFold _range = soda.lib.Range_ () apply (n : Int) : Int = - _fold.apply (_range.apply (n) ) (1) (any product --> any k --> (product * (k + 1) ) ) + if n < 0 + then 0 + else _fold.apply (_range.apply (n) ) (1) (any product --> any k --> (product * (k + 1) ) ) end diff --git a/examples/src/main/scala/soda/example/mathematics/Package.scala b/examples/src/main/scala/soda/example/mathematics/Package.scala index bcfc3464..8adcf7e5 100644 --- a/examples/src/main/scala/soda/example/mathematics/Package.scala +++ b/examples/src/main/scala/soda/example/mathematics/Package.scala @@ -11,7 +11,9 @@ trait FactorialConcise { def apply (n : Int) : Int = - _tailrec_get_factorial (n) (1) + if ( n < 0 + ) 0 + else _tailrec_get_factorial (n) (1) import scala.annotation.tailrec @tailrec final @@ -29,7 +31,9 @@ trait FactorialPatternMatching { def apply (n : Int) : Int = - _tailrec_get_factorial (n) (1) + if ( n < 0 + ) 0 + else _tailrec_get_factorial (n) (1) import scala.annotation.tailrec @tailrec final @@ -52,7 +56,9 @@ trait FactorialWithFold private lazy val _range = soda.lib.Range_ () def apply (n : Int) : Int = - _fold.apply (_range.apply (n) ) (1) ( product => k => (product * (k + 1) ) ) + if ( n < 0 + ) 0 + else _fold.apply (_range.apply (n) ) (1) ( product => k => (product * (k + 1) ) ) } diff --git a/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda b/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda index d3c7a9af..945f7e1f 100644 --- a/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda +++ b/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda @@ -7,7 +7,7 @@ class FactorialSpec () assert (obtained == expected) factorial_values = Seq ( - (0, 1), (1, 1), (2, 2), (3, 6), (4, 24), (5, 120), (6, 720), (7, 5040), (8, 40320), (9, 362880), (10, 3628800) + (-1, 0), (0, 1), (1, 1), (2, 2), (3, 6), (4, 24), (5, 120), (6, 720), (7, 5040), (8, 40320), (9, 362880), (10, 3628800) ) _factorial_concise = FactorialConcise_ () diff --git a/examples/src/test/scala/soda/example/mathematics/Package.scala b/examples/src/test/scala/soda/example/mathematics/Package.scala index a4a62f19..1e716d63 100644 --- a/examples/src/test/scala/soda/example/mathematics/Package.scala +++ b/examples/src/test/scala/soda/example/mathematics/Package.scala @@ -15,7 +15,7 @@ case class FactorialSpec () assert (obtained == expected) lazy val factorial_values = Seq ( - (0, 1), (1, 1), (2, 2), (3, 6), (4, 24), (5, 120), (6, 720), (7, 5040), (8, 40320), (9, 362880), (10, 3628800) + (-1, 0), (0, 1), (1, 1), (2, 2), (3, 6), (4, 24), (5, 120), (6, 720), (7, 5040), (8, 40320), (9, 362880), (10, 3628800) ) private lazy val _factorial_concise = FactorialConcise_ () From 7459e0080fec3882eec1860fff435cce58b74089 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sat, 11 Mar 2023 22:04:10 +0100 Subject: [PATCH 12/56] Update manual in Soda --- .../soda/translator/documentation/Manual.soda | 12 ++++++------ .../soda/translator/documentation/Manual.soda | 12 ++++++------ .../soda/translator/documentation/Manual.tex | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/translator/src/main/resources/soda/translator/documentation/Manual.soda b/translator/src/main/resources/soda/translator/documentation/Manual.soda index e3a95751..60336434 100644 --- a/translator/src/main/resources/soda/translator/documentation/Manual.soda +++ b/translator/src/main/resources/soda/translator/documentation/Manual.soda @@ -254,28 +254,28 @@ end class FoldWhile + apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) + @tailrec _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) - apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) - end class Range + apply (length : Int) : Seq [Int] = + _tailrec_range (length) (Seq [Int] () ) + @tailrec _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if n <= 0 then sequence else _tailrec_range (n - 1) (sequence.+: (n - 1) ) - apply (length : Int) : Seq [Int] = - _tailrec_range (length) (Seq [Int] () ) - end /* The main class has to be named `Main` and requires a `main` function that receives an `Array [String]` and returns a `Unit`. diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.soda b/translator/src/test/resources/soda/translator/documentation/Manual.soda index e3a95751..60336434 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.soda +++ b/translator/src/test/resources/soda/translator/documentation/Manual.soda @@ -254,28 +254,28 @@ end class FoldWhile + apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) + @tailrec _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) - apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) - end class Range + apply (length : Int) : Seq [Int] = + _tailrec_range (length) (Seq [Int] () ) + @tailrec _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if n <= 0 then sequence else _tailrec_range (n - 1) (sequence.+: (n - 1) ) - apply (length : Int) : Seq [Int] = - _tailrec_range (length) (Seq [Int] () ) - end /* The main class has to be named `Main` and requires a `main` function that receives an `Array [String]` and returns a `Unit`. diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.tex b/translator/src/test/resources/soda/translator/documentation/Manual.tex index 90999155..03fe3751 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.tex +++ b/translator/src/test/resources/soda/translator/documentation/Manual.tex @@ -440,28 +440,28 @@ class FoldWhile + apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) + @tailrec _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) - apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) - end class Range + apply (length : Int) : Seq [Int] = + _tailrec_range (length) (Seq [Int] () ) + @tailrec _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if n <= 0 then sequence else _tailrec_range (n - 1) (sequence.+: (n - 1) ) - apply (length : Int) : Seq [Int] = - _tailrec_range (length) (Seq [Int] () ) - end From ff9d94f64920535e9eec6617a62cf4bf161d167d Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sat, 11 Mar 2023 22:06:16 +0100 Subject: [PATCH 13/56] Update examples in Soda --- .../translator/example/mathematics/FactorialConcise.scala | 4 +++- .../soda/translator/example/mathematics/FactorialConcise.soda | 4 +++- .../example/mathematics/FactorialPatternMatching.scala | 4 +++- .../example/mathematics/FactorialPatternMatching.soda | 4 +++- .../translator/example/mathematics/FactorialWithFold.scala | 4 +++- .../translator/example/mathematics/FactorialWithFold.soda | 4 +++- .../translator/example/mathematics/FiboUnicodeExample.scala | 2 +- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialConcise.scala b/translator/src/test/resources/soda/translator/example/mathematics/FactorialConcise.scala index adc8593c..b1acacd2 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialConcise.scala +++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialConcise.scala @@ -2,7 +2,9 @@ trait FactorialConcise { def apply (n : Int) : Int = - _tailrec_get_factorial (n) (1) + if ( n < 0 + ) 0 + else _tailrec_get_factorial (n) (1) import scala.annotation.tailrec @tailrec final diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialConcise.soda b/translator/src/test/resources/soda/translator/example/mathematics/FactorialConcise.soda index ee08b6ac..fce0c488 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialConcise.soda +++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialConcise.soda @@ -2,7 +2,9 @@ class FactorialConcise apply (n : Int) : Int = - _tailrec_get_factorial (n) (1) + if n < 0 + then 0 + else _tailrec_get_factorial (n) (1) @tailrec _tailrec_get_factorial (n : Int) (product : Int) : Int = diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.scala b/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.scala index 7e2895cf..608cbeec 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.scala +++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.scala @@ -2,7 +2,9 @@ trait FactorialPatternMatching { def apply (n : Int) : Int = - _tailrec_get_factorial (n) (1) + if ( n < 0 + ) 0 + else _tailrec_get_factorial (n) (1) import scala.annotation.tailrec @tailrec final diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.soda b/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.soda index 9b932186..29b5964d 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.soda +++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.soda @@ -2,7 +2,9 @@ class FactorialPatternMatching apply (n : Int) : Int = - _tailrec_get_factorial (n) (1) + if n < 0 + then 0 + else _tailrec_get_factorial (n) (1) @tailrec _tailrec_get_factorial (n : Int) (product : Int) : Int = diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala index 02032bc3..5512afd3 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala +++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala @@ -6,7 +6,9 @@ trait FactorialWithFold private lazy val _range = soda.lib.Range_ () def apply (n : Int) : Int = - _fold.apply (_range.apply (n) ) (1) ( product => k => (product * (k + 1) ) ) + if ( n < 0 + ) 0 + else _fold.apply (_range.apply (n) ) (1) ( product => k => (product * (k + 1) ) ) } diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda index e47e3d0a..16a4ac45 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda +++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda @@ -6,7 +6,9 @@ class FactorialWithFold _range = soda.lib.Range_ () apply (n : Int) : Int = - _fold.apply (_range.apply (n) ) (1) (any product --> any k --> (product * (k + 1) ) ) + if n < 0 + then 0 + else _fold.apply (_range.apply (n) ) (1) (any product --> any k --> (product * (k + 1) ) ) end diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FiboUnicodeExample.scala b/translator/src/test/resources/soda/translator/example/mathematics/FiboUnicodeExample.scala index b895b1b6..506d00fb 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FiboUnicodeExample.scala +++ b/translator/src/test/resources/soda/translator/example/mathematics/FiboUnicodeExample.scala @@ -1,7 +1,7 @@ trait FiboUnicodeExample { - def apply (n : Int) = + def apply (n : Int) : Int = _rec (n) (0) (1) private def _rec (m : Int) (a : Int) (b : Int) : Int = From 84af9cd6fd7c948ac3428dddce3f3b58ce26086d Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sat, 11 Mar 2023 22:10:26 +0100 Subject: [PATCH 14/56] Update Manual --- .../soda/translator/documentation/Manual.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.scala b/translator/src/test/resources/soda/translator/documentation/Manual.scala index 3fb03504..ee9e50b6 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.scala +++ b/translator/src/test/resources/soda/translator/documentation/Manual.scala @@ -289,6 +289,9 @@ case class FactorialConcise_ () extends FactorialConcise trait FoldWhile { + def apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = + _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) + import scala.annotation.tailrec @tailrec final private def _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = @@ -296,9 +299,6 @@ trait FoldWhile ) current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) - def apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = - _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) - } case class FoldWhile_ () extends FoldWhile @@ -306,6 +306,9 @@ case class FoldWhile_ () extends FoldWhile trait Range { + def apply (length : Int) : Seq [Int] = + _tailrec_range (length) (Seq [Int] () ) + import scala.annotation.tailrec @tailrec final private def _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = @@ -313,9 +316,6 @@ trait Range ) sequence else _tailrec_range (n - 1) (sequence.+: (n - 1) ) - def apply (length : Int) : Seq [Int] = - _tailrec_range (length) (Seq [Int] () ) - } case class Range_ () extends Range From effe98528dadac9805fe89a4633019dd9373a147 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sat, 11 Mar 2023 22:32:50 +0100 Subject: [PATCH 15/56] Replace remaining `case x` by `case otherwise` --- .../soda/example/mathematics/FactorialPatternMatching.soda | 2 +- .../src/main/scala/soda/example/mathematics/Package.scala | 2 +- .../soda/translator/extension/todoc/DocBlockTranslator.soda | 2 +- .../main/scala/soda/translator/extension/todoc/Package.scala | 2 +- .../src/main/scala/soda/translator/parser/Package.scala | 2 +- .../translator/parser/PreprocessorSequenceTranslator.soda | 2 +- .../soda/translator/parser/annotation/AnnotationFactory.soda | 4 ++-- .../scala/soda/translator/parser/annotation/Package.scala | 4 ++-- .../example/mathematics/FactorialPatternMatching.soda | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/src/main/scala/soda/example/mathematics/FactorialPatternMatching.soda b/examples/src/main/scala/soda/example/mathematics/FactorialPatternMatching.soda index 29b5964d..df48a7c5 100644 --- a/examples/src/main/scala/soda/example/mathematics/FactorialPatternMatching.soda +++ b/examples/src/main/scala/soda/example/mathematics/FactorialPatternMatching.soda @@ -10,7 +10,7 @@ class FactorialPatternMatching _tailrec_get_factorial (n : Int) (product : Int) : Int = match n case 0 ==> product - case x ==> _tailrec_get_factorial (x - 1) (x * product) + case otherwise ==> _tailrec_get_factorial (n - 1) (n * product) end diff --git a/examples/src/main/scala/soda/example/mathematics/Package.scala b/examples/src/main/scala/soda/example/mathematics/Package.scala index 8adcf7e5..d380ace5 100644 --- a/examples/src/main/scala/soda/example/mathematics/Package.scala +++ b/examples/src/main/scala/soda/example/mathematics/Package.scala @@ -40,7 +40,7 @@ trait FactorialPatternMatching private def _tailrec_get_factorial (n : Int) (product : Int) : Int = n match { case 0 => product - case x => _tailrec_get_factorial (x - 1) (x * product) + case otherwise => _tailrec_get_factorial (n - 1) (n * product) } } diff --git a/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda index 0c5c886a..939048fa 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda @@ -23,7 +23,7 @@ class DocBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block case CommentAnnotation_ (block) ==> _translate_comment (CommentAnnotation_ (block) ) - case x ==> _translate_source_code (x) + case otherwise ==> _translate_source_code (annotated_block) _translate_comment (block : CommentAnnotation) : CommentAnnotation = CommentAnnotation_ ( diff --git a/translator/src/main/scala/soda/translator/extension/todoc/Package.scala b/translator/src/main/scala/soda/translator/extension/todoc/Package.scala index d6b0f430..3d68f800 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/todoc/Package.scala @@ -32,7 +32,7 @@ trait DocBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { case CommentAnnotation_ (block) => _translate_comment (CommentAnnotation_ (block) ) - case x => _translate_source_code (x) + case otherwise => _translate_source_code (annotated_block) } private def _translate_comment (block : CommentAnnotation) : CommentAnnotation = diff --git a/translator/src/main/scala/soda/translator/parser/Package.scala b/translator/src/main/scala/soda/translator/parser/Package.scala index bf73adca..e2f17473 100644 --- a/translator/src/main/scala/soda/translator/parser/Package.scala +++ b/translator/src/main/scala/soda/translator/parser/Package.scala @@ -217,7 +217,7 @@ trait PreprocessorSequenceTranslator current.block_sequence.apply (index) match { case AbstractDeclarationAnnotation_ (block, references) => _get_abstract_declaration_updated_block (current) (AbstractDeclarationAnnotation_ (block, references) ) case ClassEndAnnotation_ (block, references) => _get_class_end_updated_block (current) (ClassEndAnnotation_ (block, references) ) - case x => x + case otherwise => current.block_sequence.apply (index) } private def _get_abstract_declaration_updated_block (current : AuxiliaryTuple) (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = diff --git a/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda b/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda index a50f5674..4603b7a1 100644 --- a/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda +++ b/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda @@ -60,7 +60,7 @@ class PreprocessorSequenceTranslator match current.block_sequence.apply (index) case AbstractDeclarationAnnotation_ (block, references) ==> _get_abstract_declaration_updated_block (current) (AbstractDeclarationAnnotation_ (block, references) ) case ClassEndAnnotation_ (block, references) ==> _get_class_end_updated_block (current) (ClassEndAnnotation_ (block, references) ) - case x ==> x + case otherwise ==> current.block_sequence.apply (index) _get_abstract_declaration_updated_block (current : AuxiliaryTuple) (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = AbstractDeclarationAnnotation_ (block.block, block.references.++ (current.references.headOption.getOrElse (Seq [AnnotatedBlock] () ) ) ) diff --git a/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda b/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda index 6d0c200e..16a2a8bf 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda @@ -21,7 +21,7 @@ class AnnotationFactory annotate (block : Block) : AnnotatedBlock = match block case AnnotatedBlock_ (annotated_lines, block_annotation) ==> AnnotatedBlock_ (annotated_lines, block_annotation) - case x ==> _get_first_or_undefined (_find_candidates (x) ) (x) + case otherwise ==> _get_first_or_undefined (_find_candidates (block) ) (block) update_block (original_content : AnnotatedBlock) (new_content : Block) : AnnotatedBlock = match original_content @@ -36,7 +36,7 @@ class AnnotationFactory case ProofBlockAnnotation_ (b) ==> ProofBlockAnnotation_ (new_content) case CommentAnnotation_ (b) ==> CommentAnnotation_ (new_content) case TestDeclarationAnnotation_ (b) ==> TestDeclarationAnnotation_ (new_content) - case x ==> AnnotatedBlock_ (new_content.annotated_lines, x.block_annotation) + case otherwise ==> AnnotatedBlock_ (new_content.annotated_lines, original_content.block_annotation) _detectors (block : Block) : Seq [BlockAnnotationParser] = Seq ( diff --git a/translator/src/main/scala/soda/translator/parser/annotation/Package.scala b/translator/src/main/scala/soda/translator/parser/annotation/Package.scala index 29fd613f..37c0c6f5 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/Package.scala +++ b/translator/src/main/scala/soda/translator/parser/annotation/Package.scala @@ -58,7 +58,7 @@ trait AnnotationFactory def annotate (block : Block) : AnnotatedBlock = block match { case AnnotatedBlock_ (annotated_lines, block_annotation) => AnnotatedBlock_ (annotated_lines, block_annotation) - case x => _get_first_or_undefined (_find_candidates (x) ) (x) + case otherwise => _get_first_or_undefined (_find_candidates (block) ) (block) } def update_block (original_content : AnnotatedBlock) (new_content : Block) : AnnotatedBlock = @@ -74,7 +74,7 @@ trait AnnotationFactory case ProofBlockAnnotation_ (b) => ProofBlockAnnotation_ (new_content) case CommentAnnotation_ (b) => CommentAnnotation_ (new_content) case TestDeclarationAnnotation_ (b) => TestDeclarationAnnotation_ (new_content) - case x => AnnotatedBlock_ (new_content.annotated_lines, x.block_annotation) + case otherwise => AnnotatedBlock_ (new_content.annotated_lines, original_content.block_annotation) } private def _detectors (block : Block) : Seq [BlockAnnotationParser] = diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.soda b/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.soda index 29b5964d..df48a7c5 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.soda +++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.soda @@ -10,7 +10,7 @@ class FactorialPatternMatching _tailrec_get_factorial (n : Int) (product : Int) : Int = match n case 0 ==> product - case x ==> _tailrec_get_factorial (x - 1) (x * product) + case otherwise ==> _tailrec_get_factorial (n - 1) (n * product) end From 18aebc558b733634b2ed897291049741f10754d2 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Mon, 13 Mar 2023 17:42:00 +0100 Subject: [PATCH 16/56] Add Sphinx initial files for documentation --- .gitignore | 1 + docs/sphinx/Makefile | 20 ++++++++++++++++++++ docs/sphinx/make.bat | 35 +++++++++++++++++++++++++++++++++++ docs/sphinx/requirements.txt | 1 + docs/sphinx/source/conf.py | 28 ++++++++++++++++++++++++++++ docs/sphinx/source/index.rst | 18 ++++++++++++++++++ 6 files changed, 103 insertions(+) create mode 100644 docs/sphinx/Makefile create mode 100644 docs/sphinx/make.bat create mode 100644 docs/sphinx/requirements.txt create mode 100644 docs/sphinx/source/conf.py create mode 100644 docs/sphinx/source/index.rst diff --git a/.gitignore b/.gitignore index cbf65870..600ec835 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ Thumbs.db .cache .cache-main .cache-tests +docs/sphinx/build diff --git a/docs/sphinx/Makefile b/docs/sphinx/Makefile new file mode 100644 index 00000000..d0c3cbf1 --- /dev/null +++ b/docs/sphinx/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/sphinx/make.bat b/docs/sphinx/make.bat new file mode 100644 index 00000000..747ffb7b --- /dev/null +++ b/docs/sphinx/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/sphinx/requirements.txt b/docs/sphinx/requirements.txt new file mode 100644 index 00000000..483a4e96 --- /dev/null +++ b/docs/sphinx/requirements.txt @@ -0,0 +1 @@ +sphinx_rtd_theme diff --git a/docs/sphinx/source/conf.py b/docs/sphinx/source/conf.py new file mode 100644 index 00000000..c1135638 --- /dev/null +++ b/docs/sphinx/source/conf.py @@ -0,0 +1,28 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'Soda' +copyright = '2020--2023, Julian Alfredo Mendez' +author = 'Julian Alfredo Mendez' +release = '0.18.0' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [] + +templates_path = ['_templates'] +exclude_patterns = [] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'sphinx_rtd_theme' +html_static_path = ['_static'] diff --git a/docs/sphinx/source/index.rst b/docs/sphinx/source/index.rst new file mode 100644 index 00000000..6fc8f2b9 --- /dev/null +++ b/docs/sphinx/source/index.rst @@ -0,0 +1,18 @@ +.. Soda documentation master file. + +Documentation for the Soda language +=================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + From 0021a560b743f98d3c209fa499716aa6d66cbeb5 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Mon, 13 Mar 2023 17:58:11 +0100 Subject: [PATCH 17/56] Add .readthedocs.yaml --- .readthedocs.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..86bb985a --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,22 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.11" + +sphinx: + configuration: docs/sphinx/source/conf.py + +# formats: +# - pdf + +python: + install: + - requirements: docs/sphinx/requirements.txt + + From aac065a88ee28305b833ec38251d3aef5b51b5f0 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Mon, 13 Mar 2023 18:20:39 +0100 Subject: [PATCH 18/56] Update documentation --- docs/sphinx/source/appendix/index.rst | 6 ++++++ docs/sphinx/source/discussion/index.rst | 7 +++++++ docs/sphinx/source/index.rst | 8 ++++++++ docs/sphinx/source/manual/index.rst | 5 +++++ 4 files changed, 26 insertions(+) create mode 100644 docs/sphinx/source/appendix/index.rst create mode 100644 docs/sphinx/source/discussion/index.rst create mode 100644 docs/sphinx/source/manual/index.rst diff --git a/docs/sphinx/source/appendix/index.rst b/docs/sphinx/source/appendix/index.rst new file mode 100644 index 00000000..2bad65b8 --- /dev/null +++ b/docs/sphinx/source/appendix/index.rst @@ -0,0 +1,6 @@ +******** +Appendix +******** + +Tables to have in mind. + diff --git a/docs/sphinx/source/discussion/index.rst b/docs/sphinx/source/discussion/index.rst new file mode 100644 index 00000000..eb988dc3 --- /dev/null +++ b/docs/sphinx/source/discussion/index.rst @@ -0,0 +1,7 @@ +************ +Introduction +************ + +Why having a new language? + + diff --git a/docs/sphinx/source/index.rst b/docs/sphinx/source/index.rst index 6fc8f2b9..8342f249 100644 --- a/docs/sphinx/source/index.rst +++ b/docs/sphinx/source/index.rst @@ -3,10 +3,18 @@ Documentation for the Soda language =================================== +.. note:: + + These documentation pages are under construction. + .. toctree:: :maxdepth: 2 :caption: Contents: + discussion/index + manual/index + appendix/index + Indices and tables diff --git a/docs/sphinx/source/manual/index.rst b/docs/sphinx/source/manual/index.rst new file mode 100644 index 00000000..1267bda2 --- /dev/null +++ b/docs/sphinx/source/manual/index.rst @@ -0,0 +1,5 @@ +**************** +Reference Manual +**************** + +Reserved words in Soda From fa1a1404f1b7242549e9f3322969ba6e1ea30b0f Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Mon, 27 Mar 2023 10:47:10 +0200 Subject: [PATCH 19/56] Update script to build the project --- makeall.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/makeall.sh b/makeall.sh index b8b8ce78..8c8459b9 100644 --- a/makeall.sh +++ b/makeall.sh @@ -1,18 +1,18 @@ #/bin/bash # -# This script builds the Soda binary file. +# This script builds the binary file. # It requires `sbt` installed. # sbt scalaVersion sbtVersion version clean compile test package assembly -executableStub="exec java -jar \$0 \"\$@\" ; exit" -sodaFile="soda" scalaVersion="3.2.2" -jarFile="target/scala-${scalaVersion}/soda-*.jar" +binaryFile="soda" +executableStub="exec java -jar \$0 \"\$@\" ; exit" +jarFile="target/scala-${scalaVersion}/${binaryFile}-*.jar" -echo ${executableStub} >${sodaFile} -cat ${jarFile} >>${sodaFile} -chmod u+x ${sodaFile} +echo ${executableStub} >${binaryFile} +cat ${jarFile} >>${binaryFile} +chmod u+x ${binaryFile} From 0834f67ad80d710c4c5ed37325a9fb11bd3cc1ef Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Tue, 25 Apr 2023 22:48:29 +0200 Subject: [PATCH 20/56] Add SwapExample in Agda --- .../main/agda/soda/example/SwapExample.agda | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 examples/src/main/agda/soda/example/SwapExample.agda diff --git a/examples/src/main/agda/soda/example/SwapExample.agda b/examples/src/main/agda/soda/example/SwapExample.agda new file mode 100644 index 00000000..96a3a0d8 --- /dev/null +++ b/examples/src/main/agda/soda/example/SwapExample.agda @@ -0,0 +1,43 @@ +module SwapExample where + + +import Relation.Binary.PropositionalEquality as Eq + +open Eq +open Eq.≡-Reasoning + +open import Data.Nat + + +record PairExample : Set where + constructor PairExample- + + field + left : ℕ + right : ℕ + + +record SwapExample : Set where + constructor SwapExample- + + open PairExample + + swap : (pair : PairExample) -> PairExample + swap (pair) = + PairExample- (pair .right) (pair .left) + + lemmaSwapOfSwap : ∀ (pair : PairExample) -> swap (swap (pair) ) ≡ pair + + lemmaSwapOfSwap (PairExample- (x) (y) ) = + begin + swap (swap (PairExample- (x) (y) ) ) + ≡⟨⟩ + swap (PairExample- ( (PairExample- (x) (y) ) .right ) ( (PairExample- (x) (y) ) .left)) + ≡⟨⟩ + swap (PairExample- (y) (x)) + ≡⟨⟩ + PairExample- ( (PairExample- (y) (x) ) .right) ( (PairExample- (y) (x) ) .left) + ≡⟨⟩ + PairExample- (x) (y) + ∎ + From df30ff793ccc5e99136dd2fd105d7e9154a153ef Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Tue, 25 Apr 2023 23:26:01 +0200 Subject: [PATCH 21/56] Update fairness example in Soda --- .../ethicalissues/fairness/Fairness.soda | 31 ++++++----------- .../ethicalissues/fairness/Package.scala | 33 ++++++------------- 2 files changed, 20 insertions(+), 44 deletions(-) diff --git a/examples/src/main/scala/soda/example/ethicalissues/fairness/Fairness.soda b/examples/src/main/scala/soda/example/ethicalissues/fairness/Fairness.soda index 5994ca09..f3e3099f 100644 --- a/examples/src/main/scala/soda/example/ethicalissues/fairness/Fairness.soda +++ b/examples/src/main/scala/soda/example/ethicalissues/fairness/Fairness.soda @@ -6,37 +6,26 @@ class Applicant end -class AbstractFairness - - abstract - score_difference_tolerance : Double - ranking_difference_tolerance : Double - rank : Applicant -> Double - -end - class Fairness - extends - AbstractFairness abstract score_difference_tolerance : Double ranking_difference_tolerance : Double rank : Applicant -> Double - is_fair (alice : Applicant) (bob : Applicant) = - if have_similar_score (alice.background_score) (bob.background_score) - then have_similar_ranking (rank (alice) ) (rank (bob)) - else true - - have_similar_score (score1 : Double) (score2 : Double) = - difference_between (score1) (score2) < score_difference_tolerance + difference_between (value : Double) (another_value : Double) : Double = + Math.abs (value - another_value) - have_similar_ranking (result1 : Double) (result2 : Double) = + have_similar_ranking (result1 : Double) (result2 : Double) : Boolean = difference_between (result1) (result2) < ranking_difference_tolerance - difference_between (value : Double) (another_value : Double) = - Math.abs (value - another_value) + have_similar_score (score1 : Double) (score2 : Double) : Boolean = + difference_between (score1) (score2) < score_difference_tolerance + + is_fair (alice : Applicant) (bob : Applicant) : Boolean = + if have_similar_score (alice .background_score) (bob .background_score) + then have_similar_ranking (rank (alice) ) (rank (bob) ) + else true end diff --git a/examples/src/main/scala/soda/example/ethicalissues/fairness/Package.scala b/examples/src/main/scala/soda/example/ethicalissues/fairness/Package.scala index bb5d82e3..30e6a0f0 100644 --- a/examples/src/main/scala/soda/example/ethicalissues/fairness/Package.scala +++ b/examples/src/main/scala/soda/example/ethicalissues/fairness/Package.scala @@ -15,39 +15,26 @@ trait Applicant case class Applicant_ (background_score : Double) extends Applicant -trait AbstractFairness -{ - - def score_difference_tolerance : Double - def ranking_difference_tolerance : Double - def rank : Applicant => Double - -} - -case class AbstractFairness_ (score_difference_tolerance : Double, ranking_difference_tolerance : Double, rank : Applicant => Double) extends AbstractFairness - trait Fairness - extends - AbstractFairness { def score_difference_tolerance : Double def ranking_difference_tolerance : Double def rank : Applicant => Double - def is_fair (alice : Applicant) (bob : Applicant) = - if ( have_similar_score (alice.background_score) (bob.background_score) - ) have_similar_ranking (rank (alice) ) (rank (bob)) - else true - - def have_similar_score (score1 : Double) (score2 : Double) = - difference_between (score1) (score2) < score_difference_tolerance + def difference_between (value : Double) (another_value : Double) : Double = + Math.abs (value - another_value) - def have_similar_ranking (result1 : Double) (result2 : Double) = + def have_similar_ranking (result1 : Double) (result2 : Double) : Boolean = difference_between (result1) (result2) < ranking_difference_tolerance - def difference_between (value : Double) (another_value : Double) = - Math.abs (value - another_value) + def have_similar_score (score1 : Double) (score2 : Double) : Boolean = + difference_between (score1) (score2) < score_difference_tolerance + + def is_fair (alice : Applicant) (bob : Applicant) : Boolean = + if ( have_similar_score (alice .background_score) (bob .background_score) + ) have_similar_ranking (rank (alice) ) (rank (bob) ) + else true } From 583dad3e2f37bb3d7ee669b0201bd72215c33366 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Tue, 25 Apr 2023 23:16:57 +0200 Subject: [PATCH 22/56] Add fairness example in Agda --- .../src/main/agda/soda/example/Fairness.agda | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 examples/src/main/agda/soda/example/Fairness.agda diff --git a/examples/src/main/agda/soda/example/Fairness.agda b/examples/src/main/agda/soda/example/Fairness.agda new file mode 100644 index 00000000..7e098c62 --- /dev/null +++ b/examples/src/main/agda/soda/example/Fairness.agda @@ -0,0 +1,49 @@ + +module Fairness where + +open import Data.Bool +open import Data.Float + + +record Applicant : Set where + constructor Applicant- + + field + background-score : Float + + +record Fairness : Set where + constructor Fairness- + + field + score-difference-tolerance : Float + ranking-difference-tolerance : Float + rank : Applicant -> Float + + open Applicant + + abs-value : (value : Float) -> Float + abs-value (value) = + if value <ᵇ 0.0 + then 0.0 - value + else value + + difference-between : (value : Float) -> (another-value : Float) -> Float + difference-between (value) (another-value) = + abs-value (value - another-value) + + have-similar-ranking : (result1 : Float) -> (result2 : Float) -> Bool + have-similar-ranking (result1) (result2) = + difference-between (result1) (result2) <ᵇ ranking-difference-tolerance + + have-similar-score : (score1 : Float) -> (score2 : Float) -> Bool + have-similar-score (score1) (score2) = + difference-between (score1) (score2) <ᵇ score-difference-tolerance + + is-fair : (alice : Applicant) (bob : Applicant) -> Bool + is-fair (alice) (bob) = + if have-similar-score (alice .background-score) (bob .background-score) + then have-similar-ranking (rank (alice) ) (rank (bob) ) + else true + + From 680cd2c53dc71b497fd0a09374affe7d0e14fee3 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Wed, 26 Apr 2023 00:01:28 +0200 Subject: [PATCH 23/56] Update example --- .../ethicalissues/fairness/Fairness.scala | 33 ++++++------------- .../ethicalissues/fairness/Fairness.soda | 31 ++++++----------- 2 files changed, 20 insertions(+), 44 deletions(-) diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.scala b/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.scala index 945ff789..df98218f 100644 --- a/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.scala +++ b/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.scala @@ -7,39 +7,26 @@ trait Applicant case class Applicant_ (background_score : Double) extends Applicant -trait AbstractFairness -{ - - def score_difference_tolerance : Double - def ranking_difference_tolerance : Double - def rank : Applicant => Double - -} - -case class AbstractFairness_ (score_difference_tolerance : Double, ranking_difference_tolerance : Double, rank : Applicant => Double) extends AbstractFairness - trait Fairness - extends - AbstractFairness { def score_difference_tolerance : Double def ranking_difference_tolerance : Double def rank : Applicant => Double - def is_fair (alice : Applicant) (bob : Applicant) = - if ( have_similar_score (alice.background_score) (bob.background_score) - ) have_similar_ranking (rank (alice) ) (rank (bob)) - else true - - def have_similar_score (score1 : Double) (score2 : Double) = - difference_between (score1) (score2) < score_difference_tolerance + def difference_between (value : Double) (another_value : Double) : Double = + Math.abs (value - another_value) - def have_similar_ranking (result1 : Double) (result2 : Double) = + def have_similar_ranking (result1 : Double) (result2 : Double) : Boolean = difference_between (result1) (result2) < ranking_difference_tolerance - def difference_between (value : Double) (another_value : Double) = - Math.abs (value - another_value) + def have_similar_score (score1 : Double) (score2 : Double) : Boolean = + difference_between (score1) (score2) < score_difference_tolerance + + def is_fair (alice : Applicant) (bob : Applicant) : Boolean = + if ( have_similar_score (alice .background_score) (bob .background_score) + ) have_similar_ranking (rank (alice) ) (rank (bob) ) + else true } diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.soda b/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.soda index 5994ca09..f3e3099f 100644 --- a/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.soda +++ b/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.soda @@ -6,37 +6,26 @@ class Applicant end -class AbstractFairness - - abstract - score_difference_tolerance : Double - ranking_difference_tolerance : Double - rank : Applicant -> Double - -end - class Fairness - extends - AbstractFairness abstract score_difference_tolerance : Double ranking_difference_tolerance : Double rank : Applicant -> Double - is_fair (alice : Applicant) (bob : Applicant) = - if have_similar_score (alice.background_score) (bob.background_score) - then have_similar_ranking (rank (alice) ) (rank (bob)) - else true - - have_similar_score (score1 : Double) (score2 : Double) = - difference_between (score1) (score2) < score_difference_tolerance + difference_between (value : Double) (another_value : Double) : Double = + Math.abs (value - another_value) - have_similar_ranking (result1 : Double) (result2 : Double) = + have_similar_ranking (result1 : Double) (result2 : Double) : Boolean = difference_between (result1) (result2) < ranking_difference_tolerance - difference_between (value : Double) (another_value : Double) = - Math.abs (value - another_value) + have_similar_score (score1 : Double) (score2 : Double) : Boolean = + difference_between (score1) (score2) < score_difference_tolerance + + is_fair (alice : Applicant) (bob : Applicant) : Boolean = + if have_similar_score (alice .background_score) (bob .background_score) + then have_similar_ranking (rank (alice) ) (rank (bob) ) + else true end From 7e58f1e100f7ecdc3eddf9b3f055a1dddb7d4822 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Thu, 27 Apr 2023 22:23:59 +0200 Subject: [PATCH 24/56] Update examples in Agda --- examples/src/main/agda/soda/example/Fairness.agda | 9 ++++----- .../src/main/agda/soda/example/SwapExample.agda | 15 +++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/examples/src/main/agda/soda/example/Fairness.agda b/examples/src/main/agda/soda/example/Fairness.agda index 7e098c62..35167394 100644 --- a/examples/src/main/agda/soda/example/Fairness.agda +++ b/examples/src/main/agda/soda/example/Fairness.agda @@ -1,26 +1,25 @@ module Fairness where -open import Data.Bool -open import Data.Float +open import Data.Bool using (Bool ; false ; true ; if_then_else_) +open import Data.Float using (Float ; _-_ ; _<ᵇ_) record Applicant : Set where constructor Applicant- - field background-score : Float +open Applicant + record Fairness : Set where constructor Fairness- - field score-difference-tolerance : Float ranking-difference-tolerance : Float rank : Applicant -> Float - open Applicant abs-value : (value : Float) -> Float abs-value (value) = diff --git a/examples/src/main/agda/soda/example/SwapExample.agda b/examples/src/main/agda/soda/example/SwapExample.agda index 96a3a0d8..b84ea609 100644 --- a/examples/src/main/agda/soda/example/SwapExample.agda +++ b/examples/src/main/agda/soda/example/SwapExample.agda @@ -3,28 +3,27 @@ module SwapExample where import Relation.Binary.PropositionalEquality as Eq -open Eq -open Eq.≡-Reasoning +open Eq using (_≡_) +open Eq.≡-Reasoning using (begin_ ; _≡⟨⟩_ ; _∎) -open import Data.Nat +open import Data.Nat using (ℕ) record PairExample : Set where constructor PairExample- - field left : ℕ right : ℕ +open PairExample + record SwapExample : Set where constructor SwapExample- - open PairExample - swap : (pair : PairExample) -> PairExample swap (pair) = - PairExample- (pair .right) (pair .left) + PairExample- (pair .right) (pair .left) lemmaSwapOfSwap : ∀ (pair : PairExample) -> swap (swap (pair) ) ≡ pair @@ -32,7 +31,7 @@ record SwapExample : Set where begin swap (swap (PairExample- (x) (y) ) ) ≡⟨⟩ - swap (PairExample- ( (PairExample- (x) (y) ) .right ) ( (PairExample- (x) (y) ) .left)) + swap (PairExample- ( (PairExample- (x) (y) ) .right) ( (PairExample- (x) (y) ) .left) ) ≡⟨⟩ swap (PairExample- (y) (x)) ≡⟨⟩ From 65b508aaaef18983a24694d14342e16454180dda Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 5 May 2023 09:42:06 +0200 Subject: [PATCH 25/56] Update unit test --- .../extension/toscala/Package.scala | 24 +++++++++++++++++++ .../UpperAndLowerBoundDeclarationSpec.soda | 24 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala index d5d02b70..8691ced3 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala @@ -995,5 +995,29 @@ case class UpperAndLowerBoundDeclarationSpec () ) ) + test ("should translate mixed upper and lower bounds") ( + check ( + obtained = instance.translate (" class BlackBox [A subtype AbstractModel] [B subtype AbstractParameter]" + + "\n extends " + + "\n AbstractBlackBox[A][B]" + + "\n AbstractDevice [A] [B] " + + "\n" + + "\nend" + + "\n" + ) + ) ( + expected = " trait BlackBox [A <: AbstractModel] [B <: AbstractParameter]" + + "\n extends" + + "\n AbstractBlackBox[A][B]" + + "\n with AbstractDevice [A] [B]" + + "\n {" + + "\n" + + "\n}" + + "\n" + + "\n case class BlackBox_ [A <: AbstractModel] [B <: AbstractParameter] () extends BlackBox [A]" + + "\n" + ) + ) + } diff --git a/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda index 9f38583b..aea0cca4 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda @@ -102,5 +102,29 @@ class UpperAndLowerBoundDeclarationSpec () ) ) + test ("should translate mixed upper and lower bounds") ( + check ( + obtained := instance.translate (" class BlackBox [A subtype AbstractModel] [B subtype AbstractParameter]" + + "\n extends " + + "\n AbstractBlackBox[A][B]" + + "\n AbstractDevice [A] [B] " + + "\n" + + "\nend" + + "\n" + ) + ) ( + expected := " trait BlackBox [A <: AbstractModel] [B <: AbstractParameter]" + + "\n extends" + + "\n AbstractBlackBox[A][B]" + + "\n with AbstractDevice [A] [B]" + + "\n {" + + "\n" + + "\n}" + + "\n" + + "\n case class BlackBox_ [A <: AbstractModel] [B <: AbstractParameter] () extends BlackBox [A]" + + "\n" + ) + ) + end From 67aa418cfbcf8d7341767de1501312139a50feb9 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 5 May 2023 10:39:58 +0200 Subject: [PATCH 26/56] Make multiple type parameters be between different square brackets --- docs/RELEASE-NOTES.md | 1 + .../soda/example/algorithms/SaladMaker.soda | 4 +- .../algorithms/ScalaReservedWordEscaping.soda | 6 +- .../forcoq/algorithms/RecursionForCoq.soda | 8 +-- .../soda/example/mathematics/HardProblem.soda | 70 +++++++++---------- .../soda/example/mathematics/Package.scala | 2 +- .../main/resources/lib/soda/lib/Package.scala | 2 +- .../resources/lib/soda/lib/Recursion.soda | 14 ++-- .../soda/translator/documentation/Manual.soda | 6 +- .../src/main/scala/soda/lib/Package.scala | 2 +- .../src/main/scala/soda/lib/Recursion.soda | 14 ++-- .../AbstractDeclarationBlockTranslator.soda | 19 ++++- .../ClassConstructorBlockTranslator.soda | 1 + .../toscala/MicroTranslatorToScala.soda | 1 + .../extension/toscala/Package.scala | 44 +++++++++++- .../toscala/TypeParameterBlockTranslator.soda | 21 ++++++ .../soda/translator/parser/Package.scala | 2 +- .../soda/translator/parser/SodaConstant.soda | 2 +- .../annotation/ClassBeginningAnnotation.soda | 2 +- .../parser/annotation/Package.scala | 2 +- .../translator/documentation/Manual.scala | 2 +- .../soda/translator/documentation/Manual.soda | 6 +- .../soda/translator/documentation/Manual.tex | 6 +- .../example/algorithms/SaladMaker.soda | 4 +- .../algorithms/ScalaReservedWordEscaping.soda | 6 +- .../forcoq/algorithms/RecursionForCoq.soda | 8 +-- .../example/mathematics/HardProblem.soda | 70 +++++++++---------- .../ClassConstructorBlockTranslatorSpec.soda | 19 +++-- .../extension/toscala/Package.scala | 26 ++++--- .../UpperAndLowerBoundDeclarationSpec.soda | 8 +-- .../ClassBeginningAnnotationSpec.soda | 8 +-- .../parser/annotation/Package.scala | 8 +-- 32 files changed, 245 insertions(+), 149 deletions(-) create mode 100644 translator/src/main/scala/soda/translator/extension/toscala/TypeParameterBlockTranslator.soda diff --git a/docs/RELEASE-NOTES.md b/docs/RELEASE-NOTES.md index 5b85e516..88e827b4 100644 --- a/docs/RELEASE-NOTES.md +++ b/docs/RELEASE-NOTES.md @@ -5,6 +5,7 @@ - release: target/scala-3.2.2/soda-0.18.0.jar - new_features: - assumes translation to `Package.scala` files as default configuration for the Scala translator + - expects multiple type parameters to be between different square brackets, e.g. `MyPair [A] [B]` instead of `MyPair [A, B]` - bug_fixes: - fixes translation of reserved words after opening parenthesis - - version: v0.17.0 diff --git a/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda b/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda index b76f18d1..fa8360f3 100644 --- a/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda +++ b/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda @@ -1,7 +1,7 @@ class SaladMaker - apply [Ingredient, Salad] + apply [Ingredient] [Salad] (list_of_ingredients : Seq [Ingredient] ) (initial_bowl : Salad) (next_ingredient_function : Salad -> Ingredient -> Salad) @@ -10,7 +10,7 @@ class SaladMaker _tailrec_prepare_salad (list_of_ingredients) (initial_bowl) (next_ingredient_function) (condition_to_continue) @tailrec - _tailrec_prepare_salad [Ingredient, Salad] + _tailrec_prepare_salad [Ingredient] [Salad] (ingredients_so_far : Seq [Ingredient] ) (salad_so_far : Salad) (next_ingredient_function : Salad -> Ingredient -> Salad) diff --git a/examples/src/main/scala/soda/example/algorithms/ScalaReservedWordEscaping.soda b/examples/src/main/scala/soda/example/algorithms/ScalaReservedWordEscaping.soda index 6b1165f2..7c990f65 100644 --- a/examples/src/main/scala/soda/example/algorithms/ScalaReservedWordEscaping.soda +++ b/examples/src/main/scala/soda/example/algorithms/ScalaReservedWordEscaping.soda @@ -5,9 +5,9 @@ class ScalaReservedWordEscaping val = 1 - def [A, B] (key : A) (value : B) : MyPair [A, B] = MyPair_ (key, value) + def [A] [B] (key : A) (value : B) : MyPair [A] [B] = MyPair_ (key, value) - while [A, B] (seq : Seq [A] ) (cond : A -> Boolean) (funct : A -> B) : Seq [B] = + while [A] [B] (seq : Seq [A] ) (cond : A -> Boolean) (funct : A -> B) : Seq [B] = seq.takeWhile (cond).map (funct) protected = "protected" @@ -23,7 +23,7 @@ class ScalaReservedWordEscaping end -class MyPair [A, B] +class MyPair [A] [B] abstract key : A diff --git a/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda b/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda index eb3f11a0..f07091d9 100644 --- a/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda +++ b/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda @@ -6,7 +6,7 @@ class RecursionForCoq @tailrec - _tailrec_fold4 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + _tailrec_fold4 [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = match sequence case (head) :: (tail) ==> if (not (condition (current_value) (head) ) ) @@ -14,16 +14,16 @@ class RecursionForCoq else _tailrec_fold4 (tail) (next_value_function (current_value) (head)) (next_value_function) (condition) case otherwise ==> current_value - fold4 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + fold4 [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = _tailrec_fold4 (sequence) (initial_value) (next_value_function) (condition) @tailrec - _tailrec_fold3 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = + _tailrec_fold3 [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = match sequence case (head) :: (tail) ==> _tailrec_fold3 (tail) (next_value_function (current_value) (head)) (next_value_function) case otherwise ==> current_value - fold3 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = + fold3 [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = _tailrec_fold3 (sequence) (initial_value) (next_value_function) @tailrec diff --git a/examples/src/main/scala/soda/example/mathematics/HardProblem.soda b/examples/src/main/scala/soda/example/mathematics/HardProblem.soda index 9e69fc23..673d7304 100644 --- a/examples/src/main/scala/soda/example/mathematics/HardProblem.soda +++ b/examples/src/main/scala/soda/example/mathematics/HardProblem.soda @@ -1,74 +1,74 @@ -class InputPair [A, B] +class InputPair [A] [B] abstract value : A - memoized_values : Map [A, B] + memoized_values : Map [A] [B] end -class OutputPair [A, B] +class OutputPair [A] [B] abstract value : B - memoized_values : Map [A, B] + memoized_values : Map [A] [B] end -class MemoizableFunction [A, B] +class MemoizableFunction [A] [B] abstract - /** compute (input : InputPair [A, B] ) : OutputPair [A, B] */ - abs_compute : InputPair [A, B] -> OutputPair [A, B] + /** compute (input : InputPair [A] [B] ) : OutputPair [A] [B] */ + abs_compute : InputPair [A] [B] -> OutputPair [A] [B] - compute (input : InputPair [A, B] ) : OutputPair [A, B] = + compute (input : InputPair [A] [B] ) : OutputPair [A] [B] = abs_compute (input) end -class MainFunction [A, B] +class MainFunction [A] [B] abstract - main_function : InputPair [A, B] -> OutputPair [A, B] + main_function : InputPair [A] [B] -> OutputPair [A] [B] end -class Memoizer [A, B] +class Memoizer [A] [B] extends - MemoizableFunction [A, B] - MainFunction [A, B] + MemoizableFunction [A] [B] + MainFunction [A] [B] abstract - main_function : InputPair [A, B] -> OutputPair [A, B] + main_function : InputPair [A] [B] -> OutputPair [A] [B] - abs_compute : InputPair [A, B] -> OutputPair [A, B] = + abs_compute : InputPair [A] [B] -> OutputPair [A] [B] = lambda input --> compute_for (input) - compute_for (input : InputPair [A, B] ) : OutputPair [A, B] = + compute_for (input : InputPair [A] [B] ) : OutputPair [A] [B] = _compute_with (input.memoized_values.get (input.value) ) (input) - _compute_with (maybe_res : Option [B] ) (input : InputPair [A, B] ) : OutputPair [A, B] = + _compute_with (maybe_res : Option [B] ) (input : InputPair [A] [B] ) : OutputPair [A] [B] = if maybe_res.isEmpty then compute_and_update (input) else OutputPair_ (maybe_res.get, input.memoized_values) - compute_and_update (input : InputPair [A, B] ) : OutputPair [A, B] = + compute_and_update (input : InputPair [A] [B] ) : OutputPair [A] [B] = _compute_and_update_with (input.value) (main_function (input) ) - _compute_and_update_with (input_value : A) (output : OutputPair [A, B] ) : OutputPair [A, B] = + _compute_and_update_with (input_value : A) (output : OutputPair [A] [B] ) : OutputPair [A] [B] = _add_element (output, Tuple2 (input_value, output.value) ) - _add_element (output : OutputPair [A, B], new_pair : Tuple2 [A, B] ) : OutputPair [A, B] = + _add_element (output : OutputPair [A] [B], new_pair : Tuple2 [A] [B] ) : OutputPair [A] [B] = OutputPair_ (output.value, output.memoized_values + new_pair) end class HardProblem extends - MemoizableFunction [Int, Int] + MemoizableFunction [Int] [Int] - memoizer = Memoizer_ [Int, Int] (main_function) + memoizer = Memoizer_ [Int] [Int] (main_function) is_even (n : Int) : Boolean = n % 2 == 0 @@ -78,56 +78,56 @@ class HardProblem then n / 2 else 3 * n + 1 - main_function : InputPair [Int, Int] -> OutputPair [Int, Int] = + main_function : InputPair [Int] [Int] -> OutputPair [Int] [Int] = lambda input --> if input.value == 1 then OutputPair_ (0, input.memoized_values) else _plus_one (compute (InputPair_ (one_step (input.value), input.memoized_values) ) ) - _plus_one (pair : OutputPair [Int, Int] ) : OutputPair [Int, Int] = + _plus_one (pair : OutputPair [Int] [Int] ) : OutputPair [Int] [Int] = OutputPair_ (1 + pair.value, pair.memoized_values) - abs_compute : InputPair [Int, Int] -> OutputPair [Int, Int] = + abs_compute : InputPair [Int] [Int] -> OutputPair [Int] [Int] = lambda input --> compute_for (input) - compute_for (input : InputPair [Int, Int] ) : OutputPair [Int, Int] = + compute_for (input : InputPair [Int] [Int] ) : OutputPair [Int] [Int] = memoizer.compute (input) end class MemoizedFibonacci extends - MemoizableFunction [Int, Int] + MemoizableFunction [Int] [Int] - memoizer = Memoizer_ [Int, Int] (main_function) + memoizer = Memoizer_ [Int] [Int] (main_function) - main_function : InputPair [Int, Int] -> OutputPair [Int, Int] = + main_function : InputPair [Int] [Int] -> OutputPair [Int] [Int] = lambda input --> main_function_for (input) - main_function_for (input : InputPair [Int, Int] ): OutputPair [Int, Int] = + main_function_for (input : InputPair [Int] [Int] ): OutputPair [Int] [Int] = if (input.value == 0) or (input.value == 1) then OutputPair_ (input.value, input.memoized_values ) else _compute_and_update_1 (compute (InputPair_ (input.value - 2, input.memoized_values ) ) ) (input.value) - _compute_and_update_1 (first_tuple : OutputPair [Int, Int] ) (n : Int ) : OutputPair [Int, Int] = + _compute_and_update_1 (first_tuple : OutputPair [Int] [Int] ) (n : Int ) : OutputPair [Int] [Int] = _compute_and_update_2 (first_tuple.value) (compute (InputPair_ (n - 1, first_tuple.memoized_values) ) ) (n) - _compute_and_update_2 (first_value : Int) (second_tuple : OutputPair [Int, Int] ) (n : Int ) : OutputPair [Int, Int] = + _compute_and_update_2 (first_value : Int) (second_tuple : OutputPair [Int] [Int] ) (n : Int ) : OutputPair [Int] [Int] = _compute_and_update_3 (_get_next_fibo (first_value) (second_tuple.value) ) (second_tuple.memoized_values) (n) - _compute_and_update_3 (res : Int) (second_map : Map [Int, Int] ) (n : Int) : OutputPair [Int, Int] = + _compute_and_update_3 (res : Int) (second_map : Map [Int] [Int] ) (n : Int) : OutputPair [Int] [Int] = OutputPair_ (res, second_map + Tuple2 (n, res) ) _get_next_fibo (a : Int) (b : Int) : Int = a + b - abs_compute : InputPair [Int, Int] -> OutputPair [Int, Int] = + abs_compute : InputPair [Int] [Int] -> OutputPair [Int] [Int] = lambda input --> compute_for (input) - compute_for (input : InputPair [Int, Int] ) : OutputPair [Int, Int] = + compute_for (input : InputPair [Int] [Int] ) : OutputPair [Int] [Int] = memoizer.compute (input) end diff --git a/examples/src/main/scala/soda/example/mathematics/Package.scala b/examples/src/main/scala/soda/example/mathematics/Package.scala index d380ace5..daef1c7c 100644 --- a/examples/src/main/scala/soda/example/mathematics/Package.scala +++ b/examples/src/main/scala/soda/example/mathematics/Package.scala @@ -120,7 +120,7 @@ case class OutputPair_ [A, B] (value : B, memoized_values : Map [A, B]) extends trait MemoizableFunction [A, B] { - /** compute (input : InputPair [A, B] ) : OutputPair [A, B] */ + /** compute (input : InputPair [A] [B] ) : OutputPair [A] [B] */ def abs_compute : InputPair [A, B] => OutputPair [A, B] def compute (input : InputPair [A, B] ) : OutputPair [A, B] = diff --git a/translator/src/main/resources/lib/soda/lib/Package.scala b/translator/src/main/resources/lib/soda/lib/Package.scala index 7cf9d189..d0f6f829 100644 --- a/translator/src/main/resources/lib/soda/lib/Package.scala +++ b/translator/src/main/resources/lib/soda/lib/Package.scala @@ -289,7 +289,7 @@ trait Range private def _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if ( n <= 0 ) sequence - else _tailrec_range (n - 1) (sequence.+: (n - 1) ) + else _tailrec_range (n - 1) (sequence .+: (n - 1) ) } diff --git a/translator/src/main/resources/lib/soda/lib/Recursion.soda b/translator/src/main/resources/lib/soda/lib/Recursion.soda index 45142479..d594c018 100644 --- a/translator/src/main/resources/lib/soda/lib/Recursion.soda +++ b/translator/src/main/resources/lib/soda/lib/Recursion.soda @@ -9,7 +9,7 @@ class FoldWhile - apply [A, B] + apply [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) @@ -18,7 +18,7 @@ class FoldWhile _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) @tailrec - _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + _tailrec_fold_while [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) @@ -27,7 +27,7 @@ end class Fold - apply [A, B] + apply [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) @@ -35,7 +35,7 @@ class Fold _tailrec_fold (sequence) (initial_value) (next_value_function) @tailrec - _tailrec_fold [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = + _tailrec_fold [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = if sequence.isEmpty then current_value else _tailrec_fold (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) @@ -51,7 +51,7 @@ class Range _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if n <= 0 then sequence - else _tailrec_range (n - 1) (sequence.+: (n - 1) ) + else _tailrec_range (n - 1) (sequence .+: (n - 1) ) end @@ -63,10 +63,10 @@ class Recursion _range = Range_ () - fold_while [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + fold_while [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = _fold_while.apply (sequence) (initial_value) (next_value_function) (condition) - fold [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = + fold [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = _fold.apply (sequence) (initial_value) (next_value_function) range (length : Int) : Seq [Int] = diff --git a/translator/src/main/resources/soda/translator/documentation/Manual.soda b/translator/src/main/resources/soda/translator/documentation/Manual.soda index 60336434..6cf87e4e 100644 --- a/translator/src/main/resources/soda/translator/documentation/Manual.soda +++ b/translator/src/main/resources/soda/translator/documentation/Manual.soda @@ -254,11 +254,11 @@ end class FoldWhile - apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + apply [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) @tailrec - _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + _tailrec_fold_while [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) @@ -274,7 +274,7 @@ class Range _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if n <= 0 then sequence - else _tailrec_range (n - 1) (sequence.+: (n - 1) ) + else _tailrec_range (n - 1) (sequence .+: (n - 1) ) end diff --git a/translator/src/main/scala/soda/lib/Package.scala b/translator/src/main/scala/soda/lib/Package.scala index cb47abd7..3c648077 100644 --- a/translator/src/main/scala/soda/lib/Package.scala +++ b/translator/src/main/scala/soda/lib/Package.scala @@ -287,7 +287,7 @@ trait Range private def _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if ( n <= 0 ) sequence - else _tailrec_range (n - 1) (sequence.+: (n - 1) ) + else _tailrec_range (n - 1) (sequence .+: (n - 1) ) } diff --git a/translator/src/main/scala/soda/lib/Recursion.soda b/translator/src/main/scala/soda/lib/Recursion.soda index be68d862..8634b374 100644 --- a/translator/src/main/scala/soda/lib/Recursion.soda +++ b/translator/src/main/scala/soda/lib/Recursion.soda @@ -9,7 +9,7 @@ class FoldWhile - apply [A, B] + apply [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) @@ -18,7 +18,7 @@ class FoldWhile _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) @tailrec - _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + _tailrec_fold_while [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) @@ -27,7 +27,7 @@ end class Fold - apply [A, B] + apply [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) @@ -35,7 +35,7 @@ class Fold _tailrec_fold (sequence) (initial_value) (next_value_function) @tailrec - _tailrec_fold [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = + _tailrec_fold [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = if sequence.isEmpty then current_value else _tailrec_fold (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) @@ -51,7 +51,7 @@ class Range _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if n <= 0 then sequence - else _tailrec_range (n - 1) (sequence.+: (n - 1) ) + else _tailrec_range (n - 1) (sequence .+: (n - 1) ) end @@ -63,10 +63,10 @@ class Recursion _range = Range_ () - fold_while [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + fold_while [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = _fold_while.apply (sequence) (initial_value) (next_value_function) (condition) - fold [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = + fold [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = _fold.apply (sequence) (initial_value) (next_value_function) range (length : Int) : Seq [Int] = diff --git a/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda index 7d06303e..49d12235 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda @@ -9,9 +9,12 @@ class AbstractDeclarationBlockTranslator soda.translator.block.AnnotatedLine_ soda.translator.block.Block soda.translator.block.Block_ + soda.translator.parser.SodaConstant_ soda.translator.parser.annotation.AbstractDeclarationAnnotation soda.translator.parser.annotation.AbstractDeclarationAnnotation_ + _sc = SodaConstant_ () + _tc = TranslationConstantToScala_ () scala_abstract_function_declaration_pattern = @@ -31,7 +34,7 @@ class AbstractDeclarationBlockTranslator prepend_to_lines_aligned_at ( get_number_of_spaces_at_beginning (get_first_line (block) ) ) ( scala_abstract_function_declaration_pattern) ( - block.abstract_functions_with_comments + _translate_type_parameters (block.abstract_functions_with_comments) ), block.references ) @@ -44,7 +47,7 @@ class AbstractDeclarationBlockTranslator prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : AnnotatedLine = if annotated_line.is_comment then annotated_line - else AnnotatedLine_ (annotated_line.line.substring (0, index) + prefix + annotated_line.line.substring (index), annotated_line.is_comment) + else AnnotatedLine_ (annotated_line.line.substring (0, index) + prefix + annotated_line.line.substring (index) , annotated_line.is_comment) get_number_of_spaces_at_beginning (line : String) : Int = line @@ -54,5 +57,17 @@ class AbstractDeclarationBlockTranslator get_first_line (block : AnnotatedBlock) : String = block.lines.headOption.getOrElse ("") + _translate_type_parameters (abstract_functions_with_comments : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = + abstract_functions_with_comments + .map (lambda annotated_line --> + if annotated_line.is_comment + then annotated_line + else AnnotatedLine_ (_translate_type_parameters_in_line (annotated_line.line) , annotated_line.is_comment) + ) + + _translate_type_parameters_in_line (line : String) : String = + line + .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) + end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda index 0827a6a4..1102a8d5 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda @@ -98,6 +98,7 @@ class ClassConstructorBlockTranslator _translate_type_symbols (line : String) : String = line + .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) .replaceAll (_sc.subtype_reserved_word, _tc.scala_subtype_symbol) .replaceAll (_sc.supertype_reserved_word, _tc.scala_supertype_symbol) .replaceAll (_sc.function_arrow_symbol, _tc.scala_function_arrow_symbol) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda index 2ba6d0aa..8bbb11bf 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda @@ -34,6 +34,7 @@ class MicroTranslatorToScala _translation_pipeline = BlockTranslatorPipeline_ ( Seq ( + TypeParameterBlockTranslator_ (), MatchCaseBlockTranslator_ (), ConditionalBlockTranslator_ (_definitions_and_declarations, TokenReplacement_ ().replace (_tc.scala_non_soda) ), ConditionalBlockTranslator_ (_functions_and_tests, FunctionDefinitionBlockTranslator_ () ), diff --git a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala index 32b2dc3d..05b812bb 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala @@ -18,9 +18,12 @@ trait AbstractDeclarationBlockTranslator import soda.translator.block.AnnotatedLine_ import soda.translator.block.Block import soda.translator.block.Block_ + import soda.translator.parser.SodaConstant_ import soda.translator.parser.annotation.AbstractDeclarationAnnotation import soda.translator.parser.annotation.AbstractDeclarationAnnotation_ + private lazy val _sc = SodaConstant_ () + private lazy val _tc = TranslationConstantToScala_ () lazy val scala_abstract_function_declaration_pattern = @@ -41,7 +44,7 @@ trait AbstractDeclarationBlockTranslator prepend_to_lines_aligned_at ( get_number_of_spaces_at_beginning (get_first_line (block) ) ) ( scala_abstract_function_declaration_pattern) ( - block.abstract_functions_with_comments + _translate_type_parameters (block.abstract_functions_with_comments) ), block.references ) @@ -54,7 +57,7 @@ trait AbstractDeclarationBlockTranslator def prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : AnnotatedLine = if ( annotated_line.is_comment ) annotated_line - else AnnotatedLine_ (annotated_line.line.substring (0, index) + prefix + annotated_line.line.substring (index), annotated_line.is_comment) + else AnnotatedLine_ (annotated_line.line.substring (0, index) + prefix + annotated_line.line.substring (index) , annotated_line.is_comment) def get_number_of_spaces_at_beginning (line : String) : Int = line @@ -64,6 +67,18 @@ trait AbstractDeclarationBlockTranslator def get_first_line (block : AnnotatedBlock) : String = block.lines.headOption.getOrElse ("") + private def _translate_type_parameters (abstract_functions_with_comments : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = + abstract_functions_with_comments + .map ( annotated_line => + if ( annotated_line.is_comment + ) annotated_line + else AnnotatedLine_ (_translate_type_parameters_in_line (annotated_line.line) , annotated_line.is_comment) + ) + + private def _translate_type_parameters_in_line (line : String) : String = + line + .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) + } case class AbstractDeclarationBlockTranslator_ () extends AbstractDeclarationBlockTranslator @@ -171,6 +186,7 @@ trait ClassConstructorBlockTranslator private def _translate_type_symbols (line : String) : String = line + .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) .replaceAll (_sc.subtype_reserved_word, _tc.scala_subtype_symbol) .replaceAll (_sc.supertype_reserved_word, _tc.scala_supertype_symbol) .replaceAll (_sc.function_arrow_symbol, _tc.scala_function_arrow_symbol) @@ -788,6 +804,7 @@ trait MicroTranslatorToScala private lazy val _translation_pipeline = BlockTranslatorPipeline_ ( Seq ( + TypeParameterBlockTranslator_ (), MatchCaseBlockTranslator_ (), ConditionalBlockTranslator_ (_definitions_and_declarations, TokenReplacement_ ().replace (_tc.scala_non_soda) ), ConditionalBlockTranslator_ (_functions_and_tests, FunctionDefinitionBlockTranslator_ () ), @@ -1293,3 +1310,26 @@ trait FileNamePair case class FileNamePair_ (input_file_name : String, output_file_name : String) extends FileNamePair + +trait TypeParameterBlockTranslator + extends + soda.translator.blocktr.TokenizedBlockTranslator +{ + + import soda.translator.parser.SodaConstant_ + import soda.translator.replacement.Token + + private lazy val _sc = SodaConstant_ () + + private lazy val _tc = TranslationConstantToScala_ () + + lazy val replace_token : Token => String = + token => + token + .text + .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) + +} + +case class TypeParameterBlockTranslator_ () extends TypeParameterBlockTranslator + diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TypeParameterBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/TypeParameterBlockTranslator.soda new file mode 100644 index 00000000..0f4017e2 --- /dev/null +++ b/translator/src/main/scala/soda/translator/extension/toscala/TypeParameterBlockTranslator.soda @@ -0,0 +1,21 @@ + +class TypeParameterBlockTranslator + extends + soda.translator.blocktr.TokenizedBlockTranslator + + import + soda.translator.parser.SodaConstant_ + soda.translator.replacement.Token + + _sc = SodaConstant_ () + + _tc = TranslationConstantToScala_ () + + replace_token : Token -> String = + lambda token --> + token + .text + .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) + +end + diff --git a/translator/src/main/scala/soda/translator/parser/Package.scala b/translator/src/main/scala/soda/translator/parser/Package.scala index e2f17473..9d448aba 100644 --- a/translator/src/main/scala/soda/translator/parser/Package.scala +++ b/translator/src/main/scala/soda/translator/parser/Package.scala @@ -376,7 +376,7 @@ trait SodaConstant lazy val closing_bracket_symbol = "]" - lazy val parameter_separator_symbol = "," + lazy val parameter_separation_regex = "]\\s*\\[" lazy val addition_symbol = "+" diff --git a/translator/src/main/scala/soda/translator/parser/SodaConstant.soda b/translator/src/main/scala/soda/translator/parser/SodaConstant.soda index 41508ddf..b7aba5a7 100644 --- a/translator/src/main/scala/soda/translator/parser/SodaConstant.soda +++ b/translator/src/main/scala/soda/translator/parser/SodaConstant.soda @@ -109,7 +109,7 @@ class SodaConstant closing_bracket_symbol = "]" - parameter_separator_symbol = "," + parameter_separation_regex = "]\\s*\\[" addition_symbol = "+" diff --git a/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda index 6895af56..5640fc5c 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda @@ -32,7 +32,7 @@ class ClassBeginningAnnotation type_parameters_and_bounds : Seq [String] = remove_brackets (skip_first_word (_class_name_and_type_parameters) ) - .split (sc.parameter_separator_symbol) + .split (sc.parameter_separation_regex) .toIndexedSeq .map (lambda parameter --> parameter.trim) .filter (lambda parameter --> not parameter.isEmpty) diff --git a/translator/src/main/scala/soda/translator/parser/annotation/Package.scala b/translator/src/main/scala/soda/translator/parser/annotation/Package.scala index 37c0c6f5..522a6b7c 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/Package.scala +++ b/translator/src/main/scala/soda/translator/parser/annotation/Package.scala @@ -224,7 +224,7 @@ trait ClassBeginningAnnotation lazy val type_parameters_and_bounds : Seq [String] = remove_brackets (skip_first_word (_class_name_and_type_parameters) ) - .split (sc.parameter_separator_symbol) + .split (sc.parameter_separation_regex) .toIndexedSeq .map ( parameter => parameter.trim) .filter ( parameter => ! parameter.isEmpty) diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.scala b/translator/src/test/resources/soda/translator/documentation/Manual.scala index ee9e50b6..b32fc497 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.scala +++ b/translator/src/test/resources/soda/translator/documentation/Manual.scala @@ -314,7 +314,7 @@ trait Range private def _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if ( n <= 0 ) sequence - else _tailrec_range (n - 1) (sequence.+: (n - 1) ) + else _tailrec_range (n - 1) (sequence .+: (n - 1) ) } diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.soda b/translator/src/test/resources/soda/translator/documentation/Manual.soda index 60336434..6cf87e4e 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.soda +++ b/translator/src/test/resources/soda/translator/documentation/Manual.soda @@ -254,11 +254,11 @@ end class FoldWhile - apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + apply [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) @tailrec - _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + _tailrec_fold_while [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) @@ -274,7 +274,7 @@ class Range _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if n <= 0 then sequence - else _tailrec_range (n - 1) (sequence.+: (n - 1) ) + else _tailrec_range (n - 1) (sequence .+: (n - 1) ) end diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.tex b/translator/src/test/resources/soda/translator/documentation/Manual.tex index 03fe3751..909d94a6 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.tex +++ b/translator/src/test/resources/soda/translator/documentation/Manual.tex @@ -440,11 +440,11 @@ class FoldWhile - apply [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + apply [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition) @tailrec - _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + _tailrec_fold_while [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) @@ -460,7 +460,7 @@ _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] = if n <= 0 then sequence - else _tailrec_range (n - 1) (sequence.+: (n - 1) ) + else _tailrec_range (n - 1) (sequence .+: (n - 1) ) end diff --git a/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda b/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda index b76f18d1..fa8360f3 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda @@ -1,7 +1,7 @@ class SaladMaker - apply [Ingredient, Salad] + apply [Ingredient] [Salad] (list_of_ingredients : Seq [Ingredient] ) (initial_bowl : Salad) (next_ingredient_function : Salad -> Ingredient -> Salad) @@ -10,7 +10,7 @@ class SaladMaker _tailrec_prepare_salad (list_of_ingredients) (initial_bowl) (next_ingredient_function) (condition_to_continue) @tailrec - _tailrec_prepare_salad [Ingredient, Salad] + _tailrec_prepare_salad [Ingredient] [Salad] (ingredients_so_far : Seq [Ingredient] ) (salad_so_far : Salad) (next_ingredient_function : Salad -> Ingredient -> Salad) diff --git a/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.soda b/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.soda index 6b1165f2..7c990f65 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.soda @@ -5,9 +5,9 @@ class ScalaReservedWordEscaping val = 1 - def [A, B] (key : A) (value : B) : MyPair [A, B] = MyPair_ (key, value) + def [A] [B] (key : A) (value : B) : MyPair [A] [B] = MyPair_ (key, value) - while [A, B] (seq : Seq [A] ) (cond : A -> Boolean) (funct : A -> B) : Seq [B] = + while [A] [B] (seq : Seq [A] ) (cond : A -> Boolean) (funct : A -> B) : Seq [B] = seq.takeWhile (cond).map (funct) protected = "protected" @@ -23,7 +23,7 @@ class ScalaReservedWordEscaping end -class MyPair [A, B] +class MyPair [A] [B] abstract key : A diff --git a/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda b/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda index eb3f11a0..f07091d9 100644 --- a/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda +++ b/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda @@ -6,7 +6,7 @@ class RecursionForCoq @tailrec - _tailrec_fold4 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + _tailrec_fold4 [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = match sequence case (head) :: (tail) ==> if (not (condition (current_value) (head) ) ) @@ -14,16 +14,16 @@ class RecursionForCoq else _tailrec_fold4 (tail) (next_value_function (current_value) (head)) (next_value_function) (condition) case otherwise ==> current_value - fold4 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = + fold4 [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = _tailrec_fold4 (sequence) (initial_value) (next_value_function) (condition) @tailrec - _tailrec_fold3 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = + _tailrec_fold3 [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = match sequence case (head) :: (tail) ==> _tailrec_fold3 (tail) (next_value_function (current_value) (head)) (next_value_function) case otherwise ==> current_value - fold3 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = + fold3 [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = _tailrec_fold3 (sequence) (initial_value) (next_value_function) @tailrec diff --git a/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.soda b/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.soda index 9e69fc23..673d7304 100644 --- a/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.soda +++ b/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.soda @@ -1,74 +1,74 @@ -class InputPair [A, B] +class InputPair [A] [B] abstract value : A - memoized_values : Map [A, B] + memoized_values : Map [A] [B] end -class OutputPair [A, B] +class OutputPair [A] [B] abstract value : B - memoized_values : Map [A, B] + memoized_values : Map [A] [B] end -class MemoizableFunction [A, B] +class MemoizableFunction [A] [B] abstract - /** compute (input : InputPair [A, B] ) : OutputPair [A, B] */ - abs_compute : InputPair [A, B] -> OutputPair [A, B] + /** compute (input : InputPair [A] [B] ) : OutputPair [A] [B] */ + abs_compute : InputPair [A] [B] -> OutputPair [A] [B] - compute (input : InputPair [A, B] ) : OutputPair [A, B] = + compute (input : InputPair [A] [B] ) : OutputPair [A] [B] = abs_compute (input) end -class MainFunction [A, B] +class MainFunction [A] [B] abstract - main_function : InputPair [A, B] -> OutputPair [A, B] + main_function : InputPair [A] [B] -> OutputPair [A] [B] end -class Memoizer [A, B] +class Memoizer [A] [B] extends - MemoizableFunction [A, B] - MainFunction [A, B] + MemoizableFunction [A] [B] + MainFunction [A] [B] abstract - main_function : InputPair [A, B] -> OutputPair [A, B] + main_function : InputPair [A] [B] -> OutputPair [A] [B] - abs_compute : InputPair [A, B] -> OutputPair [A, B] = + abs_compute : InputPair [A] [B] -> OutputPair [A] [B] = lambda input --> compute_for (input) - compute_for (input : InputPair [A, B] ) : OutputPair [A, B] = + compute_for (input : InputPair [A] [B] ) : OutputPair [A] [B] = _compute_with (input.memoized_values.get (input.value) ) (input) - _compute_with (maybe_res : Option [B] ) (input : InputPair [A, B] ) : OutputPair [A, B] = + _compute_with (maybe_res : Option [B] ) (input : InputPair [A] [B] ) : OutputPair [A] [B] = if maybe_res.isEmpty then compute_and_update (input) else OutputPair_ (maybe_res.get, input.memoized_values) - compute_and_update (input : InputPair [A, B] ) : OutputPair [A, B] = + compute_and_update (input : InputPair [A] [B] ) : OutputPair [A] [B] = _compute_and_update_with (input.value) (main_function (input) ) - _compute_and_update_with (input_value : A) (output : OutputPair [A, B] ) : OutputPair [A, B] = + _compute_and_update_with (input_value : A) (output : OutputPair [A] [B] ) : OutputPair [A] [B] = _add_element (output, Tuple2 (input_value, output.value) ) - _add_element (output : OutputPair [A, B], new_pair : Tuple2 [A, B] ) : OutputPair [A, B] = + _add_element (output : OutputPair [A] [B], new_pair : Tuple2 [A] [B] ) : OutputPair [A] [B] = OutputPair_ (output.value, output.memoized_values + new_pair) end class HardProblem extends - MemoizableFunction [Int, Int] + MemoizableFunction [Int] [Int] - memoizer = Memoizer_ [Int, Int] (main_function) + memoizer = Memoizer_ [Int] [Int] (main_function) is_even (n : Int) : Boolean = n % 2 == 0 @@ -78,56 +78,56 @@ class HardProblem then n / 2 else 3 * n + 1 - main_function : InputPair [Int, Int] -> OutputPair [Int, Int] = + main_function : InputPair [Int] [Int] -> OutputPair [Int] [Int] = lambda input --> if input.value == 1 then OutputPair_ (0, input.memoized_values) else _plus_one (compute (InputPair_ (one_step (input.value), input.memoized_values) ) ) - _plus_one (pair : OutputPair [Int, Int] ) : OutputPair [Int, Int] = + _plus_one (pair : OutputPair [Int] [Int] ) : OutputPair [Int] [Int] = OutputPair_ (1 + pair.value, pair.memoized_values) - abs_compute : InputPair [Int, Int] -> OutputPair [Int, Int] = + abs_compute : InputPair [Int] [Int] -> OutputPair [Int] [Int] = lambda input --> compute_for (input) - compute_for (input : InputPair [Int, Int] ) : OutputPair [Int, Int] = + compute_for (input : InputPair [Int] [Int] ) : OutputPair [Int] [Int] = memoizer.compute (input) end class MemoizedFibonacci extends - MemoizableFunction [Int, Int] + MemoizableFunction [Int] [Int] - memoizer = Memoizer_ [Int, Int] (main_function) + memoizer = Memoizer_ [Int] [Int] (main_function) - main_function : InputPair [Int, Int] -> OutputPair [Int, Int] = + main_function : InputPair [Int] [Int] -> OutputPair [Int] [Int] = lambda input --> main_function_for (input) - main_function_for (input : InputPair [Int, Int] ): OutputPair [Int, Int] = + main_function_for (input : InputPair [Int] [Int] ): OutputPair [Int] [Int] = if (input.value == 0) or (input.value == 1) then OutputPair_ (input.value, input.memoized_values ) else _compute_and_update_1 (compute (InputPair_ (input.value - 2, input.memoized_values ) ) ) (input.value) - _compute_and_update_1 (first_tuple : OutputPair [Int, Int] ) (n : Int ) : OutputPair [Int, Int] = + _compute_and_update_1 (first_tuple : OutputPair [Int] [Int] ) (n : Int ) : OutputPair [Int] [Int] = _compute_and_update_2 (first_tuple.value) (compute (InputPair_ (n - 1, first_tuple.memoized_values) ) ) (n) - _compute_and_update_2 (first_value : Int) (second_tuple : OutputPair [Int, Int] ) (n : Int ) : OutputPair [Int, Int] = + _compute_and_update_2 (first_value : Int) (second_tuple : OutputPair [Int] [Int] ) (n : Int ) : OutputPair [Int] [Int] = _compute_and_update_3 (_get_next_fibo (first_value) (second_tuple.value) ) (second_tuple.memoized_values) (n) - _compute_and_update_3 (res : Int) (second_map : Map [Int, Int] ) (n : Int) : OutputPair [Int, Int] = + _compute_and_update_3 (res : Int) (second_map : Map [Int] [Int] ) (n : Int) : OutputPair [Int] [Int] = OutputPair_ (res, second_map + Tuple2 (n, res) ) _get_next_fibo (a : Int) (b : Int) : Int = a + b - abs_compute : InputPair [Int, Int] -> OutputPair [Int, Int] = + abs_compute : InputPair [Int] [Int] -> OutputPair [Int] [Int] = lambda input --> compute_for (input) - compute_for (input : InputPair [Int, Int] ) : OutputPair [Int, Int] = + compute_for (input : InputPair [Int] [Int] ) : OutputPair [Int] [Int] = memoizer.compute (input) end diff --git a/translator/src/test/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslatorSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslatorSpec.soda index 00cf2a4d..49ad7f7c 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslatorSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslatorSpec.soda @@ -4,6 +4,7 @@ class ClassConstructorBlockTranslatorSpec () org.scalatest.funsuite.AnyFunSuite import + soda.translator.block.BlockTranslatorPipeline_ soda.translator.block.DefaultBlockSequenceTranslator_ soda.translator.parser.BlockProcessor_ @@ -19,7 +20,7 @@ class ClassConstructorBlockTranslatorSpec () "\n" + "\n abstract" + "\n /** this value is an example */" + - "\n value: Int" + + "\n map: Map [Int] [Int]" + "\n /** this function is also an example */" + "\n a_function: Int -> Double -> String" + "\n" + @@ -42,13 +43,13 @@ class ClassConstructorBlockTranslatorSpec () "\n" + "\n abstract" + "\n /** this value is an example */" + - "\n value: Int" + + "\n map: Map [Int] [Int]" + "\n /** this function is also an example */" + "\n a_function: Int -> Double -> String" + "\n" + "\nend" + "\n" + - "\ncase class Example0_ (value: Int, a_function: Int => Double => String) extends Example0" + + "\ncase class Example0_ (map: Map [Int, Int], a_function: Int => Double => String) extends Example0" + "\n" + "\nclass Example0Spec ()" + "\n extends" + @@ -60,7 +61,7 @@ class ClassConstructorBlockTranslatorSpec () example_program_1 = "package soda.example.mytest" + "\n" + - "\nclass Example [A, B subtype SuperType]" + + "\nclass Example [A] [B subtype SuperType]" + "\n extends" + "\n SuperClassExample" + "\n AnotherSuperClassExample [A]" + @@ -82,7 +83,7 @@ class ClassConstructorBlockTranslatorSpec () expected_program_1 = "package soda.example.mytest" + "\n" + - "\nclass Example [A, B subtype SuperType]" + + "\nclass Example [A] [B subtype SuperType]" + "\n extends" + "\n SuperClassExample" + "\n AnotherSuperClassExample [A]" + @@ -102,9 +103,17 @@ class ClassConstructorBlockTranslatorSpec () "\nend" + "\n" + translator = BlockProcessor_ ( DefaultBlockSequenceTranslator_ ( + _translation_pipeline + ) + ) + + _translation_pipeline = + BlockTranslatorPipeline_ ( + Seq ( ClassConstructorBlockTranslator_ () ) ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala index 8691ced3..b3dc9276 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala @@ -41,6 +41,7 @@ case class ClassConstructorBlockTranslatorSpec () org.scalatest.funsuite.AnyFunSuite { + import soda.translator.block.BlockTranslatorPipeline_ import soda.translator.block.DefaultBlockSequenceTranslator_ import soda.translator.parser.BlockProcessor_ @@ -56,7 +57,7 @@ case class ClassConstructorBlockTranslatorSpec () "\n" + "\n abstract" + "\n /** this value is an example */" + - "\n value: Int" + + "\n map: Map [Int] [Int]" + "\n /** this function is also an example */" + "\n a_function: Int -> Double -> String" + "\n" + @@ -79,13 +80,13 @@ case class ClassConstructorBlockTranslatorSpec () "\n" + "\n abstract" + "\n /** this value is an example */" + - "\n value: Int" + + "\n map: Map [Int] [Int]" + "\n /** this function is also an example */" + "\n a_function: Int -> Double -> String" + "\n" + "\nend" + "\n" + - "\ncase class Example0_ (value: Int, a_function: Int => Double => String) extends Example0" + + "\ncase class Example0_ (map: Map [Int, Int], a_function: Int => Double => String) extends Example0" + "\n" + "\nclass Example0Spec ()" + "\n extends" + @@ -97,7 +98,7 @@ case class ClassConstructorBlockTranslatorSpec () lazy val example_program_1 = "package soda.example.mytest" + "\n" + - "\nclass Example [A, B subtype SuperType]" + + "\nclass Example [A] [B subtype SuperType]" + "\n extends" + "\n SuperClassExample" + "\n AnotherSuperClassExample [A]" + @@ -119,7 +120,7 @@ case class ClassConstructorBlockTranslatorSpec () lazy val expected_program_1 = "package soda.example.mytest" + "\n" + - "\nclass Example [A, B subtype SuperType]" + + "\nclass Example [A] [B subtype SuperType]" + "\n extends" + "\n SuperClassExample" + "\n AnotherSuperClassExample [A]" + @@ -142,6 +143,13 @@ case class ClassConstructorBlockTranslatorSpec () lazy val translator = BlockProcessor_ ( DefaultBlockSequenceTranslator_ ( + _translation_pipeline + ) + ) + + private lazy val _translation_pipeline = + BlockTranslatorPipeline_ ( + Seq ( ClassConstructorBlockTranslator_ () ) ) @@ -1006,15 +1014,15 @@ case class UpperAndLowerBoundDeclarationSpec () "\n" ) ) ( - expected = " trait BlackBox [A <: AbstractModel] [B <: AbstractParameter]" + + expected = " trait BlackBox [A <: AbstractModel, B <: AbstractParameter]" + "\n extends" + - "\n AbstractBlackBox[A][B]" + - "\n with AbstractDevice [A] [B]" + + "\n AbstractBlackBox[A, B]" + + "\n with AbstractDevice [A, B]" + "\n {" + "\n" + "\n}" + "\n" + - "\n case class BlackBox_ [A <: AbstractModel] [B <: AbstractParameter] () extends BlackBox [A]" + + "\n case class BlackBox_ [A <: AbstractModel, B <: AbstractParameter] () extends BlackBox [A, B]" + "\n" ) ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda index aea0cca4..36dc3fed 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda @@ -113,15 +113,15 @@ class UpperAndLowerBoundDeclarationSpec () "\n" ) ) ( - expected := " trait BlackBox [A <: AbstractModel] [B <: AbstractParameter]" + + expected := " trait BlackBox [A <: AbstractModel, B <: AbstractParameter]" + "\n extends" + - "\n AbstractBlackBox[A][B]" + - "\n with AbstractDevice [A] [B]" + + "\n AbstractBlackBox[A, B]" + + "\n with AbstractDevice [A, B]" + "\n {" + "\n" + "\n}" + "\n" + - "\n case class BlackBox_ [A <: AbstractModel] [B <: AbstractParameter] () extends BlackBox [A]" + + "\n case class BlackBox_ [A <: AbstractModel, B <: AbstractParameter] () extends BlackBox [A, B]" + "\n" ) ) diff --git a/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda b/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda index 992213f3..2c208ac9 100644 --- a/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda +++ b/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda @@ -36,10 +36,10 @@ class ClassBeginningAnnotationSpec () example_2 = get_as_block ( - "class Example [A, B]" + + "class Example [A][ B]" + "\n extends" + "\n SuperExample0" + - "\n SuperExample2 [A, B]" + + "\n SuperExample2 [A][B]" + "\n SuperExample1 [A]" + "\n" ) @@ -55,9 +55,9 @@ class ClassBeginningAnnotationSpec () example_4 = get_as_block ( - "class Example [A supertype SubTypeExample, B subtype SuperTypeExample]" + + "class Example [A supertype SubTypeExample][B subtype SuperTypeExample]" + "\n extends" + - "\n SuperExample2 [A, B]" + + "\n SuperExample2 [A] [B]" + "\n SuperExample1 [A]" + "\n SuperExample0" + "\n" diff --git a/translator/src/test/scala/soda/translator/parser/annotation/Package.scala b/translator/src/test/scala/soda/translator/parser/annotation/Package.scala index 7ff1cf12..1e71d3b4 100644 --- a/translator/src/test/scala/soda/translator/parser/annotation/Package.scala +++ b/translator/src/test/scala/soda/translator/parser/annotation/Package.scala @@ -200,10 +200,10 @@ case class ClassBeginningAnnotationSpec () lazy val example_2 = get_as_block ( - "class Example [A, B]" + + "class Example [A][ B]" + "\n extends" + "\n SuperExample0" + - "\n SuperExample2 [A, B]" + + "\n SuperExample2 [A][B]" + "\n SuperExample1 [A]" + "\n" ) @@ -219,9 +219,9 @@ case class ClassBeginningAnnotationSpec () lazy val example_4 = get_as_block ( - "class Example [A supertype SubTypeExample, B subtype SuperTypeExample]" + + "class Example [A supertype SubTypeExample][B subtype SuperTypeExample]" + "\n extends" + - "\n SuperExample2 [A, B]" + + "\n SuperExample2 [A] [B]" + "\n SuperExample1 [A]" + "\n SuperExample0" + "\n" From 29534687eeb844099d49254ce4725e7558a1b049 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Tue, 9 May 2023 19:41:39 +0200 Subject: [PATCH 27/56] Make small change in List example --- .../src/main/scala/soda/collection/example/ListExample.soda | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/scala/soda/collection/example/ListExample.soda b/library/src/main/scala/soda/collection/example/ListExample.soda index c0e2f4db..c0b9f370 100644 --- a/library/src/main/scala/soda/collection/example/ListExample.soda +++ b/library/src/main/scala/soda/collection/example/ListExample.soda @@ -43,10 +43,10 @@ class ListExample indices_example : Pair [Range] = Pair_("a.indices", a.indices) - zipWithIndex_example : Pair [Seq [ Tuple2 [Char, Int] ] ] = + zipWithIndex_example : Pair [Seq [ Tuple2 [Char] [Int] ] ] = Pair_("a.zipWithIndex", a.zipWithIndex) - zip_example : Pair [Seq [ Tuple2 [Char, Int] ] ] = + zip_example : Pair [Seq [ Tuple2 [Char] [Int] ] ] = Pair_("a.zip(b)", a.zip (b)) reverse_example : Pair [Seq [Char] ] = From 070b18383ebd8e93ec70b637f1bc7bef5668e37f Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Wed, 10 May 2023 17:13:31 +0200 Subject: [PATCH 28/56] Make small changes in example --- .../soda/example/algorithms/FizzBuzzPatternMatching.soda | 8 ++++---- .../scala/soda/example/algorithms/PatternMatching.soda | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda b/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda index 21f5ed9d..0e211226 100644 --- a/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda +++ b/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda @@ -13,10 +13,10 @@ class FizzBuzzPatternMatching .map (_get_fizz_buzz_term) _get_fizz_buzz_term (n : Int) : String = - match Tuple2 (n % 3, n % 5) - case Tuple2 (0, 0) ==> fizz + buzz - case Tuple2 (0, x) ==> fizz - case Tuple2 (x, 0) ==> buzz + match Tuple2 (n % 3 , n % 5) + case Tuple2 (0 , 0) ==> fizz + buzz + case Tuple2 (0 , x) ==> fizz + case Tuple2 (x , 0) ==> buzz case otherwise ==> n.toString end diff --git a/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda b/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda index f3e726a0..32584641 100644 --- a/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda +++ b/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda @@ -11,15 +11,15 @@ class PatternMatching get_value (p : Parameter) : Int = match p case Singleton_ (x) ==> x - case Pair_ (x, y) ==> (x + y) / 2 - case Triplet_ (x, y, z) ==> (x + y + z) / 3 + case Pair_ (x , y) ==> (x + y) / 2 + case Triplet_ (x , y , z) ==> (x + y + z) / 3 case otherwise ==> 0 get_type_name (p : Parameter) : String = match p case Singleton_ (x) ==> (Singleton_ (x) ).name + "(x)" - case Pair_ (x, y) ==> (Pair_ (x, y) ).name + "(x, y)" - case Triplet_ (x, y, z) ==> (Triplet_ (x, y, z) ).name + "(x, y, z)" + case Pair_ (x , y) ==> (Pair_ (x , y) ).name + "(x, y)" + case Triplet_ (x , y , z) ==> (Triplet_ (x , y , z) ).name + "(x, y, z)" case otherwise ==> "" end From efd3ecb9c30a4123011b0490482c3da653ef329c Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 12 May 2023 11:44:57 +0200 Subject: [PATCH 29/56] Update README file --- docs/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/README.md b/docs/README.md index bc46ed38..864c4a11 100644 --- a/docs/README.md +++ b/docs/README.md @@ -80,6 +80,11 @@ The following tools can be configured to have syntax highlighting: - gedit (configuration file: soda.lang) +## Documentation + +- [User manual](https://soda-lang.readthedocs.io/en/latest/) + + ## Build The project can be built with [sbt](https://www.scala-sbt.org/). From ed28c4cdf8f986227f370a7220e7af332d1f92cf Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 12 May 2023 15:06:56 +0200 Subject: [PATCH 30/56] Update user manual --- docs/sphinx/source/appendix/index.rst | 32 ++++++++++- docs/sphinx/source/discussion/index.rst | 5 +- docs/sphinx/source/manual/index.rst | 76 ++++++++++++++++++++++++- 3 files changed, 110 insertions(+), 3 deletions(-) diff --git a/docs/sphinx/source/appendix/index.rst b/docs/sphinx/source/appendix/index.rst index 2bad65b8..136dd9f3 100644 --- a/docs/sphinx/source/appendix/index.rst +++ b/docs/sphinx/source/appendix/index.rst @@ -2,5 +2,35 @@ Appendix ******** -Tables to have in mind. + ++------------------------------------------+---------------------------------------------------------------------| +| *f* = *e* | function or constant definition of *f* as *e* | ++------------------------------------------+---------------------------------------------------------------------| +| *x* : *A* | declaration that *x* is of type *A* | ++------------------------------------------+---------------------------------------------------------------------| +| ``lambda`` (*x* : *A*) ``-->`` *e* | lambda definition for λ (*x* : *A*) . *e*, where *x* is of type *A* | ++------------------------------------------+---------------------------------------------------------------------| +| *t* := *e* | assignment of parameter *t* to have value *e* | ++------------------------------------------+---------------------------------------------------------------------| +| ``if`` *b* ``then`` *e0* ``else`` *e1* | expression if *b* is true, then *e0*, else *e1* | ++------------------------------------------+---------------------------------------------------------------------| +| ``match`` *x* ``case`` *pᵢ* ``==>`` *eᵢ* | pattern matching from *pᵢ* to *eᵢ* for 1 ≤ *i* ≤ *n* | ++------------------------------------------+---------------------------------------------------------------------| +| ``class`` *B* ``extends`` *A1* ... *An* | class $B$ extends classes $A_{0}$ and $A_{1}$ | ++------------------------------------------+---------------------------------------------------------------------| +| *A₁* ``subtype`` *A₂* | $A₁$ extends $A₂$ | ++------------------------------------------+---------------------------------------------------------------------| +| *A₁* ``supertype`` *A₂* | $A₁$ is extended by $A₂$ | ++------------------------------------------+---------------------------------------------------------------------| +| ``abstract`` *f1* ... *fn* | block of functions or constants $f_{i}$ to be defined | ++------------------------------------------+---------------------------------------------------------------------| +| ``this`` | reference to itself as an instance | ++------------------------------------------+---------------------------------------------------------------------| +| ``end`` | end of class definition | ++------------------------------------------+---------------------------------------------------------------------| +| ``package`` | package declaration for this piece of code | ++------------------------------------------+---------------------------------------------------------------------| +| ``import`` *p* | block of import declarations | ++------------------------------------------+---------------------------------------------------------------------| + diff --git a/docs/sphinx/source/discussion/index.rst b/docs/sphinx/source/discussion/index.rst index eb988dc3..bbfe8e10 100644 --- a/docs/sphinx/source/discussion/index.rst +++ b/docs/sphinx/source/discussion/index.rst @@ -2,6 +2,9 @@ Introduction ************ -Why having a new language? +**Soda** (Symbolic Objective Descriptive Analysis) is a human-centered specification language to describe, formalize, and prototype abstract ideas. +It has been originally designed to formalize ethical constraints. +It allows to model entities as in object-oriented programming languages, and to model functions as in functional programming languages. +Its main purpose is to be very clear and to express what it is intended to express. diff --git a/docs/sphinx/source/manual/index.rst b/docs/sphinx/source/manual/index.rst index 1267bda2..bc642b63 100644 --- a/docs/sphinx/source/manual/index.rst +++ b/docs/sphinx/source/manual/index.rst @@ -2,4 +2,78 @@ Reference Manual **************** -Reserved words in Soda + +Functions +========= + +A simple constant can be defined as: + +:: + greeting = "Hello world!" + +This could also be defined + +:: + greeting : String = "Hello world!" + + +Functions receive one or multiple parameters: + +:: + square (n : Int) : Int = n * n + + plus (n : Int) (m : Int) : Int = n + m + + +The types ``Boolean``, ``Int``, ``Float``, and ``String`` are already available with the standard basic operations. + +It is possible to use ``if-then-else`` structures + +:: + max (x : Int) (y : Int) : Float = + if x > y + then x + else y + +Soda accepts lambda expressions, like + +:: + plus : Float -> Float -> Float = + lambda x --> + lambda y --> + x + y + + +Classes +======= + +It is possible to define classes like + +:: + class Shape + + end + +which is an empty class. + +It is also possible to add abstract fields to a class. + +:: + class RegisteredPerson + + abstract + first_name : String + last_name : String + + _separator = " " + + full_name = first_name + _separator + last_name + + end + +If a constant or function name starts with an underscore (_), it means that it should not be accessed outside the class. + +Every class has a default constructor, which is the name of class followed by an underscore + +Classes are grouped in packages. + From 6cf14b1d6b728d0d1751b9b11032c520d553eaa1 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 12 May 2023 15:35:36 +0200 Subject: [PATCH 31/56] Update user manual --- docs/sphinx/source/appendix/index.rst | 52 +++++++++++++------------- docs/sphinx/source/conf.py | 24 ++++++++++++ docs/sphinx/source/index.rst | 1 - docs/sphinx/source/manual/index.rst | 10 ++++- docs/sphinx/source/unicode-symbols.tex | 13 +++++++ 5 files changed, 71 insertions(+), 29 deletions(-) create mode 100644 docs/sphinx/source/unicode-symbols.tex diff --git a/docs/sphinx/source/appendix/index.rst b/docs/sphinx/source/appendix/index.rst index 136dd9f3..a200a029 100644 --- a/docs/sphinx/source/appendix/index.rst +++ b/docs/sphinx/source/appendix/index.rst @@ -3,34 +3,34 @@ Appendix ******** -+------------------------------------------+---------------------------------------------------------------------| ++------------------------------------------+---------------------------------------------------------------------+ | *f* = *e* | function or constant definition of *f* as *e* | -+------------------------------------------+---------------------------------------------------------------------| ++------------------------------------------+---------------------------------------------------------------------+ | *x* : *A* | declaration that *x* is of type *A* | -+------------------------------------------+---------------------------------------------------------------------| -| ``lambda`` (*x* : *A*) ``-->`` *e* | lambda definition for λ (*x* : *A*) . *e*, where *x* is of type *A* | -+------------------------------------------+---------------------------------------------------------------------| ++------------------------------------------+---------------------------------------------------------------------+ +| **lambda** (*x* : *A*) -`-`> *e* | lambda definition for λ (*x* : *A*) . *e*, where *x* is of type *A* | ++------------------------------------------+---------------------------------------------------------------------+ | *t* := *e* | assignment of parameter *t* to have value *e* | -+------------------------------------------+---------------------------------------------------------------------| -| ``if`` *b* ``then`` *e0* ``else`` *e1* | expression if *b* is true, then *e0*, else *e1* | -+------------------------------------------+---------------------------------------------------------------------| -| ``match`` *x* ``case`` *pᵢ* ``==>`` *eᵢ* | pattern matching from *pᵢ* to *eᵢ* for 1 ≤ *i* ≤ *n* | -+------------------------------------------+---------------------------------------------------------------------| -| ``class`` *B* ``extends`` *A1* ... *An* | class $B$ extends classes $A_{0}$ and $A_{1}$ | -+------------------------------------------+---------------------------------------------------------------------| -| *A₁* ``subtype`` *A₂* | $A₁$ extends $A₂$ | -+------------------------------------------+---------------------------------------------------------------------| -| *A₁* ``supertype`` *A₂* | $A₁$ is extended by $A₂$ | -+------------------------------------------+---------------------------------------------------------------------| -| ``abstract`` *f1* ... *fn* | block of functions or constants $f_{i}$ to be defined | -+------------------------------------------+---------------------------------------------------------------------| -| ``this`` | reference to itself as an instance | -+------------------------------------------+---------------------------------------------------------------------| -| ``end`` | end of class definition | -+------------------------------------------+---------------------------------------------------------------------| -| ``package`` | package declaration for this piece of code | -+------------------------------------------+---------------------------------------------------------------------| -| ``import`` *p* | block of import declarations | -+------------------------------------------+---------------------------------------------------------------------| ++------------------------------------------+---------------------------------------------------------------------+ +| **if** *b* **then** *e₁* **else** *e₂* | expression if *b* is true, then *e₁*, else *e₂* | ++------------------------------------------+---------------------------------------------------------------------+ +| **match** *x* **case** *pᵢ* ==> *eᵢ* | pattern matching from *pᵢ* to *eᵢ* for 1 ≤ *i* ≤ *n* | ++------------------------------------------+---------------------------------------------------------------------+ +| **class** *B* **extends** *A₁* ... *Aₙ* | class *B* extends classes *A₁* ... *Aₙ* | ++------------------------------------------+---------------------------------------------------------------------+ +| *A₁* **subtype** *A₂* | *A₁* extends *A₂* | ++------------------------------------------+---------------------------------------------------------------------+ +| *A₁* **supertype** *A₂* | *A₁* is extended by *A₂* | ++------------------------------------------+---------------------------------------------------------------------+ +| **abstract** *f₁* ... *fₙ* | block of functions or constants *fᵢ* to be defined | ++------------------------------------------+---------------------------------------------------------------------+ +| **this** | reference to itself as an instance | ++------------------------------------------+---------------------------------------------------------------------+ +| **end** | end of class definition | ++------------------------------------------+---------------------------------------------------------------------+ +| **package** | package declaration for this piece of code | ++------------------------------------------+---------------------------------------------------------------------+ +| **import** *p* | block of import declarations | ++------------------------------------------+---------------------------------------------------------------------+ diff --git a/docs/sphinx/source/conf.py b/docs/sphinx/source/conf.py index c1135638..bd725075 100644 --- a/docs/sphinx/source/conf.py +++ b/docs/sphinx/source/conf.py @@ -19,6 +19,19 @@ templates_path = ['_templates'] exclude_patterns = [] +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = 'en' + +# The name of the Pygments (syntax highlighting) style to use. +# For now, this is the most similar lexer. +# https://github.com/pygments/pygments/blob/master/pygments/lexers/jvm.py + +pygments_style = 'sphinx' +highlight_language = 'Scala' # -- Options for HTML output ------------------------------------------------- @@ -26,3 +39,14 @@ html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] + +# -- Options for LaTeX output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-latex-output + +latex_additional_files = ["unicode-symbols.tex"] + +latex_elements = { 'preamble': r''' +\input{unicode-symbols.tex} +'''} + + diff --git a/docs/sphinx/source/index.rst b/docs/sphinx/source/index.rst index 8342f249..de861049 100644 --- a/docs/sphinx/source/index.rst +++ b/docs/sphinx/source/index.rst @@ -21,6 +21,5 @@ Indices and tables ================== * :ref:`genindex` -* :ref:`modindex` * :ref:`search` diff --git a/docs/sphinx/source/manual/index.rst b/docs/sphinx/source/manual/index.rst index bc642b63..0ad0aad7 100644 --- a/docs/sphinx/source/manual/index.rst +++ b/docs/sphinx/source/manual/index.rst @@ -9,27 +9,30 @@ Functions A simple constant can be defined as: :: + greeting = "Hello world!" This could also be defined :: + greeting : String = "Hello world!" Functions receive one or multiple parameters: :: + square (n : Int) : Int = n * n plus (n : Int) (m : Int) : Int = n + m - The types ``Boolean``, ``Int``, ``Float``, and ``String`` are already available with the standard basic operations. -It is possible to use ``if-then-else`` structures +It is possible to use ``if``-``then``-``else`` structures :: + max (x : Int) (y : Int) : Float = if x > y then x @@ -38,6 +41,7 @@ It is possible to use ``if-then-else`` structures Soda accepts lambda expressions, like :: + plus : Float -> Float -> Float = lambda x --> lambda y --> @@ -50,6 +54,7 @@ Classes It is possible to define classes like :: + class Shape end @@ -59,6 +64,7 @@ which is an empty class. It is also possible to add abstract fields to a class. :: + class RegisteredPerson abstract diff --git a/docs/sphinx/source/unicode-symbols.tex b/docs/sphinx/source/unicode-symbols.tex new file mode 100644 index 00000000..df87b8c3 --- /dev/null +++ b/docs/sphinx/source/unicode-symbols.tex @@ -0,0 +1,13 @@ + +% +% Unicode symbols for Sphinx +% + +\DeclareUnicodeCharacter{03BB}{\ensuremath{\lambda}} %% λ +\DeclareUnicodeCharacter{1D62}{\ensuremath{_{i}}} %% ᵢ +\DeclareUnicodeCharacter{2081}{\ensuremath{_{1}}} %% ₁ +\DeclareUnicodeCharacter{2082}{\ensuremath{_{2}}} %% ₂ +\DeclareUnicodeCharacter{2099}{\ensuremath{_{n}}} %% ₙ +\DeclareUnicodeCharacter{2264}{\ensuremath{\leq}} %% ≤ + + From 81b2d9d48dc97493a8bb232b76b6b86581c71338 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 19 May 2023 00:59:25 +0200 Subject: [PATCH 32/56] Update FizzBuzz algorithm --- .../soda/example/algorithms/FizzBuzz.soda | 20 +++--- .../algorithms/FizzBuzzPatternMatching.soda | 20 +++--- .../example/algorithms/FizzBuzzUnicode.soda | 20 +++--- .../soda/example/algorithms/Package.scala | 72 +++++++++---------- .../example/algorithms/FizzBuzz.scala | 20 +++--- .../example/algorithms/FizzBuzz.soda | 20 +++--- .../algorithms/FizzBuzzPatternMatching.scala | 20 +++--- .../algorithms/FizzBuzzPatternMatching.soda | 20 +++--- .../example/algorithms/FizzBuzzUnicode.scala | 20 +++--- .../example/algorithms/FizzBuzzUnicode.soda | 20 +++--- .../example/algorithms/PatternMatching.soda | 8 +-- 11 files changed, 130 insertions(+), 130 deletions(-) diff --git a/examples/src/main/scala/soda/example/algorithms/FizzBuzz.soda b/examples/src/main/scala/soda/example/algorithms/FizzBuzz.soda index b1326734..19f17801 100644 --- a/examples/src/main/scala/soda/example/algorithms/FizzBuzz.soda +++ b/examples/src/main/scala/soda/example/algorithms/FizzBuzz.soda @@ -5,20 +5,20 @@ class FizzBuzz buzz = "Buzz" - _range = soda.lib.Range_ () + range = soda.lib.Range_ () apply : Seq [String] = - _range.apply (100) - .map (lambda (x : Int) --> x + 1) - .map (_get_fizz_buzz_term) + range .apply (100) + .map (lambda x --> x + 1) + .map (get_term) - _get_fizz_buzz_term (n : Int) : String = - if _is_divisible_by (n) (15) then fizz + buzz - else if _is_divisible_by (n) (3) then fizz - else if _is_divisible_by (n) (5) then buzz - else n.toString + get_term (n : Int) : String = + if is_div (n) (15) then fizz + buzz + else if is_div (n) (3) then fizz + else if is_div (n) (5) then buzz + else n .toString - _is_divisible_by (n : Int) (k : Int) : Boolean = + is_div (n : Int) (k : Int) : Boolean = n % k == 0 end diff --git a/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda b/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda index 0e211226..d9f1db0c 100644 --- a/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda +++ b/examples/src/main/scala/soda/example/algorithms/FizzBuzzPatternMatching.soda @@ -5,18 +5,18 @@ class FizzBuzzPatternMatching buzz = "Buzz" - _range = soda.lib.Range_ () + range = soda.lib.Range_ () apply : Seq [String] = - _range.apply (100) - .map (lambda (x : Int) --> x + 1) - .map (_get_fizz_buzz_term) + range .apply (100) + .map (lambda x --> x + 1) + .map (get_term) - _get_fizz_buzz_term (n : Int) : String = - match Tuple2 (n % 3 , n % 5) - case Tuple2 (0 , 0) ==> fizz + buzz - case Tuple2 (0 , x) ==> fizz - case Tuple2 (x , 0) ==> buzz - case otherwise ==> n.toString + get_term (n : Int) : String = + match (n % 3 , n % 5) + case (0 , 0) ==> fizz + buzz + case (0 , x) ==> fizz + case (x , 0) ==> buzz + case otherwise ==> n .toString end diff --git a/examples/src/main/scala/soda/example/algorithms/FizzBuzzUnicode.soda b/examples/src/main/scala/soda/example/algorithms/FizzBuzzUnicode.soda index bfeaf8ac..d8c755c4 100644 --- a/examples/src/main/scala/soda/example/algorithms/FizzBuzzUnicode.soda +++ b/examples/src/main/scala/soda/example/algorithms/FizzBuzzUnicode.soda @@ -5,18 +5,18 @@ buzz = "Buzz" - _range = soda.lib.Range_ () + range = soda.lib.Range_ () apply : Seq [String] = - _range.apply (100) - .map ( λ x ⟶ x + 1) - .map (_get_fizz_buzz_term) + range.apply (100) + .map (λ x ⟶ x + 1) + .map (get_term) - _get_fizz_buzz_term (n : Int) : String = - match Tuple2 (n % 3 , n % 5) - case Tuple2 (0 , 0) ⟹ fizz + buzz - case Tuple2 (0 , x) ⟹ fizz - case Tuple2 (x , 0) ⟹ buzz - case otherwise ⟹ n.toString + get_term (n : Int) : String = + match (n % 3 , n % 5) + case (0 , 0) ⟹ fizz + buzz + case (0 , x) ⟹ fizz + case (x , 0) ⟹ buzz + case otherwise ⟹ n .toString ⎿ diff --git a/examples/src/main/scala/soda/example/algorithms/Package.scala b/examples/src/main/scala/soda/example/algorithms/Package.scala index 7e21c25c..abe9646b 100644 --- a/examples/src/main/scala/soda/example/algorithms/Package.scala +++ b/examples/src/main/scala/soda/example/algorithms/Package.scala @@ -14,20 +14,20 @@ trait FizzBuzz lazy val buzz = "Buzz" - private lazy val _range = soda.lib.Range_ () + lazy val range = soda.lib.Range_ () lazy val apply : Seq [String] = - _range.apply (100) - .map ( (x : Int) => x + 1) - .map (_get_fizz_buzz_term) + range .apply (100) + .map ( x => x + 1) + .map (get_term) - private def _get_fizz_buzz_term (n : Int) : String = - if ( _is_divisible_by (n) (15) ) fizz + buzz - else if ( _is_divisible_by (n) (3) ) fizz - else if ( _is_divisible_by (n) (5) ) buzz - else n.toString + def get_term (n : Int) : String = + if ( is_div (n) (15) ) fizz + buzz + else if ( is_div (n) (3) ) fizz + else if ( is_div (n) (5) ) buzz + else n .toString - private def _is_divisible_by (n : Int) (k : Int) : Boolean = + def is_div (n : Int) (k : Int) : Boolean = n % k == 0 } @@ -42,19 +42,19 @@ trait FizzBuzzPatternMatching lazy val buzz = "Buzz" - private lazy val _range = soda.lib.Range_ () + lazy val range = soda.lib.Range_ () lazy val apply : Seq [String] = - _range.apply (100) - .map ( (x : Int) => x + 1) - .map (_get_fizz_buzz_term) - - private def _get_fizz_buzz_term (n : Int) : String = - Tuple2 (n % 3, n % 5) match { - case Tuple2 (0, 0) => fizz + buzz - case Tuple2 (0, x) => fizz - case Tuple2 (x, 0) => buzz - case otherwise => n.toString + range .apply (100) + .map ( x => x + 1) + .map (get_term) + + def get_term (n : Int) : String = + (n % 3 , n % 5) match { + case (0 , 0) => fizz + buzz + case (0 , x) => fizz + case (x , 0) => buzz + case otherwise => n .toString } } @@ -69,19 +69,19 @@ trait FizzBuzzPatternUnicode lazy val buzz = "Buzz" - private lazy val _range = soda.lib.Range_ () + lazy val range = soda.lib.Range_ () lazy val apply : Seq [String] = - _range.apply (100) - .map ( x => x + 1) - .map (_get_fizz_buzz_term) - - private def _get_fizz_buzz_term (n : Int) : String = - Tuple2 (n % 3 , n % 5) match { - case Tuple2 (0 , 0) => fizz + buzz - case Tuple2 (0 , x) => fizz - case Tuple2 (x , 0) => buzz - case otherwise => n.toString + range.apply (100) + .map ( x => x + 1) + .map (get_term) + + def get_term (n : Int) : String = + (n % 3 , n % 5) match { + case (0 , 0) => fizz + buzz + case (0 , x) => fizz + case (x , 0) => buzz + case otherwise => n .toString } } @@ -120,16 +120,16 @@ trait PatternMatching def get_value (p : Parameter) : Int = p match { case Singleton_ (x) => x - case Pair_ (x, y) => (x + y) / 2 - case Triplet_ (x, y, z) => (x + y + z) / 3 + case Pair_ (x , y) => (x + y) / 2 + case Triplet_ (x , y , z) => (x + y + z) / 3 case otherwise => 0 } def get_type_name (p : Parameter) : String = p match { case Singleton_ (x) => (Singleton_ (x) ).name + "(x)" - case Pair_ (x, y) => (Pair_ (x, y) ).name + "(x, y)" - case Triplet_ (x, y, z) => (Triplet_ (x, y, z) ).name + "(x, y, z)" + case Pair_ (x , y) => (Pair_ (x , y) ).name + "(x, y)" + case Triplet_ (x , y , z) => (Triplet_ (x , y , z) ).name + "(x, y, z)" case otherwise => "" } diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.scala b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.scala index e4a255f6..4e73f046 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.scala +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.scala @@ -5,20 +5,20 @@ trait FizzBuzz lazy val buzz = "Buzz" - private lazy val _range = soda.lib.Range_ () + lazy val range = soda.lib.Range_ () lazy val apply : Seq [String] = - _range.apply (100) - .map ( (x : Int) => x + 1) - .map (_get_fizz_buzz_term) + range .apply (100) + .map ( x => x + 1) + .map (get_term) - private def _get_fizz_buzz_term (n : Int) : String = - if ( _is_divisible_by (n) (15) ) fizz + buzz - else if ( _is_divisible_by (n) (3) ) fizz - else if ( _is_divisible_by (n) (5) ) buzz - else n.toString + def get_term (n : Int) : String = + if ( is_div (n) (15) ) fizz + buzz + else if ( is_div (n) (3) ) fizz + else if ( is_div (n) (5) ) buzz + else n .toString - private def _is_divisible_by (n : Int) (k : Int) : Boolean = + def is_div (n : Int) (k : Int) : Boolean = n % k == 0 } diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.soda b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.soda index b1326734..19f17801 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzz.soda @@ -5,20 +5,20 @@ class FizzBuzz buzz = "Buzz" - _range = soda.lib.Range_ () + range = soda.lib.Range_ () apply : Seq [String] = - _range.apply (100) - .map (lambda (x : Int) --> x + 1) - .map (_get_fizz_buzz_term) + range .apply (100) + .map (lambda x --> x + 1) + .map (get_term) - _get_fizz_buzz_term (n : Int) : String = - if _is_divisible_by (n) (15) then fizz + buzz - else if _is_divisible_by (n) (3) then fizz - else if _is_divisible_by (n) (5) then buzz - else n.toString + get_term (n : Int) : String = + if is_div (n) (15) then fizz + buzz + else if is_div (n) (3) then fizz + else if is_div (n) (5) then buzz + else n .toString - _is_divisible_by (n : Int) (k : Int) : Boolean = + is_div (n : Int) (k : Int) : Boolean = n % k == 0 end diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.scala b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.scala index 57131404..af856c01 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.scala +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.scala @@ -5,19 +5,19 @@ trait FizzBuzzPatternMatching lazy val buzz = "Buzz" - private lazy val _range = soda.lib.Range_ () + lazy val range = soda.lib.Range_ () lazy val apply : Seq [String] = - _range.apply (100) - .map ( (x : Int) => x + 1) - .map (_get_fizz_buzz_term) + range .apply (100) + .map ( x => x + 1) + .map (get_term) - private def _get_fizz_buzz_term (n : Int) : String = - Tuple2 (n % 3, n % 5) match { - case Tuple2 (0, 0) => fizz + buzz - case Tuple2 (0, x) => fizz - case Tuple2 (x, 0) => buzz - case x => n.toString + def get_term (n : Int) : String = + (n % 3 , n % 5) match { + case (0 , 0) => fizz + buzz + case (0 , x) => fizz + case (x , 0) => buzz + case otherwise => n .toString } } diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda index 21f5ed9d..d9f1db0c 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzPatternMatching.soda @@ -5,18 +5,18 @@ class FizzBuzzPatternMatching buzz = "Buzz" - _range = soda.lib.Range_ () + range = soda.lib.Range_ () apply : Seq [String] = - _range.apply (100) - .map (lambda (x : Int) --> x + 1) - .map (_get_fizz_buzz_term) + range .apply (100) + .map (lambda x --> x + 1) + .map (get_term) - _get_fizz_buzz_term (n : Int) : String = - match Tuple2 (n % 3, n % 5) - case Tuple2 (0, 0) ==> fizz + buzz - case Tuple2 (0, x) ==> fizz - case Tuple2 (x, 0) ==> buzz - case otherwise ==> n.toString + get_term (n : Int) : String = + match (n % 3 , n % 5) + case (0 , 0) ==> fizz + buzz + case (0 , x) ==> fizz + case (x , 0) ==> buzz + case otherwise ==> n .toString end diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.scala b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.scala index 2dfb7fac..e12e77e1 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.scala +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.scala @@ -5,19 +5,19 @@ trait FizzBuzzPatternUnicode lazy val buzz = "Buzz" - private lazy val _range = soda.lib.Range_ () + lazy val range = soda.lib.Range_ () lazy val apply : Seq [String] = - _range.apply (100) - .map ( x => x + 1) - .map (_get_fizz_buzz_term) + range.apply (100) + .map ( x => x + 1) + .map (get_term) - private def _get_fizz_buzz_term (n : Int) : String = - Tuple2 (n % 3 , n % 5) match { - case Tuple2 (0 , 0) => fizz + buzz - case Tuple2 (0 , x) => fizz - case Tuple2 (x , 0) => buzz - case otherwise => n.toString + def get_term (n : Int) : String = + (n % 3 , n % 5) match { + case (0 , 0) => fizz + buzz + case (0 , x) => fizz + case (x , 0) => buzz + case otherwise => n .toString } } diff --git a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.soda b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.soda index bfeaf8ac..d8c755c4 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/FizzBuzzUnicode.soda @@ -5,18 +5,18 @@ buzz = "Buzz" - _range = soda.lib.Range_ () + range = soda.lib.Range_ () apply : Seq [String] = - _range.apply (100) - .map ( λ x ⟶ x + 1) - .map (_get_fizz_buzz_term) + range.apply (100) + .map (λ x ⟶ x + 1) + .map (get_term) - _get_fizz_buzz_term (n : Int) : String = - match Tuple2 (n % 3 , n % 5) - case Tuple2 (0 , 0) ⟹ fizz + buzz - case Tuple2 (0 , x) ⟹ fizz - case Tuple2 (x , 0) ⟹ buzz - case otherwise ⟹ n.toString + get_term (n : Int) : String = + match (n % 3 , n % 5) + case (0 , 0) ⟹ fizz + buzz + case (0 , x) ⟹ fizz + case (x , 0) ⟹ buzz + case otherwise ⟹ n .toString ⎿ diff --git a/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda b/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda index f3e726a0..32584641 100644 --- a/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda +++ b/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda @@ -11,15 +11,15 @@ class PatternMatching get_value (p : Parameter) : Int = match p case Singleton_ (x) ==> x - case Pair_ (x, y) ==> (x + y) / 2 - case Triplet_ (x, y, z) ==> (x + y + z) / 3 + case Pair_ (x , y) ==> (x + y) / 2 + case Triplet_ (x , y , z) ==> (x + y + z) / 3 case otherwise ==> 0 get_type_name (p : Parameter) : String = match p case Singleton_ (x) ==> (Singleton_ (x) ).name + "(x)" - case Pair_ (x, y) ==> (Pair_ (x, y) ).name + "(x, y)" - case Triplet_ (x, y, z) ==> (Triplet_ (x, y, z) ).name + "(x, y, z)" + case Pair_ (x , y) ==> (Pair_ (x , y) ).name + "(x, y)" + case Triplet_ (x , y , z) ==> (Triplet_ (x , y , z) ).name + "(x, y, z)" case otherwise ==> "" end From cab5861c8706547fcbd4c20d86138095733ade37 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 19 May 2023 01:09:16 +0200 Subject: [PATCH 33/56] Update manual --- .../resources/soda/translator/documentation/Manual.soda | 8 ++++---- .../resources/soda/translator/documentation/Manual.scala | 8 ++++---- .../resources/soda/translator/documentation/Manual.soda | 8 ++++---- .../resources/soda/translator/documentation/Manual.tex | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/translator/src/main/resources/soda/translator/documentation/Manual.soda b/translator/src/main/resources/soda/translator/documentation/Manual.soda index 6cf87e4e..f09a76fe 100644 --- a/translator/src/main/resources/soda/translator/documentation/Manual.soda +++ b/translator/src/main/resources/soda/translator/documentation/Manual.soda @@ -137,7 +137,7 @@ class Item accept : Visitor -> Boolean = lambda visitor --> - visitor.visit (this) + visitor .visit (this) end @@ -186,12 +186,12 @@ class Manual * Lambda functions are declared with `lambda` and a long right arrow (`-->`). */ plus_one (sequence : Seq [Int] ) : Seq [Int] = - sequence.map (lambda element --> element + 1) + sequence .map (lambda element --> element + 1) /* A synonym for `lambda` is `any`, which sometimes brings more readability. */ plus_two (sequence : Seq [Int] ) : Seq [Int] = - sequence.map (any element --> element + 2) + sequence .map (any element --> element + 2) /* Boolean values `false` and `true` are available. */ @@ -261,7 +261,7 @@ class FoldWhile _tailrec_fold_while [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value - else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) + else _tailrec_fold_while (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) (condition) end diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.scala b/translator/src/test/resources/soda/translator/documentation/Manual.scala index b32fc497..50844d10 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.scala +++ b/translator/src/test/resources/soda/translator/documentation/Manual.scala @@ -159,7 +159,7 @@ trait Item lazy val accept : Visitor => Boolean = visitor => - visitor.visit (this) + visitor .visit (this) } @@ -212,12 +212,12 @@ trait Manual * Lambda functions are declared with `lambda` and a long right arrow (`-->`). */ def plus_one (sequence : Seq [Int] ) : Seq [Int] = - sequence.map ( element => element + 1) + sequence .map ( element => element + 1) /* A synonym for `lambda` is `any`, which sometimes brings more readability. */ def plus_two (sequence : Seq [Int] ) : Seq [Int] = - sequence.map ( element => element + 2) + sequence .map ( element => element + 2) /* Boolean values `false` and `true` are available. */ @@ -297,7 +297,7 @@ trait FoldWhile private def _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = if ( sequence.isEmpty || (! condition (current_value) (sequence.head) ) ) current_value - else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) + else _tailrec_fold_while (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) (condition) } diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.soda b/translator/src/test/resources/soda/translator/documentation/Manual.soda index 6cf87e4e..f09a76fe 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.soda +++ b/translator/src/test/resources/soda/translator/documentation/Manual.soda @@ -137,7 +137,7 @@ class Item accept : Visitor -> Boolean = lambda visitor --> - visitor.visit (this) + visitor .visit (this) end @@ -186,12 +186,12 @@ class Manual * Lambda functions are declared with `lambda` and a long right arrow (`-->`). */ plus_one (sequence : Seq [Int] ) : Seq [Int] = - sequence.map (lambda element --> element + 1) + sequence .map (lambda element --> element + 1) /* A synonym for `lambda` is `any`, which sometimes brings more readability. */ plus_two (sequence : Seq [Int] ) : Seq [Int] = - sequence.map (any element --> element + 2) + sequence .map (any element --> element + 2) /* Boolean values `false` and `true` are available. */ @@ -261,7 +261,7 @@ class FoldWhile _tailrec_fold_while [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value - else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) + else _tailrec_fold_while (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) (condition) end diff --git a/translator/src/test/resources/soda/translator/documentation/Manual.tex b/translator/src/test/resources/soda/translator/documentation/Manual.tex index 909d94a6..1ebb4ac5 100644 --- a/translator/src/test/resources/soda/translator/documentation/Manual.tex +++ b/translator/src/test/resources/soda/translator/documentation/Manual.tex @@ -254,7 +254,7 @@ accept : Visitor -> Boolean = lambda visitor --> - visitor.visit (this) + visitor .visit (this) end @@ -332,7 +332,7 @@ plus_one (sequence : Seq [Int] ) : Seq [Int] = - sequence.map (lambda element --> element + 1) + sequence .map (lambda element --> element + 1) \end{lstlisting} @@ -344,7 +344,7 @@ plus_two (sequence : Seq [Int] ) : Seq [Int] = - sequence.map (any element --> element + 2) + sequence .map (any element --> element + 2) \end{lstlisting} @@ -447,7 +447,7 @@ _tailrec_fold_while [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = if sequence.isEmpty or (not condition (current_value) (sequence.head) ) then current_value - else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) + else _tailrec_fold_while (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) (condition) end From 17fa70c6a2ec8f8a421affae50fb6668d5ecaccf Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Fri, 19 May 2023 22:37:11 +0200 Subject: [PATCH 34/56] Reformat Soda source code in translator module --- .../lib/soda/lib/CartesianProduct.soda | 12 +- .../main/resources/lib/soda/lib/OptionSD.soda | 6 +- .../main/resources/lib/soda/lib/Package.scala | 40 +- .../resources/lib/soda/lib/Recursion.soda | 14 +- .../main/resources/lib/soda/lib/SeqSD.soda | 8 +- .../main/scala/soda/lib/CartesianProduct.soda | 12 +- .../src/main/scala/soda/lib/OptionSD.soda | 6 +- .../src/main/scala/soda/lib/Package.scala | 40 +- .../src/main/scala/soda/lib/Recursion.soda | 14 +- translator/src/main/scala/soda/lib/SeqSD.soda | 8 +- .../scala/soda/translator/block/Block.soda | 4 +- .../block/BlockSequenceTranslator.soda | 2 +- .../block/BlockTranslatorPipeline.soda | 4 +- .../block/ConditionalBlockTranslator.soda | 4 +- .../scala/soda/translator/block/Package.scala | 16 +- .../soda/translator/block/PlainBlock.soda | 2 +- .../soda/translator/blocktr/Package.scala | 26 +- .../translator/blocktr/TableTranslator.soda | 6 +- .../translator/blocktr/TokenReplacement.soda | 2 +- .../blocktr/TokenizedBlockTranslator.soda | 22 +- .../soda/translator/extension/help/Help.soda | 10 +- .../translator/extension/help/Package.scala | 10 +- .../soda/translator/extension/main/Main.soda | 8 +- .../translator/extension/main/Package.scala | 8 +- .../CoqClassConstructorBlockTranslator.soda | 94 ++-- .../CoqClassDeclarationBlockTranslator.soda | 30 +- .../tocoq/CoqClassEndBlockTranslator.soda | 16 +- .../tocoq/CoqDefinitionBlockTranslator.soda | 18 +- .../CoqImportDeclarationBlockTranslator.soda | 22 +- .../CoqPackageDeclarationBlockTranslator.soda | 4 +- .../tocoq/CoqProofBlockTranslator.soda | 16 +- .../tocoq/CoqTheoremBlockTranslator.soda | 16 +- .../tocoq/DefinitionLineTranslator.soda | 36 +- .../tocoq/MatchCaseBlockTranslator.soda | 28 +- .../extension/tocoq/MicroTranslatorToCoq.soda | 10 +- .../translator/extension/tocoq/Package.scala | 326 ++++++------- .../tocoq/TranslationConstantToCoq.soda | 26 +- .../extension/tocoq/TranslatorToCoq.soda | 16 +- .../extension/todoc/DocBlockTranslator.soda | 40 +- .../extension/todoc/MicroTranslatorToDoc.soda | 8 +- .../translator/extension/todoc/Package.scala | 78 ++-- .../todoc/TranslationConstantToDoc.soda | 8 +- .../extension/todoc/TranslatorToDoc.soda | 22 +- .../AbstractDeclarationBlockTranslator.soda | 22 +- .../ClassConstructorBlockTranslator.soda | 68 +-- .../ClassDeclarationBlockTranslator.soda | 42 +- .../toscala/ClassEndBlockTranslator.soda | 12 +- .../FunctionDefinitionBlockTranslator.soda | 52 +-- .../FunctionDefinitionLineDetector.soda | 28 +- .../ImportDeclarationBlockTranslator.soda | 16 +- .../toscala/MainClassBlockTranslator.soda | 14 +- .../toscala/MatchCaseBlockTranslator.soda | 26 +- .../toscala/MicroTranslatorToScala.soda | 32 +- .../extension/toscala/Package.scala | 434 +++++++++--------- .../TheoremAndProofBlockTranslator.soda | 10 +- .../toscala/TranslationConstantToScala.soda | 50 +- .../extension/toscala/TranslatorToScala.soda | 66 +-- .../toscala/TypeParameterBlockTranslator.soda | 2 +- .../translator/io/DirectoryProcessor.soda | 24 +- .../soda/translator/io/DirectoryScanner.soda | 20 +- .../soda/translator/io/LibraryDeployer.soda | 8 +- .../scala/soda/translator/io/Package.scala | 68 +-- .../scala/soda/translator/io/SimpleIO.soda | 16 +- .../soda/translator/parser/BlockBuilder.soda | 14 +- .../translator/parser/BlockProcessor.soda | 24 +- .../soda/translator/parser/Package.scala | 84 ++-- .../PreprocessorSequenceTranslator.soda | 44 +- .../soda/translator/parser/SodaConstant.soda | 2 +- .../AbstractDeclarationAnnotation.soda | 8 +- .../parser/annotation/AnnotationFactory.soda | 22 +- .../annotation/BlockAnnotationParser.soda | 24 +- .../annotation/ClassAliasAnnotation.soda | 6 +- .../annotation/ClassBeginningAnnotation.soda | 26 +- .../parser/annotation/ClassEndAnnotation.soda | 6 +- .../parser/annotation/CommentAnnotation.soda | 4 +- .../FunctionDefinitionAnnotation.soda | 48 +- .../ImportDeclarationAnnotation.soda | 6 +- .../parser/annotation/Package.scala | 170 +++---- .../PackageDeclarationAnnotation.soda | 4 +- .../annotation/ProofBlockAnnotation.soda | 6 +- .../annotation/TestDeclarationAnnotation.soda | 4 +- .../annotation/TheoremBlockAnnotation.soda | 6 +- .../soda/translator/replacement/CharType.soda | 24 +- .../soda/translator/replacement/Package.scala | 190 ++++---- .../replacement/ParserTransition.soda | 60 +-- .../translator/replacement/Replacement.soda | 62 +-- .../soda/translator/replacement/Replacer.soda | 18 +- .../translator/replacement/Tokenizer.soda | 26 +- .../scala/soda/lib/CartesianProductSpec.soda | 36 +- .../src/test/scala/soda/lib/EnumSpec.soda | 20 +- .../src/test/scala/soda/lib/OptionSDSpec.soda | 61 +-- .../src/test/scala/soda/lib/Package.scala | 161 +++---- .../test/scala/soda/lib/RecursionSpec.soda | 22 +- .../src/test/scala/soda/lib/SeqSDSpec.soda | 22 +- .../block/BlockTranslatorPipelineSpec.soda | 46 +- .../scala/soda/translator/block/Package.scala | 46 +- .../tocoq/CoqFullTranslationSpec.soda | 6 +- .../translator/extension/tocoq/Package.scala | 6 +- .../todoc/DocFullTranslationSpec.soda | 6 +- .../todoc/MicroTranslatorToDocSpec.soda | 2 +- .../translator/extension/todoc/Package.scala | 8 +- .../extension/toscala/BeautifierSpec.soda | 2 +- .../ClassConstructorBlockTranslatorSpec.soda | 4 +- .../toscala/FullTranslationSpec.soda | 6 +- .../extension/toscala/LazySyntaxSpec.soda | 8 +- .../toscala/MicroTranslatorToScalaSpec.soda | 26 +- .../extension/toscala/MultiLineSpec.soda | 32 +- .../extension/toscala/Package.scala | 96 ++-- .../extension/toscala/ScalaNonSodaSpec.soda | 4 +- .../toscala/TranslatorToScalaSpec.soda | 4 +- .../UpperAndLowerBoundDeclarationSpec.soda | 10 +- .../translator/io/DirectoryScannerSpec.soda | 10 +- .../scala/soda/translator/io/Package.scala | 10 +- .../soda/translator/parser/BlockSpec.soda | 18 +- .../soda/translator/parser/Package.scala | 20 +- .../PreprocessorSequenceTranslatorSpec.soda | 2 +- .../annotation/BlockAnnotationSpec.soda | 58 +-- .../ClassBeginningAnnotationSpec.soda | 22 +- .../parser/annotation/ExampleProgram.soda | 6 +- .../parser/annotation/Package.scala | 86 ++-- .../translator/replacement/CharTypeSpec.soda | 20 +- .../soda/translator/replacement/Package.scala | 96 ++-- .../replacement/ReplacementAuxSpec.soda | 36 +- .../replacement/ReplacementSpec.soda | 8 +- .../translator/replacement/TokenizerSpec.soda | 32 +- 125 files changed, 2030 insertions(+), 2024 deletions(-) diff --git a/translator/src/main/resources/lib/soda/lib/CartesianProduct.soda b/translator/src/main/resources/lib/soda/lib/CartesianProduct.soda index 399c86a8..41de1e43 100644 --- a/translator/src/main/resources/lib/soda/lib/CartesianProduct.soda +++ b/translator/src/main/resources/lib/soda/lib/CartesianProduct.soda @@ -10,21 +10,21 @@ class CartesianProduct apply [A] (sequences : Seq [Seq [A] ] ) : Seq [Seq [A] ] = - if sequences.isEmpty + if sequences .isEmpty then sequences - else _apply_recursion (sequences.reverse) + else _apply_recursion (sequences .reverse) _apply_recursion [A] (rev_sequences : Seq [Seq [A] ] ) : Seq [Seq [A] ] = - _fold.apply (rev_sequences.tail) (_initial_value (rev_sequences.head) ) (_next_value [A] ) + _fold .apply (rev_sequences .tail) (_initial_value (rev_sequences .head) ) (_next_value [A] ) _fold = Fold_ () _initial_value [A] (seq : Seq [A] ) : Seq [Seq [A] ] = - seq.map (lambda elem --> Seq [A] (elem) ) + seq .map (lambda elem --> Seq [A] (elem) ) _next_value [A] (accum : Seq [Seq [A] ] ) (seq_a : Seq [A] ) : Seq [Seq [A] ] = - seq_a.flatMap (lambda elem_a --> - accum.map (lambda seq_b --> seq_b.+: (elem_a) ) ) + seq_a .flatMap (lambda elem_a --> + accum .map (lambda seq_b --> seq_b .+: (elem_a) ) ) end diff --git a/translator/src/main/resources/lib/soda/lib/OptionSD.soda b/translator/src/main/resources/lib/soda/lib/OptionSD.soda index 9f414f52..cf3c4026 100644 --- a/translator/src/main/resources/lib/soda/lib/OptionSD.soda +++ b/translator/src/main/resources/lib/soda/lib/OptionSD.soda @@ -58,7 +58,7 @@ class NoneSD [A] extends OptionSD [A] - toOption : None.type = None + toOption : None .type = None isEmpty : Boolean = true @@ -108,9 +108,9 @@ end class OptionSDBuilder [A] build (option : Option [A] ) : OptionSD [A] = - if option.isEmpty + if option .isEmpty then NoneSD_ [A] () - else SomeSD_ [A] (option.get) + else SomeSD_ [A] (option .get) end diff --git a/translator/src/main/resources/lib/soda/lib/Package.scala b/translator/src/main/resources/lib/soda/lib/Package.scala index d0f6f829..a93805d5 100644 --- a/translator/src/main/resources/lib/soda/lib/Package.scala +++ b/translator/src/main/resources/lib/soda/lib/Package.scala @@ -26,21 +26,21 @@ trait CartesianProduct { def apply [A] (sequences : Seq [Seq [A] ] ) : Seq [Seq [A] ] = - if ( sequences.isEmpty + if ( sequences .isEmpty ) sequences - else _apply_recursion (sequences.reverse) + else _apply_recursion (sequences .reverse) private def _apply_recursion [A] (rev_sequences : Seq [Seq [A] ] ) : Seq [Seq [A] ] = - _fold.apply (rev_sequences.tail) (_initial_value (rev_sequences.head) ) (_next_value [A] ) + _fold .apply (rev_sequences .tail) (_initial_value (rev_sequences .head) ) (_next_value [A] ) private lazy val _fold = Fold_ () private def _initial_value [A] (seq : Seq [A] ) : Seq [Seq [A] ] = - seq.map ( elem => Seq [A] (elem) ) + seq .map ( elem => Seq [A] (elem) ) private def _next_value [A] (accum : Seq [Seq [A] ] ) (seq_a : Seq [A] ) : Seq [Seq [A] ] = - seq_a.flatMap ( elem_a => - accum.map ( seq_b => seq_b.+: (elem_a) ) ) + seq_a .flatMap ( elem_a => + accum .map ( seq_b => seq_b .+: (elem_a) ) ) } @@ -161,7 +161,7 @@ trait NoneSD [A] OptionSD [A] { - lazy val toOption : None.type = None + lazy val toOption : None .type = None lazy val isEmpty : Boolean = true @@ -218,9 +218,9 @@ trait OptionSDBuilder [A] { def build (option : Option [A] ) : OptionSD [A] = - if ( option.isEmpty + if ( option .isEmpty ) NoneSD_ [A] () - else SomeSD_ [A] (option.get) + else SomeSD_ [A] (option .get) } @@ -249,9 +249,9 @@ trait FoldWhile import scala.annotation.tailrec @tailrec final private def _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = - if ( sequence.isEmpty || (! condition (current_value) (sequence.head) ) + if ( sequence .isEmpty || (! condition (current_value) (sequence .head) ) ) current_value - else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) + else _tailrec_fold_while (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) (condition) } @@ -270,9 +270,9 @@ trait Fold import scala.annotation.tailrec @tailrec final private def _tailrec_fold [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) : B = - if ( sequence.isEmpty + if ( sequence .isEmpty ) current_value - else _tailrec_fold (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) + else _tailrec_fold (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) } @@ -305,13 +305,13 @@ trait Recursion private lazy val _range = Range_ () def fold_while [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = - _fold_while.apply (sequence) (initial_value) (next_value_function) (condition) + _fold_while .apply (sequence) (initial_value) (next_value_function) (condition) def fold [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B => A => B) : B = - _fold.apply (sequence) (initial_value) (next_value_function) + _fold .apply (sequence) (initial_value) (next_value_function) def range (length : Int) : Seq [Int] = - _range.apply (length) + _range .apply (length) } @@ -362,11 +362,11 @@ trait NonEmptySeqSD [A] def toSeq : Seq [A] - lazy val head : A = toSeq.head + lazy val head : A = toSeq .head - lazy val tail : SeqSD [A] = SeqSDBuilder_ [A] ().build (toSeq.tail) + lazy val tail : SeqSD [A] = SeqSDBuilder_ [A] () .build (toSeq .tail) - lazy val reverse : NonEmptySeqSD [A] = NonEmptySeqSD_ (toSeq.reverse) + lazy val reverse : NonEmptySeqSD [A] = NonEmptySeqSD_ (toSeq .reverse) } @@ -376,7 +376,7 @@ trait SeqSDBuilder [A] { def build (seq : Seq [A] ) : SeqSD [A] = - if ( seq.isEmpty + if ( seq .isEmpty ) EmptySeqSD_ [A] () else NonEmptySeqSD_ [A] (seq) diff --git a/translator/src/main/resources/lib/soda/lib/Recursion.soda b/translator/src/main/resources/lib/soda/lib/Recursion.soda index d594c018..8942122a 100644 --- a/translator/src/main/resources/lib/soda/lib/Recursion.soda +++ b/translator/src/main/resources/lib/soda/lib/Recursion.soda @@ -19,9 +19,9 @@ class FoldWhile @tailrec _tailrec_fold_while [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - if sequence.isEmpty or (not condition (current_value) (sequence.head) ) + if sequence .isEmpty or (not condition (current_value) (sequence .head) ) then current_value - else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) + else _tailrec_fold_while (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) (condition) end @@ -36,9 +36,9 @@ class Fold @tailrec _tailrec_fold [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = - if sequence.isEmpty + if sequence .isEmpty then current_value - else _tailrec_fold (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) + else _tailrec_fold (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) end @@ -64,13 +64,13 @@ class Recursion _range = Range_ () fold_while [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - _fold_while.apply (sequence) (initial_value) (next_value_function) (condition) + _fold_while .apply (sequence) (initial_value) (next_value_function) (condition) fold [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = - _fold.apply (sequence) (initial_value) (next_value_function) + _fold .apply (sequence) (initial_value) (next_value_function) range (length : Int) : Seq [Int] = - _range.apply (length) + _range .apply (length) end diff --git a/translator/src/main/resources/lib/soda/lib/SeqSD.soda b/translator/src/main/resources/lib/soda/lib/SeqSD.soda index 745e1ede..ec823f0b 100644 --- a/translator/src/main/resources/lib/soda/lib/SeqSD.soda +++ b/translator/src/main/resources/lib/soda/lib/SeqSD.soda @@ -37,18 +37,18 @@ class NonEmptySeqSD [A] abstract toSeq : Seq [A] - head : A = toSeq.head + head : A = toSeq .head - tail : SeqSD [A] = SeqSDBuilder_ [A] ().build (toSeq.tail) + tail : SeqSD [A] = SeqSDBuilder_ [A] () .build (toSeq .tail) - reverse : NonEmptySeqSD [A] = NonEmptySeqSD_ (toSeq.reverse) + reverse : NonEmptySeqSD [A] = NonEmptySeqSD_ (toSeq .reverse) end class SeqSDBuilder [A] build (seq : Seq [A] ) : SeqSD [A] = - if seq.isEmpty + if seq .isEmpty then EmptySeqSD_ [A] () else NonEmptySeqSD_ [A] (seq) diff --git a/translator/src/main/scala/soda/lib/CartesianProduct.soda b/translator/src/main/scala/soda/lib/CartesianProduct.soda index 30e5b952..fc19ed96 100644 --- a/translator/src/main/scala/soda/lib/CartesianProduct.soda +++ b/translator/src/main/scala/soda/lib/CartesianProduct.soda @@ -10,20 +10,20 @@ class CartesianProduct apply [A] (sequences : Seq [Seq [A] ] ) : Seq [Seq [A] ] = - if sequences.isEmpty + if sequences .isEmpty then sequences - else _apply_recursion (sequences.reverse) + else _apply_recursion (sequences .reverse) _apply_recursion [A] (rev_sequences : Seq [Seq [A] ] ) : Seq [Seq [A] ] = - _fold.apply (rev_sequences.tail) (_initial_value (rev_sequences.head) ) (_next_value [A] ) + _fold .apply (rev_sequences .tail) (_initial_value (rev_sequences .head) ) (_next_value [A] ) _fold = Fold_ () _initial_value [A] (seq : Seq [A] ) : Seq [Seq [A] ] = - seq.map (lambda elem --> Seq [A] (elem) ) + seq .map (lambda elem --> Seq [A] (elem) ) _next_value [A] (accum : Seq [Seq [A] ] ) (seq_a : Seq [A] ) : Seq [Seq [A] ] = - seq_a.flatMap (lambda elem_a --> - accum.map (lambda seq_b --> seq_b.+: (elem_a) ) ) + seq_a .flatMap (lambda elem_a --> + accum .map (lambda seq_b --> seq_b .+: (elem_a) ) ) end diff --git a/translator/src/main/scala/soda/lib/OptionSD.soda b/translator/src/main/scala/soda/lib/OptionSD.soda index cb7aec2a..b5907931 100644 --- a/translator/src/main/scala/soda/lib/OptionSD.soda +++ b/translator/src/main/scala/soda/lib/OptionSD.soda @@ -58,7 +58,7 @@ class NoneSD [A] extends OptionSD [A] - toOption : None.type = None + toOption : None .type = None isEmpty : Boolean = true @@ -108,8 +108,8 @@ end class OptionSDBuilder [A] build (option : Option [A] ) : OptionSD [A] = - if option.isEmpty + if option .isEmpty then NoneSD_ [A] () - else SomeSD_ [A] (option.get) + else SomeSD_ [A] (option .get) end diff --git a/translator/src/main/scala/soda/lib/Package.scala b/translator/src/main/scala/soda/lib/Package.scala index 3c648077..fd02dd19 100644 --- a/translator/src/main/scala/soda/lib/Package.scala +++ b/translator/src/main/scala/soda/lib/Package.scala @@ -24,21 +24,21 @@ trait CartesianProduct { def apply [A] (sequences : Seq [Seq [A] ] ) : Seq [Seq [A] ] = - if ( sequences.isEmpty + if ( sequences .isEmpty ) sequences - else _apply_recursion (sequences.reverse) + else _apply_recursion (sequences .reverse) private def _apply_recursion [A] (rev_sequences : Seq [Seq [A] ] ) : Seq [Seq [A] ] = - _fold.apply (rev_sequences.tail) (_initial_value (rev_sequences.head) ) (_next_value [A] ) + _fold .apply (rev_sequences .tail) (_initial_value (rev_sequences .head) ) (_next_value [A] ) private lazy val _fold = Fold_ () private def _initial_value [A] (seq : Seq [A] ) : Seq [Seq [A] ] = - seq.map ( elem => Seq [A] (elem) ) + seq .map ( elem => Seq [A] (elem) ) private def _next_value [A] (accum : Seq [Seq [A] ] ) (seq_a : Seq [A] ) : Seq [Seq [A] ] = - seq_a.flatMap ( elem_a => - accum.map ( seq_b => seq_b.+: (elem_a) ) ) + seq_a .flatMap ( elem_a => + accum .map ( seq_b => seq_b .+: (elem_a) ) ) } @@ -159,7 +159,7 @@ trait NoneSD [A] OptionSD [A] { - lazy val toOption : None.type = None + lazy val toOption : None .type = None lazy val isEmpty : Boolean = true @@ -216,9 +216,9 @@ trait OptionSDBuilder [A] { def build (option : Option [A] ) : OptionSD [A] = - if ( option.isEmpty + if ( option .isEmpty ) NoneSD_ [A] () - else SomeSD_ [A] (option.get) + else SomeSD_ [A] (option .get) } @@ -247,9 +247,9 @@ trait FoldWhile import scala.annotation.tailrec @tailrec final private def _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = - if ( sequence.isEmpty || (! condition (current_value) (sequence.head) ) + if ( sequence .isEmpty || (! condition (current_value) (sequence .head) ) ) current_value - else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) + else _tailrec_fold_while (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) (condition) } @@ -268,9 +268,9 @@ trait Fold import scala.annotation.tailrec @tailrec final private def _tailrec_fold [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) : B = - if ( sequence.isEmpty + if ( sequence .isEmpty ) current_value - else _tailrec_fold (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) + else _tailrec_fold (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) } @@ -303,13 +303,13 @@ trait Recursion private lazy val _range = Range_ () def fold_while [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B = - _fold_while.apply (sequence) (initial_value) (next_value_function) (condition) + _fold_while .apply (sequence) (initial_value) (next_value_function) (condition) def fold [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B => A => B) : B = - _fold.apply (sequence) (initial_value) (next_value_function) + _fold .apply (sequence) (initial_value) (next_value_function) def range (length : Int) : Seq [Int] = - _range.apply (length) + _range .apply (length) } @@ -360,11 +360,11 @@ trait NonEmptySeqSD [A] def toSeq : Seq [A] - lazy val head : A = toSeq.head + lazy val head : A = toSeq .head - lazy val tail : SeqSD [A] = SeqSDBuilder_ [A] ().build (toSeq.tail) + lazy val tail : SeqSD [A] = SeqSDBuilder_ [A] () .build (toSeq .tail) - lazy val reverse : NonEmptySeqSD [A] = NonEmptySeqSD_ (toSeq.reverse) + lazy val reverse : NonEmptySeqSD [A] = NonEmptySeqSD_ (toSeq .reverse) } @@ -374,7 +374,7 @@ trait SeqSDBuilder [A] { def build (seq : Seq [A] ) : SeqSD [A] = - if ( seq.isEmpty + if ( seq .isEmpty ) EmptySeqSD_ [A] () else NonEmptySeqSD_ [A] (seq) diff --git a/translator/src/main/scala/soda/lib/Recursion.soda b/translator/src/main/scala/soda/lib/Recursion.soda index 8634b374..296576ad 100644 --- a/translator/src/main/scala/soda/lib/Recursion.soda +++ b/translator/src/main/scala/soda/lib/Recursion.soda @@ -19,9 +19,9 @@ class FoldWhile @tailrec _tailrec_fold_while [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - if sequence.isEmpty or (not condition (current_value) (sequence.head) ) + if sequence .isEmpty or (not condition (current_value) (sequence .head) ) then current_value - else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition) + else _tailrec_fold_while (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) (condition) end @@ -36,9 +36,9 @@ class Fold @tailrec _tailrec_fold [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B = - if sequence.isEmpty + if sequence .isEmpty then current_value - else _tailrec_fold (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) + else _tailrec_fold (sequence .tail) (next_value_function (current_value) (sequence .head) ) (next_value_function) end @@ -64,12 +64,12 @@ class Recursion _range = Range_ () fold_while [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = - _fold_while.apply (sequence) (initial_value) (next_value_function) (condition) + _fold_while .apply (sequence) (initial_value) (next_value_function) (condition) fold [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B = - _fold.apply (sequence) (initial_value) (next_value_function) + _fold .apply (sequence) (initial_value) (next_value_function) range (length : Int) : Seq [Int] = - _range.apply (length) + _range .apply (length) end diff --git a/translator/src/main/scala/soda/lib/SeqSD.soda b/translator/src/main/scala/soda/lib/SeqSD.soda index a2be6e78..fc783ce6 100644 --- a/translator/src/main/scala/soda/lib/SeqSD.soda +++ b/translator/src/main/scala/soda/lib/SeqSD.soda @@ -37,18 +37,18 @@ class NonEmptySeqSD [A] abstract toSeq : Seq [A] - head : A = toSeq.head + head : A = toSeq .head - tail : SeqSD [A] = SeqSDBuilder_ [A] ().build (toSeq.tail) + tail : SeqSD [A] = SeqSDBuilder_ [A] () .build (toSeq .tail) - reverse : NonEmptySeqSD [A] = NonEmptySeqSD_ (toSeq.reverse) + reverse : NonEmptySeqSD [A] = NonEmptySeqSD_ (toSeq .reverse) end class SeqSDBuilder [A] build (seq : Seq [A] ) : SeqSD [A] = - if seq.isEmpty + if seq .isEmpty then EmptySeqSD_ [A] () else NonEmptySeqSD_ [A] (seq) diff --git a/translator/src/main/scala/soda/translator/block/Block.soda b/translator/src/main/scala/soda/translator/block/Block.soda index 5fc9aa01..2786c8db 100644 --- a/translator/src/main/scala/soda/translator/block/Block.soda +++ b/translator/src/main/scala/soda/translator/block/Block.soda @@ -16,11 +16,11 @@ class Block lines : Seq [String] = annotated_lines - .map (lambda x --> x.line) + .map (lambda x --> x .line) readable_lines : Seq [AnnotatedLine] = annotated_lines - .filter (lambda line --> not line.is_comment) + .filter (lambda line --> not line .is_comment) end diff --git a/translator/src/main/scala/soda/translator/block/BlockSequenceTranslator.soda b/translator/src/main/scala/soda/translator/block/BlockSequenceTranslator.soda index aa5fc680..d83971ed 100644 --- a/translator/src/main/scala/soda/translator/block/BlockSequenceTranslator.soda +++ b/translator/src/main/scala/soda/translator/block/BlockSequenceTranslator.soda @@ -15,7 +15,7 @@ class DefaultBlockSequenceTranslator translate : Seq [AnnotatedBlock] -> Seq [AnnotatedBlock] = lambda block_sequence --> - block_sequence.map (lambda block --> translator.translate (block) ) + block_sequence .map (lambda block --> translator .translate (block) ) end diff --git a/translator/src/main/scala/soda/translator/block/BlockTranslatorPipeline.soda b/translator/src/main/scala/soda/translator/block/BlockTranslatorPipeline.soda index 424a6c46..727023f1 100644 --- a/translator/src/main/scala/soda/translator/block/BlockTranslatorPipeline.soda +++ b/translator/src/main/scala/soda/translator/block/BlockTranslatorPipeline.soda @@ -13,10 +13,10 @@ class BlockTranslatorPipeline translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> - _fold.apply (pipeline) (block) (_next_value_function) + _fold .apply (pipeline) (block) (_next_value_function) _next_value_function (block : AnnotatedBlock) (translator : BlockTranslator) : AnnotatedBlock = - translator.translate (block) + translator .translate (block) end diff --git a/translator/src/main/scala/soda/translator/block/ConditionalBlockTranslator.soda b/translator/src/main/scala/soda/translator/block/ConditionalBlockTranslator.soda index fb9a7ec9..040568d4 100644 --- a/translator/src/main/scala/soda/translator/block/ConditionalBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/block/ConditionalBlockTranslator.soda @@ -12,8 +12,8 @@ class ConditionalBlockTranslator translate_for (block) translate_for (block : AnnotatedBlock) : AnnotatedBlock = - if accepted_annotations.contains (block.block_annotation) - then translator.translate (block) + if accepted_annotations.contains (block .block_annotation) + then translator .translate (block) else block end diff --git a/translator/src/main/scala/soda/translator/block/Package.scala b/translator/src/main/scala/soda/translator/block/Package.scala index 580609a1..392fecdd 100644 --- a/translator/src/main/scala/soda/translator/block/Package.scala +++ b/translator/src/main/scala/soda/translator/block/Package.scala @@ -40,11 +40,11 @@ trait Block lazy val lines : Seq [String] = annotated_lines - .map ( x => x.line) + .map ( x => x .line) lazy val readable_lines : Seq [AnnotatedLine] = annotated_lines - .filter ( line => ! line.is_comment) + .filter ( line => ! line .is_comment) } @@ -131,7 +131,7 @@ trait DefaultBlockSequenceTranslator lazy val translate : Seq [AnnotatedBlock] => Seq [AnnotatedBlock] = block_sequence => - block_sequence.map ( block => translator.translate (block) ) + block_sequence .map ( block => translator .translate (block) ) } @@ -174,10 +174,10 @@ trait BlockTranslatorPipeline lazy val translate : AnnotatedBlock => AnnotatedBlock = block => - _fold.apply (pipeline) (block) (_next_value_function) + _fold .apply (pipeline) (block) (_next_value_function) private def _next_value_function (block : AnnotatedBlock) (translator : BlockTranslator) : AnnotatedBlock = - translator.translate (block) + translator .translate (block) } @@ -197,8 +197,8 @@ trait ConditionalBlockTranslator translate_for (block) def translate_for (block : AnnotatedBlock) : AnnotatedBlock = - if ( accepted_annotations.contains (block.block_annotation) - ) translator.translate (block) + if ( accepted_annotations.contains (block .block_annotation) + ) translator .translate (block) else block } @@ -234,7 +234,7 @@ trait PlainBlock lazy val new_line = "\n" lazy val contents : String = - lines.mkString (new_line) + lines .mkString (new_line) } diff --git a/translator/src/main/scala/soda/translator/block/PlainBlock.soda b/translator/src/main/scala/soda/translator/block/PlainBlock.soda index 90d8cd5a..de9a19c2 100644 --- a/translator/src/main/scala/soda/translator/block/PlainBlock.soda +++ b/translator/src/main/scala/soda/translator/block/PlainBlock.soda @@ -7,7 +7,7 @@ class PlainBlock new_line = "\n" contents : String = - lines.mkString (new_line) + lines .mkString (new_line) end diff --git a/translator/src/main/scala/soda/translator/blocktr/Package.scala b/translator/src/main/scala/soda/translator/blocktr/Package.scala index 1802bdb1..cff5be8f 100644 --- a/translator/src/main/scala/soda/translator/blocktr/Package.scala +++ b/translator/src/main/scala/soda/translator/blocktr/Package.scala @@ -27,7 +27,7 @@ trait TableTranslator def table : Seq [Tuple2 [String, String] ] - lazy val keys : Seq [String] = table.map ( pair => pair._1) + lazy val keys : Seq [String] = table .map ( pair => pair ._1) lazy val translate : String => String = word => @@ -49,7 +49,7 @@ trait TokenReplacement def replace (table : Seq [ Tuple2 [String, String] ] ) : TokenizedBlockTranslator = TokenizedBlockTranslator_ ( token => - ReplacementWithTranslator_ (TableTranslator_ (table) ).replace (token.text) + ReplacementWithTranslator_ (TableTranslator_ (table) ) .replace (token .text) ) } @@ -80,9 +80,9 @@ trait TokenizedBlockTranslator translate_for (block) def translate_for (block : AnnotatedBlock) : AnnotatedBlock = - AnnotationFactory_ ().update_block ( + AnnotationFactory_ () .update_block ( block) ( - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( block .annotated_lines .map ( annotated_line => _translate_if_not_a_comment (annotated_line) ) @@ -90,17 +90,17 @@ trait TokenizedBlockTranslator ) private def _translate_if_not_a_comment (annotated_line : AnnotatedLine) : String = - if ( annotated_line.is_comment - ) annotated_line.line - else _translate_non_comment (annotated_line.line) + if ( annotated_line .is_comment + ) annotated_line .line + else _translate_non_comment (annotated_line .line) private def _translate_non_comment (line : String) : String = SomeSD_ (line) - .map ( x => Replacement_ (x).add_space_to_soda_line ().line) - .map ( x => Tokenizer_ (x).tokens) + .map ( x => Replacement_ (x) .add_space_to_soda_line () .line) + .map ( x => Tokenizer_ (x) .tokens) .map ( x => _translate_line (x) ) .map ( x => _join_tokens (x) ) - .map ( x => Replacement_ (x).remove_space_from_scala_line ().line) + .map ( x => Replacement_ (x) .remove_space_from_scala_line () .line) .getOrElse ("") private def _translate_line (tokens : Seq [Token] ) : Seq [Token] = @@ -108,13 +108,13 @@ trait TokenizedBlockTranslator .map ( token => _get_token_translated_if_in_state (token) ) private def _get_token_translated_if_in_state (token : Token) : Token = - if ( token.parser_state == ParserStateEnum_ ().plain - ) Token_ (replace_token (token), token.parser_state, token.index) + if ( token .parser_state == ParserStateEnum_ () .plain + ) Token_ (replace_token (token) , token .parser_state , token .index) else token private def _join_tokens (tokens : Seq [Token] ) : String = tokens - .map ( token => token.text) + .map ( token => token .text) .mkString ("") } diff --git a/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda b/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda index a86eb470..11764cc3 100644 --- a/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda +++ b/translator/src/main/scala/soda/translator/blocktr/TableTranslator.soda @@ -2,7 +2,7 @@ class Table abstract - table : Seq [Tuple2 [String, String] ] + table : Seq [Tuple2 [String] [String] ] end @@ -12,9 +12,9 @@ class TableTranslator soda.translator.block.Translator abstract - table : Seq [Tuple2 [String, String] ] + table : Seq [Tuple2 [String] [String] ] - keys : Seq [String] = table.map (lambda pair --> pair._1) + keys : Seq [String] = table .map (lambda pair --> pair ._1) translate : String -> String = lambda word --> diff --git a/translator/src/main/scala/soda/translator/blocktr/TokenReplacement.soda b/translator/src/main/scala/soda/translator/blocktr/TokenReplacement.soda index a122b0cb..d7bebdc3 100644 --- a/translator/src/main/scala/soda/translator/blocktr/TokenReplacement.soda +++ b/translator/src/main/scala/soda/translator/blocktr/TokenReplacement.soda @@ -7,7 +7,7 @@ class TokenReplacement replace (table : Seq [ Tuple2 [String, String] ] ) : TokenizedBlockTranslator = TokenizedBlockTranslator_ ( lambda token --> - ReplacementWithTranslator_ (TableTranslator_ (table) ).replace (token.text) + ReplacementWithTranslator_ (TableTranslator_ (table) ) .replace (token .text) ) end diff --git a/translator/src/main/scala/soda/translator/blocktr/TokenizedBlockTranslator.soda b/translator/src/main/scala/soda/translator/blocktr/TokenizedBlockTranslator.soda index df8abb51..ff476467 100644 --- a/translator/src/main/scala/soda/translator/blocktr/TokenizedBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/blocktr/TokenizedBlockTranslator.soda @@ -23,9 +23,9 @@ class TokenizedBlockTranslator translate_for (block) translate_for (block : AnnotatedBlock) : AnnotatedBlock = - AnnotationFactory_ ().update_block ( + AnnotationFactory_ () .update_block ( block) ( - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( block .annotated_lines .map (lambda annotated_line --> _translate_if_not_a_comment (annotated_line) ) @@ -33,17 +33,17 @@ class TokenizedBlockTranslator ) _translate_if_not_a_comment (annotated_line : AnnotatedLine) : String = - if annotated_line.is_comment - then annotated_line.line - else _translate_non_comment (annotated_line.line) + if annotated_line .is_comment + then annotated_line .line + else _translate_non_comment (annotated_line .line) _translate_non_comment (line : String) : String = SomeSD_ (line) - .map (lambda x --> Replacement_ (x).add_space_to_soda_line ().line) - .map (lambda x --> Tokenizer_ (x).tokens) + .map (lambda x --> Replacement_ (x) .add_space_to_soda_line () .line) + .map (lambda x --> Tokenizer_ (x) .tokens) .map (lambda x --> _translate_line (x) ) .map (lambda x --> _join_tokens (x) ) - .map (lambda x --> Replacement_ (x).remove_space_from_scala_line ().line) + .map (lambda x --> Replacement_ (x) .remove_space_from_scala_line () .line) .getOrElse ("") _translate_line (tokens : Seq [Token] ) : Seq [Token] = @@ -51,13 +51,13 @@ class TokenizedBlockTranslator .map (lambda token --> _get_token_translated_if_in_state (token) ) _get_token_translated_if_in_state (token : Token) : Token = - if token.parser_state == ParserStateEnum_ ().plain - then Token_ (replace_token (token), token.parser_state, token.index) + if token .parser_state == ParserStateEnum_ () .plain + then Token_ (replace_token (token) , token .parser_state , token .index) else token _join_tokens (tokens : Seq [Token] ) : String = tokens - .map (lambda token --> token.text) + .map (lambda token --> token .text) .mkString ("") end diff --git a/translator/src/main/scala/soda/translator/extension/help/Help.soda b/translator/src/main/scala/soda/translator/extension/help/Help.soda index c1c290ec..0b8e60a5 100644 --- a/translator/src/main/scala/soda/translator/extension/help/Help.soda +++ b/translator/src/main/scala/soda/translator/extension/help/Help.soda @@ -13,15 +13,15 @@ class AbstractHelp path : String = "/soda/translator/documentation/" read (file_name : String) : String = - SimpleFileReader_ ().read_resource (path + file_name) + SimpleFileReader_ () .read_resource (path + file_name) - this_package = this.getClass.getPackage + this_package = this .getClass .getPackage - name : String = Option (this_package.getImplementationTitle).getOrElse ("") + name : String = Option (this_package .getImplementationTitle) .getOrElse ("") - version : String = Option (this_package.getImplementationVersion).getOrElse ("") + version : String = Option (this_package .getImplementationVersion) .getOrElse ("") - title_and_version : String = (name + " " + version).trim + title_and_version : String = (name + " " + version) .trim output_content (content : String) : Boolean = SomeSD_ (content) diff --git a/translator/src/main/scala/soda/translator/extension/help/Package.scala b/translator/src/main/scala/soda/translator/extension/help/Package.scala index e9a4ff07..508cc934 100644 --- a/translator/src/main/scala/soda/translator/extension/help/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/help/Package.scala @@ -21,15 +21,15 @@ trait AbstractHelp lazy val path : String = "/soda/translator/documentation/" def read (file_name : String) : String = - SimpleFileReader_ ().read_resource (path + file_name) + SimpleFileReader_ () .read_resource (path + file_name) - lazy val this_package = this.getClass.getPackage + lazy val this_package = this .getClass .getPackage - lazy val name : String = Option (this_package.getImplementationTitle).getOrElse ("") + lazy val name : String = Option (this_package .getImplementationTitle) .getOrElse ("") - lazy val version : String = Option (this_package.getImplementationVersion).getOrElse ("") + lazy val version : String = Option (this_package .getImplementationVersion) .getOrElse ("") - lazy val title_and_version : String = (name + " " + version).trim + lazy val title_and_version : String = (name + " " + version) .trim def output_content (content : String) : Boolean = SomeSD_ (content) diff --git a/translator/src/main/scala/soda/translator/extension/main/Main.soda b/translator/src/main/scala/soda/translator/extension/main/Main.soda index ea243508..ea74018a 100644 --- a/translator/src/main/scala/soda/translator/extension/main/Main.soda +++ b/translator/src/main/scala/soda/translator/extension/main/Main.soda @@ -34,12 +34,12 @@ class Main execute_for (arguments) execute_for (arguments : Seq [String] ) : Boolean = - if arguments.length == 0 - then help.execute (arguments.toSeq) + if arguments .length == 0 + then help .execute (arguments .toSeq) else extensions - .getOrElse (arguments.head, help) - .execute (arguments.tail) + .getOrElse (arguments .head, help) + .execute (arguments .tail) end diff --git a/translator/src/main/scala/soda/translator/extension/main/Package.scala b/translator/src/main/scala/soda/translator/extension/main/Package.scala index 8168e075..4cb11468 100644 --- a/translator/src/main/scala/soda/translator/extension/main/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/main/Package.scala @@ -44,12 +44,12 @@ trait Main execute_for (arguments) def execute_for (arguments : Seq [String] ) : Boolean = - if ( arguments.length == 0 - ) help.execute (arguments.toSeq) + if ( arguments .length == 0 + ) help .execute (arguments .toSeq) else extensions - .getOrElse (arguments.head, help) - .execute (arguments.tail) + .getOrElse (arguments .head, help) + .execute (arguments .tail) } diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda index f5d80815..bd2621cf 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassConstructorBlockTranslator.soda @@ -22,73 +22,73 @@ class CoqClassConstructorBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block - case AbstractDeclarationAnnotation_ (block, references) ==> _translate_block (AbstractDeclarationAnnotation_ (block, references) ) + case AbstractDeclarationAnnotation_ (block , references) ==> _translate_block (AbstractDeclarationAnnotation_ (block , references) ) case otherwise ==> annotated_block _translate_block (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = - _translate_block_with (_get_class_beginning (block.references) ) (block) + _translate_block_with (_get_class_beginning (block .references) ) (block) _translate_block_with (maybe_beginning : Option [ClassBeginningAnnotation] ) (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = - if maybe_beginning.isEmpty + if maybe_beginning .isEmpty then block - else _translate_block_with_beginning (maybe_beginning.get) (block) + else _translate_block_with_beginning (maybe_beginning .get) (block) _translate_block_with_beginning (beginning : ClassBeginningAnnotation) (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = - if beginning.is_concrete + if beginning .is_concrete then block else _translate_block_with_abstract_beginning (beginning) (block) _translate_block_with_abstract_beginning (beginning : ClassBeginningAnnotation) (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = AbstractDeclarationAnnotation_ ( - BlockBuilder_ ().build ( - Seq (_tc.coq_opening_comment).++ ( - block.lines.++ ( + BlockBuilder_ () .build ( + Seq (_tc .coq_opening_comment) .++ ( + block .lines .++ ( Seq [String] ( - _tc.coq_closing_comment, + _tc .coq_closing_comment, "", _get_constructor_declaration (beginning) (_get_types_of_abstract_functions (block) ) ) ) ) ), - block.references + block .references ) _get_constructor_declaration (beginning : ClassBeginningAnnotation) (abstract_functions : Seq [String] ) : String = _get_initial_spaces (beginning) + - _tc.coq_inductive_reserved_word + - _tc.coq_space + - beginning.class_name + - _tc.coq_space + - _tc.coq_type_membership_symbol + - _tc.coq_space + - _tc.coq_type_reserved_word + - _tc.coq_space + - _tc.coq_function_definition_symbol + - _tc.coq_new_line + + _tc .coq_inductive_reserved_word + + _tc .coq_space + + beginning .class_name + + _tc .coq_space + + _tc .coq_type_membership_symbol + + _tc .coq_space + + _tc .coq_type_reserved_word + + _tc .coq_space + + _tc .coq_function_definition_symbol + + _tc .coq_new_line + _get_initial_spaces (beginning) + - _tc.coq_space + - _tc.coq_space + - _tc.coq_vertical_bar_symbol + - _tc.coq_space + - beginning.class_name + - _sc.constructor_suffix + - _tc.coq_space + - _tc.coq_opening_parenthesis + - _tc.coq_some_variable_name + - _tc.coq_space + - _tc.coq_type_membership_symbol + - _tc.coq_space + - abstract_functions.mkString (_tc.coq_space + _tc.coq_product_type_symbol + _tc.coq_space) + - _tc.coq_closing_parenthesis + - _tc.coq_new_line + + _tc .coq_space + + _tc .coq_space + + _tc .coq_vertical_bar_symbol + + _tc .coq_space + + beginning .class_name + + _sc .constructor_suffix + + _tc .coq_space + + _tc .coq_opening_parenthesis + + _tc .coq_some_variable_name + + _tc .coq_space + + _tc .coq_type_membership_symbol + + _tc .coq_space + + abstract_functions .mkString (_tc .coq_space + _tc .coq_product_type_symbol + _tc .coq_space) + + _tc .coq_closing_parenthesis + + _tc .coq_new_line + _get_initial_spaces (beginning) + - _tc.coq_inductive_end_symbol + _tc .coq_inductive_end_symbol _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references - .flatMap (lambda block --> _get_as_class_beginning_annotation (block) ) - .headOption + .flatMap (lambda block --> _get_as_class_beginning_annotation (block) ) + .headOption _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = match annotated_block @@ -96,32 +96,32 @@ class CoqClassConstructorBlockTranslator case otherwise ==> None _get_types_of_abstract_functions (block : AbstractDeclarationAnnotation) : Seq [String] = - block.abstract_functions - .map (lambda annotated_line --> _translate_type_symbols (annotated_line.line).trim ) + block .abstract_functions + .map (lambda annotated_line --> _translate_type_symbols (annotated_line .line) .trim ) .map (lambda line --> _remove_variable (line) ) _remove_variable (line : String) : String = - _remove_variable_with (line) (line.indexOf (_sc.type_membership_symbol) ) + _remove_variable_with (line) (line .indexOf (_sc .type_membership_symbol) ) _remove_variable_with (line : String) (index : Int) : String = if index < 0 then line - else line.substring (index + _sc.type_membership_symbol.length).trim + else line .substring (index + _sc .type_membership_symbol .length) .trim _translate_type_symbols (line : String) : String = line - .replaceAll (_sc.subtype_reserved_word, _tc.coq_subtype_symbol) - .replaceAll (_sc.supertype_reserved_word, _tc.coq_supertype_symbol) - .replaceAll (_sc.function_arrow_symbol, _tc.coq_function_arrow_symbol) + .replaceAll (_sc .subtype_reserved_word , _tc .coq_subtype_symbol) + .replaceAll (_sc .supertype_reserved_word , _tc .coq_supertype_symbol) + .replaceAll (_sc .function_arrow_symbol , _tc .coq_function_arrow_symbol) _get_initial_spaces (block : AnnotatedBlock) : String = _get_initial_spaces_with (_get_first_line (block) ) _get_initial_spaces_with (line : String) : String = - line.takeWhile (lambda ch --> ch.isSpaceChar) + line .takeWhile (lambda ch --> ch .isSpaceChar) _get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda index bd0de0cc..7ae65e9b 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassDeclarationBlockTranslator.soda @@ -18,7 +18,7 @@ class CoqClassDeclarationBlockTranslator _tc = TranslationConstantToCoq_ () - soda_space : String = _sc.space + soda_space : String = _sc .space scala_space : String = " " @@ -38,7 +38,7 @@ class CoqClassDeclarationBlockTranslator if (has_condition_for_type_alias (get_first_line (block) ) ) then block else - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( _process_head (block) ++ _process_tail (block) ) @@ -47,46 +47,46 @@ class CoqClassDeclarationBlockTranslator _process_head_with (line : String) (block : Block) : Seq [String] = Seq [String] ( - Replacement_ (_sc.space + line).replace_at_beginning (0) (get_table_translator (line) ).line.substring (_sc.space.length) + _tc.coq_space + _tc.coq_end_symbol + Replacement_ (_sc .space + line) .replace_at_beginning (0) (get_table_translator (line) ) .line .substring (_sc .space .length) + _tc .coq_space + _tc .coq_end_symbol ) _process_tail (block : Block) : Seq [String] = _process_if_extends (remove_first_line (block) ) _process_if_extends (block : Block) : Seq [String] = - if (get_first_line (block).trim == _sc.extends_reserved_word) - then Seq [String] (get_initial_spaces (block) ).++ ( _process_after_extends (remove_first_line (block) ) ) - else block.lines + if (get_first_line (block) .trim == _sc .extends_reserved_word) + then Seq [String] (get_initial_spaces (block) ) .++ ( _process_after_extends (remove_first_line (block) ) ) + else block .lines get_table_translator (line : String) : Translator = TableTranslator_ ( - Seq (Tuple2 (_sc.class_reserved_word, _tc.coq_module_reserved_word ) ) + Seq (Tuple2 (_sc .class_reserved_word, _tc .coq_module_reserved_word ) ) ) _process_after_extends (block : Block) : Seq [String] = - if (get_first_line (block).trim.nonEmpty) - then block.lines.map (lambda line --> _tc.coq_import_reserved_word + _tc.coq_space + line.trim + _tc.coq_space + _tc.coq_end_symbol) + if (get_first_line (block) .trim .nonEmpty) + then block .lines .map (lambda line --> _tc .coq_import_reserved_word + _tc .coq_space + line .trim + _tc .coq_space + _tc .coq_end_symbol) else Seq [String] () remove_first_line (block : Block) : Block = - BlockBuilder_ ().build ( _remove_first_line (block.lines) ) + BlockBuilder_ () .build ( _remove_first_line (block .lines) ) _remove_first_line (lines : Seq [String] ) : Seq [String] = - if lines.isEmpty + if lines .isEmpty then lines - else lines.tail + else lines .tail get_first_line (block : Block) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") get_initial_spaces (block : Block) : String = get_initial_spaces_for (get_first_line (block) ) get_initial_spaces_for (line : String) : String = - line.takeWhile (lambda ch --> ch.isSpaceChar) + line .takeWhile (lambda ch --> ch .isSpaceChar) contains_equals (line : String) : Boolean = - line.trim.contains (_sc.function_definition_symbol) + line .trim .contains (_sc .function_definition_symbol) has_condition_for_type_alias (line : String) : Boolean = contains_equals (line) diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda index 731df9ce..a64361ed 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqClassEndBlockTranslator.soda @@ -20,32 +20,32 @@ class CoqClassEndBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block - case ClassEndAnnotation_ (block, references) ==> _translate_block (ClassEndAnnotation_ (block, references) ) + case ClassEndAnnotation_ (block , references) ==> _translate_block (ClassEndAnnotation_ (block , references) ) case otherwise ==> annotated_block _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = _translate_block_with (_get_class_beginning (block.references) ) (block) _translate_block_with (maybe_beginning : Option [ClassBeginningAnnotation] ) (block : ClassEndAnnotation) : ClassEndAnnotation = - if maybe_beginning.isEmpty + if maybe_beginning .isEmpty then block - else _translate_block_with_beginning (maybe_beginning.get) (block) + else _translate_block_with_beginning (maybe_beginning .get) (block) _translate_block_with_beginning (beginning : ClassBeginningAnnotation) (block : ClassEndAnnotation) : ClassEndAnnotation = - if beginning.is_concrete + if beginning .is_concrete then block else _translate_block_with_abstract_beginning (beginning) (block) _translate_block_with_abstract_beginning (beginning : ClassBeginningAnnotation) (block : ClassEndAnnotation) : ClassEndAnnotation = ClassEndAnnotation_ ( - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( Seq [String] ( - _tc.coq_module_end_reserved_word + _tc.coq_space + beginning.class_name + _tc.coq_space + _tc.coq_end_symbol, + _tc .coq_module_end_reserved_word + _tc .coq_space + beginning .class_name + _tc .coq_space + _tc .coq_end_symbol, "", - _tc.coq_import_reserved_word + _tc.coq_space + beginning.class_name + _tc.coq_space + _tc.coq_end_symbol + _tc .coq_import_reserved_word + _tc .coq_space + beginning .class_name + _tc .coq_space + _tc .coq_end_symbol ) ), - block.references + block .references ) _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda index aad97424..e7727e7d 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqDefinitionBlockTranslator.soda @@ -26,33 +26,33 @@ class CoqDefinitionBlockTranslator _translate_block (block : FunctionDefinitionAnnotation) : Block = if is_a_recursive_definition (block) - then _append (_tc.coq_recursive_definition_end_symbol) (_prepend (_tc.coq_recursive_definition_reserved_word + _tc.coq_space) (block) ) + then _append (_tc .coq_recursive_definition_end_symbol) (_prepend (_tc .coq_recursive_definition_reserved_word + _tc .coq_space) (block) ) else _translate_non_recursive_definition (block) _translate_non_recursive_definition (block : FunctionDefinitionAnnotation) : Block = if is_a_definition (block) - then _append (_tc.coq_definition_end_symbol) (_prepend (_tc.coq_definition_reserved_word + _tc.coq_space) (block) ) + then _append (_tc .coq_definition_end_symbol) (_prepend (_tc .coq_definition_reserved_word + _tc .coq_space) (block) ) else block _prepend (prefix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - Seq[String] (prefix + block.lines.head) ++ block.lines.tail + BlockBuilder_ () .build ( + Seq[String] (prefix + block .lines .head) ++ block .lines .tail ) _append (suffix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - block.lines.:+ (suffix) + BlockBuilder_ () .build ( + block .lines .:+ (suffix) ) is_a_recursive_definition (block : Block) : Boolean = - _tc.coq_recursive_function_prefixes.exists (lambda prefix --> first_line (block).startsWith (prefix) ) + _tc .coq_recursive_function_prefixes .exists (lambda prefix --> first_line (block) .startsWith (prefix) ) first_line (block : Block) : String = - block.lines.headOption.getOrElse ("").trim + block .lines .headOption .getOrElse ("") .trim is_a_definition (block : Block) : Boolean = not is_a_recursive_definition (block) and - not _tc.non_definition_block_prefixes.exists (lambda prefix --> block.contents.trim.startsWith (prefix) ) + not _tc .non_definition_block_prefixes .exists (lambda prefix --> block .contents .trim .startsWith (prefix) ) end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda index 37f6c18b..017d500d 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqImportDeclarationBlockTranslator.soda @@ -15,7 +15,7 @@ class CoqImportDeclarationBlockTranslator _tc = TranslationConstantToCoq_ () coq_import_declaration_pattern = - _tc.coq_import_reserved_word + _tc.coq_space + _tc .coq_import_reserved_word + _tc .coq_space translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> @@ -31,29 +31,29 @@ class CoqImportDeclarationBlockTranslator prepend_to_lines_aligned_at ( get_number_of_spaces_at_beginning (get_first_line (block) ) ) ( coq_import_declaration_pattern) ( - block.imported_items - .filter(lambda annotated_line --> not annotated_line.is_comment) - .map (lambda annotated_line --> AnnotatedLine_ (annotated_line.line + _tc.coq_space + _tc.coq_end_symbol, false) ) + block .imported_items + .filter(lambda annotated_line --> not annotated_line .is_comment) + .map (lambda annotated_line --> AnnotatedLine_ (annotated_line .line + _tc .coq_space + _tc .coq_end_symbol, false) ) ) ) prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = - BlockBuilder_ ().build ( - annotated_lines.map (lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + BlockBuilder_ () .build ( + annotated_lines .map (lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : String = - if annotated_line.is_comment - then annotated_line.line - else annotated_line.line.substring (0, index) + prefix + annotated_line.line.substring (index) + if annotated_line .is_comment + then annotated_line .line + else annotated_line .line .substring (0, index) + prefix + annotated_line .line .substring (index) get_number_of_spaces_at_beginning (line : String) : Int = line - .takeWhile (lambda ch --> ch.isSpaceChar) + .takeWhile (lambda ch --> ch .isSpaceChar) .length get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqPackageDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqPackageDeclarationBlockTranslator.soda index 99080c15..b0df7792 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqPackageDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqPackageDeclarationBlockTranslator.soda @@ -29,8 +29,8 @@ class CoqPackageDeclarationBlockTranslator ) _comment_block (block : Block) : Block = - BlockBuilder_ ().build ( - ( (Seq (_tc.coq_opening_comment).++ (block.lines) ).++ (Seq (_tc.coq_closing_comment) ) ).++ (_tc.coq_prelude) + BlockBuilder_ () .build ( + ( (Seq (_tc .coq_opening_comment) .++ (block .lines) ) .++ (Seq (_tc .coq_closing_comment) ) ) .++ (_tc .coq_prelude) ) end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqProofBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqProofBlockTranslator.soda index 42d7b0ca..bc6ec9c9 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqProofBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqProofBlockTranslator.soda @@ -24,25 +24,25 @@ class CoqProofBlockTranslator _translate_block (block : ProofBlockAnnotation) : ProofBlockAnnotation = ProofBlockAnnotation_ ( _append ( - _tc.coq_proof_end_reserved_word) ( - _replace_first_line (_tc.coq_proof_begin_reserved_word) (block) + _tc .coq_proof_end_reserved_word) ( + _replace_first_line (_tc .coq_proof_begin_reserved_word) (block) ) ) _append (suffix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - block.lines.:+ (suffix) + BlockBuilder_ () .build ( + block .lines .:+ (suffix) ) _replace_first_line (first_line : String) (block : Block) : Block = - BlockBuilder_ ().build ( - Seq (first_line) .++ (_get_tail_or_empty (block.lines) ) + BlockBuilder_ () .build ( + Seq (first_line) .++ (_get_tail_or_empty (block .lines) ) ) _get_tail_or_empty (sequence : Seq [String] ) : Seq [String] = - if sequence.isEmpty + if sequence .isEmpty then sequence - else sequence.tail + else sequence .tail end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/CoqTheoremBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/CoqTheoremBlockTranslator.soda index 09230c5f..cd03b7f4 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/CoqTheoremBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/CoqTheoremBlockTranslator.soda @@ -24,26 +24,26 @@ class CoqTheoremBlockTranslator _translate_block (block : TheoremBlockAnnotation) : TheoremBlockAnnotation = TheoremBlockAnnotation_ ( _append ( - _tc.coq_theorem_end_symbol) (_prepend ( - _tc.coq_theorem_begin_reserved_word) (_remove_first_line (block) + _tc .coq_theorem_end_symbol) (_prepend ( + _tc .coq_theorem_begin_reserved_word) (_remove_first_line (block) ) ) ) _prepend (prefix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - Seq[String] (prefix + block.lines.head).++ (block.lines.tail) + BlockBuilder_ () .build ( + Seq[String] (prefix + block .lines .head) .++ (block .lines .tail) ) _append (suffix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - block.lines.:+ (suffix) + BlockBuilder_ () .build ( + block .lines .:+ (suffix) ) _remove_first_line (block : Block) : Block = - if block.lines.isEmpty + if block .lines .isEmpty then block - else BlockBuilder_ ().build (block.lines.tail) + else BlockBuilder_ () .build (block .lines .tail) end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/DefinitionLineTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/DefinitionLineTranslator.soda index 591b67f0..7679841a 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/DefinitionLineTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/DefinitionLineTranslator.soda @@ -29,7 +29,7 @@ class DefinitionLineTranslator soda.translator.block.LineTranslator abstract - line: String + line : String import soda.lib.OptionSD @@ -42,34 +42,34 @@ class DefinitionLineTranslator _tc = TranslationConstantToCoq_ () - _trimmed_line = line.trim + _trimmed_line = line .trim translation = - find_definition (line).opt (ifEmpty := line) (ifNonEmpty := lambda position --> _try_found_definition (position).line) + find_definition (line) .opt (ifEmpty := line) (ifNonEmpty := lambda position --> _try_found_definition (position) .line) _is_class_definition = - get_index (line) (_sc.space + _sc.class_reserved_word + _sc.space).isDefined + get_index (line) (_sc .space + _sc .class_reserved_word + _sc .space) .isDefined _translation_of_class_definition = if _condition_for_type_alias then Replacement_ (line) - else Replacement_ (line).replace_all (_sc.space + _sc.function_definition_symbol) ("") + else Replacement_ (line) .replace_all (_sc .space + _sc .function_definition_symbol) ("") _ends_with_equals = false _ends_with_opening_brace = false _contains_equals = - _trimmed_line.contains (_sc.function_definition_symbol) + _trimmed_line .contains (_sc .function_definition_symbol) _condition_for_type_alias = _contains_equals and not (_ends_with_equals or _ends_with_opening_brace) _translation_of_val_definition = - Replacement_ (line).add_after_spaces_or_pattern (_tc.coq_space) (_tc.coq_space) + Replacement_ (line) .add_after_spaces_or_pattern (_tc .coq_space) (_tc .coq_space) _translation_of_def_definition = - Replacement_ (line).add_after_spaces_or_pattern (_tc.coq_space) (_tc.coq_space) + Replacement_ (line) .add_after_spaces_or_pattern (_tc .coq_space) (_tc .coq_space) _try_found_definition (position : Int) : Replacement = if _is_class_definition @@ -88,21 +88,21 @@ class DefinitionLineTranslator _is_val_definition_case_4 _position_of_first_opening_parenthesis = - get_index (line) (_sc.opening_parenthesis_symbol) + get_index (line) (_sc .opening_parenthesis_symbol) _is_val_definition_case_1 = - _position_of_first_opening_parenthesis.isEmpty + _position_of_first_opening_parenthesis .isEmpty _is_val_definition_case_2 (initial_position : Int) = - _position_of_first_opening_parenthesis.opt (false) (lambda position --> (position > initial_position) ) + _position_of_first_opening_parenthesis .opt (false) (lambda position --> (position > initial_position) ) _is_val_definition_case_3 = - (get_index (line) (_sc.type_membership_symbol) ).opt (ifEmpty := false) (ifNonEmpty := lambda other_position --> - _position_of_first_opening_parenthesis.opt (false) (lambda position --> (position > other_position) ) + (get_index (line) (_sc .type_membership_symbol) ) .opt (ifEmpty := false) (ifNonEmpty := lambda other_position --> + _position_of_first_opening_parenthesis .opt (false) (lambda position --> (position > other_position) ) ) _is_val_definition_case_4 = - _trimmed_line.startsWith (_sc.opening_parenthesis_symbol) + _trimmed_line .startsWith (_sc .opening_parenthesis_symbol) /** * A line is a definition when its main operator is "=" (the equals sign), which in this context is also called the definition sign. @@ -113,15 +113,15 @@ class DefinitionLineTranslator */ find_definition (line : String) : OptionSD [Int] = - if line.endsWith (_sc.space + _sc.function_definition_symbol) - then SomeSD_ (line.length - _sc.function_definition_symbol.length) - else get_index (line) (_sc.space + _sc.function_definition_symbol + _sc.space) + if line .endsWith (_sc .space + _sc .function_definition_symbol) + then SomeSD_ (line .length - _sc .function_definition_symbol .length) + else get_index (line) (_sc .space + _sc .function_definition_symbol + _sc .space) get_index (line : String) (pattern : String) : OptionSD [Int] = get_index_from (line) (pattern) (0) get_index_from (line : String) (pattern : String) (start : Int) : OptionSD [Int] = - SomeSD_ (line.indexOf (pattern, start) ) + SomeSD_ (line .indexOf (pattern, start) ) .filter (lambda position --> not (position == -1) ) end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda index 11973a1a..b270d1df 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/MatchCaseBlockTranslator.soda @@ -16,11 +16,11 @@ class MatchCaseBlockTranslator _sc = SodaConstant_ () - _soda_case_pattern = _sc.case_reserved_word + _sc.space + _soda_case_pattern = _sc .case_reserved_word + _sc .space _tc = TranslationConstantToCoq_ () - _soda_match_pattern = _sc.match_reserved_word + " " + _soda_match_pattern = _sc .match_reserved_word + " " translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> @@ -44,40 +44,40 @@ class MatchCaseBlockTranslator else block _is_a_match_case_structure (block : AnnotatedBlock) : Boolean = - block.lines.exists (lambda line --> _is_a_match_line (line) ) + block .lines .exists (lambda line --> _is_a_match_line (line) ) _is_a_match_line (line : String) : Boolean = - line.trim.startsWith (_soda_match_pattern) + line .trim .startsWith (_soda_match_pattern) _is_a_case_line (line : String) : Boolean = - line.trim.startsWith (_soda_case_pattern) + line .trim .startsWith (_soda_case_pattern) _get_tabulation_of_match (block : AnnotatedBlock) : String = - block.lines + block .lines .find (lambda line --> _is_a_match_line (line) ) - .map (lambda line --> _left_part (line.indexOf (_soda_match_pattern) ) (line) ) - .getOrElse (_tc.coq_space) + .map (lambda line --> _left_part (line .indexOf (_soda_match_pattern) ) (line) ) + .getOrElse (_tc .coq_space) _translate_match_case_structure (block: AnnotatedBlock) (tabulation : String) : Block = - BlockBuilder_ ().build ( - block.lines + BlockBuilder_ () .build ( + block .lines .map (lambda line --> _append_with_after_match (line) ) .map (lambda line --> _replace_case (line) ) - .++ ( Seq [String] () .+: (tabulation + _tc.coq_match_end_translation) ) + .++ ( Seq [String] () .+: (tabulation + _tc .coq_match_end_translation) ) ) _append_with_after_match (line : String) : String = if _is_a_match_line (line) - then line + _tc.coq_space + _tc.coq_with_reserved_word + then line + _tc .coq_space + _tc .coq_with_reserved_word else line _replace_case (line : String) : String = if _is_a_case_line (line) - then ReplacementAux_ (). replace_first (line) (_soda_case_pattern) (_tc.coq_case_translation) + then ReplacementAux_ () . replace_first (line) (_soda_case_pattern) (_tc .coq_case_translation) else line _left_part (index : Int) (line : String) : String = - line.substring (0, index) + line .substring (0 , index) end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/MicroTranslatorToCoq.soda b/translator/src/main/scala/soda/translator/extension/tocoq/MicroTranslatorToCoq.soda index d2e466e2..2610d4f2 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/MicroTranslatorToCoq.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/MicroTranslatorToCoq.soda @@ -18,19 +18,19 @@ class MicroTranslatorToCoq _tc = TranslationConstantToCoq_ () - _function_definition = BlockAnnotationEnum_ ().function_definition + _function_definition = BlockAnnotationEnum_ () .function_definition - _test_declaration = BlockAnnotationEnum_ ().test_declaration + _test_declaration = BlockAnnotationEnum_ () .test_declaration functions_and_tests = Seq (_function_definition, _test_declaration) translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> - _translation_pipeline.translate (block) + _translation_pipeline .translate (block) try_definition : Token -> String = lambda token --> - DefinitionLineTranslator_ (token.text).translation + DefinitionLineTranslator_ (token .text) .translation _translation_pipeline = BlockTranslatorPipeline_ ( @@ -45,7 +45,7 @@ class MicroTranslatorToCoq CoqTheoremBlockTranslator_ (), CoqProofBlockTranslator_ (), ConditionalBlockTranslator_ (functions_and_tests, TokenizedBlockTranslator_ (try_definition) ), - ConditionalBlockTranslator_ (functions_and_tests, TokenReplacement_ ().replace (_tc.function_symbols_translation) ) + ConditionalBlockTranslator_ (functions_and_tests, TokenReplacement_ () .replace (_tc .function_symbols_translation) ) ) ) diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala b/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala index 20f6f1f8..cfed0677 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/tocoq/Package.scala @@ -31,74 +31,74 @@ trait CoqClassConstructorBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { - case AbstractDeclarationAnnotation_ (block, references) => _translate_block (AbstractDeclarationAnnotation_ (block, references) ) + case AbstractDeclarationAnnotation_ (block , references) => _translate_block (AbstractDeclarationAnnotation_ (block , references) ) case otherwise => annotated_block } private def _translate_block (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = - _translate_block_with (_get_class_beginning (block.references) ) (block) + _translate_block_with (_get_class_beginning (block .references) ) (block) private def _translate_block_with (maybe_beginning : Option [ClassBeginningAnnotation] ) (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = - if ( maybe_beginning.isEmpty + if ( maybe_beginning .isEmpty ) block - else _translate_block_with_beginning (maybe_beginning.get) (block) + else _translate_block_with_beginning (maybe_beginning .get) (block) private def _translate_block_with_beginning (beginning : ClassBeginningAnnotation) (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = - if ( beginning.is_concrete + if ( beginning .is_concrete ) block else _translate_block_with_abstract_beginning (beginning) (block) private def _translate_block_with_abstract_beginning (beginning : ClassBeginningAnnotation) (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = AbstractDeclarationAnnotation_ ( - BlockBuilder_ ().build ( - Seq (_tc.coq_opening_comment).++ ( - block.lines.++ ( + BlockBuilder_ () .build ( + Seq (_tc .coq_opening_comment) .++ ( + block .lines .++ ( Seq [String] ( - _tc.coq_closing_comment, + _tc .coq_closing_comment, "", _get_constructor_declaration (beginning) (_get_types_of_abstract_functions (block) ) ) ) ) ), - block.references + block .references ) private def _get_constructor_declaration (beginning : ClassBeginningAnnotation) (abstract_functions : Seq [String] ) : String = _get_initial_spaces (beginning) + - _tc.coq_inductive_reserved_word + - _tc.coq_space + - beginning.class_name + - _tc.coq_space + - _tc.coq_type_membership_symbol + - _tc.coq_space + - _tc.coq_type_reserved_word + - _tc.coq_space + - _tc.coq_function_definition_symbol + - _tc.coq_new_line + + _tc .coq_inductive_reserved_word + + _tc .coq_space + + beginning .class_name + + _tc .coq_space + + _tc .coq_type_membership_symbol + + _tc .coq_space + + _tc .coq_type_reserved_word + + _tc .coq_space + + _tc .coq_function_definition_symbol + + _tc .coq_new_line + _get_initial_spaces (beginning) + - _tc.coq_space + - _tc.coq_space + - _tc.coq_vertical_bar_symbol + - _tc.coq_space + - beginning.class_name + - _sc.constructor_suffix + - _tc.coq_space + - _tc.coq_opening_parenthesis + - _tc.coq_some_variable_name + - _tc.coq_space + - _tc.coq_type_membership_symbol + - _tc.coq_space + - abstract_functions.mkString (_tc.coq_space + _tc.coq_product_type_symbol + _tc.coq_space) + - _tc.coq_closing_parenthesis + - _tc.coq_new_line + + _tc .coq_space + + _tc .coq_space + + _tc .coq_vertical_bar_symbol + + _tc .coq_space + + beginning .class_name + + _sc .constructor_suffix + + _tc .coq_space + + _tc .coq_opening_parenthesis + + _tc .coq_some_variable_name + + _tc .coq_space + + _tc .coq_type_membership_symbol + + _tc .coq_space + + abstract_functions .mkString (_tc .coq_space + _tc .coq_product_type_symbol + _tc .coq_space) + + _tc .coq_closing_parenthesis + + _tc .coq_new_line + _get_initial_spaces (beginning) + - _tc.coq_inductive_end_symbol + _tc .coq_inductive_end_symbol private def _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references - .flatMap ( block => _get_as_class_beginning_annotation (block) ) - .headOption + .flatMap ( block => _get_as_class_beginning_annotation (block) ) + .headOption private def _get_as_class_beginning_annotation (annotated_block : AnnotatedBlock) : Option [ClassBeginningAnnotation] = annotated_block match { @@ -107,32 +107,32 @@ trait CoqClassConstructorBlockTranslator } private def _get_types_of_abstract_functions (block : AbstractDeclarationAnnotation) : Seq [String] = - block.abstract_functions - .map ( annotated_line => _translate_type_symbols (annotated_line.line).trim ) + block .abstract_functions + .map ( annotated_line => _translate_type_symbols (annotated_line .line) .trim ) .map ( line => _remove_variable (line) ) private def _remove_variable (line : String) : String = - _remove_variable_with (line) (line.indexOf (_sc.type_membership_symbol) ) + _remove_variable_with (line) (line .indexOf (_sc .type_membership_symbol) ) private def _remove_variable_with (line : String) (index : Int) : String = if ( index < 0 ) line - else line.substring (index + _sc.type_membership_symbol.length).trim + else line .substring (index + _sc .type_membership_symbol .length) .trim private def _translate_type_symbols (line : String) : String = line - .replaceAll (_sc.subtype_reserved_word, _tc.coq_subtype_symbol) - .replaceAll (_sc.supertype_reserved_word, _tc.coq_supertype_symbol) - .replaceAll (_sc.function_arrow_symbol, _tc.coq_function_arrow_symbol) + .replaceAll (_sc .subtype_reserved_word , _tc .coq_subtype_symbol) + .replaceAll (_sc .supertype_reserved_word , _tc .coq_supertype_symbol) + .replaceAll (_sc .function_arrow_symbol , _tc .coq_function_arrow_symbol) private def _get_initial_spaces (block : AnnotatedBlock) : String = _get_initial_spaces_with (_get_first_line (block) ) private def _get_initial_spaces_with (line : String) : String = - line.takeWhile ( ch => ch.isSpaceChar) + line .takeWhile ( ch => ch .isSpaceChar) private def _get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") } @@ -158,7 +158,7 @@ trait CoqClassDeclarationBlockTranslator private lazy val _tc = TranslationConstantToCoq_ () - lazy val soda_space : String = _sc.space + lazy val soda_space : String = _sc .space lazy val scala_space : String = " " @@ -179,7 +179,7 @@ trait CoqClassDeclarationBlockTranslator if ( (has_condition_for_type_alias (get_first_line (block) ) ) ) block else - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( _process_head (block) ++ _process_tail (block) ) @@ -188,46 +188,46 @@ trait CoqClassDeclarationBlockTranslator private def _process_head_with (line : String) (block : Block) : Seq [String] = Seq [String] ( - Replacement_ (_sc.space + line).replace_at_beginning (0) (get_table_translator (line) ).line.substring (_sc.space.length) + _tc.coq_space + _tc.coq_end_symbol + Replacement_ (_sc .space + line) .replace_at_beginning (0) (get_table_translator (line) ) .line .substring (_sc .space .length) + _tc .coq_space + _tc .coq_end_symbol ) private def _process_tail (block : Block) : Seq [String] = _process_if_extends (remove_first_line (block) ) private def _process_if_extends (block : Block) : Seq [String] = - if ( (get_first_line (block).trim == _sc.extends_reserved_word) - ) Seq [String] (get_initial_spaces (block) ).++ ( _process_after_extends (remove_first_line (block) ) ) - else block.lines + if ( (get_first_line (block) .trim == _sc .extends_reserved_word) + ) Seq [String] (get_initial_spaces (block) ) .++ ( _process_after_extends (remove_first_line (block) ) ) + else block .lines def get_table_translator (line : String) : Translator = TableTranslator_ ( - Seq (Tuple2 (_sc.class_reserved_word, _tc.coq_module_reserved_word ) ) + Seq (Tuple2 (_sc .class_reserved_word, _tc .coq_module_reserved_word ) ) ) private def _process_after_extends (block : Block) : Seq [String] = - if ( (get_first_line (block).trim.nonEmpty) - ) block.lines.map ( line => _tc.coq_import_reserved_word + _tc.coq_space + line.trim + _tc.coq_space + _tc.coq_end_symbol) + if ( (get_first_line (block) .trim .nonEmpty) + ) block .lines .map ( line => _tc .coq_import_reserved_word + _tc .coq_space + line .trim + _tc .coq_space + _tc .coq_end_symbol) else Seq [String] () def remove_first_line (block : Block) : Block = - BlockBuilder_ ().build ( _remove_first_line (block.lines) ) + BlockBuilder_ () .build ( _remove_first_line (block .lines) ) private def _remove_first_line (lines : Seq [String] ) : Seq [String] = - if ( lines.isEmpty + if ( lines .isEmpty ) lines - else lines.tail + else lines .tail def get_first_line (block : Block) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") def get_initial_spaces (block : Block) : String = get_initial_spaces_for (get_first_line (block) ) def get_initial_spaces_for (line : String) : String = - line.takeWhile ( ch => ch.isSpaceChar) + line .takeWhile ( ch => ch .isSpaceChar) def contains_equals (line : String) : Boolean = - line.trim.contains (_sc.function_definition_symbol) + line .trim .contains (_sc .function_definition_symbol) def has_condition_for_type_alias (line : String) : Boolean = contains_equals (line) @@ -258,7 +258,7 @@ trait CoqClassEndBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { - case ClassEndAnnotation_ (block, references) => _translate_block (ClassEndAnnotation_ (block, references) ) + case ClassEndAnnotation_ (block , references) => _translate_block (ClassEndAnnotation_ (block , references) ) case otherwise => annotated_block } @@ -266,25 +266,25 @@ trait CoqClassEndBlockTranslator _translate_block_with (_get_class_beginning (block.references) ) (block) private def _translate_block_with (maybe_beginning : Option [ClassBeginningAnnotation] ) (block : ClassEndAnnotation) : ClassEndAnnotation = - if ( maybe_beginning.isEmpty + if ( maybe_beginning .isEmpty ) block - else _translate_block_with_beginning (maybe_beginning.get) (block) + else _translate_block_with_beginning (maybe_beginning .get) (block) private def _translate_block_with_beginning (beginning : ClassBeginningAnnotation) (block : ClassEndAnnotation) : ClassEndAnnotation = - if ( beginning.is_concrete + if ( beginning .is_concrete ) block else _translate_block_with_abstract_beginning (beginning) (block) private def _translate_block_with_abstract_beginning (beginning : ClassBeginningAnnotation) (block : ClassEndAnnotation) : ClassEndAnnotation = ClassEndAnnotation_ ( - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( Seq [String] ( - _tc.coq_module_end_reserved_word + _tc.coq_space + beginning.class_name + _tc.coq_space + _tc.coq_end_symbol, + _tc .coq_module_end_reserved_word + _tc .coq_space + beginning .class_name + _tc .coq_space + _tc .coq_end_symbol, "", - _tc.coq_import_reserved_word + _tc.coq_space + beginning.class_name + _tc.coq_space + _tc.coq_end_symbol + _tc .coq_import_reserved_word + _tc .coq_space + beginning .class_name + _tc .coq_space + _tc .coq_end_symbol ) ), - block.references + block .references ) private def _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = @@ -331,33 +331,33 @@ trait CoqDefinitionBlockTranslator private def _translate_block (block : FunctionDefinitionAnnotation) : Block = if ( is_a_recursive_definition (block) - ) _append (_tc.coq_recursive_definition_end_symbol) (_prepend (_tc.coq_recursive_definition_reserved_word + _tc.coq_space) (block) ) + ) _append (_tc .coq_recursive_definition_end_symbol) (_prepend (_tc .coq_recursive_definition_reserved_word + _tc .coq_space) (block) ) else _translate_non_recursive_definition (block) private def _translate_non_recursive_definition (block : FunctionDefinitionAnnotation) : Block = if ( is_a_definition (block) - ) _append (_tc.coq_definition_end_symbol) (_prepend (_tc.coq_definition_reserved_word + _tc.coq_space) (block) ) + ) _append (_tc .coq_definition_end_symbol) (_prepend (_tc .coq_definition_reserved_word + _tc .coq_space) (block) ) else block private def _prepend (prefix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - Seq[String] (prefix + block.lines.head) ++ block.lines.tail + BlockBuilder_ () .build ( + Seq[String] (prefix + block .lines .head) ++ block .lines .tail ) private def _append (suffix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - block.lines.:+ (suffix) + BlockBuilder_ () .build ( + block .lines .:+ (suffix) ) def is_a_recursive_definition (block : Block) : Boolean = - _tc.coq_recursive_function_prefixes.exists ( prefix => first_line (block).startsWith (prefix) ) + _tc .coq_recursive_function_prefixes .exists ( prefix => first_line (block) .startsWith (prefix) ) def first_line (block : Block) : String = - block.lines.headOption.getOrElse ("").trim + block .lines .headOption .getOrElse ("") .trim def is_a_definition (block : Block) : Boolean = ! is_a_recursive_definition (block) && - ! _tc.non_definition_block_prefixes.exists ( prefix => block.contents.trim.startsWith (prefix) ) + ! _tc .non_definition_block_prefixes .exists ( prefix => block .contents .trim .startsWith (prefix) ) } @@ -380,7 +380,7 @@ trait CoqImportDeclarationBlockTranslator private lazy val _tc = TranslationConstantToCoq_ () lazy val coq_import_declaration_pattern = - _tc.coq_import_reserved_word + _tc.coq_space + _tc .coq_import_reserved_word + _tc .coq_space lazy val translate : AnnotatedBlock => AnnotatedBlock = block => @@ -397,29 +397,29 @@ trait CoqImportDeclarationBlockTranslator prepend_to_lines_aligned_at ( get_number_of_spaces_at_beginning (get_first_line (block) ) ) ( coq_import_declaration_pattern) ( - block.imported_items - .filter( annotated_line => ! annotated_line.is_comment) - .map ( annotated_line => AnnotatedLine_ (annotated_line.line + _tc.coq_space + _tc.coq_end_symbol, false) ) + block .imported_items + .filter( annotated_line => ! annotated_line .is_comment) + .map ( annotated_line => AnnotatedLine_ (annotated_line .line + _tc .coq_space + _tc .coq_end_symbol, false) ) ) ) def prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = - BlockBuilder_ ().build ( - annotated_lines.map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + BlockBuilder_ () .build ( + annotated_lines .map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) def prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : String = - if ( annotated_line.is_comment - ) annotated_line.line - else annotated_line.line.substring (0, index) + prefix + annotated_line.line.substring (index) + if ( annotated_line .is_comment + ) annotated_line .line + else annotated_line .line .substring (0, index) + prefix + annotated_line .line .substring (index) def get_number_of_spaces_at_beginning (line : String) : Int = line - .takeWhile ( ch => ch.isSpaceChar) + .takeWhile ( ch => ch .isSpaceChar) .length def get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") } @@ -457,8 +457,8 @@ trait CoqPackageDeclarationBlockTranslator ) private def _comment_block (block : Block) : Block = - BlockBuilder_ ().build ( - ( (Seq (_tc.coq_opening_comment).++ (block.lines) ).++ (Seq (_tc.coq_closing_comment) ) ).++ (_tc.coq_prelude) + BlockBuilder_ () .build ( + ( (Seq (_tc .coq_opening_comment) .++ (block .lines) ) .++ (Seq (_tc .coq_closing_comment) ) ) .++ (_tc .coq_prelude) ) } @@ -492,25 +492,25 @@ trait CoqProofBlockTranslator private def _translate_block (block : ProofBlockAnnotation) : ProofBlockAnnotation = ProofBlockAnnotation_ ( _append ( - _tc.coq_proof_end_reserved_word) ( - _replace_first_line (_tc.coq_proof_begin_reserved_word) (block) + _tc .coq_proof_end_reserved_word) ( + _replace_first_line (_tc .coq_proof_begin_reserved_word) (block) ) ) private def _append (suffix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - block.lines.:+ (suffix) + BlockBuilder_ () .build ( + block .lines .:+ (suffix) ) private def _replace_first_line (first_line : String) (block : Block) : Block = - BlockBuilder_ ().build ( - Seq (first_line) .++ (_get_tail_or_empty (block.lines) ) + BlockBuilder_ () .build ( + Seq (first_line) .++ (_get_tail_or_empty (block .lines) ) ) private def _get_tail_or_empty (sequence : Seq [String] ) : Seq [String] = - if ( sequence.isEmpty + if ( sequence .isEmpty ) sequence - else sequence.tail + else sequence .tail } @@ -543,26 +543,26 @@ trait CoqTheoremBlockTranslator private def _translate_block (block : TheoremBlockAnnotation) : TheoremBlockAnnotation = TheoremBlockAnnotation_ ( _append ( - _tc.coq_theorem_end_symbol) (_prepend ( - _tc.coq_theorem_begin_reserved_word) (_remove_first_line (block) + _tc .coq_theorem_end_symbol) (_prepend ( + _tc .coq_theorem_begin_reserved_word) (_remove_first_line (block) ) ) ) private def _prepend (prefix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - Seq[String] (prefix + block.lines.head).++ (block.lines.tail) + BlockBuilder_ () .build ( + Seq[String] (prefix + block .lines .head) .++ (block .lines .tail) ) private def _append (suffix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - block.lines.:+ (suffix) + BlockBuilder_ () .build ( + block .lines .:+ (suffix) ) private def _remove_first_line (block : Block) : Block = - if ( block.lines.isEmpty + if ( block .lines .isEmpty ) block - else BlockBuilder_ ().build (block.lines.tail) + else BlockBuilder_ () .build (block .lines .tail) } @@ -599,7 +599,7 @@ trait DefinitionLineTranslator soda.translator.block.LineTranslator { - def line: String + def line : String import soda.lib.OptionSD import soda.lib.SomeSD_ @@ -611,34 +611,34 @@ trait DefinitionLineTranslator private lazy val _tc = TranslationConstantToCoq_ () - private lazy val _trimmed_line = line.trim + private lazy val _trimmed_line = line .trim lazy val translation = - find_definition (line).opt (ifEmpty = line) (ifNonEmpty = position => _try_found_definition (position).line) + find_definition (line) .opt (ifEmpty = line) (ifNonEmpty = position => _try_found_definition (position) .line) private lazy val _is_class_definition = - get_index (line) (_sc.space + _sc.class_reserved_word + _sc.space).isDefined + get_index (line) (_sc .space + _sc .class_reserved_word + _sc .space) .isDefined private lazy val _translation_of_class_definition = if ( _condition_for_type_alias ) Replacement_ (line) - else Replacement_ (line).replace_all (_sc.space + _sc.function_definition_symbol) ("") + else Replacement_ (line) .replace_all (_sc .space + _sc .function_definition_symbol) ("") private lazy val _ends_with_equals = false private lazy val _ends_with_opening_brace = false private lazy val _contains_equals = - _trimmed_line.contains (_sc.function_definition_symbol) + _trimmed_line .contains (_sc .function_definition_symbol) private lazy val _condition_for_type_alias = _contains_equals && ! (_ends_with_equals || _ends_with_opening_brace) private lazy val _translation_of_val_definition = - Replacement_ (line).add_after_spaces_or_pattern (_tc.coq_space) (_tc.coq_space) + Replacement_ (line) .add_after_spaces_or_pattern (_tc .coq_space) (_tc .coq_space) private lazy val _translation_of_def_definition = - Replacement_ (line).add_after_spaces_or_pattern (_tc.coq_space) (_tc.coq_space) + Replacement_ (line) .add_after_spaces_or_pattern (_tc .coq_space) (_tc .coq_space) private def _try_found_definition (position : Int) : Replacement = if ( _is_class_definition @@ -657,21 +657,21 @@ trait DefinitionLineTranslator _is_val_definition_case_4 private lazy val _position_of_first_opening_parenthesis = - get_index (line) (_sc.opening_parenthesis_symbol) + get_index (line) (_sc .opening_parenthesis_symbol) private lazy val _is_val_definition_case_1 = - _position_of_first_opening_parenthesis.isEmpty + _position_of_first_opening_parenthesis .isEmpty private def _is_val_definition_case_2 (initial_position : Int) = - _position_of_first_opening_parenthesis.opt (false) ( position => (position > initial_position) ) + _position_of_first_opening_parenthesis .opt (false) ( position => (position > initial_position) ) private lazy val _is_val_definition_case_3 = - (get_index (line) (_sc.type_membership_symbol) ).opt (ifEmpty = false) (ifNonEmpty = other_position => - _position_of_first_opening_parenthesis.opt (false) ( position => (position > other_position) ) + (get_index (line) (_sc .type_membership_symbol) ) .opt (ifEmpty = false) (ifNonEmpty = other_position => + _position_of_first_opening_parenthesis .opt (false) ( position => (position > other_position) ) ) private lazy val _is_val_definition_case_4 = - _trimmed_line.startsWith (_sc.opening_parenthesis_symbol) + _trimmed_line .startsWith (_sc .opening_parenthesis_symbol) /** * A line is a definition when its main operator is "=" (the equals sign), which in this context is also called the definition sign. @@ -682,20 +682,20 @@ trait DefinitionLineTranslator */ def find_definition (line : String) : OptionSD [Int] = - if ( line.endsWith (_sc.space + _sc.function_definition_symbol) - ) SomeSD_ (line.length - _sc.function_definition_symbol.length) - else get_index (line) (_sc.space + _sc.function_definition_symbol + _sc.space) + if ( line .endsWith (_sc .space + _sc .function_definition_symbol) + ) SomeSD_ (line .length - _sc .function_definition_symbol .length) + else get_index (line) (_sc .space + _sc .function_definition_symbol + _sc .space) def get_index (line : String) (pattern : String) : OptionSD [Int] = get_index_from (line) (pattern) (0) def get_index_from (line : String) (pattern : String) (start : Int) : OptionSD [Int] = - SomeSD_ (line.indexOf (pattern, start) ) + SomeSD_ (line .indexOf (pattern, start) ) .filter ( position => ! (position == -1) ) } -case class DefinitionLineTranslator_ (line: String) extends DefinitionLineTranslator +case class DefinitionLineTranslator_ (line : String) extends DefinitionLineTranslator trait MatchCaseBlockTranslator @@ -715,11 +715,11 @@ trait MatchCaseBlockTranslator private lazy val _sc = SodaConstant_ () - private lazy val _soda_case_pattern = _sc.case_reserved_word + _sc.space + private lazy val _soda_case_pattern = _sc .case_reserved_word + _sc .space private lazy val _tc = TranslationConstantToCoq_ () - private lazy val _soda_match_pattern = _sc.match_reserved_word + " " + private lazy val _soda_match_pattern = _sc .match_reserved_word + " " lazy val translate : AnnotatedBlock => AnnotatedBlock = block => @@ -744,40 +744,40 @@ trait MatchCaseBlockTranslator else block private def _is_a_match_case_structure (block : AnnotatedBlock) : Boolean = - block.lines.exists ( line => _is_a_match_line (line) ) + block .lines .exists ( line => _is_a_match_line (line) ) private def _is_a_match_line (line : String) : Boolean = - line.trim.startsWith (_soda_match_pattern) + line .trim .startsWith (_soda_match_pattern) private def _is_a_case_line (line : String) : Boolean = - line.trim.startsWith (_soda_case_pattern) + line .trim .startsWith (_soda_case_pattern) private def _get_tabulation_of_match (block : AnnotatedBlock) : String = - block.lines + block .lines .find ( line => _is_a_match_line (line) ) - .map ( line => _left_part (line.indexOf (_soda_match_pattern) ) (line) ) - .getOrElse (_tc.coq_space) + .map ( line => _left_part (line .indexOf (_soda_match_pattern) ) (line) ) + .getOrElse (_tc .coq_space) private def _translate_match_case_structure (block: AnnotatedBlock) (tabulation : String) : Block = - BlockBuilder_ ().build ( - block.lines + BlockBuilder_ () .build ( + block .lines .map ( line => _append_with_after_match (line) ) .map ( line => _replace_case (line) ) - .++ ( Seq [String] () .+: (tabulation + _tc.coq_match_end_translation) ) + .++ ( Seq [String] () .+: (tabulation + _tc .coq_match_end_translation) ) ) private def _append_with_after_match (line : String) : String = if ( _is_a_match_line (line) - ) line + _tc.coq_space + _tc.coq_with_reserved_word + ) line + _tc .coq_space + _tc .coq_with_reserved_word else line private def _replace_case (line : String) : String = if ( _is_a_case_line (line) - ) ReplacementAux_ (). replace_first (line) (_soda_case_pattern) (_tc.coq_case_translation) + ) ReplacementAux_ () . replace_first (line) (_soda_case_pattern) (_tc .coq_case_translation) else line private def _left_part (index : Int) (line : String) : String = - line.substring (0, index) + line .substring (0 , index) } @@ -803,19 +803,19 @@ trait MicroTranslatorToCoq private lazy val _tc = TranslationConstantToCoq_ () - private lazy val _function_definition = BlockAnnotationEnum_ ().function_definition + private lazy val _function_definition = BlockAnnotationEnum_ () .function_definition - private lazy val _test_declaration = BlockAnnotationEnum_ ().test_declaration + private lazy val _test_declaration = BlockAnnotationEnum_ () .test_declaration lazy val functions_and_tests = Seq (_function_definition, _test_declaration) lazy val translate : AnnotatedBlock => AnnotatedBlock = block => - _translation_pipeline.translate (block) + _translation_pipeline .translate (block) lazy val try_definition : Token => String = token => - DefinitionLineTranslator_ (token.text).translation + DefinitionLineTranslator_ (token .text) .translation private lazy val _translation_pipeline = BlockTranslatorPipeline_ ( @@ -830,7 +830,7 @@ trait MicroTranslatorToCoq CoqTheoremBlockTranslator_ (), CoqProofBlockTranslator_ (), ConditionalBlockTranslator_ (functions_and_tests, TokenizedBlockTranslator_ (try_definition) ), - ConditionalBlockTranslator_ (functions_and_tests, TokenReplacement_ ().replace (_tc.function_symbols_translation) ) + ConditionalBlockTranslator_ (functions_and_tests, TokenReplacement_ () .replace (_tc .function_symbols_translation) ) ) ) @@ -962,11 +962,11 @@ trait TranslationConstantToCoq lazy val non_definition_block_prefixes : Seq [String] = Seq ( - soda_constant.package_reserved_word, - soda_constant.import_reserved_word, - soda_constant.class_end_reserved_word, - soda_constant.class_reserved_word, - soda_constant.comment_opening_symbol + soda_constant .package_reserved_word , + soda_constant .import_reserved_word , + soda_constant .class_end_reserved_word , + soda_constant .class_reserved_word , + soda_constant .comment_opening_symbol ) lazy val coq_reserved_words = @@ -1085,14 +1085,14 @@ trait TranslationConstantToCoq lazy val coq_non_soda : Seq [Tuple2 [String, String] ] = coq_reserved_words - .filter ( x => ! soda_constant.soda_reserved_words.contains (x)) - .map ( x => Tuple2 (x, prefix_coq_non_soda + x) ) + .filter ( x => ! soda_constant.soda_reserved_words .contains (x)) + .map ( x => Tuple2 (x , prefix_coq_non_soda + x) ) def is_coq_word (word : String) : Boolean = - coq_reserved_words.contains (word) + coq_reserved_words .contains (word) def is_soda_word (word : String) : Boolean = - soda_constant.soda_reserved_words.contains (word) + soda_constant .soda_reserved_words.contains (word) } @@ -1141,30 +1141,30 @@ trait TranslatorToCoq } private def _process_directory (start : String) : Boolean = - DirectoryProcessor_ (start, _process_soda_file).process () + DirectoryProcessor_ (start , _process_soda_file) .process () private def _process_soda_file (file : File) : Boolean = - _process_soda_file_with (_get_input_output_file_names (file.getAbsolutePath) ) + _process_soda_file_with (_get_input_output_file_names (file .getAbsolutePath) ) private def _process_soda_file_with (pair : FileNamePair) : Boolean = - _translate (pair.input_file_name) (pair.output_file_name) + _translate (pair .input_file_name) (pair .output_file_name) private def _get_input_output_file_names (input_name : String) : FileNamePair = - if ( input_name.endsWith (_soda_extension) + if ( input_name .endsWith (_soda_extension) ) FileNamePair_ (input_name, - input_name.substring (0, input_name.length - _soda_extension.length) + _coq_extension) + input_name .substring (0, input_name .length - _soda_extension .length) + _coq_extension) else FileNamePair_ (input_name + _soda_extension, input_name + _coq_extension) private def _translate (input_file_name : String) (output_file_name : String) : Boolean = _translate_with_input ( - SimpleFileReader_ ().read_file (input_file_name) ) ( + SimpleFileReader_ () .read_file (input_file_name) ) ( output_file_name ) private def _translate_with_input (input : String) (output_file_name : String) : Boolean = - SimpleFileWriter_ ().write_file ( + SimpleFileWriter_ () .write_file ( output_file_name) ( - content = _translator.translate (input) + content = _translator .translate (input) ) } diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/TranslationConstantToCoq.soda b/translator/src/main/scala/soda/translator/extension/tocoq/TranslationConstantToCoq.soda index 491d9a0a..f738b918 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/TranslationConstantToCoq.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/TranslationConstantToCoq.soda @@ -122,11 +122,11 @@ class TranslationConstantToCoq non_definition_block_prefixes : Seq [String] = Seq ( - soda_constant.package_reserved_word, - soda_constant.import_reserved_word, - soda_constant.class_end_reserved_word, - soda_constant.class_reserved_word, - soda_constant.comment_opening_symbol + soda_constant .package_reserved_word , + soda_constant .import_reserved_word , + soda_constant .class_end_reserved_word , + soda_constant .class_reserved_word , + soda_constant .comment_opening_symbol ) coq_reserved_words = @@ -212,14 +212,14 @@ class TranslationConstantToCoq "Variable" ) - type_symbols_translation : Seq [Tuple2 [String, String] ] = + type_symbols_translation : Seq [Tuple2 [String] [String] ] = Seq ( Tuple2 (soda_constant.subtype_reserved_word, coq_subtype_symbol), Tuple2 (soda_constant.supertype_reserved_word, coq_supertype_symbol), Tuple2 (soda_constant.function_arrow_symbol, coq_function_arrow_symbol) ) - function_symbols_translation : Seq [Tuple2 [String, String] ] = + function_symbols_translation : Seq [Tuple2 [String] [String] ] = Seq ( Tuple2 (soda_constant.function_definition_symbol, coq_function_definition_symbol), Tuple2 (soda_constant.lambda_reserved_word, coq_lambda_reserved_word), @@ -231,7 +231,7 @@ class TranslationConstantToCoq Tuple2 (soda_constant.or_reserved_word, coq_or_reserved_word ) ) - type_translation : Seq [ Tuple2 [String, String] ] = + type_translation : Seq [ Tuple2 [String] [String] ] = Seq ( Tuple2 ("Boolean", "bool"), Tuple2 ("Nat", "nat"), @@ -243,16 +243,16 @@ class TranslationConstantToCoq prefix_coq_non_soda : String = "__soda__" - coq_non_soda : Seq [Tuple2 [String, String] ] = + coq_non_soda : Seq [Tuple2 [String] [String] ] = coq_reserved_words - .filter (lambda x --> not soda_constant.soda_reserved_words.contains (x)) - .map (lambda x --> Tuple2 (x, prefix_coq_non_soda + x) ) + .filter (lambda x --> not soda_constant.soda_reserved_words .contains (x)) + .map (lambda x --> Tuple2 (x , prefix_coq_non_soda + x) ) is_coq_word (word : String) : Boolean = - coq_reserved_words.contains (word) + coq_reserved_words .contains (word) is_soda_word (word : String) : Boolean = - soda_constant.soda_reserved_words.contains (word) + soda_constant .soda_reserved_words.contains (word) end diff --git a/translator/src/main/scala/soda/translator/extension/tocoq/TranslatorToCoq.soda b/translator/src/main/scala/soda/translator/extension/tocoq/TranslatorToCoq.soda index 8a170b7a..eebed096 100644 --- a/translator/src/main/scala/soda/translator/extension/tocoq/TranslatorToCoq.soda +++ b/translator/src/main/scala/soda/translator/extension/tocoq/TranslatorToCoq.soda @@ -40,30 +40,30 @@ class TranslatorToCoq case otherwise ==> false _process_directory (start : String) : Boolean = - DirectoryProcessor_ (start, _process_soda_file).process () + DirectoryProcessor_ (start , _process_soda_file) .process () _process_soda_file (file : File) : Boolean = - _process_soda_file_with (_get_input_output_file_names (file.getAbsolutePath) ) + _process_soda_file_with (_get_input_output_file_names (file .getAbsolutePath) ) _process_soda_file_with (pair : FileNamePair) : Boolean = - _translate (pair.input_file_name) (pair.output_file_name) + _translate (pair .input_file_name) (pair .output_file_name) _get_input_output_file_names (input_name : String) : FileNamePair = - if input_name.endsWith (_soda_extension) + if input_name .endsWith (_soda_extension) then FileNamePair_ (input_name, - input_name.substring (0, input_name.length - _soda_extension.length) + _coq_extension) + input_name .substring (0, input_name .length - _soda_extension .length) + _coq_extension) else FileNamePair_ (input_name + _soda_extension, input_name + _coq_extension) _translate (input_file_name : String) (output_file_name : String) : Boolean = _translate_with_input ( - SimpleFileReader_ ().read_file (input_file_name) ) ( + SimpleFileReader_ () .read_file (input_file_name) ) ( output_file_name ) _translate_with_input (input : String) (output_file_name : String) : Boolean = - SimpleFileWriter_ ().write_file ( + SimpleFileWriter_ () .write_file ( output_file_name) ( - content := _translator.translate (input) + content := _translator .translate (input) ) end diff --git a/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda index 939048fa..993dc39d 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/todoc/DocBlockTranslator.soda @@ -14,7 +14,7 @@ class DocBlockTranslator _tc = TranslationConstantToDoc_ () - _comment_line_prefix = _sc.comment_line_symbol + _sc.space + _comment_line_prefix = _sc .comment_line_symbol + _sc .space translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> @@ -27,12 +27,12 @@ class DocBlockTranslator _translate_comment (block : CommentAnnotation) : CommentAnnotation = CommentAnnotation_ ( - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( _append ( - _tc.doc_closing_comment_translation) ( - _prepend (_tc.doc_opening_comment_translation) ( + _tc .doc_closing_comment_translation) ( + _prepend (_tc .doc_opening_comment_translation) ( _remove_comment_delimiter ( - _remove_comment_line_prefix (block.lines) + _remove_comment_line_prefix (block .lines) ) ) ) @@ -45,12 +45,12 @@ class DocBlockTranslator ) _prepend (prefix : String) (content : Seq [String] ) : Seq [String] = - if content.isEmpty + if content .isEmpty then Seq [String] (prefix) - else Seq[String] (prefix + content.head).++ (content.tail) + else Seq[String] (prefix + content .head) .++ (content .tail) _append (suffix : String) (content : Seq [String] ) : Seq [String] = - content.:+ (suffix) + content .:+ (suffix) _remove_comment_delimiter (content : Seq [String] ) : Seq [String] = _remove_last_delimiter ( @@ -58,39 +58,39 @@ class DocBlockTranslator ) _remove_first_delimiter (content : Seq [String] ) : Seq [String] = - if content.isEmpty + if content .isEmpty then content else _prepend ( - _remove_prefix_in_line (_sc.documentation_comment_opening_symbol) ( - _remove_prefix_in_line (_sc.comment_opening_symbol) (content.head) + _remove_prefix_in_line (_sc .documentation_comment_opening_symbol) ( + _remove_prefix_in_line (_sc .comment_opening_symbol) (content .head) ) - ) (content.tail) + ) (content .tail) _remove_last_delimiter (content : Seq [String] ) : Seq [String] = - ( _remove_last_delimiter_on_first_line (content.reverse) ).reverse + ( _remove_last_delimiter_on_first_line (content .reverse) ) .reverse _remove_last_delimiter_on_first_line (content : Seq [String] ) : Seq [String] = - if content.isEmpty + if content .isEmpty then content - else _prepend (_remove_suffix_in_line (_sc.comment_closing_symbol) (content.head) ) (content.tail) + else _prepend (_remove_suffix_in_line (_sc .comment_closing_symbol) (content .head) ) (content .tail) _remove_comment_line_prefix (content : Seq [String] ) : Seq [String] = - content.map (lambda line --> _remove_prefix_in_line (_comment_line_prefix) (line) ) + content .map (lambda line --> _remove_prefix_in_line (_comment_line_prefix) (line) ) _remove_prefix_in_line (prefix : String) (line : String) : String = - _remove_prefix_in_line_at (line.indexOf (prefix) ) (prefix) (line) + _remove_prefix_in_line_at (line .indexOf (prefix) ) (prefix) (line) _remove_prefix_in_line_at (index : Int) (prefix : String) (line : String) : String = if index >= 0 - then line.substring (index + prefix.length) + then line .substring (index + prefix .length) else line _remove_suffix_in_line (suffix : String) (line : String) : String = - _remove_suffix_in_line_at (line.lastIndexOf (suffix) ) (line) + _remove_suffix_in_line_at (line .lastIndexOf (suffix) ) (line) _remove_suffix_in_line_at (index : Int) (line : String) : String = if index >= 0 - then line.substring (0, index) + then line .substring (0, index) else line end diff --git a/translator/src/main/scala/soda/translator/extension/todoc/MicroTranslatorToDoc.soda b/translator/src/main/scala/soda/translator/extension/todoc/MicroTranslatorToDoc.soda index 4085e38e..656b3e50 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/MicroTranslatorToDoc.soda +++ b/translator/src/main/scala/soda/translator/extension/todoc/MicroTranslatorToDoc.soda @@ -12,15 +12,15 @@ class MicroTranslatorToDoc soda.translator.block.BlockAnnotationEnum_ soda.translator.block.BlockTranslatorPipeline_ - _function_definition = BlockAnnotationEnum_ ().function_definition + _function_definition = BlockAnnotationEnum_ () .function_definition - _test_declaration = BlockAnnotationEnum_ ().test_declaration + _test_declaration = BlockAnnotationEnum_ () .test_declaration - functions_and_tests = Seq (_function_definition, _test_declaration) + functions_and_tests = Seq (_function_definition , _test_declaration) translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> - _translation_pipeline.translate (block) + _translation_pipeline .translate (block) _translation_pipeline = BlockTranslatorPipeline_ ( diff --git a/translator/src/main/scala/soda/translator/extension/todoc/Package.scala b/translator/src/main/scala/soda/translator/extension/todoc/Package.scala index 3d68f800..70e49bce 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/todoc/Package.scala @@ -23,7 +23,7 @@ trait DocBlockTranslator private lazy val _tc = TranslationConstantToDoc_ () - private lazy val _comment_line_prefix = _sc.comment_line_symbol + _sc.space + private lazy val _comment_line_prefix = _sc .comment_line_symbol + _sc .space lazy val translate : AnnotatedBlock => AnnotatedBlock = block => @@ -37,12 +37,12 @@ trait DocBlockTranslator private def _translate_comment (block : CommentAnnotation) : CommentAnnotation = CommentAnnotation_ ( - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( _append ( - _tc.doc_closing_comment_translation) ( - _prepend (_tc.doc_opening_comment_translation) ( + _tc .doc_closing_comment_translation) ( + _prepend (_tc .doc_opening_comment_translation) ( _remove_comment_delimiter ( - _remove_comment_line_prefix (block.lines) + _remove_comment_line_prefix (block .lines) ) ) ) @@ -55,12 +55,12 @@ trait DocBlockTranslator ) private def _prepend (prefix : String) (content : Seq [String] ) : Seq [String] = - if ( content.isEmpty + if ( content .isEmpty ) Seq [String] (prefix) - else Seq[String] (prefix + content.head).++ (content.tail) + else Seq[String] (prefix + content .head) .++ (content .tail) private def _append (suffix : String) (content : Seq [String] ) : Seq [String] = - content.:+ (suffix) + content .:+ (suffix) private def _remove_comment_delimiter (content : Seq [String] ) : Seq [String] = _remove_last_delimiter ( @@ -68,39 +68,39 @@ trait DocBlockTranslator ) private def _remove_first_delimiter (content : Seq [String] ) : Seq [String] = - if ( content.isEmpty + if ( content .isEmpty ) content else _prepend ( - _remove_prefix_in_line (_sc.documentation_comment_opening_symbol) ( - _remove_prefix_in_line (_sc.comment_opening_symbol) (content.head) + _remove_prefix_in_line (_sc .documentation_comment_opening_symbol) ( + _remove_prefix_in_line (_sc .comment_opening_symbol) (content .head) ) - ) (content.tail) + ) (content .tail) private def _remove_last_delimiter (content : Seq [String] ) : Seq [String] = - ( _remove_last_delimiter_on_first_line (content.reverse) ).reverse + ( _remove_last_delimiter_on_first_line (content .reverse) ) .reverse private def _remove_last_delimiter_on_first_line (content : Seq [String] ) : Seq [String] = - if ( content.isEmpty + if ( content .isEmpty ) content - else _prepend (_remove_suffix_in_line (_sc.comment_closing_symbol) (content.head) ) (content.tail) + else _prepend (_remove_suffix_in_line (_sc .comment_closing_symbol) (content .head) ) (content .tail) private def _remove_comment_line_prefix (content : Seq [String] ) : Seq [String] = - content.map ( line => _remove_prefix_in_line (_comment_line_prefix) (line) ) + content .map ( line => _remove_prefix_in_line (_comment_line_prefix) (line) ) private def _remove_prefix_in_line (prefix : String) (line : String) : String = - _remove_prefix_in_line_at (line.indexOf (prefix) ) (prefix) (line) + _remove_prefix_in_line_at (line .indexOf (prefix) ) (prefix) (line) private def _remove_prefix_in_line_at (index : Int) (prefix : String) (line : String) : String = if ( index >= 0 - ) line.substring (index + prefix.length) + ) line .substring (index + prefix .length) else line private def _remove_suffix_in_line (suffix : String) (line : String) : String = - _remove_suffix_in_line_at (line.lastIndexOf (suffix) ) (line) + _remove_suffix_in_line_at (line .lastIndexOf (suffix) ) (line) private def _remove_suffix_in_line_at (index : Int) (line : String) : String = if ( index >= 0 - ) line.substring (0, index) + ) line .substring (0, index) else line } @@ -121,15 +121,15 @@ trait MicroTranslatorToDoc import soda.translator.block.BlockAnnotationEnum_ import soda.translator.block.BlockTranslatorPipeline_ - private lazy val _function_definition = BlockAnnotationEnum_ ().function_definition + private lazy val _function_definition = BlockAnnotationEnum_ () .function_definition - private lazy val _test_declaration = BlockAnnotationEnum_ ().test_declaration + private lazy val _test_declaration = BlockAnnotationEnum_ () .test_declaration - lazy val functions_and_tests = Seq (_function_definition, _test_declaration) + lazy val functions_and_tests = Seq (_function_definition , _test_declaration) lazy val translate : AnnotatedBlock => AnnotatedBlock = block => - _translation_pipeline.translate (block) + _translation_pipeline .translate (block) private lazy val _translation_pipeline = BlockTranslatorPipeline_ ( @@ -206,7 +206,7 @@ trait TranslationConstantToDoc lazy val doc_end_lstlisting = "\\end{lstlisting}" lazy val soda_reserved_words_csv = - (soda_constant.soda_reserved_words_words_only.++ (soda_constant.soda_reserved_words_annotations_only) ).mkString (", ") + (soda_constant .soda_reserved_words_words_only .++ (soda_constant .soda_reserved_words_annotations_only) ) .mkString (", ") lazy val doc_packages : Seq [String] = Seq ( @@ -217,14 +217,14 @@ trait TranslationConstantToDoc ) lazy val doc_packages_text : String = - doc_packages.mkString ("\n") + doc_packages .mkString ("\n") lazy val doc_language_definitions : Seq [String] = Seq ( "\\lstdefinelanguage{Soda}{", " morekeywords={" + soda_reserved_words_csv + "},", " sensitive=true,", - " morecomment=[s]{" + soda_constant.comment_opening_symbol + "}{" + soda_constant.comment_closing_symbol + "},", + " morecomment=[s]{" + soda_constant .comment_opening_symbol + "}{" + soda_constant .comment_closing_symbol + "},", " morestring=[b]\"", "}", "", @@ -247,7 +247,7 @@ trait TranslationConstantToDoc ) lazy val doc_language_definitions_text : String = - doc_language_definitions.mkString ("\n") + doc_language_definitions .mkString ("\n") } @@ -290,7 +290,7 @@ trait TranslatorToDoc execute_for (arguments) def execute_for (arguments : Seq [String] ) : Boolean = - arguments.length match { + arguments .length match { case 0 => _process_directory (_default_argument) case 1 => _process_directory (arguments (0) ) case 2 => _translate (arguments (0) ) (arguments (1) ) @@ -298,31 +298,31 @@ trait TranslatorToDoc } def translate_content (input : String) : String = - _tc.doc_header + _translator.translate (input) + _tc.doc_footer + _tc .doc_header + _translator .translate (input) + _tc .doc_footer private def _process_directory (start : String) : Boolean = - DirectoryProcessor_ (start, _process_soda_file).process () + DirectoryProcessor_ (start , _process_soda_file) .process () private def _process_soda_file (file : File) : Boolean = - _process_soda_file_with (_get_input_output_file_names (file.getAbsolutePath) ) + _process_soda_file_with (_get_input_output_file_names (file .getAbsolutePath) ) private def _process_soda_file_with (pair : FileNamePair) : Boolean = - _translate (pair.input_file_name) (pair.output_file_name) + _translate (pair .input_file_name) (pair .output_file_name) private def _get_input_output_file_names (input_name : String) : FileNamePair = - if ( input_name.endsWith (_soda_extension) - ) FileNamePair_ (input_name, - input_name.substring (0, input_name.length - _soda_extension.length) + _doc_extension) - else FileNamePair_ (input_name + _soda_extension, input_name + _doc_extension) + if ( input_name .endsWith (_soda_extension) + ) FileNamePair_ (input_name , + input_name .substring (0 , input_name .length - _soda_extension .length) + _doc_extension) + else FileNamePair_ (input_name + _soda_extension , input_name + _doc_extension) private def _translate (input_file_name : String) (output_file_name : String) : Boolean = _translate_with_input ( - SimpleFileReader_ ().read_file (input_file_name) ) ( + SimpleFileReader_ () .read_file (input_file_name) ) ( output_file_name ) private def _translate_with_input (input : String) (output_file_name : String) : Boolean = - SimpleFileWriter_ ().write_file ( + SimpleFileWriter_ () .write_file ( output_file_name) ( content = translate_content (input) ) diff --git a/translator/src/main/scala/soda/translator/extension/todoc/TranslationConstantToDoc.soda b/translator/src/main/scala/soda/translator/extension/todoc/TranslationConstantToDoc.soda index d5b58428..3d178622 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/TranslationConstantToDoc.soda +++ b/translator/src/main/scala/soda/translator/extension/todoc/TranslationConstantToDoc.soda @@ -62,7 +62,7 @@ class TranslationConstantToDoc doc_end_lstlisting = "\\end{lstlisting}" soda_reserved_words_csv = - (soda_constant.soda_reserved_words_words_only.++ (soda_constant.soda_reserved_words_annotations_only) ).mkString (", ") + (soda_constant .soda_reserved_words_words_only .++ (soda_constant .soda_reserved_words_annotations_only) ) .mkString (", ") doc_packages : Seq [String] = Seq ( @@ -73,14 +73,14 @@ class TranslationConstantToDoc ) doc_packages_text : String = - doc_packages.mkString ("\n") + doc_packages .mkString ("\n") doc_language_definitions : Seq [String] = Seq ( "\\lstdefinelanguage{Soda}{", " morekeywords={" + soda_reserved_words_csv + "},", " sensitive=true,", - " morecomment=[s]{" + soda_constant.comment_opening_symbol + "}{" + soda_constant.comment_closing_symbol + "},", + " morecomment=[s]{" + soda_constant .comment_opening_symbol + "}{" + soda_constant .comment_closing_symbol + "},", " morestring=[b]\"", "}", "", @@ -103,7 +103,7 @@ class TranslationConstantToDoc ) doc_language_definitions_text : String = - doc_language_definitions.mkString ("\n") + doc_language_definitions .mkString ("\n") end diff --git a/translator/src/main/scala/soda/translator/extension/todoc/TranslatorToDoc.soda b/translator/src/main/scala/soda/translator/extension/todoc/TranslatorToDoc.soda index 8198aa12..606565a2 100644 --- a/translator/src/main/scala/soda/translator/extension/todoc/TranslatorToDoc.soda +++ b/translator/src/main/scala/soda/translator/extension/todoc/TranslatorToDoc.soda @@ -35,38 +35,38 @@ class TranslatorToDoc execute_for (arguments) execute_for (arguments : Seq [String] ) : Boolean = - match arguments.length + match arguments .length case 0 ==> _process_directory (_default_argument) case 1 ==> _process_directory (arguments (0) ) case 2 ==> _translate (arguments (0) ) (arguments (1) ) case otherwise ==> false translate_content (input : String) : String = - _tc.doc_header + _translator.translate (input) + _tc.doc_footer + _tc .doc_header + _translator .translate (input) + _tc .doc_footer _process_directory (start : String) : Boolean = - DirectoryProcessor_ (start, _process_soda_file).process () + DirectoryProcessor_ (start , _process_soda_file) .process () _process_soda_file (file : File) : Boolean = - _process_soda_file_with (_get_input_output_file_names (file.getAbsolutePath) ) + _process_soda_file_with (_get_input_output_file_names (file .getAbsolutePath) ) _process_soda_file_with (pair : FileNamePair) : Boolean = - _translate (pair.input_file_name) (pair.output_file_name) + _translate (pair .input_file_name) (pair .output_file_name) _get_input_output_file_names (input_name : String) : FileNamePair = - if input_name.endsWith (_soda_extension) - then FileNamePair_ (input_name, - input_name.substring (0, input_name.length - _soda_extension.length) + _doc_extension) - else FileNamePair_ (input_name + _soda_extension, input_name + _doc_extension) + if input_name .endsWith (_soda_extension) + then FileNamePair_ (input_name , + input_name .substring (0 , input_name .length - _soda_extension .length) + _doc_extension) + else FileNamePair_ (input_name + _soda_extension , input_name + _doc_extension) _translate (input_file_name : String) (output_file_name : String) : Boolean = _translate_with_input ( - SimpleFileReader_ ().read_file (input_file_name) ) ( + SimpleFileReader_ () .read_file (input_file_name) ) ( output_file_name ) _translate_with_input (input : String) (output_file_name : String) : Boolean = - SimpleFileWriter_ ().write_file ( + SimpleFileWriter_ () .write_file ( output_file_name) ( content := translate_content (input) ) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda index 49d12235..1c785f0d 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/AbstractDeclarationBlockTranslator.soda @@ -18,7 +18,7 @@ class AbstractDeclarationBlockTranslator _tc = TranslationConstantToScala_ () scala_abstract_function_declaration_pattern = - _tc.scala_abstract_function_declaration + _tc.scala_space + _tc .scala_abstract_function_declaration + _tc .scala_space translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> @@ -34,40 +34,40 @@ class AbstractDeclarationBlockTranslator prepend_to_lines_aligned_at ( get_number_of_spaces_at_beginning (get_first_line (block) ) ) ( scala_abstract_function_declaration_pattern) ( - _translate_type_parameters (block.abstract_functions_with_comments) + _translate_type_parameters (block .abstract_functions_with_comments) ), - block.references + block .references ) prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = Block_ ( - annotated_lines.map (lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + annotated_lines .map (lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : AnnotatedLine = - if annotated_line.is_comment + if annotated_line .is_comment then annotated_line - else AnnotatedLine_ (annotated_line.line.substring (0, index) + prefix + annotated_line.line.substring (index) , annotated_line.is_comment) + else AnnotatedLine_ (annotated_line .line .substring (0, index) + prefix + annotated_line .line .substring (index) , annotated_line .is_comment) get_number_of_spaces_at_beginning (line : String) : Int = line - .takeWhile (ch ==> ch.isSpaceChar) + .takeWhile (ch ==> ch .isSpaceChar) .length get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") _translate_type_parameters (abstract_functions_with_comments : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = abstract_functions_with_comments .map (lambda annotated_line --> - if annotated_line.is_comment + if annotated_line .is_comment then annotated_line - else AnnotatedLine_ (_translate_type_parameters_in_line (annotated_line.line) , annotated_line.is_comment) + else AnnotatedLine_ (_translate_type_parameters_in_line (annotated_line .line) , annotated_line .is_comment) ) _translate_type_parameters_in_line (line : String) : String = line - .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) + .replaceAll (_sc .parameter_separation_regex, _tc .scala_parameter_separator_symbol + _tc .scala_space) end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda index 1102a8d5..89500268 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslator.soda @@ -24,56 +24,56 @@ class ClassConstructorBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block - case ClassEndAnnotation_ (block, references) ==> _translate_block (ClassEndAnnotation_ (block, references) ) + case ClassEndAnnotation_ (block , references) ==> _translate_block (ClassEndAnnotation_ (block , references) ) case otherwise ==> annotated_block _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = - _translate_block_with (_get_class_beginning (block.references) ) (block) + _translate_block_with (_get_class_beginning (block .references) ) (block) _translate_block_with (maybe_beginning : Option [ClassBeginningAnnotation] ) (block : ClassEndAnnotation) : ClassEndAnnotation = - if maybe_beginning.isEmpty + if maybe_beginning .isEmpty then block - else _translate_block_with_beginning (maybe_beginning.get) (block) + else _translate_block_with_beginning (maybe_beginning .get) (block) _translate_block_with_beginning (beginning : ClassBeginningAnnotation) (block : ClassEndAnnotation) : ClassEndAnnotation = - if beginning.is_concrete + if beginning .is_concrete then block else _translate_block_with_abstract_beginning (beginning) (block) _translate_block_with_abstract_beginning (beginning : ClassBeginningAnnotation) (block : ClassEndAnnotation) : ClassEndAnnotation = ClassEndAnnotation_ ( - BlockBuilder_ ().build ( - block.lines.++ ( + BlockBuilder_ () .build ( + block .lines .++ ( Seq [String] ( "", - _get_constructor_declaration (beginning) (_get_abstract_functions (block.references) ) + _get_constructor_declaration (beginning) (_get_abstract_functions (block .references) ) ) ) ), - block.references + block .references ) _get_constructor_declaration (beginning : ClassBeginningAnnotation) (abstract_functions : Seq [String] ) : String = _get_initial_spaces (beginning) + - _tc.class_declaration_translation_at_beginning_with_paren + - _tc.scala_space + - beginning.class_name + - _sc.constructor_suffix + - _translate_type_symbols (_get_as_parameter_list (beginning.type_parameters_and_bounds) ) + - _tc.scala_space + - _tc.scala_opening_parenthesis + - abstract_functions.mkString (_tc.scala_parameter_separator_symbol + _tc.scala_space) + - _tc.scala_closing_parenthesis + - _tc.scala_space + - _tc.scala_extends_translation + - _tc.scala_space + - beginning.class_name + - _get_as_parameter_list (beginning.type_parameters) + _tc .class_declaration_translation_at_beginning_with_paren + + _tc .scala_space + + beginning .class_name + + _sc .constructor_suffix + + _translate_type_symbols (_get_as_parameter_list (beginning .type_parameters_and_bounds) ) + + _tc .scala_space + + _tc .scala_opening_parenthesis + + abstract_functions .mkString (_tc .scala_parameter_separator_symbol + _tc .scala_space) + + _tc .scala_closing_parenthesis + + _tc .scala_space + + _tc .scala_extends_translation + + _tc .scala_space + + beginning .class_name + + _get_as_parameter_list (beginning .type_parameters) _get_as_parameter_list (parameters : Seq [String] ) : String = - if parameters.isEmpty + if parameters .isEmpty then "" - else _tc.scala_space + _tc.scala_opening_bracket + parameters.mkString (_tc.scala_parameter_separator_symbol + _tc.scala_space) + _tc.scala_closing_bracket + else _tc .scala_space + _tc .scala_opening_bracket + parameters .mkString (_tc .scala_parameter_separator_symbol + _tc .scala_space) + _tc .scala_closing_bracket _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references @@ -88,29 +88,29 @@ class ClassConstructorBlockTranslator _get_abstract_functions (references : Seq [AnnotatedBlock] ) : Seq [String] = references .flatMap (lambda block --> _get_as_abstract_declaration_annotation (block) ) - .flatMap (lambda block --> block.abstract_functions) - .map (lambda annotated_line --> _translate_type_symbols (annotated_line.line).trim ) + .flatMap (lambda block --> block .abstract_functions) + .map (lambda annotated_line --> _translate_type_symbols (annotated_line .line) .trim ) _get_as_abstract_declaration_annotation (block : AnnotatedBlock) : Option [AbstractDeclarationAnnotation] = match block - case AbstractDeclarationAnnotation_ (b, references) ==> Some (AbstractDeclarationAnnotation_ (b, references) ) + case AbstractDeclarationAnnotation_ (b , references) ==> Some (AbstractDeclarationAnnotation_ (b , references) ) case otherwise ==> None _translate_type_symbols (line : String) : String = line - .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) - .replaceAll (_sc.subtype_reserved_word, _tc.scala_subtype_symbol) - .replaceAll (_sc.supertype_reserved_word, _tc.scala_supertype_symbol) - .replaceAll (_sc.function_arrow_symbol, _tc.scala_function_arrow_symbol) + .replaceAll (_sc .parameter_separation_regex , _tc .scala_parameter_separator_symbol + _tc .scala_space) + .replaceAll (_sc .subtype_reserved_word , _tc .scala_subtype_symbol) + .replaceAll (_sc .supertype_reserved_word , _tc .scala_supertype_symbol) + .replaceAll (_sc .function_arrow_symbol , _tc .scala_function_arrow_symbol) _get_initial_spaces (block : AnnotatedBlock) : String = _get_initial_spaces_with (_get_first_line (block) ) _get_initial_spaces_with (line : String) : String = - line.takeWhile (lambda ch --> ch.isSpaceChar) + line .takeWhile (lambda ch --> ch .isSpaceChar) _get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda index ad7aaf8c..e0bf1a62 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ClassDeclarationBlockTranslator.soda @@ -20,7 +20,7 @@ class ClassDeclarationBlockTranslator _tc = TranslationConstantToScala_ () - soda_space : String = _sc.space + soda_space : String = _sc .space translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> @@ -39,66 +39,66 @@ class ClassDeclarationBlockTranslator ClassAliasAnnotation_ (_translate_block (block) ) _translate_block (block : AnnotatedBlock) : Block = - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( if (has_condition_for_type_alias (get_first_line (block) ) ) then _process_head (block) ++ _process_tail (block) - else _process_head (block) ++ _process_tail (block) ++ Seq [String] (get_initial_spaces (block) + _tc.scala_class_begin_symbol) + else _process_head (block) ++ _process_tail (block) ++ Seq [String] (get_initial_spaces (block) + _tc .scala_class_begin_symbol) ) _process_head (block : Block) : Seq [String] = _process_head_with (get_first_line (block) ) (block) _process_head_with (line : String) (block : Block) : Seq [String] = - Seq [String] (Replacement_ (_sc.space + line).replace_at_beginning (0) (get_table_translator (line) ).line.substring (_sc.space.length) ) + Seq [String] (Replacement_ (_sc .space + line) .replace_at_beginning (0) (get_table_translator (line) ) .line .substring (_sc .space .length) ) _process_tail (block : Block) : Seq [String] = _process_if_extends (remove_first_line (block) ) _process_if_extends (block : Block) : Seq [String] = - if (get_first_line (block).trim == _sc.extends_reserved_word) - then Seq [String] (get_initial_spaces (block) + _tc.scala_extends_translation) ++ _process_after_extends (remove_first_line (block) ) - else block.lines + if (get_first_line (block) .trim == _sc .extends_reserved_word) + then Seq [String] (get_initial_spaces (block) + _tc .scala_extends_translation) ++ _process_after_extends (remove_first_line (block) ) + else block .lines get_table_translator (line : String) : Translator = TableTranslator_ ( - Seq (Tuple2 (_sc.class_reserved_word, get_class_declaration_translation (line) ) ) + Seq (Tuple2 (_sc .class_reserved_word, get_class_declaration_translation (line) ) ) ) get_class_declaration_translation (line : String) : String = - if line.contains (_sc.opening_parenthesis_symbol) - then _tc.class_declaration_translation_at_beginning_with_paren + if line .contains (_sc .opening_parenthesis_symbol) + then _tc .class_declaration_translation_at_beginning_with_paren else if has_condition_for_type_alias (line) - then _tc.class_declaration_translation_at_beginning_without_paren_for_type_alias - else _tc.class_declaration_translation_at_beginning_without_paren + then _tc .class_declaration_translation_at_beginning_without_paren_for_type_alias + else _tc .class_declaration_translation_at_beginning_without_paren _process_after_extends (block : Block) : Seq [String] = - if (get_first_line (block).trim.nonEmpty) - then Seq [String] (get_first_line (block) ) ++ remove_first_line (block).lines.map (lambda line --> get_initial_spaces_for (line) + _tc.scala_with_translation + _tc.scala_space + line.trim) + if (get_first_line (block) .trim .nonEmpty) + then Seq [String] (get_first_line (block) ) ++ remove_first_line (block) .lines .map (lambda line --> get_initial_spaces_for (line) + _tc .scala_with_translation + _tc .scala_space + line .trim) else Seq [String] () remove_first_line (block : Block) : Block = - BlockBuilder_ ().build ( - if block.lines.isEmpty - then block.lines - else block.lines.tail + BlockBuilder_ () .build ( + if block .lines .isEmpty + then block .lines + else block .lines .tail ) get_first_line (block : Block) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") get_initial_spaces (block : Block) : String = get_initial_spaces_for (get_first_line (block) ) get_initial_spaces_for (line : String) : String = - line.takeWhile (lambda ch --> ch.isSpaceChar) + line .takeWhile (lambda ch --> ch .isSpaceChar) ends_with_equals (line : String) : Boolean = false ends_with_opening_brace (line : String) : Boolean = false contains_equals (line : String) : Boolean = - line.trim.contains (_sc.function_definition_symbol) + line .trim .contains (_sc .function_definition_symbol) has_condition_for_type_alias (line : String) : Boolean = contains_equals (line) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda index ef419eb2..e153efba 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ClassEndBlockTranslator.soda @@ -17,30 +17,30 @@ class ClassEndBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block - case ClassEndAnnotation_ (block, references) ==> _translate_block (ClassEndAnnotation_ (block, references) ) + case ClassEndAnnotation_ (block , references) ==> _translate_block (ClassEndAnnotation_ (block , references) ) case otherwise ==> annotated_block _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = ClassEndAnnotation_ ( - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( Seq [String] ( _get_translation (block) ) ), - block.references + block .references ) _get_translation (block : ClassEndAnnotation) : String = - _get_initial_spaces (block) + _tc.scala_class_end_symbol + _get_initial_spaces (block) + _tc .scala_class_end_symbol _get_initial_spaces (block : ClassEndAnnotation) : String = _get_initial_spaces_with (_get_first_line (block) ) _get_initial_spaces_with (line : String) : String = - line.takeWhile (lambda ch --> ch.isSpaceChar) + line .takeWhile (lambda ch --> ch .isSpaceChar) _get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda index d855da35..8f85f23d 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionBlockTranslator.soda @@ -32,75 +32,75 @@ class FunctionDefinitionBlockTranslator FunctionDefinitionAnnotation_ (_translate_block (block) ) _translate_block (block : Block) : Block = - if block.readable_lines.isEmpty + if block .readable_lines .isEmpty then block - else _translate_block_with (block.readable_lines.head) (block) + else _translate_block_with (block .readable_lines .head) (block) _translate_block_with (first_line : AnnotatedLine) (block : Block) : Block = - if _is_annotation (first_line.line) - then _prepend_line (first_line.line) (_translate_main_block (_remove_first_line_if_possible (block) ) ) + if _is_annotation (first_line .line) + then _prepend_line (first_line .line) (_translate_main_block (_remove_first_line_if_possible (block) ) ) else _translate_main_block (block) _translate_main_block (block : Block) : Block = _translate_main_block_with (block) ( FunctionDefinitionLineDetector_ (_flatten_block (block) ) ) _translate_main_block_with (block : Block) (detector : FunctionDefinitionLineDetector) : Block = - match detector.detect - case detector.val_detected ==> _replace_on_val_block (_get_initial_comment (block.annotated_lines) ) (_get_part_without_initial_comment (block.annotated_lines) ) - case detector.def_detected ==> _replace_on_def_block (_get_initial_comment (block.annotated_lines) ) (_get_part_without_initial_comment (block.annotated_lines) ) + match detector .detect + case detector .val_detected ==> _replace_on_val_block (_get_initial_comment (block .annotated_lines) ) (_get_part_without_initial_comment (block .annotated_lines) ) + case detector .def_detected ==> _replace_on_def_block (_get_initial_comment (block .annotated_lines) ) (_get_part_without_initial_comment (block .annotated_lines) ) case otherwise ==> block _replace_on_val_block (initial_comments : Seq [AnnotatedLine] ) (main_block : Seq [AnnotatedLine] ) : Block = Block_ ( - initial_comments .++ (_replace_first_line (main_block) (_translate_val_definition (main_block.head.line) ) ) + initial_comments .++ (_replace_first_line (main_block) (_translate_val_definition (main_block .head .line) ) ) ) _replace_on_def_block (initial_comments : Seq [AnnotatedLine] ) (main_block : Seq [AnnotatedLine] ) : Block = Block_ ( - initial_comments .++ (_replace_first_line (main_block) (_translate_def_definition (main_block.head.line) ) ) + initial_comments .++ (_replace_first_line (main_block) (_translate_def_definition (main_block .head .line) ) ) ) _get_initial_comment (lines : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = - lines.takeWhile (lambda annotated_line --> annotated_line.is_comment ) + lines .takeWhile (lambda annotated_line --> annotated_line .is_comment ) _get_part_without_initial_comment (lines : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = - lines.dropWhile (lambda annotated_line --> annotated_line.is_comment ) + lines .dropWhile (lambda annotated_line --> annotated_line .is_comment ) _translate_val_definition (line : String) : String = Replacement_ (line) - .add_after_spaces_or_pattern (_tc.scala_space) (_private_prefix_if_necessary (line) + _tc.scala_value + _tc.scala_space) - .line + .add_after_spaces_or_pattern (_tc .scala_space) (_private_prefix_if_necessary (line) + _tc .scala_value + _tc .scala_space) + .line _translate_def_definition (line : String) : String = Replacement_ (line) - .add_after_spaces_or_pattern (_tc.scala_space) (_private_prefix_if_necessary (line) + _tc.scala_definition + _tc.scala_space) - .line + .add_after_spaces_or_pattern (_tc .scala_space) (_private_prefix_if_necessary (line) + _tc .scala_definition + _tc .scala_space) + .line _private_prefix_if_necessary (line : String) : String = - if line.trim.startsWith (_sc.private_function_prefix) - then _tc.scala_private_reserved_word + _tc.scala_space + if line .trim .startsWith (_sc .private_function_prefix) + then _tc .scala_private_reserved_word + _tc .scala_space else "" _replace_first_line (lines : Seq [AnnotatedLine] ) (new_first_line : String) : Seq [AnnotatedLine] = - if lines.isEmpty - then Seq [AnnotatedLine] () .+: ( AnnotatedLine_ (new_first_line, false) ) - else lines.tail .+: ( AnnotatedLine_ (new_first_line, false) ) + if lines .isEmpty + then Seq [AnnotatedLine] () .+: ( AnnotatedLine_ (new_first_line , false) ) + else lines .tail .+: ( AnnotatedLine_ (new_first_line , false) ) _remove_first_line_if_possible (block : Block) : Block = - if block.lines.isEmpty + if block .lines .isEmpty then block - else BlockBuilder_ ().build (block.lines.tail) + else BlockBuilder_ () .build (block .lines .tail) _prepend_line (line : String) (block : Block) : Block = - BlockBuilder_ ().build ( - Seq [String] (line) .++ (block.lines) + BlockBuilder_ () .build ( + Seq [String] (line) .++ (block .lines) ) _flatten_block (block : Block) : String = - block.lines.mkString (_sc.space) + block .lines .mkString (_sc .space) _is_annotation (line : String) : Boolean = - (line.trim == _sc.tail_recursion_annotation) or (line.trim == _sc.override_annotation) + (line .trim == _sc .tail_recursion_annotation) or (line .trim == _sc .override_annotation) end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionLineDetector.soda b/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionLineDetector.soda index 65033e77..0d0161d1 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionLineDetector.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/FunctionDefinitionLineDetector.soda @@ -24,7 +24,7 @@ class FunctionDefinitionLineDetector abstract - line: String + line : String import soda.lib.OptionSD @@ -42,7 +42,7 @@ class FunctionDefinitionLineDetector def_detected = 2 detect : Int = - _find_definition (line).opt (ifEmpty := undetected) (ifNonEmpty := lambda position --> _try_found_definition (position) ) + _find_definition (line) .opt (ifEmpty := undetected) (ifNonEmpty := lambda position --> _try_found_definition (position) ) _try_found_definition (position : Int) : Int = if _is_val_definition (position) @@ -56,40 +56,40 @@ class FunctionDefinitionLineDetector _is_val_definition_case_4 _position_of_first_opening_parenthesis = - _get_index (line) (_sc.opening_parenthesis_symbol) + _get_index (line) (_sc .opening_parenthesis_symbol) _is_val_definition_case_1 = - _position_of_first_opening_parenthesis.isEmpty + _position_of_first_opening_parenthesis .isEmpty _is_val_definition_case_2 (initial_position : Int) = - _position_of_first_opening_parenthesis.opt (false) (lambda position --> position > initial_position) + _position_of_first_opening_parenthesis .opt (false) (lambda position --> position > initial_position) _is_val_definition_case_3 = - (_get_index (line) (_sc.type_membership_symbol) ).opt (ifEmpty := false) (ifNonEmpty := lambda other_position --> - _position_of_first_opening_parenthesis.opt (false) (lambda position --> position > other_position) + (_get_index (line) (_sc .type_membership_symbol) ) .opt (ifEmpty := false) (ifNonEmpty := lambda other_position --> + _position_of_first_opening_parenthesis .opt (false) (lambda position --> position > other_position) ) _is_val_definition_case_4 = - _trimmed_line.startsWith (_sc.opening_parenthesis_symbol) + _trimmed_line .startsWith (_sc .opening_parenthesis_symbol) /** - * A line is a definition when its main operator is "=" (the equals sign), which in this context is also called the definition sign. + * A line is a definition when its main operator is "=" (the equals sign), which in this context is also called the definition sign . * This function finds the first occurrence of the definition sign, if it is present. * * @param line line * @return maybe the position of the definition sign */ _find_definition (line : String) : OptionSD [Int] = - if line.endsWith (_sc.space + _sc.function_definition_symbol) - then SomeSD_ (line.length - _sc.function_definition_symbol.length) - else _get_index (line) (_sc.space + _sc.function_definition_symbol + _sc.space) + if line .endsWith (_sc .space + _sc .function_definition_symbol) + then SomeSD_ (line .length - _sc .function_definition_symbol .length) + else _get_index (line) (_sc .space + _sc .function_definition_symbol + _sc .space) _get_index (line : String) (pattern : String) : OptionSD [Int] = _get_index_from (line) (pattern) (0) _get_index_from (line : String) (pattern : String) (start : Int) : OptionSD [Int] = - SomeSD_ (line.indexOf (pattern, start) ) - .filter (lambda position --> not (position == -1) ) + SomeSD_ (line .indexOf (pattern, start) ) + .filter (lambda position --> not (position == -1) ) end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda index a6ff6aff..c6301887 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/ImportDeclarationBlockTranslator.soda @@ -30,27 +30,27 @@ class ImportDeclarationBlockTranslator prepend_to_lines_aligned_at ( get_number_of_spaces_at_beginning (get_first_line (block) ) ) ( scala_import_declaration_pattern) ( - block.imported_items + block .imported_items ) ) prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = - BlockBuilder_ ().build ( - annotated_lines.map (lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + BlockBuilder_ () .build ( + annotated_lines .map (lambda annotated_line --> prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : String = - if annotated_line.is_comment - then annotated_line.line - else annotated_line.line.substring (0, index) + prefix + annotated_line.line.substring (index) + if annotated_line .is_comment + then annotated_line .line + else annotated_line .line .substring (0, index) + prefix + annotated_line .line .substring (index) get_number_of_spaces_at_beginning (line : String) : Int = line - .takeWhile (lambda ch --> ch.isSpaceChar) + .takeWhile (lambda ch --> ch .isSpaceChar) .length get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda index 23038e65..43970131 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/MainClassBlockTranslator.soda @@ -19,27 +19,27 @@ class MainClassBlockTranslator translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = match annotated_block - case ClassEndAnnotation_ (block, references) ==> _translate_block (ClassEndAnnotation_ (block, references) ) + case ClassEndAnnotation_ (block , references) ==> _translate_block (ClassEndAnnotation_ (block , references) ) case otherwise ==> annotated_block _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = - if _get_class_name (block.references) == _tc.soda_main_class_name + if _get_class_name (block .references) == _tc .soda_main_class_name then ClassEndAnnotation_ ( - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( Seq [String] ( - _tc.scala_class_end_symbol, + _tc .scala_class_end_symbol, "", - _tc.scala_entry_point + _tc .scala_entry_point ) ), - block.references + block .references ) else block _get_class_name (references : Seq [AnnotatedBlock] ) : String = _get_class_beginning (references) - .map (lambda x --> x.class_name) + .map (lambda x --> x .class_name) .getOrElse ("") _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = diff --git a/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda index f8cdf4f1..58fef648 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda @@ -17,7 +17,7 @@ class MatchCaseBlockTranslator _tc = TranslationConstantToScala_ () - _soda_match_pattern = _sc.match_reserved_word + " " + _soda_match_pattern = _sc .match_reserved_word + " " translate: AnnotatedBlock -> AnnotatedBlock = lambda block --> @@ -41,37 +41,37 @@ class MatchCaseBlockTranslator else block _is_a_match_case_structure (block : AnnotatedBlock) : Boolean = - block.lines.exists (lambda line --> _is_a_match_line (line) ) + block .lines .exists (lambda line --> _is_a_match_line (line) ) _is_a_match_line (line : String) : Boolean = - line.trim.startsWith (_soda_match_pattern) + line .trim .startsWith (_soda_match_pattern) _get_tabulation_of_match (block : AnnotatedBlock) : String = - block.lines + block .lines .find (lambda line --> _is_a_match_line (line) ) - .map (lambda line --> _left_part (line.indexOf (_soda_match_pattern) ) (line) ) - .getOrElse (_tc.scala_space) + .map (lambda line --> _left_part (line .indexOf (_soda_match_pattern) ) (line) ) + .getOrElse (_tc .scala_space) _translate_match_case_structure (block: AnnotatedBlock) (tabulation : String) : Block = - BlockBuilder_ ().build ( - block.lines + BlockBuilder_ () .build ( + block .lines .map (lambda line --> _insert_match_before_brace_if_found (line) ) - .++ ( Seq [String] () .+: (tabulation + _tc.scala_match_end_translation) ) + .++ ( Seq [String] () .+: (tabulation + _tc .scala_match_end_translation) ) ) _insert_match_before_brace_if_found (line : String) : String = if _is_a_match_line (line) - then _assemble_parts (index := line.indexOf (_soda_match_pattern) ) (line) + then _assemble_parts (index := line .indexOf (_soda_match_pattern) ) (line) else line _assemble_parts (index : Int) (line : String) : String = - (_left_part (index) (line) ) + (_right_part (index) (line) ) + _tc.scala_match_translation + _tc.scala_space + _tc.scala_opening_brace + (_left_part (index) (line) ) + (_right_part (index) (line) ) + _tc .scala_match_translation + _tc .scala_space + _tc .scala_opening_brace _left_part (index : Int) (line : String) : String = - line.substring (0, index) + line .substring (0 , index) _right_part (index : Int) (line : String) : String = - line.substring (index + _soda_match_pattern.length, line.length) + line .substring (index + _soda_match_pattern .length , line .length) end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda index 8bbb11bf..d954dfc4 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda @@ -19,33 +19,33 @@ class MicroTranslatorToScala _ba = BlockAnnotationEnum_ () _functions_and_tests = - Seq (_ba.function_definition, _ba.test_declaration) + Seq (_ba .function_definition , _ba .test_declaration) _class_declarations = - Seq (_ba.class_alias, _ba.class_beginning, _ba.abstract_declaration) + Seq (_ba .class_alias , _ba .class_beginning , _ba .abstract_declaration) _definitions_and_declarations = - _functions_and_tests.++ (_class_declarations) + _functions_and_tests .++ (_class_declarations) translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> - _translation_pipeline.translate (block) + _translation_pipeline .translate (block) _translation_pipeline = BlockTranslatorPipeline_ ( Seq ( - TypeParameterBlockTranslator_ (), - MatchCaseBlockTranslator_ (), - ConditionalBlockTranslator_ (_definitions_and_declarations, TokenReplacement_ ().replace (_tc.scala_non_soda) ), - ConditionalBlockTranslator_ (_functions_and_tests, FunctionDefinitionBlockTranslator_ () ), - ConditionalBlockTranslator_ (_class_declarations, TokenReplacement_ ().replace (_tc.type_symbol_translation) ), - ConditionalBlockTranslator_ (_functions_and_tests, TokenReplacement_ ().replace (_tc.all_translations) ), - ClassDeclarationBlockTranslator_ (), - ImportDeclarationBlockTranslator_ (), - AbstractDeclarationBlockTranslator_ (), - TheoremAndProofBlockTranslator_ (), - ClassEndBlockTranslator_ (), - MainClassBlockTranslator_ (), + TypeParameterBlockTranslator_ () , + MatchCaseBlockTranslator_ () , + ConditionalBlockTranslator_ (_definitions_and_declarations , TokenReplacement_ () .replace (_tc .scala_non_soda) ) , + ConditionalBlockTranslator_ (_functions_and_tests , FunctionDefinitionBlockTranslator_ () ) , + ConditionalBlockTranslator_ (_class_declarations , TokenReplacement_ () .replace (_tc .type_symbol_translation) ) , + ConditionalBlockTranslator_ (_functions_and_tests , TokenReplacement_ () .replace (_tc .all_translations) ) , + ClassDeclarationBlockTranslator_ () , + ImportDeclarationBlockTranslator_ () , + AbstractDeclarationBlockTranslator_ () , + TheoremAndProofBlockTranslator_ () , + ClassEndBlockTranslator_ () , + MainClassBlockTranslator_ () , ClassConstructorBlockTranslator_ () ) ) diff --git a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala index 05b812bb..a9d59d74 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala @@ -27,7 +27,7 @@ trait AbstractDeclarationBlockTranslator private lazy val _tc = TranslationConstantToScala_ () lazy val scala_abstract_function_declaration_pattern = - _tc.scala_abstract_function_declaration + _tc.scala_space + _tc .scala_abstract_function_declaration + _tc .scala_space lazy val translate : AnnotatedBlock => AnnotatedBlock = block => @@ -44,40 +44,40 @@ trait AbstractDeclarationBlockTranslator prepend_to_lines_aligned_at ( get_number_of_spaces_at_beginning (get_first_line (block) ) ) ( scala_abstract_function_declaration_pattern) ( - _translate_type_parameters (block.abstract_functions_with_comments) + _translate_type_parameters (block .abstract_functions_with_comments) ), - block.references + block .references ) def prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = Block_ ( - annotated_lines.map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + annotated_lines .map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) def prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : AnnotatedLine = - if ( annotated_line.is_comment + if ( annotated_line .is_comment ) annotated_line - else AnnotatedLine_ (annotated_line.line.substring (0, index) + prefix + annotated_line.line.substring (index) , annotated_line.is_comment) + else AnnotatedLine_ (annotated_line .line .substring (0, index) + prefix + annotated_line .line .substring (index) , annotated_line .is_comment) def get_number_of_spaces_at_beginning (line : String) : Int = line - .takeWhile (ch => ch.isSpaceChar) + .takeWhile (ch => ch .isSpaceChar) .length def get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") private def _translate_type_parameters (abstract_functions_with_comments : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = abstract_functions_with_comments .map ( annotated_line => - if ( annotated_line.is_comment + if ( annotated_line .is_comment ) annotated_line - else AnnotatedLine_ (_translate_type_parameters_in_line (annotated_line.line) , annotated_line.is_comment) + else AnnotatedLine_ (_translate_type_parameters_in_line (annotated_line .line) , annotated_line .is_comment) ) private def _translate_type_parameters_in_line (line : String) : String = line - .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) + .replaceAll (_sc .parameter_separation_regex, _tc .scala_parameter_separator_symbol + _tc .scala_space) } @@ -109,57 +109,57 @@ trait ClassConstructorBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { - case ClassEndAnnotation_ (block, references) => _translate_block (ClassEndAnnotation_ (block, references) ) + case ClassEndAnnotation_ (block , references) => _translate_block (ClassEndAnnotation_ (block , references) ) case otherwise => annotated_block } private def _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = - _translate_block_with (_get_class_beginning (block.references) ) (block) + _translate_block_with (_get_class_beginning (block .references) ) (block) private def _translate_block_with (maybe_beginning : Option [ClassBeginningAnnotation] ) (block : ClassEndAnnotation) : ClassEndAnnotation = - if ( maybe_beginning.isEmpty + if ( maybe_beginning .isEmpty ) block - else _translate_block_with_beginning (maybe_beginning.get) (block) + else _translate_block_with_beginning (maybe_beginning .get) (block) private def _translate_block_with_beginning (beginning : ClassBeginningAnnotation) (block : ClassEndAnnotation) : ClassEndAnnotation = - if ( beginning.is_concrete + if ( beginning .is_concrete ) block else _translate_block_with_abstract_beginning (beginning) (block) private def _translate_block_with_abstract_beginning (beginning : ClassBeginningAnnotation) (block : ClassEndAnnotation) : ClassEndAnnotation = ClassEndAnnotation_ ( - BlockBuilder_ ().build ( - block.lines.++ ( + BlockBuilder_ () .build ( + block .lines .++ ( Seq [String] ( "", - _get_constructor_declaration (beginning) (_get_abstract_functions (block.references) ) + _get_constructor_declaration (beginning) (_get_abstract_functions (block .references) ) ) ) ), - block.references + block .references ) private def _get_constructor_declaration (beginning : ClassBeginningAnnotation) (abstract_functions : Seq [String] ) : String = _get_initial_spaces (beginning) + - _tc.class_declaration_translation_at_beginning_with_paren + - _tc.scala_space + - beginning.class_name + - _sc.constructor_suffix + - _translate_type_symbols (_get_as_parameter_list (beginning.type_parameters_and_bounds) ) + - _tc.scala_space + - _tc.scala_opening_parenthesis + - abstract_functions.mkString (_tc.scala_parameter_separator_symbol + _tc.scala_space) + - _tc.scala_closing_parenthesis + - _tc.scala_space + - _tc.scala_extends_translation + - _tc.scala_space + - beginning.class_name + - _get_as_parameter_list (beginning.type_parameters) + _tc .class_declaration_translation_at_beginning_with_paren + + _tc .scala_space + + beginning .class_name + + _sc .constructor_suffix + + _translate_type_symbols (_get_as_parameter_list (beginning .type_parameters_and_bounds) ) + + _tc .scala_space + + _tc .scala_opening_parenthesis + + abstract_functions .mkString (_tc .scala_parameter_separator_symbol + _tc .scala_space) + + _tc .scala_closing_parenthesis + + _tc .scala_space + + _tc .scala_extends_translation + + _tc .scala_space + + beginning .class_name + + _get_as_parameter_list (beginning .type_parameters) private def _get_as_parameter_list (parameters : Seq [String] ) : String = - if ( parameters.isEmpty + if ( parameters .isEmpty ) "" - else _tc.scala_space + _tc.scala_opening_bracket + parameters.mkString (_tc.scala_parameter_separator_symbol + _tc.scala_space) + _tc.scala_closing_bracket + else _tc .scala_space + _tc .scala_opening_bracket + parameters .mkString (_tc .scala_parameter_separator_symbol + _tc .scala_space) + _tc .scala_closing_bracket private def _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = references @@ -175,30 +175,30 @@ trait ClassConstructorBlockTranslator private def _get_abstract_functions (references : Seq [AnnotatedBlock] ) : Seq [String] = references .flatMap ( block => _get_as_abstract_declaration_annotation (block) ) - .flatMap ( block => block.abstract_functions) - .map ( annotated_line => _translate_type_symbols (annotated_line.line).trim ) + .flatMap ( block => block .abstract_functions) + .map ( annotated_line => _translate_type_symbols (annotated_line .line) .trim ) private def _get_as_abstract_declaration_annotation (block : AnnotatedBlock) : Option [AbstractDeclarationAnnotation] = block match { - case AbstractDeclarationAnnotation_ (b, references) => Some (AbstractDeclarationAnnotation_ (b, references) ) + case AbstractDeclarationAnnotation_ (b , references) => Some (AbstractDeclarationAnnotation_ (b , references) ) case otherwise => None } private def _translate_type_symbols (line : String) : String = line - .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) - .replaceAll (_sc.subtype_reserved_word, _tc.scala_subtype_symbol) - .replaceAll (_sc.supertype_reserved_word, _tc.scala_supertype_symbol) - .replaceAll (_sc.function_arrow_symbol, _tc.scala_function_arrow_symbol) + .replaceAll (_sc .parameter_separation_regex , _tc .scala_parameter_separator_symbol + _tc .scala_space) + .replaceAll (_sc .subtype_reserved_word , _tc .scala_subtype_symbol) + .replaceAll (_sc .supertype_reserved_word , _tc .scala_supertype_symbol) + .replaceAll (_sc .function_arrow_symbol , _tc .scala_function_arrow_symbol) private def _get_initial_spaces (block : AnnotatedBlock) : String = _get_initial_spaces_with (_get_first_line (block) ) private def _get_initial_spaces_with (line : String) : String = - line.takeWhile ( ch => ch.isSpaceChar) + line .takeWhile ( ch => ch .isSpaceChar) private def _get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") } @@ -226,7 +226,7 @@ trait ClassDeclarationBlockTranslator private lazy val _tc = TranslationConstantToScala_ () - lazy val soda_space : String = _sc.space + lazy val soda_space : String = _sc .space lazy val translate : AnnotatedBlock => AnnotatedBlock = block => @@ -246,66 +246,66 @@ trait ClassDeclarationBlockTranslator ClassAliasAnnotation_ (_translate_block (block) ) private def _translate_block (block : AnnotatedBlock) : Block = - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( if ( (has_condition_for_type_alias (get_first_line (block) ) ) ) _process_head (block) ++ _process_tail (block) - else _process_head (block) ++ _process_tail (block) ++ Seq [String] (get_initial_spaces (block) + _tc.scala_class_begin_symbol) + else _process_head (block) ++ _process_tail (block) ++ Seq [String] (get_initial_spaces (block) + _tc .scala_class_begin_symbol) ) private def _process_head (block : Block) : Seq [String] = _process_head_with (get_first_line (block) ) (block) private def _process_head_with (line : String) (block : Block) : Seq [String] = - Seq [String] (Replacement_ (_sc.space + line).replace_at_beginning (0) (get_table_translator (line) ).line.substring (_sc.space.length) ) + Seq [String] (Replacement_ (_sc .space + line) .replace_at_beginning (0) (get_table_translator (line) ) .line .substring (_sc .space .length) ) private def _process_tail (block : Block) : Seq [String] = _process_if_extends (remove_first_line (block) ) private def _process_if_extends (block : Block) : Seq [String] = - if ( (get_first_line (block).trim == _sc.extends_reserved_word) - ) Seq [String] (get_initial_spaces (block) + _tc.scala_extends_translation) ++ _process_after_extends (remove_first_line (block) ) - else block.lines + if ( (get_first_line (block) .trim == _sc .extends_reserved_word) + ) Seq [String] (get_initial_spaces (block) + _tc .scala_extends_translation) ++ _process_after_extends (remove_first_line (block) ) + else block .lines def get_table_translator (line : String) : Translator = TableTranslator_ ( - Seq (Tuple2 (_sc.class_reserved_word, get_class_declaration_translation (line) ) ) + Seq (Tuple2 (_sc .class_reserved_word, get_class_declaration_translation (line) ) ) ) def get_class_declaration_translation (line : String) : String = - if ( line.contains (_sc.opening_parenthesis_symbol) - ) _tc.class_declaration_translation_at_beginning_with_paren + if ( line .contains (_sc .opening_parenthesis_symbol) + ) _tc .class_declaration_translation_at_beginning_with_paren else if ( has_condition_for_type_alias (line) - ) _tc.class_declaration_translation_at_beginning_without_paren_for_type_alias - else _tc.class_declaration_translation_at_beginning_without_paren + ) _tc .class_declaration_translation_at_beginning_without_paren_for_type_alias + else _tc .class_declaration_translation_at_beginning_without_paren private def _process_after_extends (block : Block) : Seq [String] = - if ( (get_first_line (block).trim.nonEmpty) - ) Seq [String] (get_first_line (block) ) ++ remove_first_line (block).lines.map ( line => get_initial_spaces_for (line) + _tc.scala_with_translation + _tc.scala_space + line.trim) + if ( (get_first_line (block) .trim .nonEmpty) + ) Seq [String] (get_first_line (block) ) ++ remove_first_line (block) .lines .map ( line => get_initial_spaces_for (line) + _tc .scala_with_translation + _tc .scala_space + line .trim) else Seq [String] () def remove_first_line (block : Block) : Block = - BlockBuilder_ ().build ( - if ( block.lines.isEmpty - ) block.lines - else block.lines.tail + BlockBuilder_ () .build ( + if ( block .lines .isEmpty + ) block .lines + else block .lines .tail ) def get_first_line (block : Block) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") def get_initial_spaces (block : Block) : String = get_initial_spaces_for (get_first_line (block) ) def get_initial_spaces_for (line : String) : String = - line.takeWhile ( ch => ch.isSpaceChar) + line .takeWhile ( ch => ch .isSpaceChar) def ends_with_equals (line : String) : Boolean = false def ends_with_opening_brace (line : String) : Boolean = false def contains_equals (line : String) : Boolean = - line.trim.contains (_sc.function_definition_symbol) + line .trim .contains (_sc .function_definition_symbol) def has_condition_for_type_alias (line : String) : Boolean = contains_equals (line) @@ -333,31 +333,31 @@ trait ClassEndBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { - case ClassEndAnnotation_ (block, references) => _translate_block (ClassEndAnnotation_ (block, references) ) + case ClassEndAnnotation_ (block , references) => _translate_block (ClassEndAnnotation_ (block , references) ) case otherwise => annotated_block } private def _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = ClassEndAnnotation_ ( - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( Seq [String] ( _get_translation (block) ) ), - block.references + block .references ) private def _get_translation (block : ClassEndAnnotation) : String = - _get_initial_spaces (block) + _tc.scala_class_end_symbol + _get_initial_spaces (block) + _tc .scala_class_end_symbol private def _get_initial_spaces (block : ClassEndAnnotation) : String = _get_initial_spaces_with (_get_first_line (block) ) private def _get_initial_spaces_with (line : String) : String = - line.takeWhile ( ch => ch.isSpaceChar) + line .takeWhile ( ch => ch .isSpaceChar) private def _get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") } @@ -398,76 +398,76 @@ trait FunctionDefinitionBlockTranslator FunctionDefinitionAnnotation_ (_translate_block (block) ) private def _translate_block (block : Block) : Block = - if ( block.readable_lines.isEmpty + if ( block .readable_lines .isEmpty ) block - else _translate_block_with (block.readable_lines.head) (block) + else _translate_block_with (block .readable_lines .head) (block) private def _translate_block_with (first_line : AnnotatedLine) (block : Block) : Block = - if ( _is_annotation (first_line.line) - ) _prepend_line (first_line.line) (_translate_main_block (_remove_first_line_if_possible (block) ) ) + if ( _is_annotation (first_line .line) + ) _prepend_line (first_line .line) (_translate_main_block (_remove_first_line_if_possible (block) ) ) else _translate_main_block (block) private def _translate_main_block (block : Block) : Block = _translate_main_block_with (block) ( FunctionDefinitionLineDetector_ (_flatten_block (block) ) ) private def _translate_main_block_with (block : Block) (detector : FunctionDefinitionLineDetector) : Block = - detector.detect match { - case detector.val_detected => _replace_on_val_block (_get_initial_comment (block.annotated_lines) ) (_get_part_without_initial_comment (block.annotated_lines) ) - case detector.def_detected => _replace_on_def_block (_get_initial_comment (block.annotated_lines) ) (_get_part_without_initial_comment (block.annotated_lines) ) + detector .detect match { + case detector .val_detected => _replace_on_val_block (_get_initial_comment (block .annotated_lines) ) (_get_part_without_initial_comment (block .annotated_lines) ) + case detector .def_detected => _replace_on_def_block (_get_initial_comment (block .annotated_lines) ) (_get_part_without_initial_comment (block .annotated_lines) ) case otherwise => block } private def _replace_on_val_block (initial_comments : Seq [AnnotatedLine] ) (main_block : Seq [AnnotatedLine] ) : Block = Block_ ( - initial_comments .++ (_replace_first_line (main_block) (_translate_val_definition (main_block.head.line) ) ) + initial_comments .++ (_replace_first_line (main_block) (_translate_val_definition (main_block .head .line) ) ) ) private def _replace_on_def_block (initial_comments : Seq [AnnotatedLine] ) (main_block : Seq [AnnotatedLine] ) : Block = Block_ ( - initial_comments .++ (_replace_first_line (main_block) (_translate_def_definition (main_block.head.line) ) ) + initial_comments .++ (_replace_first_line (main_block) (_translate_def_definition (main_block .head .line) ) ) ) private def _get_initial_comment (lines : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = - lines.takeWhile ( annotated_line => annotated_line.is_comment ) + lines .takeWhile ( annotated_line => annotated_line .is_comment ) private def _get_part_without_initial_comment (lines : Seq [AnnotatedLine] ) : Seq [AnnotatedLine] = - lines.dropWhile ( annotated_line => annotated_line.is_comment ) + lines .dropWhile ( annotated_line => annotated_line .is_comment ) private def _translate_val_definition (line : String) : String = Replacement_ (line) - .add_after_spaces_or_pattern (_tc.scala_space) (_private_prefix_if_necessary (line) + _tc.scala_value + _tc.scala_space) - .line + .add_after_spaces_or_pattern (_tc .scala_space) (_private_prefix_if_necessary (line) + _tc .scala_value + _tc .scala_space) + .line private def _translate_def_definition (line : String) : String = Replacement_ (line) - .add_after_spaces_or_pattern (_tc.scala_space) (_private_prefix_if_necessary (line) + _tc.scala_definition + _tc.scala_space) - .line + .add_after_spaces_or_pattern (_tc .scala_space) (_private_prefix_if_necessary (line) + _tc .scala_definition + _tc .scala_space) + .line private def _private_prefix_if_necessary (line : String) : String = - if ( line.trim.startsWith (_sc.private_function_prefix) - ) _tc.scala_private_reserved_word + _tc.scala_space + if ( line .trim .startsWith (_sc .private_function_prefix) + ) _tc .scala_private_reserved_word + _tc .scala_space else "" private def _replace_first_line (lines : Seq [AnnotatedLine] ) (new_first_line : String) : Seq [AnnotatedLine] = - if ( lines.isEmpty - ) Seq [AnnotatedLine] () .+: ( AnnotatedLine_ (new_first_line, false) ) - else lines.tail .+: ( AnnotatedLine_ (new_first_line, false) ) + if ( lines .isEmpty + ) Seq [AnnotatedLine] () .+: ( AnnotatedLine_ (new_first_line , false) ) + else lines .tail .+: ( AnnotatedLine_ (new_first_line , false) ) private def _remove_first_line_if_possible (block : Block) : Block = - if ( block.lines.isEmpty + if ( block .lines .isEmpty ) block - else BlockBuilder_ ().build (block.lines.tail) + else BlockBuilder_ () .build (block .lines .tail) private def _prepend_line (line : String) (block : Block) : Block = - BlockBuilder_ ().build ( - Seq [String] (line) .++ (block.lines) + BlockBuilder_ () .build ( + Seq [String] (line) .++ (block .lines) ) private def _flatten_block (block : Block) : String = - block.lines.mkString (_sc.space) + block .lines .mkString (_sc .space) private def _is_annotation (line : String) : Boolean = - (line.trim == _sc.tail_recursion_annotation) || (line.trim == _sc.override_annotation) + (line .trim == _sc .tail_recursion_annotation) || (line .trim == _sc .override_annotation) } @@ -499,7 +499,7 @@ case class FunctionDefinitionBlockTranslator_ () extends FunctionDefinitionBlock trait FunctionDefinitionLineDetector { - def line: String + def line : String import soda.lib.OptionSD import soda.lib.SomeSD_ @@ -516,7 +516,7 @@ trait FunctionDefinitionLineDetector lazy val def_detected = 2 lazy val detect : Int = - _find_definition (line).opt (ifEmpty = undetected) (ifNonEmpty = position => _try_found_definition (position) ) + _find_definition (line) .opt (ifEmpty = undetected) (ifNonEmpty = position => _try_found_definition (position) ) private def _try_found_definition (position : Int) : Int = if ( _is_val_definition (position) @@ -530,44 +530,44 @@ trait FunctionDefinitionLineDetector _is_val_definition_case_4 private lazy val _position_of_first_opening_parenthesis = - _get_index (line) (_sc.opening_parenthesis_symbol) + _get_index (line) (_sc .opening_parenthesis_symbol) private lazy val _is_val_definition_case_1 = - _position_of_first_opening_parenthesis.isEmpty + _position_of_first_opening_parenthesis .isEmpty private def _is_val_definition_case_2 (initial_position : Int) = - _position_of_first_opening_parenthesis.opt (false) ( position => position > initial_position) + _position_of_first_opening_parenthesis .opt (false) ( position => position > initial_position) private lazy val _is_val_definition_case_3 = - (_get_index (line) (_sc.type_membership_symbol) ).opt (ifEmpty = false) (ifNonEmpty = other_position => - _position_of_first_opening_parenthesis.opt (false) ( position => position > other_position) + (_get_index (line) (_sc .type_membership_symbol) ) .opt (ifEmpty = false) (ifNonEmpty = other_position => + _position_of_first_opening_parenthesis .opt (false) ( position => position > other_position) ) private lazy val _is_val_definition_case_4 = - _trimmed_line.startsWith (_sc.opening_parenthesis_symbol) + _trimmed_line .startsWith (_sc .opening_parenthesis_symbol) /** - * A line is a definition when its main operator is "=" (the equals sign), which in this context is also called the definition sign. + * A line is a definition when its main operator is "=" (the equals sign), which in this context is also called the definition sign . * This function finds the first occurrence of the definition sign, if it is present. * * @param line line * @return maybe the position of the definition sign */ private def _find_definition (line : String) : OptionSD [Int] = - if ( line.endsWith (_sc.space + _sc.function_definition_symbol) - ) SomeSD_ (line.length - _sc.function_definition_symbol.length) - else _get_index (line) (_sc.space + _sc.function_definition_symbol + _sc.space) + if ( line .endsWith (_sc .space + _sc .function_definition_symbol) + ) SomeSD_ (line .length - _sc .function_definition_symbol .length) + else _get_index (line) (_sc .space + _sc .function_definition_symbol + _sc .space) private def _get_index (line : String) (pattern : String) : OptionSD [Int] = _get_index_from (line) (pattern) (0) private def _get_index_from (line : String) (pattern : String) (start : Int) : OptionSD [Int] = - SomeSD_ (line.indexOf (pattern, start) ) - .filter ( position => ! (position == -1) ) + SomeSD_ (line .indexOf (pattern, start) ) + .filter ( position => ! (position == -1) ) } -case class FunctionDefinitionLineDetector_ (line: String) extends FunctionDefinitionLineDetector +case class FunctionDefinitionLineDetector_ (line : String) extends FunctionDefinitionLineDetector trait ImportDeclarationBlockTranslator @@ -602,27 +602,27 @@ trait ImportDeclarationBlockTranslator prepend_to_lines_aligned_at ( get_number_of_spaces_at_beginning (get_first_line (block) ) ) ( scala_import_declaration_pattern) ( - block.imported_items + block .imported_items ) ) def prepend_to_lines_aligned_at (number_of_spaces : Int) (prefix : String) (annotated_lines : Seq [AnnotatedLine] ) : Block = - BlockBuilder_ ().build ( - annotated_lines.map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) + BlockBuilder_ () .build ( + annotated_lines .map ( annotated_line => prepend_aligned_non_comment (number_of_spaces) (prefix) (annotated_line) ) ) def prepend_aligned_non_comment (index : Int) (prefix : String) (annotated_line : AnnotatedLine) : String = - if ( annotated_line.is_comment - ) annotated_line.line - else annotated_line.line.substring (0, index) + prefix + annotated_line.line.substring (index) + if ( annotated_line .is_comment + ) annotated_line .line + else annotated_line .line .substring (0, index) + prefix + annotated_line .line .substring (index) def get_number_of_spaces_at_beginning (line : String) : Int = line - .takeWhile ( ch => ch.isSpaceChar) + .takeWhile ( ch => ch .isSpaceChar) .length def get_first_line (block : AnnotatedBlock) : String = - block.lines.headOption.getOrElse ("") + block .lines .headOption .getOrElse ("") } @@ -649,28 +649,28 @@ trait MainClassBlockTranslator def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock = annotated_block match { - case ClassEndAnnotation_ (block, references) => _translate_block (ClassEndAnnotation_ (block, references) ) + case ClassEndAnnotation_ (block , references) => _translate_block (ClassEndAnnotation_ (block , references) ) case otherwise => annotated_block } private def _translate_block (block : ClassEndAnnotation) : ClassEndAnnotation = - if ( _get_class_name (block.references) == _tc.soda_main_class_name + if ( _get_class_name (block .references) == _tc .soda_main_class_name ) ClassEndAnnotation_ ( - BlockBuilder_ ().build ( + BlockBuilder_ () .build ( Seq [String] ( - _tc.scala_class_end_symbol, + _tc .scala_class_end_symbol, "", - _tc.scala_entry_point + _tc .scala_entry_point ) ), - block.references + block .references ) else block private def _get_class_name (references : Seq [AnnotatedBlock] ) : String = _get_class_beginning (references) - .map ( x => x.class_name) + .map ( x => x .class_name) .getOrElse ("") private def _get_class_beginning (references : Seq [AnnotatedBlock] ) : Option [ClassBeginningAnnotation] = @@ -707,7 +707,7 @@ trait MatchCaseBlockTranslator private lazy val _tc = TranslationConstantToScala_ () - private lazy val _soda_match_pattern = _sc.match_reserved_word + " " + private lazy val _soda_match_pattern = _sc .match_reserved_word + " " lazy val translate: AnnotatedBlock => AnnotatedBlock = block => @@ -732,37 +732,37 @@ trait MatchCaseBlockTranslator else block private def _is_a_match_case_structure (block : AnnotatedBlock) : Boolean = - block.lines.exists ( line => _is_a_match_line (line) ) + block .lines .exists ( line => _is_a_match_line (line) ) private def _is_a_match_line (line : String) : Boolean = - line.trim.startsWith (_soda_match_pattern) + line .trim .startsWith (_soda_match_pattern) private def _get_tabulation_of_match (block : AnnotatedBlock) : String = - block.lines + block .lines .find ( line => _is_a_match_line (line) ) - .map ( line => _left_part (line.indexOf (_soda_match_pattern) ) (line) ) - .getOrElse (_tc.scala_space) + .map ( line => _left_part (line .indexOf (_soda_match_pattern) ) (line) ) + .getOrElse (_tc .scala_space) private def _translate_match_case_structure (block: AnnotatedBlock) (tabulation : String) : Block = - BlockBuilder_ ().build ( - block.lines + BlockBuilder_ () .build ( + block .lines .map ( line => _insert_match_before_brace_if_found (line) ) - .++ ( Seq [String] () .+: (tabulation + _tc.scala_match_end_translation) ) + .++ ( Seq [String] () .+: (tabulation + _tc .scala_match_end_translation) ) ) private def _insert_match_before_brace_if_found (line : String) : String = if ( _is_a_match_line (line) - ) _assemble_parts (index = line.indexOf (_soda_match_pattern) ) (line) + ) _assemble_parts (index = line .indexOf (_soda_match_pattern) ) (line) else line private def _assemble_parts (index : Int) (line : String) : String = - (_left_part (index) (line) ) + (_right_part (index) (line) ) + _tc.scala_match_translation + _tc.scala_space + _tc.scala_opening_brace + (_left_part (index) (line) ) + (_right_part (index) (line) ) + _tc .scala_match_translation + _tc .scala_space + _tc .scala_opening_brace private def _left_part (index : Int) (line : String) : String = - line.substring (0, index) + line .substring (0 , index) private def _right_part (index : Int) (line : String) : String = - line.substring (index + _soda_match_pattern.length, line.length) + line .substring (index + _soda_match_pattern .length , line .length) } @@ -789,33 +789,33 @@ trait MicroTranslatorToScala private lazy val _ba = BlockAnnotationEnum_ () private lazy val _functions_and_tests = - Seq (_ba.function_definition, _ba.test_declaration) + Seq (_ba .function_definition , _ba .test_declaration) private lazy val _class_declarations = - Seq (_ba.class_alias, _ba.class_beginning, _ba.abstract_declaration) + Seq (_ba .class_alias , _ba .class_beginning , _ba .abstract_declaration) private lazy val _definitions_and_declarations = - _functions_and_tests.++ (_class_declarations) + _functions_and_tests .++ (_class_declarations) lazy val translate : AnnotatedBlock => AnnotatedBlock = block => - _translation_pipeline.translate (block) + _translation_pipeline .translate (block) private lazy val _translation_pipeline = BlockTranslatorPipeline_ ( Seq ( - TypeParameterBlockTranslator_ (), - MatchCaseBlockTranslator_ (), - ConditionalBlockTranslator_ (_definitions_and_declarations, TokenReplacement_ ().replace (_tc.scala_non_soda) ), - ConditionalBlockTranslator_ (_functions_and_tests, FunctionDefinitionBlockTranslator_ () ), - ConditionalBlockTranslator_ (_class_declarations, TokenReplacement_ ().replace (_tc.type_symbol_translation) ), - ConditionalBlockTranslator_ (_functions_and_tests, TokenReplacement_ ().replace (_tc.all_translations) ), - ClassDeclarationBlockTranslator_ (), - ImportDeclarationBlockTranslator_ (), - AbstractDeclarationBlockTranslator_ (), - TheoremAndProofBlockTranslator_ (), - ClassEndBlockTranslator_ (), - MainClassBlockTranslator_ (), + TypeParameterBlockTranslator_ () , + MatchCaseBlockTranslator_ () , + ConditionalBlockTranslator_ (_definitions_and_declarations , TokenReplacement_ () .replace (_tc .scala_non_soda) ) , + ConditionalBlockTranslator_ (_functions_and_tests , FunctionDefinitionBlockTranslator_ () ) , + ConditionalBlockTranslator_ (_class_declarations , TokenReplacement_ () .replace (_tc .type_symbol_translation) ) , + ConditionalBlockTranslator_ (_functions_and_tests , TokenReplacement_ () .replace (_tc .all_translations) ) , + ClassDeclarationBlockTranslator_ () , + ImportDeclarationBlockTranslator_ () , + AbstractDeclarationBlockTranslator_ () , + TheoremAndProofBlockTranslator_ () , + ClassEndBlockTranslator_ () , + MainClassBlockTranslator_ () , ClassConstructorBlockTranslator_ () ) ) @@ -858,16 +858,16 @@ trait TheoremAndProofBlockTranslator ProofBlockAnnotation_ (_translate_block (block) ) private def _translate_block (block : AnnotatedBlock) : Block = - _append (_tc.scala_comment_closing_symbol) (_prepend (_tc.scala_comment_opening_symbol) (block) ) + _append (_tc .scala_comment_closing_symbol) (_prepend (_tc .scala_comment_opening_symbol) (block) ) private def _prepend (prefix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - Seq [String] (prefix + block.lines.head) .++ (block.lines.tail) + BlockBuilder_ () .build ( + Seq [String] (prefix + block .lines .head) .++ (block .lines .tail) ) private def _append (suffix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - block.lines.:+ (suffix) + BlockBuilder_ () .build ( + block .lines .:+ (suffix) ) } @@ -1061,30 +1061,30 @@ trait TranslationConstantToScala lazy val type_symbol_translation : Seq [Tuple2 [String, String] ] = Seq ( - Tuple2 (soda_constant.subtype_reserved_word, scala_subtype_symbol), - Tuple2 (soda_constant.supertype_reserved_word, scala_supertype_symbol), - Tuple2 (soda_constant.function_arrow_symbol, scala_function_arrow_symbol) + Tuple2 (soda_constant .subtype_reserved_word , scala_subtype_symbol) , + Tuple2 (soda_constant .supertype_reserved_word , scala_supertype_symbol) , + Tuple2 (soda_constant .function_arrow_symbol , scala_function_arrow_symbol) ) lazy val function_symbol_translation : Seq [Tuple2 [String, String] ] = Seq ( - Tuple2 (soda_constant.lambda_reserved_word, scala_empty_string), - Tuple2 (soda_constant.any_reserved_word, scala_empty_string), - Tuple2 (soda_constant.lambda_arrow_symbol, scala_lambda_arrow_symbol), - Tuple2 (soda_constant.case_arrow_symbol, scala_case_arrow_symbol), - Tuple2 (soda_constant.not_reserved_word, scala_not_symbol), - Tuple2 (soda_constant.and_reserved_word, scala_and_symbol), - Tuple2 (soda_constant.or_reserved_word, scala_or_symbol), - Tuple2 (soda_constant.if_reserved_word, scala_if_translation), - Tuple2 (soda_constant.then_reserved_word, scala_then_translation), - Tuple2 (soda_constant.parameter_definition_symbol, scala_parameter_definition_symbol), - Tuple2 (soda_constant.tail_recursion_annotation, scala_tail_recursion_annotation_translation), - Tuple2 (soda_constant.override_annotation, scala_override_annotation_translation), - Tuple2 (soda_constant.new_annotation, scala_new_annotation_translation) + Tuple2 (soda_constant .lambda_reserved_word , scala_empty_string) , + Tuple2 (soda_constant .any_reserved_word , scala_empty_string) , + Tuple2 (soda_constant .lambda_arrow_symbol , scala_lambda_arrow_symbol) , + Tuple2 (soda_constant .case_arrow_symbol , scala_case_arrow_symbol) , + Tuple2 (soda_constant .not_reserved_word , scala_not_symbol) , + Tuple2 (soda_constant .and_reserved_word , scala_and_symbol) , + Tuple2 (soda_constant .or_reserved_word , scala_or_symbol) , + Tuple2 (soda_constant .if_reserved_word , scala_if_translation) , + Tuple2 (soda_constant .then_reserved_word , scala_then_translation) , + Tuple2 (soda_constant .parameter_definition_symbol , scala_parameter_definition_symbol) , + Tuple2 (soda_constant .tail_recursion_annotation , scala_tail_recursion_annotation_translation) , + Tuple2 (soda_constant .override_annotation , scala_override_annotation_translation) , + Tuple2 (soda_constant .new_annotation , scala_new_annotation_translation) ) lazy val all_translations : Seq [Tuple2 [String, String] ] = - type_symbol_translation.++ (function_symbol_translation) + type_symbol_translation .++ (function_symbol_translation) lazy val class_declaration_translation_at_beginning_with_paren = "case class" @@ -1096,14 +1096,14 @@ trait TranslationConstantToScala lazy val scala_non_soda : Seq [Tuple2 [String, String] ] = scala_reserved_words - .filter ( x => ! soda_constant.soda_reserved_words.contains (x)) - .map ( x => Tuple2 (x, prefix_scala_non_soda + x) ) + .filter ( x => ! soda_constant .soda_reserved_words .contains (x)) + .map ( x => Tuple2 (x , prefix_scala_non_soda + x) ) def is_scala_word (word : String) : Boolean = - scala_reserved_words.contains (word) + scala_reserved_words .contains (word) def is_soda_word (word : String) : Boolean = - soda_constant.soda_reserved_words.contains (word) + soda_constant .soda_reserved_words .contains (word) } @@ -1138,32 +1138,32 @@ trait TranslatorToScala def execute_for (arguments : Seq [String] ) : Boolean = arguments.length match { - case 0 => _process_directory_with_package_option (tc.default_argument) - case 1 => _process_directory_with_package_option (arguments.apply (0) ) + case 0 => _process_directory_with_package_option (tc .default_argument) + case 1 => _process_directory_with_package_option (arguments .apply (0) ) case 2 => - if ( _is_single_files_option (arguments.apply (0) ) - ) _process_directory_with_single_files_option (arguments.apply (1) ) + if ( _is_single_files_option (arguments .apply (0) ) + ) _process_directory_with_single_files_option (arguments .apply (1) ) else false case 3 => - if ( _is_single_files_option (arguments.apply (0) ) - ) IndividualProcessor_ ().translate (arguments.apply (1) ) (arguments.apply (2) ) + if ( _is_single_files_option (arguments .apply (0) ) + ) IndividualProcessor_ () .translate (arguments .apply (1) ) (arguments .apply (2) ) else false case otherwise => false } private def _process_directory_with_single_files_option (start : String) : Boolean = - DirectoryProcessor_ (start , IndividualProcessor_ ().process_soda_file).process () + DirectoryProcessor_ (start , IndividualProcessor_ () .process_soda_file) .process () private def _process_directory_with_package_option (start : String) : Boolean = - DirectoryProcessor_ (start , process_soda_file_with_package_option).process () + DirectoryProcessor_ (start , process_soda_file_with_package_option) .process () def process_soda_file_with_package_option (file : File) : Boolean = - if ( file.getName == tc.package_file_name - ) IndividualProcessor_ ().process_soda_file (file) - else PackageProcessor_ ().process_soda_file (file) + if ( file .getName == tc .package_file_name + ) IndividualProcessor_ () .process_soda_file (file) + else PackageProcessor_ () .process_soda_file (file) private def _is_single_files_option (s : String) : Boolean = - (s == tc.single_files_option_1) || (s == tc.single_files_option_2) + (s == tc .single_files_option_1) || (s == tc .single_files_option_2) } @@ -1183,40 +1183,40 @@ trait IndividualProcessor lazy val writer = SimpleFileWriter_ () def process_soda_file (file : File) : Boolean = - process_soda_file_with (get_input_output_file_names (file.getAbsolutePath) ) + process_soda_file_with (get_input_output_file_names (file .getAbsolutePath) ) def process_soda_file_with (pair : FileNamePair) : Boolean = - translate (pair.input_file_name) (pair.output_file_name) + translate (pair .input_file_name) (pair .output_file_name) def translate (input_file_name : String) (output_file_name : String) : Boolean = _translate_with_input (_read_input_with_prelude (input_file_name) ) (output_file_name) private def _read_input_with_prelude (input_file_name : String) : String = if ( _is_a_prelude_file (input_file_name) - ) reader.read_file (input_file_name) + tc.prelude_file_body - else _get_prelude (input_file_name) + reader.read_file (input_file_name) + ) reader .read_file (input_file_name) + tc .prelude_file_body + else _get_prelude (input_file_name) + reader .read_file (input_file_name) private def _get_prelude (input_file_name : String) : String = _get_prelude_with (_get_prelude_file (input_file_name) ) private def _get_prelude_with (prelude_file : File) : String = - if ( prelude_file.exists - ) (reader.read_file (prelude_file.getAbsolutePath) ) + tc.append_separation - else tc.default_prelude + if ( prelude_file .exists + ) (reader .read_file (prelude_file .getAbsolutePath) ) + tc .append_separation + else tc .default_prelude private def _get_prelude_file (input_file_name : String) : File = - new File ( new File (input_file_name) .getParentFile , tc.package_file_name ) + new File ( new File (input_file_name) .getParentFile , tc .package_file_name ) private def _is_a_prelude_file (input_file_name : String) : Boolean = - tc.package_file_name == ( ( new File (input_file_name) ) .getName) + tc .package_file_name == ( ( new File (input_file_name) ) .getName) private def _translate_with_input (input : String) (output_file_name : String) : Boolean = - writer.write_file (output_file_name) (content = tc.translator.translate (input) ) + writer .write_file (output_file_name) (content = tc .translator .translate (input) ) def get_input_output_file_names (input_name : String) : FileNamePair = - if ( input_name.endsWith (tc.soda_extension) - ) FileNamePair_ (input_name, input_name.substring (0, input_name.length - tc.soda_extension.length) + tc.scala_extension) - else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) + if ( input_name .endsWith (tc .soda_extension) + ) FileNamePair_ (input_name, input_name .substring (0, input_name .length - tc .soda_extension .length) + tc .scala_extension) + else FileNamePair_ (input_name + tc .soda_extension, input_name + tc .scala_extension) } @@ -1236,21 +1236,21 @@ trait PackageProcessor lazy val writer = SimpleFileWriter_ () def process_soda_file (file : File) : Boolean = - process_soda_file_with (get_input_output_file_names (file.getAbsolutePath) (file.getParent) ) + process_soda_file_with (get_input_output_file_names (file .getAbsolutePath) (file .getParent) ) def process_soda_file_with (pair : FileNamePair) : Boolean = - translate_append (pair.input_file_name) (pair.output_file_name) + translate_append (pair .input_file_name) (pair .output_file_name) def get_input_output_file_names (input_name : String) (parent_name : String) : FileNamePair = - if ( input_name.endsWith (tc.soda_extension) - ) FileNamePair_ (input_name , parent_name + tc.file_separator + tc.package_scala_file_name ) - else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) + if ( input_name .endsWith (tc .soda_extension) + ) FileNamePair_ (input_name , parent_name + tc .file_separator + tc .package_scala_file_name ) + else FileNamePair_ (input_name + tc .soda_extension, input_name + tc .scala_extension) def translate_append (input_file_name : String) (output_file_name : String) : Boolean = - _translate_append_with_input (reader.read_file (input_file_name) ) (output_file_name) + _translate_append_with_input (reader .read_file (input_file_name) ) (output_file_name) private def _translate_append_with_input (input : String) (output_file_name : String) : Boolean = - writer.append_file (output_file_name) (content = tc.new_line + tc.translator.translate (input) + tc.new_line) + writer .append_file (output_file_name) (content = tc .new_line + tc .translator .translate (input) + tc .new_line) } @@ -1275,7 +1275,7 @@ trait TranslatorToScalaConstant lazy val package_scala_file_name : String = package_file_prefix + scala_extension - lazy val file_separator : String = File.separator + lazy val file_separator : String = File .separator lazy val default_prelude : String = "" @@ -1327,7 +1327,7 @@ trait TypeParameterBlockTranslator token => token .text - .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) + .replaceAll (_sc .parameter_separation_regex, _tc .scala_parameter_separator_symbol + _tc .scala_space) } diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TheoremAndProofBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/TheoremAndProofBlockTranslator.soda index 9c80acc4..718b7482 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/TheoremAndProofBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/TheoremAndProofBlockTranslator.soda @@ -31,16 +31,16 @@ class TheoremAndProofBlockTranslator ProofBlockAnnotation_ (_translate_block (block) ) _translate_block (block : AnnotatedBlock) : Block = - _append (_tc.scala_comment_closing_symbol) (_prepend (_tc.scala_comment_opening_symbol) (block) ) + _append (_tc .scala_comment_closing_symbol) (_prepend (_tc .scala_comment_opening_symbol) (block) ) _prepend (prefix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - Seq [String] (prefix + block.lines.head) .++ (block.lines.tail) + BlockBuilder_ () .build ( + Seq [String] (prefix + block .lines .head) .++ (block .lines .tail) ) _append (suffix : String) (block : Block) : Block = - BlockBuilder_ ().build ( - block.lines.:+ (suffix) + BlockBuilder_ () .build ( + block .lines .:+ (suffix) ) end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TranslationConstantToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/TranslationConstantToScala.soda index f229bd1e..73809980 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/TranslationConstantToScala.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/TranslationConstantToScala.soda @@ -183,32 +183,32 @@ class TranslationConstantToScala "\u2190" ) - type_symbol_translation : Seq [Tuple2 [String, String] ] = + type_symbol_translation : Seq [Tuple2 [String] [String] ] = Seq ( - Tuple2 (soda_constant.subtype_reserved_word, scala_subtype_symbol), - Tuple2 (soda_constant.supertype_reserved_word, scala_supertype_symbol), - Tuple2 (soda_constant.function_arrow_symbol, scala_function_arrow_symbol) + Tuple2 (soda_constant .subtype_reserved_word , scala_subtype_symbol) , + Tuple2 (soda_constant .supertype_reserved_word , scala_supertype_symbol) , + Tuple2 (soda_constant .function_arrow_symbol , scala_function_arrow_symbol) ) - function_symbol_translation : Seq [Tuple2 [String, String] ] = + function_symbol_translation : Seq [Tuple2 [String] [String] ] = Seq ( - Tuple2 (soda_constant.lambda_reserved_word, scala_empty_string), - Tuple2 (soda_constant.any_reserved_word, scala_empty_string), - Tuple2 (soda_constant.lambda_arrow_symbol, scala_lambda_arrow_symbol), - Tuple2 (soda_constant.case_arrow_symbol, scala_case_arrow_symbol), - Tuple2 (soda_constant.not_reserved_word, scala_not_symbol), - Tuple2 (soda_constant.and_reserved_word, scala_and_symbol), - Tuple2 (soda_constant.or_reserved_word, scala_or_symbol), - Tuple2 (soda_constant.if_reserved_word, scala_if_translation), - Tuple2 (soda_constant.then_reserved_word, scala_then_translation), - Tuple2 (soda_constant.parameter_definition_symbol, scala_parameter_definition_symbol), - Tuple2 (soda_constant.tail_recursion_annotation, scala_tail_recursion_annotation_translation), - Tuple2 (soda_constant.override_annotation, scala_override_annotation_translation), - Tuple2 (soda_constant.new_annotation, scala_new_annotation_translation) + Tuple2 (soda_constant .lambda_reserved_word , scala_empty_string) , + Tuple2 (soda_constant .any_reserved_word , scala_empty_string) , + Tuple2 (soda_constant .lambda_arrow_symbol , scala_lambda_arrow_symbol) , + Tuple2 (soda_constant .case_arrow_symbol , scala_case_arrow_symbol) , + Tuple2 (soda_constant .not_reserved_word , scala_not_symbol) , + Tuple2 (soda_constant .and_reserved_word , scala_and_symbol) , + Tuple2 (soda_constant .or_reserved_word , scala_or_symbol) , + Tuple2 (soda_constant .if_reserved_word , scala_if_translation) , + Tuple2 (soda_constant .then_reserved_word , scala_then_translation) , + Tuple2 (soda_constant .parameter_definition_symbol , scala_parameter_definition_symbol) , + Tuple2 (soda_constant .tail_recursion_annotation , scala_tail_recursion_annotation_translation) , + Tuple2 (soda_constant .override_annotation , scala_override_annotation_translation) , + Tuple2 (soda_constant .new_annotation , scala_new_annotation_translation) ) - all_translations : Seq [Tuple2 [String, String] ] = - type_symbol_translation.++ (function_symbol_translation) + all_translations : Seq [Tuple2 [String] [String] ] = + type_symbol_translation .++ (function_symbol_translation) class_declaration_translation_at_beginning_with_paren = "case class" @@ -218,16 +218,16 @@ class TranslationConstantToScala prefix_scala_non_soda = "__soda__" - scala_non_soda : Seq [Tuple2 [String, String] ] = + scala_non_soda : Seq [Tuple2 [String] [String] ] = scala_reserved_words - .filter (lambda x --> not soda_constant.soda_reserved_words.contains (x)) - .map (lambda x --> Tuple2 (x, prefix_scala_non_soda + x) ) + .filter (lambda x --> not soda_constant .soda_reserved_words .contains (x)) + .map (lambda x --> Tuple2 (x , prefix_scala_non_soda + x) ) is_scala_word (word : String) : Boolean = - scala_reserved_words.contains (word) + scala_reserved_words .contains (word) is_soda_word (word : String) : Boolean = - soda_constant.soda_reserved_words.contains (word) + soda_constant .soda_reserved_words .contains (word) end diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda index 3e44bf1a..fa29d656 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda @@ -26,31 +26,31 @@ class TranslatorToScala execute_for (arguments : Seq [String] ) : Boolean = match arguments.length - case 0 ==> _process_directory_with_package_option (tc.default_argument) - case 1 ==> _process_directory_with_package_option (arguments.apply (0) ) + case 0 ==> _process_directory_with_package_option (tc .default_argument) + case 1 ==> _process_directory_with_package_option (arguments .apply (0) ) case 2 ==> - if _is_single_files_option (arguments.apply (0) ) - then _process_directory_with_single_files_option (arguments.apply (1) ) + if _is_single_files_option (arguments .apply (0) ) + then _process_directory_with_single_files_option (arguments .apply (1) ) else false case 3 ==> - if _is_single_files_option (arguments.apply (0) ) - then IndividualProcessor_ ().translate (arguments.apply (1) ) (arguments.apply (2) ) + if _is_single_files_option (arguments .apply (0) ) + then IndividualProcessor_ () .translate (arguments .apply (1) ) (arguments .apply (2) ) else false case otherwise ==> false _process_directory_with_single_files_option (start : String) : Boolean = - DirectoryProcessor_ (start , IndividualProcessor_ ().process_soda_file).process () + DirectoryProcessor_ (start , IndividualProcessor_ () .process_soda_file) .process () _process_directory_with_package_option (start : String) : Boolean = - DirectoryProcessor_ (start , process_soda_file_with_package_option).process () + DirectoryProcessor_ (start , process_soda_file_with_package_option) .process () process_soda_file_with_package_option (file : File) : Boolean = - if file.getName == tc.package_file_name - then IndividualProcessor_ ().process_soda_file (file) - else PackageProcessor_ ().process_soda_file (file) + if file .getName == tc .package_file_name + then IndividualProcessor_ () .process_soda_file (file) + else PackageProcessor_ () .process_soda_file (file) _is_single_files_option (s : String) : Boolean = - (s == tc.single_files_option_1) or (s == tc.single_files_option_2) + (s == tc .single_files_option_1) or (s == tc .single_files_option_2) end @@ -68,40 +68,40 @@ class IndividualProcessor writer = SimpleFileWriter_ () process_soda_file (file : File) : Boolean = - process_soda_file_with (get_input_output_file_names (file.getAbsolutePath) ) + process_soda_file_with (get_input_output_file_names (file .getAbsolutePath) ) process_soda_file_with (pair : FileNamePair) : Boolean = - translate (pair.input_file_name) (pair.output_file_name) + translate (pair .input_file_name) (pair .output_file_name) translate (input_file_name : String) (output_file_name : String) : Boolean = _translate_with_input (_read_input_with_prelude (input_file_name) ) (output_file_name) _read_input_with_prelude (input_file_name : String) : String = if _is_a_prelude_file (input_file_name) - then reader.read_file (input_file_name) + tc.prelude_file_body - else _get_prelude (input_file_name) + reader.read_file (input_file_name) + then reader .read_file (input_file_name) + tc .prelude_file_body + else _get_prelude (input_file_name) + reader .read_file (input_file_name) _get_prelude (input_file_name : String) : String = _get_prelude_with (_get_prelude_file (input_file_name) ) _get_prelude_with (prelude_file : File) : String = - if prelude_file.exists - then (reader.read_file (prelude_file.getAbsolutePath) ) + tc.append_separation - else tc.default_prelude + if prelude_file .exists + then (reader .read_file (prelude_file .getAbsolutePath) ) + tc .append_separation + else tc .default_prelude _get_prelude_file (input_file_name : String) : File = - @new File ( @new File (input_file_name) .getParentFile , tc.package_file_name ) + @new File ( @new File (input_file_name) .getParentFile , tc .package_file_name ) _is_a_prelude_file (input_file_name : String) : Boolean = - tc.package_file_name == ( ( @new File (input_file_name) ) .getName) + tc .package_file_name == ( ( @new File (input_file_name) ) .getName) _translate_with_input (input : String) (output_file_name : String) : Boolean = - writer.write_file (output_file_name) (content := tc.translator.translate (input) ) + writer .write_file (output_file_name) (content := tc .translator .translate (input) ) get_input_output_file_names (input_name : String) : FileNamePair = - if input_name.endsWith (tc.soda_extension) - then FileNamePair_ (input_name, input_name.substring (0, input_name.length - tc.soda_extension.length) + tc.scala_extension) - else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) + if input_name .endsWith (tc .soda_extension) + then FileNamePair_ (input_name, input_name .substring (0, input_name .length - tc .soda_extension .length) + tc .scala_extension) + else FileNamePair_ (input_name + tc .soda_extension, input_name + tc .scala_extension) end @@ -119,21 +119,21 @@ class PackageProcessor writer = SimpleFileWriter_ () process_soda_file (file : File) : Boolean = - process_soda_file_with (get_input_output_file_names (file.getAbsolutePath) (file.getParent) ) + process_soda_file_with (get_input_output_file_names (file .getAbsolutePath) (file .getParent) ) process_soda_file_with (pair : FileNamePair) : Boolean = - translate_append (pair.input_file_name) (pair.output_file_name) + translate_append (pair .input_file_name) (pair .output_file_name) get_input_output_file_names (input_name : String) (parent_name : String) : FileNamePair = - if input_name.endsWith (tc.soda_extension) - then FileNamePair_ (input_name , parent_name + tc.file_separator + tc.package_scala_file_name ) - else FileNamePair_ (input_name + tc.soda_extension, input_name + tc.scala_extension) + if input_name .endsWith (tc .soda_extension) + then FileNamePair_ (input_name , parent_name + tc .file_separator + tc .package_scala_file_name ) + else FileNamePair_ (input_name + tc .soda_extension, input_name + tc .scala_extension) translate_append (input_file_name : String) (output_file_name : String) : Boolean = - _translate_append_with_input (reader.read_file (input_file_name) ) (output_file_name) + _translate_append_with_input (reader .read_file (input_file_name) ) (output_file_name) _translate_append_with_input (input : String) (output_file_name : String) : Boolean = - writer.append_file (output_file_name) (content := tc.new_line + tc.translator.translate (input) + tc.new_line) + writer .append_file (output_file_name) (content := tc .new_line + tc .translator .translate (input) + tc .new_line) end @@ -156,7 +156,7 @@ class TranslatorToScalaConstant package_scala_file_name : String = package_file_prefix + scala_extension - file_separator : String = File.separator + file_separator : String = File .separator default_prelude : String = "" diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TypeParameterBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/TypeParameterBlockTranslator.soda index 0f4017e2..fb139a1b 100644 --- a/translator/src/main/scala/soda/translator/extension/toscala/TypeParameterBlockTranslator.soda +++ b/translator/src/main/scala/soda/translator/extension/toscala/TypeParameterBlockTranslator.soda @@ -15,7 +15,7 @@ class TypeParameterBlockTranslator lambda token --> token .text - .replaceAll (_sc.parameter_separation_regex, _tc.scala_parameter_separator_symbol + _tc.scala_space) + .replaceAll (_sc .parameter_separation_regex, _tc .scala_parameter_separator_symbol + _tc .scala_space) end diff --git a/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda b/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda index 9775912f..bba8dd33 100644 --- a/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda +++ b/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda @@ -23,36 +23,36 @@ class DirectoryProcessor package_file_name = "Package.soda" _all_files : Seq [File] = - DirectoryScanner_ ().get_all_files ( @new File (start)) + DirectoryScanner_ () .get_all_files ( @new File (start)) _all_soda_files : Seq [File] = _all_files - .filter (lambda x --> x.isFile) - .filter (lambda x --> x.getName.endsWith (soda_suffix)) + .filter (lambda x --> x .isFile) + .filter (lambda x --> x .getName .endsWith (soda_suffix)) _package_files : Seq [File] = _all_files - .filter (lambda x --> x.isFile) - .filter (lambda x --> x.getName == package_file_name) + .filter (lambda x --> x .isFile) + .filter (lambda x --> x .getName == package_file_name) - _sorted_package_files : Seq [File] = _package_files.sorted + _sorted_package_files : Seq [File] = _package_files .sorted _soda_non_package_files : Seq [File] = _all_soda_files - .filter (lambda x --> not (x.getName == package_file_name) ) + .filter (lambda x --> not (x .getName == package_file_name) ) - _sorted_soda_non_package_files : Seq [File] = _soda_non_package_files.sorted + _sorted_soda_non_package_files : Seq [File] = _soda_non_package_files .sorted _soda_files : Seq [File] = - _sorted_package_files .++ (_sorted_soda_non_package_files) + _sorted_package_files .++ (_sorted_soda_non_package_files) _lib_files : Seq [File] = _all_files - .filter (lambda x --> x.isFile) - .filter (lambda file --> file.getName == LibraryDeployer_ ().library_marker_file) + .filter (lambda x --> x .isFile) + .filter (lambda file --> file .getName == LibraryDeployer_ () .library_marker_file) process () : Boolean = - LibraryDeployer_ ().expand_library (_lib_files) and + LibraryDeployer_ () .expand_library (_lib_files) and _soda_files .map (process_soda_file) .forall (lambda x --> x) diff --git a/translator/src/main/scala/soda/translator/io/DirectoryScanner.soda b/translator/src/main/scala/soda/translator/io/DirectoryScanner.soda index c8aba3e6..afa1cd60 100644 --- a/translator/src/main/scala/soda/translator/io/DirectoryScanner.soda +++ b/translator/src/main/scala/soda/translator/io/DirectoryScanner.soda @@ -1,35 +1,35 @@ /** - * This class is used to scan files in a given directory. + * This class is used to scan files in a given directory . */ class DirectoryScanner import - java.io.File + java .io.File get_all_files (start : File) : Seq [File] = - if start.isFile + if start .isFile then Seq (start) - else _scan (Seq () ) (start.listFiles ().toSeq) + else _scan (Seq () ) (start .listFiles () .toSeq) @tailrec _tailrec_scan (found : Seq [File] ) (to_scan : Seq [File] ) : Seq [File] = - if to_scan.isEmpty + if to_scan .isEmpty then found - else _tailrec_scan (found.+: (to_scan.head) ) (_get_files_to_scan (to_scan) ) + else _tailrec_scan (found .+: (to_scan .head) ) (_get_files_to_scan (to_scan) ) _scan (found : Seq [File] ) (to_scan : Seq [File] ) : Seq [File] = _tailrec_scan (found) (to_scan) _get_files_to_scan (to_scan : Seq [File] ) : Seq [File] = - if to_scan.isEmpty + if to_scan .isEmpty then to_scan - else _get_files_to_scan_with (to_scan.head) (to_scan.tail) + else _get_files_to_scan_with (to_scan .head) (to_scan .tail) _get_files_to_scan_with (to_scan_head : File) (to_scan_tail : Seq [File] ) : Seq [File] = - if to_scan_head.isDirectory - then to_scan_tail.++ (to_scan_head.listFiles () ) + if to_scan_head .isDirectory + then to_scan_tail .++ (to_scan_head .listFiles () ) else to_scan_tail end diff --git a/translator/src/main/scala/soda/translator/io/LibraryDeployer.soda b/translator/src/main/scala/soda/translator/io/LibraryDeployer.soda index 8b8841f9..a79d2bc5 100644 --- a/translator/src/main/scala/soda/translator/io/LibraryDeployer.soda +++ b/translator/src/main/scala/soda/translator/io/LibraryDeployer.soda @@ -16,16 +16,16 @@ class LibraryDeployer expand_library (lib_files : Seq [File] ) : Boolean = lib_files - .map (lambda lib_file --> lib_file.getParent) + .map (lambda lib_file --> lib_file .getParent) .map (lambda parent_directory --> _expand_files (parent_directory) ) .forall (lambda x --> x) _expand_files (parent_directory : String) : Boolean = _library_content_files .map (lambda lib_file_name --> - SimpleFileWriter_ ().write_file_with ( - file := SimpleFileWriter_ ().create_file (parent_directory) (lib_file_name) ) ( - content := SimpleFileReader_ ().read_resource (_library_directory_in_jar + lib_file_name) + SimpleFileWriter_ () .write_file_with ( + file := SimpleFileWriter_ () .create_file (parent_directory) (lib_file_name) ) ( + content := SimpleFileReader_ () .read_resource (_library_directory_in_jar + lib_file_name) ) ) .forall (lambda x --> x) diff --git a/translator/src/main/scala/soda/translator/io/Package.scala b/translator/src/main/scala/soda/translator/io/Package.scala index 897030cf..91df5beb 100644 --- a/translator/src/main/scala/soda/translator/io/Package.scala +++ b/translator/src/main/scala/soda/translator/io/Package.scala @@ -34,36 +34,36 @@ trait DirectoryProcessor lazy val package_file_name = "Package.soda" private lazy val _all_files : Seq [File] = - DirectoryScanner_ ().get_all_files ( new File (start)) + DirectoryScanner_ () .get_all_files ( new File (start)) private lazy val _all_soda_files : Seq [File] = _all_files - .filter ( x => x.isFile) - .filter ( x => x.getName.endsWith (soda_suffix)) + .filter ( x => x .isFile) + .filter ( x => x .getName .endsWith (soda_suffix)) private lazy val _package_files : Seq [File] = _all_files - .filter ( x => x.isFile) - .filter ( x => x.getName == package_file_name) + .filter ( x => x .isFile) + .filter ( x => x .getName == package_file_name) - private lazy val _sorted_package_files : Seq [File] = _package_files.sorted + private lazy val _sorted_package_files : Seq [File] = _package_files .sorted private lazy val _soda_non_package_files : Seq [File] = _all_soda_files - .filter ( x => ! (x.getName == package_file_name) ) + .filter ( x => ! (x .getName == package_file_name) ) - private lazy val _sorted_soda_non_package_files : Seq [File] = _soda_non_package_files.sorted + private lazy val _sorted_soda_non_package_files : Seq [File] = _soda_non_package_files .sorted private lazy val _soda_files : Seq [File] = - _sorted_package_files .++ (_sorted_soda_non_package_files) + _sorted_package_files .++ (_sorted_soda_non_package_files) private lazy val _lib_files : Seq [File] = _all_files - .filter ( x => x.isFile) - .filter ( file => file.getName == LibraryDeployer_ ().library_marker_file) + .filter ( x => x .isFile) + .filter ( file => file .getName == LibraryDeployer_ () .library_marker_file) def process () : Boolean = - LibraryDeployer_ ().expand_library (_lib_files) && + LibraryDeployer_ () .expand_library (_lib_files) && _soda_files .map (process_soda_file) .forall ( x => x) @@ -74,37 +74,37 @@ case class DirectoryProcessor_ (start : String, process_soda_file : java.io.File /** - * This class is used to scan files in a given directory. + * This class is used to scan files in a given directory . */ trait DirectoryScanner { - import java.io.File + import java .io.File def get_all_files (start : File) : Seq [File] = - if ( start.isFile + if ( start .isFile ) Seq (start) - else _scan (Seq () ) (start.listFiles ().toSeq) + else _scan (Seq () ) (start .listFiles () .toSeq) import scala.annotation.tailrec @tailrec final private def _tailrec_scan (found : Seq [File] ) (to_scan : Seq [File] ) : Seq [File] = - if ( to_scan.isEmpty + if ( to_scan .isEmpty ) found - else _tailrec_scan (found.+: (to_scan.head) ) (_get_files_to_scan (to_scan) ) + else _tailrec_scan (found .+: (to_scan .head) ) (_get_files_to_scan (to_scan) ) private def _scan (found : Seq [File] ) (to_scan : Seq [File] ) : Seq [File] = _tailrec_scan (found) (to_scan) private def _get_files_to_scan (to_scan : Seq [File] ) : Seq [File] = - if ( to_scan.isEmpty + if ( to_scan .isEmpty ) to_scan - else _get_files_to_scan_with (to_scan.head) (to_scan.tail) + else _get_files_to_scan_with (to_scan .head) (to_scan .tail) private def _get_files_to_scan_with (to_scan_head : File) (to_scan_tail : Seq [File] ) : Seq [File] = - if ( to_scan_head.isDirectory - ) to_scan_tail.++ (to_scan_head.listFiles () ) + if ( to_scan_head .isDirectory + ) to_scan_tail .++ (to_scan_head .listFiles () ) else to_scan_tail } @@ -129,16 +129,16 @@ trait LibraryDeployer def expand_library (lib_files : Seq [File] ) : Boolean = lib_files - .map ( lib_file => lib_file.getParent) + .map ( lib_file => lib_file .getParent) .map ( parent_directory => _expand_files (parent_directory) ) .forall ( x => x) private def _expand_files (parent_directory : String) : Boolean = _library_content_files .map ( lib_file_name => - SimpleFileWriter_ ().write_file_with ( - file = SimpleFileWriter_ ().create_file (parent_directory) (lib_file_name) ) ( - content = SimpleFileReader_ ().read_resource (_library_directory_in_jar + lib_file_name) + SimpleFileWriter_ () .write_file_with ( + file = SimpleFileWriter_ () .create_file (parent_directory) (lib_file_name) ) ( + content = SimpleFileReader_ () .read_resource (_library_directory_in_jar + lib_file_name) ) ) .forall ( x => x) @@ -164,16 +164,16 @@ trait SimpleFileReader lazy val new_line = "\n" def read_file (file_name : String) : String = - new String (Files.readAllBytes (Paths.get (file_name) ) ) + new String (Files .readAllBytes (Paths .get (file_name) ) ) def read_resource (file_name : String) : String = - read_input_stream (getClass.getResourceAsStream (file_name) ) + read_input_stream (getClass .getResourceAsStream (file_name) ) def read_input_stream (input_stream : InputStream) : String = _read_reader_content ( new BufferedReader ( new InputStreamReader (input_stream) ) ) private def _read_reader_content (reader : BufferedReader) : String = - reader.lines ().collect (Collectors.joining (new_line) ) + reader .lines () .collect (Collectors .joining (new_line) ) } @@ -192,16 +192,16 @@ trait SimpleFileWriter import java.io.Writer def write_file (file_name : String) (content : String) : Boolean = - write_file_with ( new File (file_name) ) (content) + write_file_with (new File (file_name) ) (content) def write_file_with (file : File) (content : String) : Boolean = - _write_content ( new FileWriter (file , false) ) (content) + _write_content (new FileWriter (file , false) ) (content) def append_file (file_name : String) (content : String) : Boolean = - append_file_with ( new File (file_name) ) (content) + append_file_with (new File (file_name) ) (content) def append_file_with (file : File) (content : String) : Boolean = - _write_content ( new FileWriter (file , true) ) (content) + _write_content (new FileWriter (file , true) ) (content) private def _write_content (writer : Writer) (content : String) : Boolean = SomeSD_ (true) @@ -212,7 +212,7 @@ trait SimpleFileWriter .getOrElse (false) def create_file (parent_directory : String) (file_name : String) : File = - new File (parent_directory, file_name) + new File (parent_directory , file_name) } diff --git a/translator/src/main/scala/soda/translator/io/SimpleIO.soda b/translator/src/main/scala/soda/translator/io/SimpleIO.soda index 2ae8a4b2..5d61fb04 100644 --- a/translator/src/main/scala/soda/translator/io/SimpleIO.soda +++ b/translator/src/main/scala/soda/translator/io/SimpleIO.soda @@ -16,16 +16,16 @@ class SimpleFileReader new_line = "\n" read_file (file_name : String) : String = - @new String (Files.readAllBytes (Paths.get (file_name) ) ) + @new String (Files .readAllBytes (Paths .get (file_name) ) ) read_resource (file_name : String) : String = - read_input_stream (getClass.getResourceAsStream (file_name) ) + read_input_stream (getClass .getResourceAsStream (file_name) ) read_input_stream (input_stream : InputStream) : String = _read_reader_content ( @new BufferedReader ( @new InputStreamReader (input_stream) ) ) _read_reader_content (reader : BufferedReader) : String = - reader.lines ().collect (Collectors.joining (new_line) ) + reader .lines () .collect (Collectors .joining (new_line) ) end @@ -42,16 +42,16 @@ class SimpleFileWriter java.io.Writer write_file (file_name : String) (content : String) : Boolean = - write_file_with ( @new File (file_name) ) (content) + write_file_with (@new File (file_name) ) (content) write_file_with (file : File) (content : String) : Boolean = - _write_content ( @new FileWriter (file , false) ) (content) + _write_content (@new FileWriter (file , false) ) (content) append_file (file_name : String) (content : String) : Boolean = - append_file_with ( @new File (file_name) ) (content) + append_file_with (@new File (file_name) ) (content) append_file_with (file : File) (content : String) : Boolean = - _write_content ( @new FileWriter (file , true) ) (content) + _write_content (@new FileWriter (file , true) ) (content) _write_content (writer : Writer) (content : String) : Boolean = SomeSD_ (true) @@ -62,7 +62,7 @@ class SimpleFileWriter .getOrElse (false) create_file (parent_directory : String) (file_name : String) : File = - @new File (parent_directory, file_name) + @new File (parent_directory , file_name) end diff --git a/translator/src/main/scala/soda/translator/parser/BlockBuilder.soda b/translator/src/main/scala/soda/translator/parser/BlockBuilder.soda index e094b242..af8b24f4 100644 --- a/translator/src/main/scala/soda/translator/parser/BlockBuilder.soda +++ b/translator/src/main/scala/soda/translator/parser/BlockBuilder.soda @@ -22,23 +22,23 @@ class BlockBuilder .annotated_lines_rev .reverse - _get_annotated_lines_initial_value : PreprocessorFoldTuple = PreprocessorFoldTuple_ (false, Seq () ) + _get_annotated_lines_initial_value : PreprocessorFoldTuple = PreprocessorFoldTuple_ (false , Seq () ) _get_annotated_lines_next_value_function (pair : PreprocessorFoldTuple) (line : String) : PreprocessorFoldTuple = - _get_annotated_lines_next_value_function_with (_annotate_this_line (line) (pair.comment_state) ) (pair) (line) + _get_annotated_lines_next_value_function_with (_annotate_this_line (line) (pair .comment_state) ) (pair) (line) _get_annotated_lines_next_value_function_with (t : CurrentAndNewCommentState) (pair : PreprocessorFoldTuple) (line : String) : PreprocessorFoldTuple = - PreprocessorFoldTuple_ (t.new_comment_state, pair.annotated_lines_rev.+: (AnnotatedLine_ (line, t.current_state) ) ) + PreprocessorFoldTuple_ (t .new_comment_state , pair .annotated_lines_rev .+: (AnnotatedLine_ (line , t .current_state) ) ) _annotate_this_line (line : String) (comment_state : Boolean) : CurrentAndNewCommentState = if comment_state - then CurrentAndNewCommentState_ (true, not line.trim.endsWith (_sc.comment_closing_symbol) ) + then CurrentAndNewCommentState_ (true , not line .trim .endsWith (_sc .comment_closing_symbol) ) else _annotate_this_line_considering_opening_symbol (line) (comment_state) _annotate_this_line_considering_opening_symbol (line : String) (comment_state : Boolean) : CurrentAndNewCommentState = - if line.trim.startsWith (_sc.comment_opening_symbol) - then CurrentAndNewCommentState_ (true, not line.trim.endsWith (_sc.comment_closing_symbol) ) - else CurrentAndNewCommentState_ (false, false) + if line .trim .startsWith (_sc .comment_opening_symbol) + then CurrentAndNewCommentState_ (true , not line .trim .endsWith (_sc .comment_closing_symbol) ) + else CurrentAndNewCommentState_ (false , false) end diff --git a/translator/src/main/scala/soda/translator/parser/BlockProcessor.soda b/translator/src/main/scala/soda/translator/parser/BlockProcessor.soda index b7415bb0..6dcb927d 100644 --- a/translator/src/main/scala/soda/translator/parser/BlockProcessor.soda +++ b/translator/src/main/scala/soda/translator/parser/BlockProcessor.soda @@ -28,7 +28,7 @@ class BlockProcessor translate (program : String) : String = join_translated_blocks ( - translator_with_preprocessor.translate ( + translator_with_preprocessor .translate ( split_blocks (program) .map (lambda block --> process_unicode_symbols_in_block (block) ) .map (lambda block --> make_block (block) ) @@ -47,36 +47,36 @@ class BlockProcessor .mkString process_unicode_symbols_in_token (token : Token) : String = - if (token.parser_state == ParserStateEnum_ ().plain) - then replace_unicode_symbols_in_string (token.text) - else token.text + if (token .parser_state == ParserStateEnum_ () .plain) + then replace_unicode_symbols_in_string (token .text) + else token .text replace_unicode_symbols_in_string (text : String) : String = - fold (_sc.soda_unicode_symbols) (text) (_replace_one_unicode_symbol) + fold (_sc .soda_unicode_symbols) (text) (_replace_one_unicode_symbol) _replace_one_unicode_symbol (text : String) (symbol_pair : Tuple2 [String , String] ) : String = Replacement_ (text) - .replace_all (symbol_pair._1) (symbol_pair._2) + .replace_all (symbol_pair ._1) (symbol_pair ._2) .line make_blocks (blocks: Seq [String] ) : Seq[AnnotatedBlock] = - blocks.map (lambda paragraph --> make_block (paragraph) ) + blocks .map (lambda paragraph --> make_block (paragraph) ) make_block (paragraph : String) : AnnotatedBlock = - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( - remove_empty_lines (paragraph.split (new_line).toIndexedSeq) + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( + remove_empty_lines (paragraph .split (new_line) .toIndexedSeq) ) ) join_translated_blocks (blocks : Seq [AnnotatedBlock] ) : String = blocks - .map (lambda x --> x.contents) + .map (lambda x --> x .contents) .mkString (double_new_line) + new_line remove_empty_lines (lines : Seq [String] ) : Seq [String] = lines - .filter (lambda line --> line.trim.nonEmpty) + .filter (lambda line --> line .trim .nonEmpty) end diff --git a/translator/src/main/scala/soda/translator/parser/Package.scala b/translator/src/main/scala/soda/translator/parser/Package.scala index 9d448aba..d6350963 100644 --- a/translator/src/main/scala/soda/translator/parser/Package.scala +++ b/translator/src/main/scala/soda/translator/parser/Package.scala @@ -31,23 +31,23 @@ trait BlockBuilder .annotated_lines_rev .reverse - private lazy val _get_annotated_lines_initial_value : PreprocessorFoldTuple = PreprocessorFoldTuple_ (false, Seq () ) + private lazy val _get_annotated_lines_initial_value : PreprocessorFoldTuple = PreprocessorFoldTuple_ (false , Seq () ) private def _get_annotated_lines_next_value_function (pair : PreprocessorFoldTuple) (line : String) : PreprocessorFoldTuple = - _get_annotated_lines_next_value_function_with (_annotate_this_line (line) (pair.comment_state) ) (pair) (line) + _get_annotated_lines_next_value_function_with (_annotate_this_line (line) (pair .comment_state) ) (pair) (line) private def _get_annotated_lines_next_value_function_with (t : CurrentAndNewCommentState) (pair : PreprocessorFoldTuple) (line : String) : PreprocessorFoldTuple = - PreprocessorFoldTuple_ (t.new_comment_state, pair.annotated_lines_rev.+: (AnnotatedLine_ (line, t.current_state) ) ) + PreprocessorFoldTuple_ (t .new_comment_state , pair .annotated_lines_rev .+: (AnnotatedLine_ (line , t .current_state) ) ) private def _annotate_this_line (line : String) (comment_state : Boolean) : CurrentAndNewCommentState = if ( comment_state - ) CurrentAndNewCommentState_ (true, ! line.trim.endsWith (_sc.comment_closing_symbol) ) + ) CurrentAndNewCommentState_ (true , ! line .trim .endsWith (_sc .comment_closing_symbol) ) else _annotate_this_line_considering_opening_symbol (line) (comment_state) private def _annotate_this_line_considering_opening_symbol (line : String) (comment_state : Boolean) : CurrentAndNewCommentState = - if ( line.trim.startsWith (_sc.comment_opening_symbol) - ) CurrentAndNewCommentState_ (true, ! line.trim.endsWith (_sc.comment_closing_symbol) ) - else CurrentAndNewCommentState_ (false, false) + if ( line .trim .startsWith (_sc .comment_opening_symbol) + ) CurrentAndNewCommentState_ (true , ! line .trim .endsWith (_sc .comment_closing_symbol) ) + else CurrentAndNewCommentState_ (false , false) } @@ -102,7 +102,7 @@ trait BlockProcessor def translate (program : String) : String = join_translated_blocks ( - translator_with_preprocessor.translate ( + translator_with_preprocessor .translate ( split_blocks (program) .map ( block => process_unicode_symbols_in_block (block) ) .map ( block => make_block (block) ) @@ -121,36 +121,36 @@ trait BlockProcessor .mkString def process_unicode_symbols_in_token (token : Token) : String = - if ( (token.parser_state == ParserStateEnum_ ().plain) - ) replace_unicode_symbols_in_string (token.text) - else token.text + if ( (token .parser_state == ParserStateEnum_ () .plain) + ) replace_unicode_symbols_in_string (token .text) + else token .text def replace_unicode_symbols_in_string (text : String) : String = - fold (_sc.soda_unicode_symbols) (text) (_replace_one_unicode_symbol) + fold (_sc .soda_unicode_symbols) (text) (_replace_one_unicode_symbol) private def _replace_one_unicode_symbol (text : String) (symbol_pair : Tuple2 [String , String] ) : String = Replacement_ (text) - .replace_all (symbol_pair._1) (symbol_pair._2) + .replace_all (symbol_pair ._1) (symbol_pair ._2) .line def make_blocks (blocks: Seq [String] ) : Seq[AnnotatedBlock] = - blocks.map ( paragraph => make_block (paragraph) ) + blocks .map ( paragraph => make_block (paragraph) ) def make_block (paragraph : String) : AnnotatedBlock = - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( - remove_empty_lines (paragraph.split (new_line).toIndexedSeq) + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( + remove_empty_lines (paragraph .split (new_line) .toIndexedSeq) ) ) def join_translated_blocks (blocks : Seq [AnnotatedBlock] ) : String = blocks - .map ( x => x.contents) + .map ( x => x .contents) .mkString (double_new_line) + new_line def remove_empty_lines (lines : Seq [String] ) : Seq [String] = lines - .filter ( line => line.trim.nonEmpty) + .filter ( line => line .trim .nonEmpty) } @@ -182,26 +182,26 @@ trait PreprocessorSequenceTranslator private lazy val _fold = Fold_ () - lazy val empty_line = AnnotatedLine_ ("", true) + lazy val empty_line = AnnotatedLine_ ("" , true) lazy val translate : Seq [AnnotatedBlock] => Seq [AnnotatedBlock] = block_sequence => translate_for (block_sequence) def translate_for (block_sequence : Seq [AnnotatedBlock] ) : Seq [AnnotatedBlock] = - translator.translate ( + translator .translate ( _get_second_pass ( _get_first_pass (block_sequence) ) ) private def _get_first_pass (block_sequence : Seq [AnnotatedBlock] ) : Seq [AnnotatedBlock] = - block_sequence.map ( block => block_annotator.translate (block) ) + block_sequence .map ( block => block_annotator .translate (block) ) private def _get_second_pass (block_sequence : Seq [AnnotatedBlock] ) : Seq [AnnotatedBlock] = - _fold.apply (block_sequence.indices) (_get_second_pass_initial_value (block_sequence) ) (_get_second_pass_next_value_function) - .accumulated - .reverse + _fold .apply (block_sequence .indices) (_get_second_pass_initial_value (block_sequence) ) (_get_second_pass_next_value_function) + .accumulated + .reverse private def _get_second_pass_initial_value (block_sequence : Seq [AnnotatedBlock] ) : AuxiliaryTuple = AuxiliaryTuple_ ( @@ -214,40 +214,40 @@ trait PreprocessorSequenceTranslator _pass_next_step (current) (index) (_get_additional_information (current) (index) ) private def _get_additional_information (current : AuxiliaryTuple) (index : Int) : AnnotatedBlock = - current.block_sequence.apply (index) match { - case AbstractDeclarationAnnotation_ (block, references) => _get_abstract_declaration_updated_block (current) (AbstractDeclarationAnnotation_ (block, references) ) - case ClassEndAnnotation_ (block, references) => _get_class_end_updated_block (current) (ClassEndAnnotation_ (block, references) ) - case otherwise => current.block_sequence.apply (index) + current .block_sequence .apply (index) match { + case AbstractDeclarationAnnotation_ (block , references) => _get_abstract_declaration_updated_block (current) (AbstractDeclarationAnnotation_ (block , references) ) + case ClassEndAnnotation_ (block , references) => _get_class_end_updated_block (current) (ClassEndAnnotation_ (block , references) ) + case otherwise => current .block_sequence .apply (index) } private def _get_abstract_declaration_updated_block (current : AuxiliaryTuple) (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = - AbstractDeclarationAnnotation_ (block.block, block.references.++ (current.references.headOption.getOrElse (Seq [AnnotatedBlock] () ) ) ) + AbstractDeclarationAnnotation_ (block .block , block .references .++ (current .references .headOption .getOrElse (Seq [AnnotatedBlock] () ) ) ) private def _get_class_end_updated_block (current : AuxiliaryTuple) (block : ClassEndAnnotation) : ClassEndAnnotation = - ClassEndAnnotation_ (block.block, block.references.++ (current.references.headOption.getOrElse (Seq [AnnotatedBlock] () ) ) ) + ClassEndAnnotation_ (block .block , block .references .++ (current .references .headOption .getOrElse (Seq [AnnotatedBlock] () ) ) ) private def _pass_next_step (current : AuxiliaryTuple) (index : Int) (updated_block : AnnotatedBlock ) : AuxiliaryTuple = AuxiliaryTuple_ ( - block_sequence = current.block_sequence, - accumulated = current.accumulated.+: (updated_block), + block_sequence = current .block_sequence, + accumulated = current .accumulated .+: (updated_block), references = _update_references (current) (index) ) private def _update_references (current : AuxiliaryTuple) (index : Int) : Seq [Seq [AnnotatedBlock] ] = - current.block_sequence.apply (index) match { - case ClassBeginningAnnotation_ (b) => current.references.+: (Seq [AnnotatedBlock] (ClassBeginningAnnotation_ (b) ) ) - case AbstractDeclarationAnnotation_ (b, references) => _update_first_element (current.references) (AbstractDeclarationAnnotation_ (b, references) ) - case ClassEndAnnotation_ (b, references) => _tail_non_empty (current.references) - case otherwise => current.references + current .block_sequence .apply (index) match { + case ClassBeginningAnnotation_ (b) => current .references .+: (Seq [AnnotatedBlock] (ClassBeginningAnnotation_ (b) ) ) + case AbstractDeclarationAnnotation_ (b , references) => _update_first_element (current .references) (AbstractDeclarationAnnotation_ (b , references) ) + case ClassEndAnnotation_ (b , references) => _tail_non_empty (current .references) + case otherwise => current .references } private def _update_first_element (s : Seq [Seq [AnnotatedBlock] ] ) (b : AnnotatedBlock) : Seq [Seq [AnnotatedBlock] ] = - _tail_non_empty (s).+: (s.headOption.getOrElse (Seq [AnnotatedBlock] () ).+: (b) ) + _tail_non_empty (s) .+: (s .headOption .getOrElse (Seq [AnnotatedBlock] () ) .+: (b) ) private def _tail_non_empty [A] (s : Seq [A] ) : Seq [A] = - if ( s.isEmpty + if ( s .isEmpty ) s - else s.tail + else s .tail } @@ -474,7 +474,7 @@ trait SodaConstant ) lazy val soda_reserved_words : Seq [String] = - soda_reserved_words_words_only.++ (soda_reserved_words_symbols_only.++ (soda_reserved_words_annotations_only) ) + soda_reserved_words_words_only .++ (soda_reserved_words_symbols_only .++ (soda_reserved_words_annotations_only) ) lazy val soda_unicode_symbols : Seq [Tuple2 [String, String] ] = Seq ( diff --git a/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda b/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda index 4603b7a1..083174a6 100644 --- a/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda +++ b/translator/src/main/scala/soda/translator/parser/PreprocessorSequenceTranslator.soda @@ -25,26 +25,26 @@ class PreprocessorSequenceTranslator _fold = Fold_ () - empty_line = AnnotatedLine_ ("", true) + empty_line = AnnotatedLine_ ("" , true) translate : Seq [AnnotatedBlock] -> Seq [AnnotatedBlock] = lambda block_sequence --> translate_for (block_sequence) translate_for (block_sequence : Seq [AnnotatedBlock] ) : Seq [AnnotatedBlock] = - translator.translate ( + translator .translate ( _get_second_pass ( _get_first_pass (block_sequence) ) ) _get_first_pass (block_sequence : Seq [AnnotatedBlock] ) : Seq [AnnotatedBlock] = - block_sequence.map (lambda block --> block_annotator.translate (block) ) + block_sequence .map (lambda block --> block_annotator .translate (block) ) _get_second_pass (block_sequence : Seq [AnnotatedBlock] ) : Seq [AnnotatedBlock] = - _fold.apply (block_sequence.indices) (_get_second_pass_initial_value (block_sequence) ) (_get_second_pass_next_value_function) - .accumulated - .reverse + _fold .apply (block_sequence .indices) (_get_second_pass_initial_value (block_sequence) ) (_get_second_pass_next_value_function) + .accumulated + .reverse _get_second_pass_initial_value (block_sequence : Seq [AnnotatedBlock] ) : AuxiliaryTuple = AuxiliaryTuple_ ( @@ -57,38 +57,38 @@ class PreprocessorSequenceTranslator _pass_next_step (current) (index) (_get_additional_information (current) (index) ) _get_additional_information (current : AuxiliaryTuple) (index : Int) : AnnotatedBlock = - match current.block_sequence.apply (index) - case AbstractDeclarationAnnotation_ (block, references) ==> _get_abstract_declaration_updated_block (current) (AbstractDeclarationAnnotation_ (block, references) ) - case ClassEndAnnotation_ (block, references) ==> _get_class_end_updated_block (current) (ClassEndAnnotation_ (block, references) ) - case otherwise ==> current.block_sequence.apply (index) + match current .block_sequence .apply (index) + case AbstractDeclarationAnnotation_ (block , references) ==> _get_abstract_declaration_updated_block (current) (AbstractDeclarationAnnotation_ (block , references) ) + case ClassEndAnnotation_ (block , references) ==> _get_class_end_updated_block (current) (ClassEndAnnotation_ (block , references) ) + case otherwise ==> current .block_sequence .apply (index) _get_abstract_declaration_updated_block (current : AuxiliaryTuple) (block : AbstractDeclarationAnnotation) : AbstractDeclarationAnnotation = - AbstractDeclarationAnnotation_ (block.block, block.references.++ (current.references.headOption.getOrElse (Seq [AnnotatedBlock] () ) ) ) + AbstractDeclarationAnnotation_ (block .block , block .references .++ (current .references .headOption .getOrElse (Seq [AnnotatedBlock] () ) ) ) _get_class_end_updated_block (current : AuxiliaryTuple) (block : ClassEndAnnotation) : ClassEndAnnotation = - ClassEndAnnotation_ (block.block, block.references.++ (current.references.headOption.getOrElse (Seq [AnnotatedBlock] () ) ) ) + ClassEndAnnotation_ (block .block , block .references .++ (current .references .headOption .getOrElse (Seq [AnnotatedBlock] () ) ) ) _pass_next_step (current : AuxiliaryTuple) (index : Int) (updated_block : AnnotatedBlock ) : AuxiliaryTuple = AuxiliaryTuple_ ( - block_sequence := current.block_sequence, - accumulated := current.accumulated.+: (updated_block), + block_sequence := current .block_sequence, + accumulated := current .accumulated .+: (updated_block), references := _update_references (current) (index) ) _update_references (current : AuxiliaryTuple) (index : Int) : Seq [Seq [AnnotatedBlock] ] = - match current.block_sequence.apply (index) - case ClassBeginningAnnotation_ (b) ==> current.references.+: (Seq [AnnotatedBlock] (ClassBeginningAnnotation_ (b) ) ) - case AbstractDeclarationAnnotation_ (b, references) ==> _update_first_element (current.references) (AbstractDeclarationAnnotation_ (b, references) ) - case ClassEndAnnotation_ (b, references) ==> _tail_non_empty (current.references) - case otherwise ==> current.references + match current .block_sequence .apply (index) + case ClassBeginningAnnotation_ (b) ==> current .references .+: (Seq [AnnotatedBlock] (ClassBeginningAnnotation_ (b) ) ) + case AbstractDeclarationAnnotation_ (b , references) ==> _update_first_element (current .references) (AbstractDeclarationAnnotation_ (b , references) ) + case ClassEndAnnotation_ (b , references) ==> _tail_non_empty (current .references) + case otherwise ==> current .references _update_first_element (s : Seq [Seq [AnnotatedBlock] ] ) (b : AnnotatedBlock) : Seq [Seq [AnnotatedBlock] ] = - _tail_non_empty (s).+: (s.headOption.getOrElse (Seq [AnnotatedBlock] () ).+: (b) ) + _tail_non_empty (s) .+: (s .headOption .getOrElse (Seq [AnnotatedBlock] () ) .+: (b) ) _tail_non_empty [A] (s : Seq [A] ) : Seq [A] = - if s.isEmpty + if s .isEmpty then s - else s.tail + else s .tail end diff --git a/translator/src/main/scala/soda/translator/parser/SodaConstant.soda b/translator/src/main/scala/soda/translator/parser/SodaConstant.soda index b7aba5a7..a0153153 100644 --- a/translator/src/main/scala/soda/translator/parser/SodaConstant.soda +++ b/translator/src/main/scala/soda/translator/parser/SodaConstant.soda @@ -207,7 +207,7 @@ class SodaConstant ) soda_reserved_words : Seq [String] = - soda_reserved_words_words_only.++ (soda_reserved_words_symbols_only.++ (soda_reserved_words_annotations_only) ) + soda_reserved_words_words_only .++ (soda_reserved_words_symbols_only .++ (soda_reserved_words_annotations_only) ) soda_unicode_symbols : Seq [Tuple2 [String, String] ] = Seq ( diff --git a/translator/src/main/scala/soda/translator/parser/annotation/AbstractDeclarationAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/AbstractDeclarationAnnotation.soda index b851dc61..b500aea1 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/AbstractDeclarationAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/AbstractDeclarationAnnotation.soda @@ -12,18 +12,18 @@ class AbstractDeclarationAnnotation soda.translator.block.BlockAnnotationEnum_ soda.translator.parser.SodaConstant_ - identifier = BlockAnnotationEnum_ ().abstract_declaration + identifier = BlockAnnotationEnum_ () .abstract_declaration applies : Boolean = - block.readable_lines.nonEmpty and - (block.readable_lines.head.line.trim == SodaConstant_ ().abstract_reserved_word) + block .readable_lines .nonEmpty and + (block .readable_lines .head .line .trim == SodaConstant_ () .abstract_reserved_word) abstract_functions_with_comments : Seq [AnnotatedLine] = content_lines abstract_functions : Seq [AnnotatedLine] = abstract_functions_with_comments - .filter (lambda line --> not line.is_comment) + .filter (lambda line --> not line .is_comment) end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda b/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda index 16a2a8bf..93ee215f 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/AnnotationFactory.soda @@ -14,21 +14,21 @@ class AnnotationFactory translate_for (block) translate_for (block : AnnotatedBlock) : AnnotatedBlock = - if block.block_annotation == BlockAnnotationEnum_ ().undefined + if block .block_annotation == BlockAnnotationEnum_ () .undefined then annotate (block) else block annotate (block : Block) : AnnotatedBlock = match block - case AnnotatedBlock_ (annotated_lines, block_annotation) ==> AnnotatedBlock_ (annotated_lines, block_annotation) + case AnnotatedBlock_ (annotated_lines, block_annotation) ==> AnnotatedBlock_ (annotated_lines , block_annotation) case otherwise ==> _get_first_or_undefined (_find_candidates (block) ) (block) update_block (original_content : AnnotatedBlock) (new_content : Block) : AnnotatedBlock = match original_content case FunctionDefinitionAnnotation_ (b) ==> FunctionDefinitionAnnotation_ (new_content) case ClassBeginningAnnotation_ (b) ==> ClassBeginningAnnotation_ (new_content) - case ClassEndAnnotation_ (b, references) ==> ClassEndAnnotation_ (new_content, references) - case AbstractDeclarationAnnotation_ (b, references) ==> AbstractDeclarationAnnotation_ (new_content, references) + case ClassEndAnnotation_ (b , references) ==> ClassEndAnnotation_ (new_content , references) + case AbstractDeclarationAnnotation_ (b , references) ==> AbstractDeclarationAnnotation_ (new_content , references) case ImportDeclarationAnnotation_ (b) ==> ImportDeclarationAnnotation_ (new_content) case PackageDeclarationAnnotation_ (b) ==> PackageDeclarationAnnotation_ (new_content) case ClassAliasAnnotation_ (b) ==> ClassAliasAnnotation_ (new_content) @@ -36,14 +36,14 @@ class AnnotationFactory case ProofBlockAnnotation_ (b) ==> ProofBlockAnnotation_ (new_content) case CommentAnnotation_ (b) ==> CommentAnnotation_ (new_content) case TestDeclarationAnnotation_ (b) ==> TestDeclarationAnnotation_ (new_content) - case otherwise ==> AnnotatedBlock_ (new_content.annotated_lines, original_content.block_annotation) + case otherwise ==> AnnotatedBlock_ (new_content .annotated_lines , original_content .block_annotation) _detectors (block : Block) : Seq [BlockAnnotationParser] = Seq ( FunctionDefinitionAnnotation_ (block), ClassBeginningAnnotation_ (block), - ClassEndAnnotation_ (block, Seq [BlockAnnotationParser] () ), - AbstractDeclarationAnnotation_ (block, Seq [BlockAnnotationParser] () ), + ClassEndAnnotation_ (block , Seq [BlockAnnotationParser] () ), + AbstractDeclarationAnnotation_ (block , Seq [BlockAnnotationParser] () ), ImportDeclarationAnnotation_ (block), PackageDeclarationAnnotation_ (block), ClassAliasAnnotation_ (block), @@ -55,12 +55,12 @@ class AnnotationFactory _find_candidates (block : Block) : Seq [BlockAnnotationParser] = _detectors (block) - .filter (lambda detector --> detector.applies) + .filter (lambda detector --> detector .applies) _get_first_or_undefined (candidates : Seq [BlockAnnotationParser] ) (block : Block) : AnnotatedBlock = - if candidates.length == 1 - then candidates.head - else AnnotatedBlock_ (block.annotated_lines, BlockAnnotationEnum_ ().undefined ) + if candidates .length == 1 + then candidates .head + else AnnotatedBlock_ (block .annotated_lines , BlockAnnotationEnum_ () .undefined ) end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/BlockAnnotationParser.soda b/translator/src/main/scala/soda/translator/parser/annotation/BlockAnnotationParser.soda index 724c80e2..48271897 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/BlockAnnotationParser.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/BlockAnnotationParser.soda @@ -15,44 +15,44 @@ class BlockAnnotationParser soda.translator.block.BlockAnnotationId soda.translator.parser.SodaConstant_ - space = SodaConstant_ ().space + space = SodaConstant_ () .space default_annotated_line = AnnotatedLine_ ("", true) - annotated_lines : Seq [AnnotatedLine] = block.annotated_lines + annotated_lines : Seq [AnnotatedLine] = block .annotated_lines block_annotation : BlockAnnotationId = identifier starts_with_prefix_and_space (prefix : String) : Boolean = - block.readable_lines.nonEmpty and - block.readable_lines.head.line.trim.startsWith (prefix + space) + block .readable_lines .nonEmpty and + block .readable_lines .head .line .trim .startsWith (prefix + space) content_lines : Seq [AnnotatedLine] = - if block.readable_lines.isEmpty - then block.annotated_lines + if block .readable_lines .isEmpty + then block .annotated_lines else block .annotated_lines .tail - .filter (lambda x -> not x.line.trim.isEmpty) + .filter (lambda x -> not x .line .trim .isEmpty) first_readable_line : AnnotatedLine = - block.readable_lines.headOption.getOrElse (default_annotated_line) + block .readable_lines .headOption .getOrElse (default_annotated_line) get_first_word (line : String) : String = - (_get_first_word_with (line.trim.indexOf (space) ) (line) ).trim + (_get_first_word_with (line .trim .indexOf (space) ) (line) ) .trim _get_first_word_with (index : Int) (line : String) : String = if index >= 0 - then line.substring (0, index) + then line .substring (0, index) else line skip_first_word (line : String) : String = - (_skip_first_word_with (line.trim.indexOf (space) ) (line) ).trim + (_skip_first_word_with (line .trim .indexOf (space) ) (line) ) .trim _skip_first_word_with (index : Int) (line : String) : String = if index >= 0 - then line.trim.substring (index) + then line .trim .substring (index) else "" end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/ClassAliasAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/ClassAliasAnnotation.soda index 7658515a..2e067ff8 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/ClassAliasAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/ClassAliasAnnotation.soda @@ -10,16 +10,16 @@ class ClassAliasAnnotation soda.translator.block.BlockAnnotationEnum_ soda.translator.parser.SodaConstant_ - identifier = BlockAnnotationEnum_ ().class_alias + identifier = BlockAnnotationEnum_ () .class_alias sc = SodaConstant_ () applies : Boolean = - starts_with_prefix_and_space (sc.class_reserved_word) and + starts_with_prefix_and_space (sc .class_reserved_word) and _contains_the_equals_symbol _contains_the_equals_symbol : Boolean = - FunctionDefinitionAnnotation_ (block).contains_the_equals_symbol + FunctionDefinitionAnnotation_ (block) .contains_the_equals_symbol end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda index 5640fc5c..ceea657d 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/ClassBeginningAnnotation.soda @@ -10,44 +10,44 @@ class ClassBeginningAnnotation soda.translator.block.BlockAnnotationEnum_ soda.translator.parser.SodaConstant_ - identifier = BlockAnnotationEnum_ ().class_beginning + identifier = BlockAnnotationEnum_ () .class_beginning sc = SodaConstant_ () applies : Boolean = - starts_with_prefix_and_space (sc.class_reserved_word) and + starts_with_prefix_and_space (sc .class_reserved_word) and not _contains_the_equals_symbol _contains_the_equals_symbol : Boolean = - FunctionDefinitionAnnotation_ (block).contains_the_equals_symbol + FunctionDefinitionAnnotation_ (block) .contains_the_equals_symbol _contains_an_opening_parenthesis : Boolean = - first_readable_line.line.contains (sc.opening_parenthesis_symbol) + first_readable_line .line .contains (sc .opening_parenthesis_symbol) _class_name_and_type_parameters : String = - skip_first_word (first_readable_line.line) + skip_first_word (first_readable_line .line) class_name : String = get_first_word (_class_name_and_type_parameters) type_parameters_and_bounds : Seq [String] = remove_brackets (skip_first_word (_class_name_and_type_parameters) ) - .split (sc.parameter_separation_regex) + .split (sc .parameter_separation_regex) .toIndexedSeq - .map (lambda parameter --> parameter.trim) - .filter (lambda parameter --> not parameter.isEmpty) + .map (lambda parameter --> parameter .trim) + .filter (lambda parameter --> not parameter .isEmpty) type_parameters : Seq [String] = type_parameters_and_bounds - .map (lambda parameter --> get_first_word (parameter) ) + .map (lambda parameter --> get_first_word (parameter) ) remove_brackets (text : String) : String = - remove_brackets_with (text.trim) + remove_brackets_with (text .trim) remove_brackets_with (trimmed_text : String) : String = - if trimmed_text.startsWith (sc.opening_bracket_symbol) and - trimmed_text.endsWith (sc.closing_bracket_symbol) - then trimmed_text.substring (sc.opening_bracket_symbol.length, trimmed_text.length - sc.closing_bracket_symbol.length) + if trimmed_text .startsWith (sc .opening_bracket_symbol) and + trimmed_text .endsWith (sc .closing_bracket_symbol) + then trimmed_text .substring (sc .opening_bracket_symbol .length, trimmed_text .length - sc .closing_bracket_symbol .length) else trimmed_text is_concrete : Boolean = applies and _contains_an_opening_parenthesis diff --git a/translator/src/main/scala/soda/translator/parser/annotation/ClassEndAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/ClassEndAnnotation.soda index da6d103e..4550457d 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/ClassEndAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/ClassEndAnnotation.soda @@ -11,11 +11,11 @@ class ClassEndAnnotation soda.translator.block.BlockAnnotationEnum_ soda.translator.parser.SodaConstant_ - identifier = BlockAnnotationEnum_ ().class_end + identifier = BlockAnnotationEnum_ () .class_end applies : Boolean = - block.readable_lines.nonEmpty and - (block.readable_lines.head.line.trim == SodaConstant_ ().class_end_reserved_word) + block .readable_lines .nonEmpty and + (block .readable_lines .head .line .trim == SodaConstant_ () .class_end_reserved_word) end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/CommentAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/CommentAnnotation.soda index 2ab72f35..bb2a4ea7 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/CommentAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/CommentAnnotation.soda @@ -9,12 +9,12 @@ class CommentAnnotation import soda.translator.block.BlockAnnotationEnum_ - identifier = BlockAnnotationEnum_ ().comment + identifier = BlockAnnotationEnum_ () .comment applies : Boolean = block .annotated_lines - .forall (lambda annotated_line --> annotated_line.is_comment) + .forall (lambda annotated_line --> annotated_line .is_comment) end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/FunctionDefinitionAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/FunctionDefinitionAnnotation.soda index e5e2ba53..00f8ee8d 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/FunctionDefinitionAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/FunctionDefinitionAnnotation.soda @@ -12,20 +12,20 @@ class FunctionDefinitionAnnotation soda.translator.replacement.ParserStateEnum_ soda.translator.replacement.Tokenizer_ - identifier = BlockAnnotationEnum_ ().function_definition + identifier = BlockAnnotationEnum_ () .function_definition sc = SodaConstant_ () _symbol_at_the_end : String = - sc.space + - sc.function_definition_symbol + sc .space + + sc .function_definition_symbol _symbol_in_the_middle : String = - sc.space + - sc.function_definition_symbol + - sc.space + sc .space + + sc .function_definition_symbol + + sc .space - _plain_state = ParserStateEnum_ ().plain + _plain_state = ParserStateEnum_ () .plain applies : Boolean = not is_a_theorem and @@ -34,43 +34,43 @@ class FunctionDefinitionAnnotation (contains_the_equals_symbol or _starts_with_valid_annotation) contains_the_equals_symbol : Boolean = - block.readable_lines.nonEmpty and - block.readable_lines - .filter (lambda annotated_line --> not annotated_line.is_comment) - .exists (lambda annotated_line --> _contains_the_equals_symbol_in_line (annotated_line.line) ) + block .readable_lines .nonEmpty and + block .readable_lines + .filter (lambda annotated_line --> not annotated_line .is_comment) + .exists (lambda annotated_line --> _contains_the_equals_symbol_in_line (annotated_line .line) ) _contains_the_equals_symbol_in_line (line : String) : Boolean = Tokenizer_ (line) .tokens .exists (lambda token --> - token.parser_state == _plain_state and - _contains_the_equals_symbol_in_token (token.text) + token .parser_state == _plain_state and + _contains_the_equals_symbol_in_token (token .text) ) _contains_the_equals_symbol_in_token (token_text : String) : Boolean = ( - (token_text.contains (_symbol_in_the_middle) ) or - (token_text.endsWith (_symbol_at_the_end) ) + (token_text .contains (_symbol_in_the_middle) ) or + (token_text .endsWith (_symbol_at_the_end) ) ) _starts_with_valid_annotation : Boolean = - block.readable_lines.nonEmpty and - _starts_with_valid_annotation_with (block.readable_lines.head.line.trim) + block .readable_lines .nonEmpty and + _starts_with_valid_annotation_with (block .readable_lines .head .line .trim) _starts_with_valid_annotation_with (first_line_trimmed : String) : Boolean = - ( first_line_trimmed == sc.tail_recursion_annotation or - first_line_trimmed == sc.override_annotation ) + ( first_line_trimmed == sc .tail_recursion_annotation or + first_line_trimmed == sc .override_annotation ) is_a_class_declaration : Boolean = - starts_with_prefix_and_space (sc.class_reserved_word) + starts_with_prefix_and_space (sc .class_reserved_word) is_a_theorem : Boolean = - block.readable_lines.nonEmpty and - (block.readable_lines.head.line.trim == SodaConstant_ ().theorem_reserved_word) + block .readable_lines .nonEmpty and + (block .readable_lines .head .line .trim == SodaConstant_ () .theorem_reserved_word) is_a_proof : Boolean = - block.readable_lines.nonEmpty and - (block.readable_lines.head.line.trim == SodaConstant_ ().proof_reserved_word) + block .readable_lines .nonEmpty and + (block .readable_lines .head .line .trim == SodaConstant_ () .proof_reserved_word) end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/ImportDeclarationAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/ImportDeclarationAnnotation.soda index cc2941b6..084df942 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/ImportDeclarationAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/ImportDeclarationAnnotation.soda @@ -11,11 +11,11 @@ class ImportDeclarationAnnotation soda.translator.block.BlockAnnotationEnum_ soda.translator.parser.SodaConstant_ - identifier = BlockAnnotationEnum_ ().import_declaration + identifier = BlockAnnotationEnum_ () .import_declaration applies : Boolean = - block.readable_lines.nonEmpty and - (block.readable_lines.head.line.trim == SodaConstant_ ().import_reserved_word) + block .readable_lines .nonEmpty and + (block .readable_lines .head .line .trim == SodaConstant_ () .import_reserved_word) imported_items : Seq [AnnotatedLine] = content_lines diff --git a/translator/src/main/scala/soda/translator/parser/annotation/Package.scala b/translator/src/main/scala/soda/translator/parser/annotation/Package.scala index 522a6b7c..8b7deb71 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/Package.scala +++ b/translator/src/main/scala/soda/translator/parser/annotation/Package.scala @@ -18,18 +18,18 @@ trait AbstractDeclarationAnnotation import soda.translator.block.BlockAnnotationEnum_ import soda.translator.parser.SodaConstant_ - lazy val identifier = BlockAnnotationEnum_ ().abstract_declaration + lazy val identifier = BlockAnnotationEnum_ () .abstract_declaration lazy val applies : Boolean = - block.readable_lines.nonEmpty && - (block.readable_lines.head.line.trim == SodaConstant_ ().abstract_reserved_word) + block .readable_lines .nonEmpty && + (block .readable_lines .head .line .trim == SodaConstant_ () .abstract_reserved_word) lazy val abstract_functions_with_comments : Seq [AnnotatedLine] = content_lines lazy val abstract_functions : Seq [AnnotatedLine] = abstract_functions_with_comments - .filter ( line => ! line.is_comment) + .filter ( line => ! line .is_comment) } @@ -51,13 +51,13 @@ trait AnnotationFactory translate_for (block) def translate_for (block : AnnotatedBlock) : AnnotatedBlock = - if ( block.block_annotation == BlockAnnotationEnum_ ().undefined + if ( block .block_annotation == BlockAnnotationEnum_ () .undefined ) annotate (block) else block def annotate (block : Block) : AnnotatedBlock = block match { - case AnnotatedBlock_ (annotated_lines, block_annotation) => AnnotatedBlock_ (annotated_lines, block_annotation) + case AnnotatedBlock_ (annotated_lines, block_annotation) => AnnotatedBlock_ (annotated_lines , block_annotation) case otherwise => _get_first_or_undefined (_find_candidates (block) ) (block) } @@ -65,8 +65,8 @@ trait AnnotationFactory original_content match { case FunctionDefinitionAnnotation_ (b) => FunctionDefinitionAnnotation_ (new_content) case ClassBeginningAnnotation_ (b) => ClassBeginningAnnotation_ (new_content) - case ClassEndAnnotation_ (b, references) => ClassEndAnnotation_ (new_content, references) - case AbstractDeclarationAnnotation_ (b, references) => AbstractDeclarationAnnotation_ (new_content, references) + case ClassEndAnnotation_ (b , references) => ClassEndAnnotation_ (new_content , references) + case AbstractDeclarationAnnotation_ (b , references) => AbstractDeclarationAnnotation_ (new_content , references) case ImportDeclarationAnnotation_ (b) => ImportDeclarationAnnotation_ (new_content) case PackageDeclarationAnnotation_ (b) => PackageDeclarationAnnotation_ (new_content) case ClassAliasAnnotation_ (b) => ClassAliasAnnotation_ (new_content) @@ -74,15 +74,15 @@ trait AnnotationFactory case ProofBlockAnnotation_ (b) => ProofBlockAnnotation_ (new_content) case CommentAnnotation_ (b) => CommentAnnotation_ (new_content) case TestDeclarationAnnotation_ (b) => TestDeclarationAnnotation_ (new_content) - case otherwise => AnnotatedBlock_ (new_content.annotated_lines, original_content.block_annotation) + case otherwise => AnnotatedBlock_ (new_content .annotated_lines , original_content .block_annotation) } private def _detectors (block : Block) : Seq [BlockAnnotationParser] = Seq ( FunctionDefinitionAnnotation_ (block), ClassBeginningAnnotation_ (block), - ClassEndAnnotation_ (block, Seq [BlockAnnotationParser] () ), - AbstractDeclarationAnnotation_ (block, Seq [BlockAnnotationParser] () ), + ClassEndAnnotation_ (block , Seq [BlockAnnotationParser] () ), + AbstractDeclarationAnnotation_ (block , Seq [BlockAnnotationParser] () ), ImportDeclarationAnnotation_ (block), PackageDeclarationAnnotation_ (block), ClassAliasAnnotation_ (block), @@ -94,12 +94,12 @@ trait AnnotationFactory private def _find_candidates (block : Block) : Seq [BlockAnnotationParser] = _detectors (block) - .filter ( detector => detector.applies) + .filter ( detector => detector .applies) private def _get_first_or_undefined (candidates : Seq [BlockAnnotationParser] ) (block : Block) : AnnotatedBlock = - if ( candidates.length == 1 - ) candidates.head - else AnnotatedBlock_ (block.annotated_lines, BlockAnnotationEnum_ ().undefined ) + if ( candidates .length == 1 + ) candidates .head + else AnnotatedBlock_ (block .annotated_lines , BlockAnnotationEnum_ () .undefined ) } @@ -121,44 +121,44 @@ trait BlockAnnotationParser import soda.translator.block.BlockAnnotationId import soda.translator.parser.SodaConstant_ - lazy val space = SodaConstant_ ().space + lazy val space = SodaConstant_ () .space lazy val default_annotated_line = AnnotatedLine_ ("", true) - lazy val annotated_lines : Seq [AnnotatedLine] = block.annotated_lines + lazy val annotated_lines : Seq [AnnotatedLine] = block .annotated_lines lazy val block_annotation : BlockAnnotationId = identifier def starts_with_prefix_and_space (prefix : String) : Boolean = - block.readable_lines.nonEmpty && - block.readable_lines.head.line.trim.startsWith (prefix + space) + block .readable_lines .nonEmpty && + block .readable_lines .head .line .trim .startsWith (prefix + space) lazy val content_lines : Seq [AnnotatedLine] = - if ( block.readable_lines.isEmpty - ) block.annotated_lines + if ( block .readable_lines .isEmpty + ) block .annotated_lines else block .annotated_lines .tail - .filter ( x => ! x.line.trim.isEmpty) + .filter ( x => ! x .line .trim .isEmpty) lazy val first_readable_line : AnnotatedLine = - block.readable_lines.headOption.getOrElse (default_annotated_line) + block .readable_lines .headOption .getOrElse (default_annotated_line) def get_first_word (line : String) : String = - (_get_first_word_with (line.trim.indexOf (space) ) (line) ).trim + (_get_first_word_with (line .trim .indexOf (space) ) (line) ) .trim private def _get_first_word_with (index : Int) (line : String) : String = if ( index >= 0 - ) line.substring (0, index) + ) line .substring (0, index) else line def skip_first_word (line : String) : String = - (_skip_first_word_with (line.trim.indexOf (space) ) (line) ).trim + (_skip_first_word_with (line .trim .indexOf (space) ) (line) ) .trim private def _skip_first_word_with (index : Int) (line : String) : String = if ( index >= 0 - ) line.trim.substring (index) + ) line .trim .substring (index) else "" } @@ -176,16 +176,16 @@ trait ClassAliasAnnotation import soda.translator.block.BlockAnnotationEnum_ import soda.translator.parser.SodaConstant_ - lazy val identifier = BlockAnnotationEnum_ ().class_alias + lazy val identifier = BlockAnnotationEnum_ () .class_alias lazy val sc = SodaConstant_ () lazy val applies : Boolean = - starts_with_prefix_and_space (sc.class_reserved_word) && + starts_with_prefix_and_space (sc .class_reserved_word) && _contains_the_equals_symbol private lazy val _contains_the_equals_symbol : Boolean = - FunctionDefinitionAnnotation_ (block).contains_the_equals_symbol + FunctionDefinitionAnnotation_ (block) .contains_the_equals_symbol } @@ -202,44 +202,44 @@ trait ClassBeginningAnnotation import soda.translator.block.BlockAnnotationEnum_ import soda.translator.parser.SodaConstant_ - lazy val identifier = BlockAnnotationEnum_ ().class_beginning + lazy val identifier = BlockAnnotationEnum_ () .class_beginning lazy val sc = SodaConstant_ () lazy val applies : Boolean = - starts_with_prefix_and_space (sc.class_reserved_word) && + starts_with_prefix_and_space (sc .class_reserved_word) && ! _contains_the_equals_symbol private lazy val _contains_the_equals_symbol : Boolean = - FunctionDefinitionAnnotation_ (block).contains_the_equals_symbol + FunctionDefinitionAnnotation_ (block) .contains_the_equals_symbol private lazy val _contains_an_opening_parenthesis : Boolean = - first_readable_line.line.contains (sc.opening_parenthesis_symbol) + first_readable_line .line .contains (sc .opening_parenthesis_symbol) private lazy val _class_name_and_type_parameters : String = - skip_first_word (first_readable_line.line) + skip_first_word (first_readable_line .line) lazy val class_name : String = get_first_word (_class_name_and_type_parameters) lazy val type_parameters_and_bounds : Seq [String] = remove_brackets (skip_first_word (_class_name_and_type_parameters) ) - .split (sc.parameter_separation_regex) + .split (sc .parameter_separation_regex) .toIndexedSeq - .map ( parameter => parameter.trim) - .filter ( parameter => ! parameter.isEmpty) + .map ( parameter => parameter .trim) + .filter ( parameter => ! parameter .isEmpty) lazy val type_parameters : Seq [String] = type_parameters_and_bounds - .map ( parameter => get_first_word (parameter) ) + .map ( parameter => get_first_word (parameter) ) def remove_brackets (text : String) : String = - remove_brackets_with (text.trim) + remove_brackets_with (text .trim) def remove_brackets_with (trimmed_text : String) : String = - if ( trimmed_text.startsWith (sc.opening_bracket_symbol) && - trimmed_text.endsWith (sc.closing_bracket_symbol) - ) trimmed_text.substring (sc.opening_bracket_symbol.length, trimmed_text.length - sc.closing_bracket_symbol.length) + if ( trimmed_text .startsWith (sc .opening_bracket_symbol) && + trimmed_text .endsWith (sc .closing_bracket_symbol) + ) trimmed_text .substring (sc .opening_bracket_symbol .length, trimmed_text .length - sc .closing_bracket_symbol .length) else trimmed_text lazy val is_concrete : Boolean = applies && _contains_an_opening_parenthesis @@ -260,11 +260,11 @@ trait ClassEndAnnotation import soda.translator.block.BlockAnnotationEnum_ import soda.translator.parser.SodaConstant_ - lazy val identifier = BlockAnnotationEnum_ ().class_end + lazy val identifier = BlockAnnotationEnum_ () .class_end lazy val applies : Boolean = - block.readable_lines.nonEmpty && - (block.readable_lines.head.line.trim == SodaConstant_ ().class_end_reserved_word) + block .readable_lines .nonEmpty && + (block .readable_lines .head .line .trim == SodaConstant_ () .class_end_reserved_word) } @@ -280,12 +280,12 @@ trait CommentAnnotation import soda.translator.block.BlockAnnotationEnum_ - lazy val identifier = BlockAnnotationEnum_ ().comment + lazy val identifier = BlockAnnotationEnum_ () .comment lazy val applies : Boolean = block .annotated_lines - .forall ( annotated_line => annotated_line.is_comment) + .forall ( annotated_line => annotated_line .is_comment) } @@ -304,20 +304,20 @@ trait FunctionDefinitionAnnotation import soda.translator.replacement.ParserStateEnum_ import soda.translator.replacement.Tokenizer_ - lazy val identifier = BlockAnnotationEnum_ ().function_definition + lazy val identifier = BlockAnnotationEnum_ () .function_definition lazy val sc = SodaConstant_ () private lazy val _symbol_at_the_end : String = - sc.space + - sc.function_definition_symbol + sc .space + + sc .function_definition_symbol private lazy val _symbol_in_the_middle : String = - sc.space + - sc.function_definition_symbol + - sc.space + sc .space + + sc .function_definition_symbol + + sc .space - private lazy val _plain_state = ParserStateEnum_ ().plain + private lazy val _plain_state = ParserStateEnum_ () .plain lazy val applies : Boolean = ! is_a_theorem && @@ -326,43 +326,43 @@ trait FunctionDefinitionAnnotation (contains_the_equals_symbol || _starts_with_valid_annotation) lazy val contains_the_equals_symbol : Boolean = - block.readable_lines.nonEmpty && - block.readable_lines - .filter ( annotated_line => ! annotated_line.is_comment) - .exists ( annotated_line => _contains_the_equals_symbol_in_line (annotated_line.line) ) + block .readable_lines .nonEmpty && + block .readable_lines + .filter ( annotated_line => ! annotated_line .is_comment) + .exists ( annotated_line => _contains_the_equals_symbol_in_line (annotated_line .line) ) private def _contains_the_equals_symbol_in_line (line : String) : Boolean = Tokenizer_ (line) .tokens .exists ( token => - token.parser_state == _plain_state && - _contains_the_equals_symbol_in_token (token.text) + token .parser_state == _plain_state && + _contains_the_equals_symbol_in_token (token .text) ) private def _contains_the_equals_symbol_in_token (token_text : String) : Boolean = ( - (token_text.contains (_symbol_in_the_middle) ) || - (token_text.endsWith (_symbol_at_the_end) ) + (token_text .contains (_symbol_in_the_middle) ) || + (token_text .endsWith (_symbol_at_the_end) ) ) private lazy val _starts_with_valid_annotation : Boolean = - block.readable_lines.nonEmpty && - _starts_with_valid_annotation_with (block.readable_lines.head.line.trim) + block .readable_lines .nonEmpty && + _starts_with_valid_annotation_with (block .readable_lines .head .line .trim) private def _starts_with_valid_annotation_with (first_line_trimmed : String) : Boolean = - ( first_line_trimmed == sc.tail_recursion_annotation || - first_line_trimmed == sc.override_annotation ) + ( first_line_trimmed == sc .tail_recursion_annotation || + first_line_trimmed == sc .override_annotation ) lazy val is_a_class_declaration : Boolean = - starts_with_prefix_and_space (sc.class_reserved_word) + starts_with_prefix_and_space (sc .class_reserved_word) lazy val is_a_theorem : Boolean = - block.readable_lines.nonEmpty && - (block.readable_lines.head.line.trim == SodaConstant_ ().theorem_reserved_word) + block .readable_lines .nonEmpty && + (block .readable_lines .head .line .trim == SodaConstant_ () .theorem_reserved_word) lazy val is_a_proof : Boolean = - block.readable_lines.nonEmpty && - (block.readable_lines.head.line.trim == SodaConstant_ ().proof_reserved_word) + block .readable_lines .nonEmpty && + (block .readable_lines .head .line .trim == SodaConstant_ () .proof_reserved_word) } @@ -380,11 +380,11 @@ trait ImportDeclarationAnnotation import soda.translator.block.BlockAnnotationEnum_ import soda.translator.parser.SodaConstant_ - lazy val identifier = BlockAnnotationEnum_ ().import_declaration + lazy val identifier = BlockAnnotationEnum_ () .import_declaration lazy val applies : Boolean = - block.readable_lines.nonEmpty && - (block.readable_lines.head.line.trim == SodaConstant_ ().import_reserved_word) + block .readable_lines .nonEmpty && + (block .readable_lines .head .line .trim == SodaConstant_ () .import_reserved_word) lazy val imported_items : Seq [AnnotatedLine] = content_lines @@ -404,10 +404,10 @@ trait PackageDeclarationAnnotation import soda.translator.block.BlockAnnotationEnum_ import soda.translator.parser.SodaConstant_ - lazy val identifier = BlockAnnotationEnum_ ().package_declaration + lazy val identifier = BlockAnnotationEnum_ () .package_declaration lazy val applies : Boolean = - starts_with_prefix_and_space (SodaConstant_ ().package_reserved_word) + starts_with_prefix_and_space (SodaConstant_ () .package_reserved_word) } @@ -424,11 +424,11 @@ trait ProofBlockAnnotation import soda.translator.block.BlockAnnotationEnum_ import soda.translator.parser.SodaConstant_ - lazy val identifier = BlockAnnotationEnum_ ().proof_block + lazy val identifier = BlockAnnotationEnum_ () .proof_block lazy val applies : Boolean = - block.readable_lines.nonEmpty && - (block.readable_lines.head.line.trim == SodaConstant_ ().proof_reserved_word) + block .readable_lines .nonEmpty && + (block .readable_lines .head .line .trim == SodaConstant_ () .proof_reserved_word) } @@ -445,10 +445,10 @@ trait TestDeclarationAnnotation import soda.translator.block.BlockAnnotationEnum_ import soda.translator.parser.SodaConstant_ - lazy val identifier = BlockAnnotationEnum_ ().test_declaration + lazy val identifier = BlockAnnotationEnum_ () .test_declaration lazy val applies : Boolean = - starts_with_prefix_and_space (SodaConstant_ ().test_special_function) + starts_with_prefix_and_space (SodaConstant_ () .test_special_function) } @@ -465,11 +465,11 @@ trait TheoremBlockAnnotation import soda.translator.block.BlockAnnotationEnum_ import soda.translator.parser.SodaConstant_ - lazy val identifier = BlockAnnotationEnum_ ().theorem_block + lazy val identifier = BlockAnnotationEnum_ () .theorem_block lazy val applies : Boolean = - block.readable_lines.nonEmpty && - (block.readable_lines.head.line.trim == SodaConstant_ ().theorem_reserved_word) + block .readable_lines .nonEmpty && + (block .readable_lines .head .line .trim == SodaConstant_ () .theorem_reserved_word) } diff --git a/translator/src/main/scala/soda/translator/parser/annotation/PackageDeclarationAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/PackageDeclarationAnnotation.soda index 742a1b84..97cd700e 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/PackageDeclarationAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/PackageDeclarationAnnotation.soda @@ -10,10 +10,10 @@ class PackageDeclarationAnnotation soda.translator.block.BlockAnnotationEnum_ soda.translator.parser.SodaConstant_ - identifier = BlockAnnotationEnum_ ().package_declaration + identifier = BlockAnnotationEnum_ () .package_declaration applies : Boolean = - starts_with_prefix_and_space (SodaConstant_ ().package_reserved_word) + starts_with_prefix_and_space (SodaConstant_ () .package_reserved_word) end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/ProofBlockAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/ProofBlockAnnotation.soda index e5b2e02b..4f0b03e8 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/ProofBlockAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/ProofBlockAnnotation.soda @@ -10,11 +10,11 @@ class ProofBlockAnnotation soda.translator.block.BlockAnnotationEnum_ soda.translator.parser.SodaConstant_ - identifier = BlockAnnotationEnum_ ().proof_block + identifier = BlockAnnotationEnum_ () .proof_block applies : Boolean = - block.readable_lines.nonEmpty and - (block.readable_lines.head.line.trim == SodaConstant_ ().proof_reserved_word) + block .readable_lines .nonEmpty and + (block .readable_lines .head .line .trim == SodaConstant_ () .proof_reserved_word) end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/TestDeclarationAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/TestDeclarationAnnotation.soda index bfa47a7c..29d9ee89 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/TestDeclarationAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/TestDeclarationAnnotation.soda @@ -10,10 +10,10 @@ class TestDeclarationAnnotation soda.translator.block.BlockAnnotationEnum_ soda.translator.parser.SodaConstant_ - identifier = BlockAnnotationEnum_ ().test_declaration + identifier = BlockAnnotationEnum_ () .test_declaration applies : Boolean = - starts_with_prefix_and_space (SodaConstant_ ().test_special_function) + starts_with_prefix_and_space (SodaConstant_ () .test_special_function) end diff --git a/translator/src/main/scala/soda/translator/parser/annotation/TheoremBlockAnnotation.soda b/translator/src/main/scala/soda/translator/parser/annotation/TheoremBlockAnnotation.soda index 9ec0f9a8..d507c81f 100644 --- a/translator/src/main/scala/soda/translator/parser/annotation/TheoremBlockAnnotation.soda +++ b/translator/src/main/scala/soda/translator/parser/annotation/TheoremBlockAnnotation.soda @@ -10,11 +10,11 @@ class TheoremBlockAnnotation soda.translator.block.BlockAnnotationEnum_ soda.translator.parser.SodaConstant_ - identifier = BlockAnnotationEnum_ ().theorem_block + identifier = BlockAnnotationEnum_ () .theorem_block applies : Boolean = - block.readable_lines.nonEmpty and - (block.readable_lines.head.line.trim == SodaConstant_ ().theorem_reserved_word) + block .readable_lines .nonEmpty and + (block .readable_lines .head .line .trim == SodaConstant_ () .theorem_reserved_word) end diff --git a/translator/src/main/scala/soda/translator/replacement/CharType.soda b/translator/src/main/scala/soda/translator/replacement/CharType.soda index 257ead88..e3d9e231 100644 --- a/translator/src/main/scala/soda/translator/replacement/CharType.soda +++ b/translator/src/main/scala/soda/translator/replacement/CharType.soda @@ -21,17 +21,17 @@ class CharTypeEnum extends soda.lib.Enum [CharType] - undefined_type = CharType_ (0, "undefined_type") + undefined_type = CharType_ (0 , "undefined_type") - quotes_type = CharType_ (1, "quotes_type") + quotes_type = CharType_ (1 , "quotes_type") - apostrophe_type = CharType_ (2, "apostrophe_type") + apostrophe_type = CharType_ (2 , "apostrophe_type") - backslash_type = CharType_ (3, "backslash_type") + backslash_type = CharType_ (3 , "backslash_type") - plain_type = CharType_ (4, "plain_type") + plain_type = CharType_ (4 , "plain_type") - values = Seq (undefined_type, quotes_type, apostrophe_type, backslash_type, plain_type) + values = Seq (undefined_type , quotes_type , apostrophe_type , backslash_type , plain_type) backslash_char = '\\' @@ -44,18 +44,18 @@ class CharTypeEnum last_standard_symbol : Char = 0x7F symbol_chars : Seq [Char] = - Seq ('!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', ']', '^', '`', '{', '|', '}', '~') + Seq ('!' , '#' , '$' , '%' , '&' , '(' , ')' , '*' , '+' , ',' , '-' , '.' , '/' , ':' , ';' , '<' , '=' , '>' , '?' , '@' , '[' , ']' , '^' , '`' , '{' , '|' , '}' , '~') - simple_char_type_map : Map [Char , CharType] = + simple_char_type_map : Map [Char] [CharType] = Map ( - Tuple2 ( quotes_char , quotes_type ), - Tuple2 ( apostrophe_char , apostrophe_type ), - Tuple2 ( backslash_char, backslash_type ) + Tuple2 (quotes_char , quotes_type) , + Tuple2 (apostrophe_char , apostrophe_type) , + Tuple2 (backslash_char , backslash_type) ) get_char_type (ch : Char) : CharType = simple_char_type_map - .getOrElse (ch, _get_char_type_if_plain (ch) ) + .getOrElse (ch , _get_char_type_if_plain (ch) ) _get_char_type_if_plain (ch : Char) : CharType = if _is_plain (ch) diff --git a/translator/src/main/scala/soda/translator/replacement/Package.scala b/translator/src/main/scala/soda/translator/replacement/Package.scala index 3f951ec4..bb9998a6 100644 --- a/translator/src/main/scala/soda/translator/replacement/Package.scala +++ b/translator/src/main/scala/soda/translator/replacement/Package.scala @@ -34,17 +34,17 @@ trait CharTypeEnum soda.lib.Enum [CharType] { - lazy val undefined_type = CharType_ (0, "undefined_type") + lazy val undefined_type = CharType_ (0 , "undefined_type") - lazy val quotes_type = CharType_ (1, "quotes_type") + lazy val quotes_type = CharType_ (1 , "quotes_type") - lazy val apostrophe_type = CharType_ (2, "apostrophe_type") + lazy val apostrophe_type = CharType_ (2 , "apostrophe_type") - lazy val backslash_type = CharType_ (3, "backslash_type") + lazy val backslash_type = CharType_ (3 , "backslash_type") - lazy val plain_type = CharType_ (4, "plain_type") + lazy val plain_type = CharType_ (4 , "plain_type") - lazy val values = Seq (undefined_type, quotes_type, apostrophe_type, backslash_type, plain_type) + lazy val values = Seq (undefined_type , quotes_type , apostrophe_type , backslash_type , plain_type) lazy val backslash_char = '\\' @@ -57,18 +57,18 @@ trait CharTypeEnum lazy val last_standard_symbol : Char = 0x7F lazy val symbol_chars : Seq [Char] = - Seq ('!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', ']', '^', '`', '{', '|', '}', '~') + Seq ('!' , '#' , '$' , '%' , '&' , '(' , ')' , '*' , '+' , ',' , '-' , '.' , '/' , ':' , ';' , '<' , '=' , '>' , '?' , '@' , '[' , ']' , '^' , '`' , '{' , '|' , '}' , '~') - lazy val simple_char_type_map : Map [Char , CharType] = + lazy val simple_char_type_map : Map [Char, CharType] = Map ( - Tuple2 ( quotes_char , quotes_type ), - Tuple2 ( apostrophe_char , apostrophe_type ), - Tuple2 ( backslash_char, backslash_type ) + Tuple2 (quotes_char , quotes_type) , + Tuple2 (apostrophe_char , apostrophe_type) , + Tuple2 (backslash_char , backslash_type) ) def get_char_type (ch : Char) : CharType = simple_char_type_map - .getOrElse (ch, _get_char_type_if_plain (ch) ) + .getOrElse (ch , _get_char_type_if_plain (ch) ) private def _get_char_type_if_plain (ch : Char) : CharType = if ( _is_plain (ch) @@ -120,19 +120,19 @@ trait ParserStateEnum soda.lib.Enum [ParserState] { - lazy val undefined_state = ParserState_ (0, "undefined_state") + lazy val undefined_state = ParserState_ (0 , "undefined_state") - lazy val quotes_state = ParserState_ (1, "quotes_state") + lazy val quotes_state = ParserState_ (1 , "quotes_state") - lazy val apostrophe_state = ParserState_ (2, "apostrophe_state") + lazy val apostrophe_state = ParserState_ (2 , "apostrophe_state") - lazy val quotes_backslash_state = ParserState_ (3, "quotes_backslash_state") + lazy val quotes_backslash_state = ParserState_ (3 , "quotes_backslash_state") - lazy val apostrophe_backslash_state = ParserState_ (4, "apostrophe_backslash_state") + lazy val apostrophe_backslash_state = ParserState_ (4 , "apostrophe_backslash_state") - lazy val plain = ParserState_ (5, "plain") + lazy val plain = ParserState_ (5 , "plain") - lazy val values = Seq (undefined_state, quotes_state, apostrophe_state, quotes_backslash_state, apostrophe_backslash_state, plain) + lazy val values = Seq (undefined_state , quotes_state , apostrophe_state , quotes_backslash_state , apostrophe_backslash_state , plain) def is_same_class (x : ParserState) (y : ParserState) : Boolean = (x == y) || _is_like (x) (y) || _is_like (y) (x) @@ -152,38 +152,38 @@ trait ParserTransition lazy val ct = CharTypeEnum_ () - lazy val transitions_that_change_states : Map [ Tuple2 [ParserState, CharType], ParserState] = + lazy val transitions_that_change_states : Map [ Tuple2 [ParserState , CharType] , ParserState] = Map ( /* */ - Tuple2 ( Tuple2 (ps.quotes_state, ct.undefined_type), ps.undefined_state), - Tuple2 ( Tuple2 (ps.quotes_state, ct.quotes_type), ps.plain), - Tuple2 ( Tuple2 (ps.quotes_state, ct.backslash_type), ps.quotes_backslash_state), + Tuple2 ( Tuple2 (ps .quotes_state , ct .undefined_type) , ps .undefined_state), + Tuple2 ( Tuple2 (ps .quotes_state , ct .quotes_type) , ps .plain), + Tuple2 ( Tuple2 (ps .quotes_state , ct .backslash_type) , ps .quotes_backslash_state), /* */ - Tuple2 ( Tuple2 (ps.apostrophe_state, ct.undefined_type), ps.undefined_state), - Tuple2 ( Tuple2 (ps.apostrophe_state, ct.apostrophe_type), ps.plain), - Tuple2 ( Tuple2 (ps.apostrophe_state, ct.backslash_type), ps.apostrophe_backslash_state), + Tuple2 ( Tuple2 (ps .apostrophe_state , ct .undefined_type) , ps .undefined_state), + Tuple2 ( Tuple2 (ps .apostrophe_state , ct .apostrophe_type) , ps .plain), + Tuple2 ( Tuple2 (ps .apostrophe_state , ct .backslash_type) , ps .apostrophe_backslash_state), /* */ - Tuple2 ( Tuple2 (ps.quotes_backslash_state, ct.undefined_type), ps.undefined_state), - Tuple2 ( Tuple2 (ps.quotes_backslash_state, ct.quotes_type), ps.quotes_state), - Tuple2 ( Tuple2 (ps.quotes_backslash_state, ct.apostrophe_type), ps.quotes_state), - Tuple2 ( Tuple2 (ps.quotes_backslash_state, ct.backslash_type), ps.quotes_state), - Tuple2 ( Tuple2 (ps.quotes_backslash_state, ct.plain_type), ps.quotes_state), + Tuple2 ( Tuple2 (ps .quotes_backslash_state , ct .undefined_type) , ps .undefined_state), + Tuple2 ( Tuple2 (ps .quotes_backslash_state , ct .quotes_type) , ps .quotes_state), + Tuple2 ( Tuple2 (ps .quotes_backslash_state , ct .apostrophe_type) , ps .quotes_state), + Tuple2 ( Tuple2 (ps .quotes_backslash_state , ct .backslash_type) , ps .quotes_state), + Tuple2 ( Tuple2 (ps .quotes_backslash_state , ct .plain_type) , ps .quotes_state), /* */ - Tuple2 ( Tuple2 (ps.apostrophe_backslash_state, ct.undefined_type), ps.undefined_state), - Tuple2 ( Tuple2 (ps.apostrophe_backslash_state, ct.quotes_type), ps.apostrophe_state), - Tuple2 ( Tuple2 (ps.apostrophe_backslash_state, ct.apostrophe_type), ps.apostrophe_state), - Tuple2 ( Tuple2 (ps.apostrophe_backslash_state, ct.backslash_type), ps.apostrophe_state), - Tuple2 ( Tuple2 (ps.apostrophe_backslash_state, ct.plain_type), ps.apostrophe_state), + Tuple2 ( Tuple2 (ps .apostrophe_backslash_state , ct .undefined_type) , ps .undefined_state), + Tuple2 ( Tuple2 (ps .apostrophe_backslash_state , ct .quotes_type) , ps .apostrophe_state), + Tuple2 ( Tuple2 (ps .apostrophe_backslash_state , ct .apostrophe_type) , ps .apostrophe_state), + Tuple2 ( Tuple2 (ps .apostrophe_backslash_state , ct .backslash_type) , ps .apostrophe_state), + Tuple2 ( Tuple2 (ps .apostrophe_backslash_state , ct .plain_type) , ps .apostrophe_state), /* */ - Tuple2 ( Tuple2 (ps.plain, ct.undefined_type), ps.undefined_state), - Tuple2 ( Tuple2 (ps.plain, ct.quotes_type), ps.quotes_state), - Tuple2 ( Tuple2 (ps.plain, ct.apostrophe_type), ps.apostrophe_state), - Tuple2 ( Tuple2 (ps.plain, ct.backslash_type), ps.plain), - Tuple2 ( Tuple2 (ps.plain, ct.plain_type), ps.plain) + Tuple2 ( Tuple2 (ps .plain , ct .undefined_type) , ps .undefined_state), + Tuple2 ( Tuple2 (ps .plain , ct .quotes_type) , ps .quotes_state), + Tuple2 ( Tuple2 (ps .plain , ct .apostrophe_type) , ps .apostrophe_state), + Tuple2 ( Tuple2 (ps .plain , ct .backslash_type) , ps .plain), + Tuple2 ( Tuple2 (ps .plain , ct .plain_type) , ps .plain) ) def next_parser_state (parser_state : ParserState) (char_type : CharType) : ParserState = - transitions_that_change_states.getOrElse ( Tuple2 (parser_state, char_type), parser_state) + transitions_that_change_states .getOrElse (Tuple2 (parser_state , char_type) , parser_state) } @@ -209,19 +209,19 @@ trait Replacement lazy val soda_space = aux.soda_space def replace_at_beginning (index : Int) (translator : Translator) : Replacement = - Replacement_ (ReplacementWithTranslator_ (translator).replace_at_beginning (line) (index) ) + Replacement_ (ReplacementWithTranslator_ (translator) .replace_at_beginning (line) (index) ) def replace_all (pattern : String) (replacement : String) : Replacement = - Replacement_ (aux.replace_all (line) (pattern) (replacement) ) + Replacement_ (aux .replace_all (line) (pattern) (replacement) ) def add_space_to_soda_line () : Replacement = Replacement_ (soda_space + line + soda_space) def remove_space_from_scala_line () : Replacement = - Replacement_ (aux.remove_space_from_scala_line (line) ) + Replacement_ (aux .remove_space_from_scala_line (line) ) def add_after_spaces_or_pattern (pattern : String) (text_to_prepend : String) : Replacement = - Replacement_ (aux.add_after_spaces_or_pattern (line) (pattern) (text_to_prepend) ) + Replacement_ (aux .add_after_spaces_or_pattern (line) (pattern) (text_to_prepend) ) } @@ -235,25 +235,25 @@ trait ReplacementAux lazy val scala_space = " " def replace_if_found_at_beginning (line : String) (pattern : String) (new_text : String) : String = - if ( line.trim.startsWith (pattern.trim) + if ( line .trim .startsWith (pattern .trim) ) replace_first (line) (pattern) (new_text) else line def replace_first (line : String) (pattern : String) (replacement : String) : String = - replace_at (line.indexOf (pattern) ) (line) (pattern) (replacement) + replace_at (line .indexOf (pattern) ) (line) (pattern) (replacement) def replace_at (index : Int) (line : String) (pattern : String) (replacement : String) : String = - if ( (0 <= index) && (index + pattern.length <= line.length) - ) line.substring (0, index) + replacement + line.substring (index + pattern.length, line.length) + if ( (0 <= index) && (index + pattern .length <= line .length) + ) line .substring (0, index) + replacement + line .substring (index + pattern .length, line .length) else line def replace_if_found (line : String) (pattern : String) (new_text : String) : String = - if ( line.contains (pattern) + if ( line .contains (pattern) ) replace_all (line) (pattern) (new_text) else line def replace_all (line : String) (pattern : String) (replacement : String) : String = - Replacer_ (line, pattern, replacement).replaced_text + Replacer_ (line, pattern, replacement) .replaced_text def add_spaces_to_symbols (line : String) (symbols : Set [Char] ) : String = line @@ -265,40 +265,40 @@ trait ReplacementAux (_left_part_of_symbols (line) (symbols) (index) (ch) ) + ch + (_right_part_of_symbols (line) (symbols) (index) (ch) ) private def _left_part_of_symbols (line : String) (symbols : Set [Char] ) (index : Int) (ch : Char) : String = - if ( (index > 0) && symbols.contains (ch) && - ! line (index - 1).isWhitespace + if ( (index > 0) && symbols .contains (ch) && + ! line (index - 1) .isWhitespace ) scala_space else "" private def _right_part_of_symbols (line : String) (symbols : Set [Char] ) (index : Int) (ch : Char) : String = - if ( (index < line.length - 1) && symbols.contains (ch) && - ! line (index + 1).isWhitespace + if ( (index < line .length - 1) && symbols .contains (ch) && + ! line (index + 1) .isWhitespace ) scala_space else "" def remove_space_from_scala_line (line : String) : String = - _get_line_without_ending_space ( _get_line_without_starting_space (line) ) + _get_line_without_ending_space (_get_line_without_starting_space (line) ) private def _get_line_without_starting_space (line : String) : String = - if ( line.startsWith (scala_space) - ) line.substring (1) + if ( line .startsWith (scala_space) + ) line .substring (1) else line private def _get_line_without_ending_space (line : String) : String = - if ( line.endsWith (scala_space) - ) line.substring (0, line.length - 1) + if ( line .endsWith (scala_space) + ) line .substring (0, line .length - 1) else line def add_after_spaces_or_pattern (line : String) (pattern : String) (text_to_prepend : String) : String = _add_after_spaces_or_pattern_with (_get_prefix_length (line) (pattern) ) (line) (pattern) (text_to_prepend) private def _add_after_spaces_or_pattern_with (prefix_length : Int) (line : String) (pattern : String) (text_to_prepend : String) : String = - line.substring (0, prefix_length) + text_to_prepend + line.substring (prefix_length) + line .substring (0, prefix_length) + text_to_prepend + line .substring (prefix_length) private def _get_prefix_length (line : String) (pattern : String) : Int = - if ( line.trim.startsWith (pattern) - ) line.indexOf (pattern) + pattern.length - else line.takeWhile ( ch => ch.isSpaceChar).length + if ( line .trim .startsWith (pattern) + ) line .indexOf (pattern) + pattern .length + else line .takeWhile ( ch => ch .isSpaceChar) .length } @@ -313,9 +313,9 @@ trait ReplacementWithTranslator lazy val aux = ReplacementAux_ () - lazy val soda_space = aux.soda_space + lazy val soda_space = aux .soda_space - lazy val scala_space = aux.scala_space + lazy val scala_space = aux .scala_space lazy val soda_opening_parenthesis_symbol = "(" @@ -329,14 +329,14 @@ trait ReplacementWithTranslator else line private def _replace_only_beginning (line : String) : String = - _fold.apply (translator.keys) (initial_value = line) (next_value_function = _next_replace_only_beginning) + _fold .apply (translator .keys) (initial_value = line) (next_value_function = _next_replace_only_beginning) private def _next_replace_only_beginning (line : String) (reserved_word : String) : String = - aux.replace_if_found_at_beginning (line) ( - soda_space + reserved_word + soda_space) (scala_space + translator.translate (reserved_word) + scala_space) + aux .replace_if_found_at_beginning (line) ( + soda_space + reserved_word + soda_space) (scala_space + translator .translate (reserved_word) + scala_space) def replace (line : String) : String = - _fold.apply (translator.keys) (initial_value = line) (next_value_function = _next_replace) + _fold .apply (translator .keys) (initial_value = line) (next_value_function = _next_replace) private def _next_replace (line : String) (reserved_word : String) : String = _replace_if_found (soda_opening_parenthesis_symbol) (reserved_word) ( @@ -344,8 +344,8 @@ trait ReplacementWithTranslator ) private def _replace_if_found (previous_character : String) (reserved_word : String) (line : String) : String = - aux.replace_if_found (line) ( - previous_character + reserved_word + soda_space) (previous_character + translator.translate (reserved_word) + scala_space) + aux .replace_if_found (line) ( + previous_character + reserved_word + soda_space) (previous_character + translator .translate (reserved_word) + scala_space) } @@ -380,31 +380,31 @@ trait Replacer private lazy val _range = Range_ () lazy val replaced_text = - postprocess (_fold_while.apply (_range.apply (line.length) ) (initial_value) (next_value_function) (should_continue) ) + postprocess (_fold_while.apply (_range .apply (line .length) ) (initial_value) (next_value_function) (should_continue) ) lazy val initial_value : ReplacerFoldTuple = ReplacerFoldTuple_ (Seq (), 0 ) def next_value_function (tuple : ReplacerFoldTuple) (x : Int) : ReplacerFoldTuple = _get_next_tuple ( - replaced_text_rev = tuple.replaced_text_rev) ( - start_index = tuple.start_index) ( - pos = line.indexOf (pattern, tuple.start_index) + replaced_text_rev = tuple .replaced_text_rev) ( + start_index = tuple .start_index) ( + pos = line .indexOf (pattern, tuple .start_index) ) private def _get_next_tuple (replaced_text_rev : Seq [String] ) (start_index : Int) (pos : Int) : ReplacerFoldTuple = if ( pos == -1 - ) ReplacerFoldTuple_ (replaced_text_rev.+: (line.substring (start_index) ), pos ) + ) ReplacerFoldTuple_ (replaced_text_rev .+: (line .substring (start_index) ), pos ) else ReplacerFoldTuple_ ( - (replaced_text_rev.+: (line.substring (start_index, pos) ) ).+: (replacement), - pos + pattern.length + (replaced_text_rev .+: (line .substring (start_index, pos) ) ) .+: (replacement), + pos + pattern .length ) def should_continue (tuple : ReplacerFoldTuple) (x : Int) : Boolean = - ! (tuple.start_index == -1) + ! (tuple .start_index == -1) def postprocess (tuple : ReplacerFoldTuple) : String = - tuple.replaced_text_rev.reverse.mkString ("") + tuple .replaced_text_rev .reverse .mkString ("") } @@ -455,27 +455,27 @@ trait Tokenizer private lazy val _range = Range_ () lazy val tokens : Seq [Token] = - _postprocess (_fold.apply (_range.apply (line.length) ) (_initial_value) (_next_value_function) ) + _postprocess (_fold .apply (_range .apply (line .length) ) (_initial_value) (_next_value_function) ) - private lazy val _initial_value : TokenizerFoldTuple = TokenizerFoldTuple_ (0, ParserStateEnum_ ().plain, Seq () ) + private lazy val _initial_value : TokenizerFoldTuple = TokenizerFoldTuple_ (0, ParserStateEnum_ () .plain, Seq () ) private def _postprocess (tuple : TokenizerFoldTuple) : Seq [Token] = - (tuple.rev_tokens.+: (Token_ (line.substring (tuple.last_index), tuple.parser_state, tuple.last_index) ) ) + (tuple .rev_tokens .+: (Token_ (line .substring (tuple .last_index), tuple .parser_state, tuple .last_index) ) ) .reverse private def _next_value_function (tuple : TokenizerFoldTuple) (current_index : Int) : TokenizerFoldTuple = _new_value_function_with (tuple) (current_index) (_new_parser_state (tuple) (current_index) ) private def _new_value_function_with (tuple : TokenizerFoldTuple) (current_index : Int) (new_parser_state : ParserState) : TokenizerFoldTuple = - if ( ParserStateEnum_ ().is_same_class (new_parser_state) (tuple.parser_state) - ) TokenizerFoldTuple_ (tuple.last_index, new_parser_state, tuple.rev_tokens) + if ( ParserStateEnum_ () .is_same_class (new_parser_state) (tuple .parser_state) + ) TokenizerFoldTuple_ (tuple .last_index, new_parser_state, tuple .rev_tokens) else _next_value_function_of_different_class (tuple) (current_index) (new_parser_state) private def _new_parser_state (tuple : TokenizerFoldTuple) (current_index : Int) : ParserState = ParserTransition_ () .next_parser_state ( - tuple.parser_state) ( - CharTypeEnum_ ().get_char_type (line.charAt (current_index) ) + tuple .parser_state) ( + CharTypeEnum_ () .get_char_type (line .charAt (current_index) ) ) private def _next_value_function_of_different_class (tuple : TokenizerFoldTuple) (current_index : Int) (new_parser_state : ParserState) : TokenizerFoldTuple = @@ -487,18 +487,18 @@ trait Tokenizer ) private def _get_new_current_index (tuple : TokenizerFoldTuple) (current_index : Int) : Int = - if ( tuple.parser_state == ParserStateEnum_ ().quotes_state || - tuple.parser_state == ParserStateEnum_ ().apostrophe_state + if ( tuple .parser_state == ParserStateEnum_ () .quotes_state || + tuple .parser_state == ParserStateEnum_ () .apostrophe_state ) current_index + 1 else current_index private def _next_value_function_of_different_class_with (tuple : TokenizerFoldTuple) (current_index : Int) (new_parser_state : ParserState) (index : Int) : TokenizerFoldTuple = TokenizerFoldTuple_ (index, new_parser_state, - tuple.rev_tokens.+: ( + tuple .rev_tokens .+: ( Token_ ( - line.substring (tuple.last_index, index), - tuple.parser_state, - tuple.last_index + line .substring (tuple .last_index, index), + tuple .parser_state, + tuple .last_index ) ) ) diff --git a/translator/src/main/scala/soda/translator/replacement/ParserTransition.soda b/translator/src/main/scala/soda/translator/replacement/ParserTransition.soda index 037f37b3..a1f6af94 100644 --- a/translator/src/main/scala/soda/translator/replacement/ParserTransition.soda +++ b/translator/src/main/scala/soda/translator/replacement/ParserTransition.soda @@ -21,19 +21,19 @@ class ParserStateEnum extends soda.lib.Enum [ParserState] - undefined_state = ParserState_ (0, "undefined_state") + undefined_state = ParserState_ (0 , "undefined_state") - quotes_state = ParserState_ (1, "quotes_state") + quotes_state = ParserState_ (1 , "quotes_state") - apostrophe_state = ParserState_ (2, "apostrophe_state") + apostrophe_state = ParserState_ (2 , "apostrophe_state") - quotes_backslash_state = ParserState_ (3, "quotes_backslash_state") + quotes_backslash_state = ParserState_ (3 , "quotes_backslash_state") - apostrophe_backslash_state = ParserState_ (4, "apostrophe_backslash_state") + apostrophe_backslash_state = ParserState_ (4 , "apostrophe_backslash_state") - plain = ParserState_ (5, "plain") + plain = ParserState_ (5 , "plain") - values = Seq (undefined_state, quotes_state, apostrophe_state, quotes_backslash_state, apostrophe_backslash_state, plain) + values = Seq (undefined_state , quotes_state , apostrophe_state , quotes_backslash_state , apostrophe_backslash_state , plain) is_same_class (x : ParserState) (y : ParserState) : Boolean = (x == y) or _is_like (x) (y) or _is_like (y) (x) @@ -50,38 +50,38 @@ class ParserTransition ct = CharTypeEnum_ () - transitions_that_change_states : Map [ Tuple2 [ParserState, CharType], ParserState] = + transitions_that_change_states : Map [ Tuple2 [ParserState , CharType] , ParserState] = Map ( /* */ - Tuple2 ( Tuple2 (ps.quotes_state, ct.undefined_type), ps.undefined_state), - Tuple2 ( Tuple2 (ps.quotes_state, ct.quotes_type), ps.plain), - Tuple2 ( Tuple2 (ps.quotes_state, ct.backslash_type), ps.quotes_backslash_state), + Tuple2 ( Tuple2 (ps .quotes_state , ct .undefined_type) , ps .undefined_state), + Tuple2 ( Tuple2 (ps .quotes_state , ct .quotes_type) , ps .plain), + Tuple2 ( Tuple2 (ps .quotes_state , ct .backslash_type) , ps .quotes_backslash_state), /* */ - Tuple2 ( Tuple2 (ps.apostrophe_state, ct.undefined_type), ps.undefined_state), - Tuple2 ( Tuple2 (ps.apostrophe_state, ct.apostrophe_type), ps.plain), - Tuple2 ( Tuple2 (ps.apostrophe_state, ct.backslash_type), ps.apostrophe_backslash_state), + Tuple2 ( Tuple2 (ps .apostrophe_state , ct .undefined_type) , ps .undefined_state), + Tuple2 ( Tuple2 (ps .apostrophe_state , ct .apostrophe_type) , ps .plain), + Tuple2 ( Tuple2 (ps .apostrophe_state , ct .backslash_type) , ps .apostrophe_backslash_state), /* */ - Tuple2 ( Tuple2 (ps.quotes_backslash_state, ct.undefined_type), ps.undefined_state), - Tuple2 ( Tuple2 (ps.quotes_backslash_state, ct.quotes_type), ps.quotes_state), - Tuple2 ( Tuple2 (ps.quotes_backslash_state, ct.apostrophe_type), ps.quotes_state), - Tuple2 ( Tuple2 (ps.quotes_backslash_state, ct.backslash_type), ps.quotes_state), - Tuple2 ( Tuple2 (ps.quotes_backslash_state, ct.plain_type), ps.quotes_state), + Tuple2 ( Tuple2 (ps .quotes_backslash_state , ct .undefined_type) , ps .undefined_state), + Tuple2 ( Tuple2 (ps .quotes_backslash_state , ct .quotes_type) , ps .quotes_state), + Tuple2 ( Tuple2 (ps .quotes_backslash_state , ct .apostrophe_type) , ps .quotes_state), + Tuple2 ( Tuple2 (ps .quotes_backslash_state , ct .backslash_type) , ps .quotes_state), + Tuple2 ( Tuple2 (ps .quotes_backslash_state , ct .plain_type) , ps .quotes_state), /* */ - Tuple2 ( Tuple2 (ps.apostrophe_backslash_state, ct.undefined_type), ps.undefined_state), - Tuple2 ( Tuple2 (ps.apostrophe_backslash_state, ct.quotes_type), ps.apostrophe_state), - Tuple2 ( Tuple2 (ps.apostrophe_backslash_state, ct.apostrophe_type), ps.apostrophe_state), - Tuple2 ( Tuple2 (ps.apostrophe_backslash_state, ct.backslash_type), ps.apostrophe_state), - Tuple2 ( Tuple2 (ps.apostrophe_backslash_state, ct.plain_type), ps.apostrophe_state), + Tuple2 ( Tuple2 (ps .apostrophe_backslash_state , ct .undefined_type) , ps .undefined_state), + Tuple2 ( Tuple2 (ps .apostrophe_backslash_state , ct .quotes_type) , ps .apostrophe_state), + Tuple2 ( Tuple2 (ps .apostrophe_backslash_state , ct .apostrophe_type) , ps .apostrophe_state), + Tuple2 ( Tuple2 (ps .apostrophe_backslash_state , ct .backslash_type) , ps .apostrophe_state), + Tuple2 ( Tuple2 (ps .apostrophe_backslash_state , ct .plain_type) , ps .apostrophe_state), /* */ - Tuple2 ( Tuple2 (ps.plain, ct.undefined_type), ps.undefined_state), - Tuple2 ( Tuple2 (ps.plain, ct.quotes_type), ps.quotes_state), - Tuple2 ( Tuple2 (ps.plain, ct.apostrophe_type), ps.apostrophe_state), - Tuple2 ( Tuple2 (ps.plain, ct.backslash_type), ps.plain), - Tuple2 ( Tuple2 (ps.plain, ct.plain_type), ps.plain) + Tuple2 ( Tuple2 (ps .plain , ct .undefined_type) , ps .undefined_state), + Tuple2 ( Tuple2 (ps .plain , ct .quotes_type) , ps .quotes_state), + Tuple2 ( Tuple2 (ps .plain , ct .apostrophe_type) , ps .apostrophe_state), + Tuple2 ( Tuple2 (ps .plain , ct .backslash_type) , ps .plain), + Tuple2 ( Tuple2 (ps .plain , ct .plain_type) , ps .plain) ) next_parser_state (parser_state : ParserState) (char_type : CharType) : ParserState = - transitions_that_change_states.getOrElse ( Tuple2 (parser_state, char_type), parser_state) + transitions_that_change_states .getOrElse (Tuple2 (parser_state , char_type) , parser_state) end diff --git a/translator/src/main/scala/soda/translator/replacement/Replacement.soda b/translator/src/main/scala/soda/translator/replacement/Replacement.soda index 5bbee689..deeb8552 100644 --- a/translator/src/main/scala/soda/translator/replacement/Replacement.soda +++ b/translator/src/main/scala/soda/translator/replacement/Replacement.soda @@ -19,19 +19,19 @@ class Replacement soda_space = aux.soda_space replace_at_beginning (index : Int) (translator : Translator) : Replacement = - Replacement_ (ReplacementWithTranslator_ (translator).replace_at_beginning (line) (index) ) + Replacement_ (ReplacementWithTranslator_ (translator) .replace_at_beginning (line) (index) ) replace_all (pattern : String) (replacement : String) : Replacement = - Replacement_ (aux.replace_all (line) (pattern) (replacement) ) + Replacement_ (aux .replace_all (line) (pattern) (replacement) ) add_space_to_soda_line () : Replacement = Replacement_ (soda_space + line + soda_space) remove_space_from_scala_line () : Replacement = - Replacement_ (aux.remove_space_from_scala_line (line) ) + Replacement_ (aux .remove_space_from_scala_line (line) ) add_after_spaces_or_pattern (pattern : String) (text_to_prepend : String) : Replacement = - Replacement_ (aux.add_after_spaces_or_pattern (line) (pattern) (text_to_prepend) ) + Replacement_ (aux .add_after_spaces_or_pattern (line) (pattern) (text_to_prepend) ) end @@ -42,25 +42,25 @@ class ReplacementAux scala_space = " " replace_if_found_at_beginning (line : String) (pattern : String) (new_text : String) : String = - if line.trim.startsWith (pattern.trim) + if line .trim .startsWith (pattern .trim) then replace_first (line) (pattern) (new_text) else line replace_first (line : String) (pattern : String) (replacement : String) : String = - replace_at (line.indexOf (pattern) ) (line) (pattern) (replacement) + replace_at (line .indexOf (pattern) ) (line) (pattern) (replacement) replace_at (index : Int) (line : String) (pattern : String) (replacement : String) : String = - if (0 <= index) and (index + pattern.length <= line.length) - then line.substring (0, index) + replacement + line.substring (index + pattern.length, line.length) + if (0 <= index) and (index + pattern .length <= line .length) + then line .substring (0, index) + replacement + line .substring (index + pattern .length, line .length) else line replace_if_found (line : String) (pattern : String) (new_text : String) : String = - if line.contains (pattern) + if line .contains (pattern) then replace_all (line) (pattern) (new_text) else line replace_all (line : String) (pattern : String) (replacement : String) : String = - Replacer_ (line, pattern, replacement).replaced_text + Replacer_ (line, pattern, replacement) .replaced_text add_spaces_to_symbols (line : String) (symbols : Set [Char] ) : String = line @@ -72,40 +72,40 @@ class ReplacementAux (_left_part_of_symbols (line) (symbols) (index) (ch) ) + ch + (_right_part_of_symbols (line) (symbols) (index) (ch) ) _left_part_of_symbols (line : String) (symbols : Set [Char] ) (index : Int) (ch : Char) : String = - if (index > 0) and symbols.contains (ch) and - not line (index - 1).isWhitespace + if (index > 0) and symbols .contains (ch) and + not line (index - 1) .isWhitespace then scala_space else "" _right_part_of_symbols (line : String) (symbols : Set [Char] ) (index : Int) (ch : Char) : String = - if (index < line.length - 1) and symbols.contains (ch) and - not line (index + 1).isWhitespace + if (index < line .length - 1) and symbols .contains (ch) and + not line (index + 1) .isWhitespace then scala_space else "" remove_space_from_scala_line (line : String) : String = - _get_line_without_ending_space ( _get_line_without_starting_space (line) ) + _get_line_without_ending_space (_get_line_without_starting_space (line) ) _get_line_without_starting_space (line : String) : String = - if line.startsWith (scala_space) - then line.substring (1) + if line .startsWith (scala_space) + then line .substring (1) else line _get_line_without_ending_space (line : String) : String = - if line.endsWith (scala_space) - then line.substring (0, line.length - 1) + if line .endsWith (scala_space) + then line .substring (0, line .length - 1) else line add_after_spaces_or_pattern (line : String) (pattern : String) (text_to_prepend : String) : String = _add_after_spaces_or_pattern_with (_get_prefix_length (line) (pattern) ) (line) (pattern) (text_to_prepend) _add_after_spaces_or_pattern_with (prefix_length : Int) (line : String) (pattern : String) (text_to_prepend : String) : String = - line.substring (0, prefix_length) + text_to_prepend + line.substring (prefix_length) + line .substring (0, prefix_length) + text_to_prepend + line .substring (prefix_length) _get_prefix_length (line : String) (pattern : String) : Int = - if line.trim.startsWith (pattern) - then line.indexOf (pattern) + pattern.length - else line.takeWhile (lambda ch --> ch.isSpaceChar).length + if line .trim .startsWith (pattern) + then line .indexOf (pattern) + pattern .length + else line .takeWhile (lambda ch --> ch .isSpaceChar) .length end @@ -119,9 +119,9 @@ class ReplacementWithTranslator aux = ReplacementAux_ () - soda_space = aux.soda_space + soda_space = aux .soda_space - scala_space = aux.scala_space + scala_space = aux .scala_space soda_opening_parenthesis_symbol = "(" @@ -135,14 +135,14 @@ class ReplacementWithTranslator else line _replace_only_beginning (line : String) : String = - _fold.apply (translator.keys) (initial_value := line) (next_value_function := _next_replace_only_beginning) + _fold .apply (translator .keys) (initial_value := line) (next_value_function := _next_replace_only_beginning) _next_replace_only_beginning (line : String) (reserved_word : String) : String = - aux.replace_if_found_at_beginning (line) ( - soda_space + reserved_word + soda_space) (scala_space + translator.translate (reserved_word) + scala_space) + aux .replace_if_found_at_beginning (line) ( + soda_space + reserved_word + soda_space) (scala_space + translator .translate (reserved_word) + scala_space) replace (line : String) : String = - _fold.apply (translator.keys) (initial_value := line) (next_value_function := _next_replace) + _fold .apply (translator .keys) (initial_value := line) (next_value_function := _next_replace) _next_replace (line : String) (reserved_word : String) : String = _replace_if_found (soda_opening_parenthesis_symbol) (reserved_word) ( @@ -150,8 +150,8 @@ class ReplacementWithTranslator ) _replace_if_found (previous_character : String) (reserved_word : String) (line : String) : String = - aux.replace_if_found (line) ( - previous_character + reserved_word + soda_space) (previous_character + translator.translate (reserved_word) + scala_space) + aux .replace_if_found (line) ( + previous_character + reserved_word + soda_space) (previous_character + translator .translate (reserved_word) + scala_space) end diff --git a/translator/src/main/scala/soda/translator/replacement/Replacer.soda b/translator/src/main/scala/soda/translator/replacement/Replacer.soda index 34b94c3c..e28c11d6 100644 --- a/translator/src/main/scala/soda/translator/replacement/Replacer.soda +++ b/translator/src/main/scala/soda/translator/replacement/Replacer.soda @@ -26,31 +26,31 @@ class Replacer _range = Range_ () replaced_text = - postprocess (_fold_while.apply (_range.apply (line.length) ) (initial_value) (next_value_function) (should_continue) ) + postprocess (_fold_while.apply (_range .apply (line .length) ) (initial_value) (next_value_function) (should_continue) ) initial_value : ReplacerFoldTuple = ReplacerFoldTuple_ (Seq (), 0 ) next_value_function (tuple : ReplacerFoldTuple) (x : Int) : ReplacerFoldTuple = _get_next_tuple ( - replaced_text_rev := tuple.replaced_text_rev) ( - start_index := tuple.start_index) ( - pos := line.indexOf (pattern, tuple.start_index) + replaced_text_rev := tuple .replaced_text_rev) ( + start_index := tuple .start_index) ( + pos := line .indexOf (pattern, tuple .start_index) ) _get_next_tuple (replaced_text_rev : Seq [String] ) (start_index : Int) (pos : Int) : ReplacerFoldTuple = if pos == -1 - then ReplacerFoldTuple_ (replaced_text_rev.+: (line.substring (start_index) ), pos ) + then ReplacerFoldTuple_ (replaced_text_rev .+: (line .substring (start_index) ), pos ) else ReplacerFoldTuple_ ( - (replaced_text_rev.+: (line.substring (start_index, pos) ) ).+: (replacement), - pos + pattern.length + (replaced_text_rev .+: (line .substring (start_index, pos) ) ) .+: (replacement), + pos + pattern .length ) should_continue (tuple : ReplacerFoldTuple) (x : Int) : Boolean = - not (tuple.start_index == -1) + not (tuple .start_index == -1) postprocess (tuple : ReplacerFoldTuple) : String = - tuple.replaced_text_rev.reverse.mkString ("") + tuple .replaced_text_rev .reverse .mkString ("") end diff --git a/translator/src/main/scala/soda/translator/replacement/Tokenizer.soda b/translator/src/main/scala/soda/translator/replacement/Tokenizer.soda index 2e4fdc99..e840b89e 100644 --- a/translator/src/main/scala/soda/translator/replacement/Tokenizer.soda +++ b/translator/src/main/scala/soda/translator/replacement/Tokenizer.soda @@ -32,27 +32,27 @@ class Tokenizer _range = Range_ () tokens : Seq [Token] = - _postprocess (_fold.apply (_range.apply (line.length) ) (_initial_value) (_next_value_function) ) + _postprocess (_fold .apply (_range .apply (line .length) ) (_initial_value) (_next_value_function) ) - _initial_value : TokenizerFoldTuple = TokenizerFoldTuple_ (0, ParserStateEnum_ ().plain, Seq () ) + _initial_value : TokenizerFoldTuple = TokenizerFoldTuple_ (0, ParserStateEnum_ () .plain, Seq () ) _postprocess (tuple : TokenizerFoldTuple) : Seq [Token] = - (tuple.rev_tokens.+: (Token_ (line.substring (tuple.last_index), tuple.parser_state, tuple.last_index) ) ) + (tuple .rev_tokens .+: (Token_ (line .substring (tuple .last_index), tuple .parser_state, tuple .last_index) ) ) .reverse _next_value_function (tuple : TokenizerFoldTuple) (current_index : Int) : TokenizerFoldTuple = _new_value_function_with (tuple) (current_index) (_new_parser_state (tuple) (current_index) ) _new_value_function_with (tuple : TokenizerFoldTuple) (current_index : Int) (new_parser_state : ParserState) : TokenizerFoldTuple = - if ParserStateEnum_ ().is_same_class (new_parser_state) (tuple.parser_state) - then TokenizerFoldTuple_ (tuple.last_index, new_parser_state, tuple.rev_tokens) + if ParserStateEnum_ () .is_same_class (new_parser_state) (tuple .parser_state) + then TokenizerFoldTuple_ (tuple .last_index, new_parser_state, tuple .rev_tokens) else _next_value_function_of_different_class (tuple) (current_index) (new_parser_state) _new_parser_state (tuple : TokenizerFoldTuple) (current_index : Int) : ParserState = ParserTransition_ () .next_parser_state ( - tuple.parser_state) ( - CharTypeEnum_ ().get_char_type (line.charAt (current_index) ) + tuple .parser_state) ( + CharTypeEnum_ () .get_char_type (line .charAt (current_index) ) ) _next_value_function_of_different_class (tuple : TokenizerFoldTuple) (current_index : Int) (new_parser_state : ParserState) : TokenizerFoldTuple = @@ -64,18 +64,18 @@ class Tokenizer ) _get_new_current_index (tuple : TokenizerFoldTuple) (current_index : Int) : Int = - if tuple.parser_state == ParserStateEnum_ ().quotes_state or - tuple.parser_state == ParserStateEnum_ ().apostrophe_state + if tuple .parser_state == ParserStateEnum_ () .quotes_state or + tuple .parser_state == ParserStateEnum_ () .apostrophe_state then current_index + 1 else current_index _next_value_function_of_different_class_with (tuple : TokenizerFoldTuple) (current_index : Int) (new_parser_state : ParserState) (index : Int) : TokenizerFoldTuple = TokenizerFoldTuple_ (index, new_parser_state, - tuple.rev_tokens.+: ( + tuple .rev_tokens .+: ( Token_ ( - line.substring (tuple.last_index, index), - tuple.parser_state, - tuple.last_index + line .substring (tuple .last_index, index), + tuple .parser_state, + tuple .last_index ) ) ) diff --git a/translator/src/test/scala/soda/lib/CartesianProductSpec.soda b/translator/src/test/scala/soda/lib/CartesianProductSpec.soda index cf00e09d..39839974 100644 --- a/translator/src/test/scala/soda/lib/CartesianProductSpec.soda +++ b/translator/src/test/scala/soda/lib/CartesianProductSpec.soda @@ -6,32 +6,32 @@ class CartesianProductSpec () check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) - int_seq_a = Seq (10, 20) + int_seq_a = Seq (10 , 20) - int_seq_b = Seq (100, 200, 300) + int_seq_b = Seq (100 , 200 , 300) - str_seq_a = Seq ("A", "B") + str_seq_a = Seq ("A" , "B") - str_seq_b = Seq ("0", "1", "2") + str_seq_b = Seq ("0" , "1" , "2") - str_seq_c = Seq ("a", "b", "c", "d") + str_seq_c = Seq ("a" , "b" , "c" , "d") instance = CartesianProduct_ () test ("Cartesian product of two sequences") ( check ( - obtained := instance.apply (Seq (int_seq_a, int_seq_b) ) + obtained := instance .apply (Seq (int_seq_a , int_seq_b) ) ) ( expected := Seq ( - Seq (10, 100), Seq (10, 200), Seq (10, 300), - Seq (20, 100), Seq (20, 200), Seq (20, 300) + Seq (10 , 100) , Seq (10 , 200) , Seq (10 , 300), + Seq (20 , 100) , Seq (20 , 200) , Seq (20 , 300) ) ) ) test ("Cartesian product of an empty sequence") ( check ( - obtained := instance.apply (Seq () ) + obtained := instance .apply (Seq () ) ) ( expected := Seq () ) @@ -39,7 +39,7 @@ class CartesianProductSpec () test ("Cartesian product of only empty sequences") ( check ( - obtained := instance.apply (Seq (Seq (), Seq (), Seq () ) ) + obtained := instance .apply (Seq (Seq () , Seq () , Seq () ) ) ) ( expected := Seq () ) @@ -47,7 +47,7 @@ class CartesianProductSpec () test ("Cartesian product with at least one empty sequence") ( check ( - obtained := instance.apply (Seq (Seq ("A"), Seq () ) ) + obtained := instance .apply (Seq (Seq ("A") , Seq () ) ) ) ( expected := Seq () ) @@ -55,15 +55,15 @@ class CartesianProductSpec () test ("Cartesian product of three sequences") ( check ( - obtained := instance.apply (Seq (str_seq_a, str_seq_b, str_seq_c) ) + obtained := instance .apply (Seq (str_seq_a , str_seq_b , str_seq_c) ) ) ( expected := Seq ( - Seq ("A", "0", "a"), Seq ("A", "0", "b"), Seq ("A", "0", "c"), Seq ("A", "0", "d"), - Seq ("A", "1", "a"), Seq ("A", "1", "b"), Seq ("A", "1", "c"), Seq ("A", "1", "d"), - Seq ("A", "2", "a"), Seq ("A", "2", "b"), Seq ("A", "2", "c"), Seq ("A", "2", "d"), - Seq ("B", "0", "a"), Seq ("B", "0", "b"), Seq ("B", "0", "c"), Seq ("B", "0", "d"), - Seq ("B", "1", "a"), Seq ("B", "1", "b"), Seq ("B", "1", "c"), Seq ("B", "1", "d"), - Seq ("B", "2", "a"), Seq ("B", "2", "b"), Seq ("B", "2", "c"), Seq ("B", "2", "d") + Seq ("A" , "0" , "a") , Seq ("A" , "0" , "b") , Seq ("A" , "0" , "c") , Seq ("A" , "0" , "d"), + Seq ("A" , "1" , "a") , Seq ("A" , "1" , "b") , Seq ("A" , "1" , "c") , Seq ("A" , "1" , "d"), + Seq ("A" , "2" , "a") , Seq ("A" , "2" , "b") , Seq ("A" , "2" , "c") , Seq ("A" , "2" , "d"), + Seq ("B" , "0" , "a") , Seq ("B" , "0" , "b") , Seq ("B" , "0" , "c") , Seq ("B" , "0" , "d"), + Seq ("B" , "1" , "a") , Seq ("B" , "1" , "b") , Seq ("B" , "1" , "c") , Seq ("B" , "1" , "d"), + Seq ("B" , "2" , "a") , Seq ("B" , "2" , "b") , Seq ("B" , "2" , "c") , Seq ("B" , "2" , "d") ) ) ) diff --git a/translator/src/test/scala/soda/lib/EnumSpec.soda b/translator/src/test/scala/soda/lib/EnumSpec.soda index ec7a92eb..848266c0 100644 --- a/translator/src/test/scala/soda/lib/EnumSpec.soda +++ b/translator/src/test/scala/soda/lib/EnumSpec.soda @@ -11,21 +11,21 @@ end class DayOfTheWeekConstant - sunday = DayOfTheWeek_ (0, "Sunday") + sunday = DayOfTheWeek_ (0 , "Sunday") - monday = DayOfTheWeek_ (1, "Monday") + monday = DayOfTheWeek_ (1 , "Monday") - tuesday = DayOfTheWeek_ (2, "Tuesday") + tuesday = DayOfTheWeek_ (2 , "Tuesday") - wednesday = DayOfTheWeek_ (3, "Wednesday") + wednesday = DayOfTheWeek_ (3 , "Wednesday") - thursday = DayOfTheWeek_ (4, "Thursday") + thursday = DayOfTheWeek_ (4 , "Thursday") - friday = DayOfTheWeek_ (5, "Friday") + friday = DayOfTheWeek_ (5 , "Friday") - saturday = DayOfTheWeek_ (6, "Saturday") + saturday = DayOfTheWeek_ (6 , "Saturday") - DayOfTheWeek_values = Seq (sunday, monday, tuesday, wednesday, thursday, friday, saturday) + DayOfTheWeek_values = Seq (sunday , monday , tuesday , wednesday , thursday , friday , saturday) end @@ -46,9 +46,9 @@ class EnumSpec () test ("the names of the elements in enumerations") ( check ( - obtained := DayOfTheWeekEnum_ ().values.map (lambda x --> x.toString) + obtained := DayOfTheWeekEnum_ ().values.map (lambda x --> x .toString) ) ( - expected := Seq ("DayOfTheWeek_(0,Sunday)", "DayOfTheWeek_(1,Monday)", "DayOfTheWeek_(2,Tuesday)", "DayOfTheWeek_(3,Wednesday)", "DayOfTheWeek_(4,Thursday)", "DayOfTheWeek_(5,Friday)", "DayOfTheWeek_(6,Saturday)") + expected := Seq ("DayOfTheWeek_(0,Sunday)" , "DayOfTheWeek_(1,Monday)" , "DayOfTheWeek_(2,Tuesday)" , "DayOfTheWeek_(3,Wednesday)" , "DayOfTheWeek_(4,Thursday)" , "DayOfTheWeek_(5,Friday)" , "DayOfTheWeek_(6,Saturday)") ) ) diff --git a/translator/src/test/scala/soda/lib/OptionSDSpec.soda b/translator/src/test/scala/soda/lib/OptionSDSpec.soda index 9eb3c2f0..ab5bc5ae 100644 --- a/translator/src/test/scala/soda/lib/OptionSDSpec.soda +++ b/translator/src/test/scala/soda/lib/OptionSDSpec.soda @@ -11,21 +11,24 @@ class OptionSDSpec () result_if_empty : String = "It is empty." - result_if_non_empty (value : String) : String = "Its value is " + value + "." + result_if_non_empty (value : String) : String = + "Its value is " + value + "." - int_to_string (n : Int) : String = "" + n + int_to_string (n : Int) : String = + "" + n - maybe_int_to_string (n : Int) : SomeSD_ [String] = SomeSD_ [String] ("" + n) + maybe_int_to_string (n : Int) : SomeSD_ [String] = + SomeSD_ [String] ("" + n) maybe_string_to_int (s : String) : OptionSD [Int] = - OptionSDBuilder_ ().build ( - Try ( Integer.parseInt (s.trim) ) + OptionSDBuilder_ () .build ( + Try (Integer .parseInt (s .trim) ) .toOption ) test ("should test an empty option") ( check ( - obtained := empty_opt.isEmpty and not empty_opt.isDefined and not empty_opt.isNonEmpty + obtained := empty_opt .isEmpty and not empty_opt .isDefined and not empty_opt .isNonEmpty ) ( expected := true ) @@ -35,7 +38,7 @@ class OptionSDSpec () test ("should test a non empty option") ( check ( - obtained := not non_empty_opt.isEmpty and non_empty_opt.isDefined and non_empty_opt.isNonEmpty + obtained := not non_empty_opt .isEmpty and non_empty_opt .isDefined and non_empty_opt .isNonEmpty ) ( expected := true ) @@ -45,7 +48,7 @@ class OptionSDSpec () test ("should get a default value, when empty") ( check ( - obtained := (NoneSD_ [Int] () ).getOrElse (1) + obtained := (NoneSD_ [Int] () ) .getOrElse (1) ) ( expected := 1 ) @@ -53,7 +56,7 @@ class OptionSDSpec () test ("should get a value") ( check ( - obtained := (SomeSD_ [Int] (2) ).getOrElse (1) + obtained := (SomeSD_ [Int] (2) ) .getOrElse (1) ) ( expected := 2 ) @@ -61,7 +64,7 @@ class OptionSDSpec () test ("should open an empty option") ( check ( - obtained := (NoneSD_ [String] () ).opt (ifEmpty := result_if_empty) (ifNonEmpty := result_if_non_empty) + obtained := (NoneSD_ [String] () ) .opt (ifEmpty := result_if_empty) (ifNonEmpty := result_if_non_empty) ) ( expected := "It is empty." ) @@ -69,7 +72,7 @@ class OptionSDSpec () test ("should open an non empty option") ( check ( - obtained := (SomeSD_ [String] ("0") ).opt (ifEmpty := result_if_empty) (ifNonEmpty := result_if_non_empty) + obtained := (SomeSD_ [String] ("0") ) .opt (ifEmpty := result_if_empty) (ifNonEmpty := result_if_non_empty) ) ( expected := "Its value is 0." ) @@ -77,7 +80,7 @@ class OptionSDSpec () test ("should try fold an empty option") ( check ( - obtained := (NoneSD_ [String] () ).fold (ifEmpty := result_if_empty) (f := result_if_non_empty) + obtained := (NoneSD_ [String] () ) .fold (ifEmpty := result_if_empty) (f := result_if_non_empty) ) ( expected := "It is empty." ) @@ -85,7 +88,7 @@ class OptionSDSpec () test ("should try fold an non empty option") ( check ( - obtained := (SomeSD_ [String] ("0") ).fold (ifEmpty := result_if_empty) (f := result_if_non_empty) + obtained := (SomeSD_ [String] ("0") ) .fold (ifEmpty := result_if_empty) (f := result_if_non_empty) ) ( expected := "Its value is 0." ) @@ -93,7 +96,7 @@ class OptionSDSpec () test ("should map empty to empty") ( check ( - obtained := (NoneSD_ [Int] () ).map (int_to_string) + obtained := (NoneSD_ [Int] () ) .map (int_to_string) ) ( expected := NoneSD_ [String] () ) @@ -101,7 +104,7 @@ class OptionSDSpec () test ("should map a non-empty to another non-empty") ( check ( - obtained := (SomeSD_ [Int] (2) ).map (int_to_string) + obtained := (SomeSD_ [Int] (2) ) .map (int_to_string) ) ( expected := SomeSD_ [String] ("2") ) @@ -109,7 +112,7 @@ class OptionSDSpec () test ("should flat map empty to empty") ( check ( - obtained := (NoneSD_ [Int] () ).flatMap (maybe_int_to_string) + obtained := (NoneSD_ [Int] () ) .flatMap (maybe_int_to_string) ) ( expected := NoneSD_ [String] () ) @@ -117,7 +120,7 @@ class OptionSDSpec () test ("should flat map a non-empty to another non-empty") ( check ( - obtained := (SomeSD_ [Int] (2) ).flatMap (maybe_int_to_string) + obtained := (SomeSD_ [Int] (2) ) .flatMap (maybe_int_to_string) ) ( expected := SomeSD_ [String] ("2") ) @@ -126,11 +129,11 @@ class OptionSDSpec () test ("should try how successive applications of open works") ( check ( obtained := - maybe_string_to_int ("1").opt (ifEmpty := _empty_opt ) ( + maybe_string_to_int ("1") .opt (ifEmpty := _empty_opt ) ( ifNonEmpty := lambda a --> - maybe_string_to_int ("2").opt (ifEmpty := _empty_opt ) ( + maybe_string_to_int ("2") .opt (ifEmpty := _empty_opt ) ( ifNonEmpty := lambda b --> - maybe_string_to_int ("3").opt (ifEmpty := _empty_opt ) ( + maybe_string_to_int ("3") .opt (ifEmpty := _empty_opt ) ( ifNonEmpty := lambda c --> SomeSD_ (a + b + c) ) ) ) ) ( @@ -142,7 +145,7 @@ class OptionSDSpec () test ("toOption with non empty option") ( check ( - obtained := (SomeSD_ [Int] (1) ).toOption + obtained := (SomeSD_ [Int] (1) ) .toOption ) ( expected := Some (1) ) @@ -150,7 +153,7 @@ class OptionSDSpec () test ("toOption with another non empty option") ( check ( - obtained := (SomeSD_ [Int] (2) ).toOption + obtained := (SomeSD_ [Int] (2) ) .toOption ) ( expected := Some (2) ) @@ -158,7 +161,7 @@ class OptionSDSpec () test ("toOption with empty option") ( check ( - obtained := (NoneSD_ [Int] () ).toOption + obtained := (NoneSD_ [Int] () ) .toOption ) ( expected := None ) @@ -166,7 +169,7 @@ class OptionSDSpec () test ("toSeq with non empty option") ( check ( - obtained := (SomeSD_ (1) ).toSeq + obtained := (SomeSD_ (1) ) .toSeq ) ( expected := Seq (1) ) @@ -174,7 +177,7 @@ class OptionSDSpec () test ("toSeq with another non empty option") ( check ( - obtained := (SomeSD_ (2) ).toSeq + obtained := (SomeSD_ (2) ) .toSeq ) ( expected := Seq (2) ) @@ -182,7 +185,7 @@ class OptionSDSpec () test ("toSeq with empty option") ( check ( - obtained := (NoneSD_ () ).toSeq + obtained := (NoneSD_ () ) .toSeq ) ( expected := Seq () ) @@ -190,7 +193,7 @@ class OptionSDSpec () test ("filter should work for None") ( check ( - obtained := (NoneSD_ [Int] () ).filter (lambda x --> true) + obtained := (NoneSD_ [Int] () ) .filter (lambda x --> true) ) ( expected := NoneSD_ [Int] () ) @@ -198,7 +201,7 @@ class OptionSDSpec () test ("filter should work for Some, if predicate does not hold") ( check ( - obtained := (SomeSD_ [Int] (0) ).filter (lambda x --> x > 0) + obtained := (SomeSD_ [Int] (0) ) .filter (lambda x --> x > 0) ) ( expected := NoneSD_ [Int] () ) @@ -206,7 +209,7 @@ class OptionSDSpec () test ("filter should work for Some, if predicate holds") ( check ( - obtained := (SomeSD_ [Int] (1) ).filter (lambda x --> x > 0) + obtained := (SomeSD_ [Int] (1) ) .filter (lambda x --> x > 0) ) ( expected := SomeSD_ [Int] (1) ) diff --git a/translator/src/test/scala/soda/lib/Package.scala b/translator/src/test/scala/soda/lib/Package.scala index 0369a4df..a33f4efc 100644 --- a/translator/src/test/scala/soda/lib/Package.scala +++ b/translator/src/test/scala/soda/lib/Package.scala @@ -14,32 +14,32 @@ case class CartesianProductSpec () def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) - lazy val int_seq_a = Seq (10, 20) + lazy val int_seq_a = Seq (10 , 20) - lazy val int_seq_b = Seq (100, 200, 300) + lazy val int_seq_b = Seq (100 , 200 , 300) - lazy val str_seq_a = Seq ("A", "B") + lazy val str_seq_a = Seq ("A" , "B") - lazy val str_seq_b = Seq ("0", "1", "2") + lazy val str_seq_b = Seq ("0" , "1" , "2") - lazy val str_seq_c = Seq ("a", "b", "c", "d") + lazy val str_seq_c = Seq ("a" , "b" , "c" , "d") lazy val instance = CartesianProduct_ () test ("Cartesian product of two sequences") ( check ( - obtained = instance.apply (Seq (int_seq_a, int_seq_b) ) + obtained = instance .apply (Seq (int_seq_a , int_seq_b) ) ) ( expected = Seq ( - Seq (10, 100), Seq (10, 200), Seq (10, 300), - Seq (20, 100), Seq (20, 200), Seq (20, 300) + Seq (10 , 100) , Seq (10 , 200) , Seq (10 , 300), + Seq (20 , 100) , Seq (20 , 200) , Seq (20 , 300) ) ) ) test ("Cartesian product of an empty sequence") ( check ( - obtained = instance.apply (Seq () ) + obtained = instance .apply (Seq () ) ) ( expected = Seq () ) @@ -47,7 +47,7 @@ case class CartesianProductSpec () test ("Cartesian product of only empty sequences") ( check ( - obtained = instance.apply (Seq (Seq (), Seq (), Seq () ) ) + obtained = instance .apply (Seq (Seq () , Seq () , Seq () ) ) ) ( expected = Seq () ) @@ -55,7 +55,7 @@ case class CartesianProductSpec () test ("Cartesian product with at least one empty sequence") ( check ( - obtained = instance.apply (Seq (Seq ("A"), Seq () ) ) + obtained = instance .apply (Seq (Seq ("A") , Seq () ) ) ) ( expected = Seq () ) @@ -63,15 +63,15 @@ case class CartesianProductSpec () test ("Cartesian product of three sequences") ( check ( - obtained = instance.apply (Seq (str_seq_a, str_seq_b, str_seq_c) ) + obtained = instance .apply (Seq (str_seq_a , str_seq_b , str_seq_c) ) ) ( expected = Seq ( - Seq ("A", "0", "a"), Seq ("A", "0", "b"), Seq ("A", "0", "c"), Seq ("A", "0", "d"), - Seq ("A", "1", "a"), Seq ("A", "1", "b"), Seq ("A", "1", "c"), Seq ("A", "1", "d"), - Seq ("A", "2", "a"), Seq ("A", "2", "b"), Seq ("A", "2", "c"), Seq ("A", "2", "d"), - Seq ("B", "0", "a"), Seq ("B", "0", "b"), Seq ("B", "0", "c"), Seq ("B", "0", "d"), - Seq ("B", "1", "a"), Seq ("B", "1", "b"), Seq ("B", "1", "c"), Seq ("B", "1", "d"), - Seq ("B", "2", "a"), Seq ("B", "2", "b"), Seq ("B", "2", "c"), Seq ("B", "2", "d") + Seq ("A" , "0" , "a") , Seq ("A" , "0" , "b") , Seq ("A" , "0" , "c") , Seq ("A" , "0" , "d"), + Seq ("A" , "1" , "a") , Seq ("A" , "1" , "b") , Seq ("A" , "1" , "c") , Seq ("A" , "1" , "d"), + Seq ("A" , "2" , "a") , Seq ("A" , "2" , "b") , Seq ("A" , "2" , "c") , Seq ("A" , "2" , "d"), + Seq ("B" , "0" , "a") , Seq ("B" , "0" , "b") , Seq ("B" , "0" , "c") , Seq ("B" , "0" , "d"), + Seq ("B" , "1" , "a") , Seq ("B" , "1" , "b") , Seq ("B" , "1" , "c") , Seq ("B" , "1" , "d"), + Seq ("B" , "2" , "a") , Seq ("B" , "2" , "b") , Seq ("B" , "2" , "c") , Seq ("B" , "2" , "d") ) ) ) @@ -94,21 +94,21 @@ case class DayOfTheWeek_ (ordinal : Int, name : String) extends DayOfTheWeek trait DayOfTheWeekConstant { - lazy val sunday = DayOfTheWeek_ (0, "Sunday") + lazy val sunday = DayOfTheWeek_ (0 , "Sunday") - lazy val monday = DayOfTheWeek_ (1, "Monday") + lazy val monday = DayOfTheWeek_ (1 , "Monday") - lazy val tuesday = DayOfTheWeek_ (2, "Tuesday") + lazy val tuesday = DayOfTheWeek_ (2 , "Tuesday") - lazy val wednesday = DayOfTheWeek_ (3, "Wednesday") + lazy val wednesday = DayOfTheWeek_ (3 , "Wednesday") - lazy val thursday = DayOfTheWeek_ (4, "Thursday") + lazy val thursday = DayOfTheWeek_ (4 , "Thursday") - lazy val friday = DayOfTheWeek_ (5, "Friday") + lazy val friday = DayOfTheWeek_ (5 , "Friday") - lazy val saturday = DayOfTheWeek_ (6, "Saturday") + lazy val saturday = DayOfTheWeek_ (6 , "Saturday") - lazy val DayOfTheWeek_values = Seq (sunday, monday, tuesday, wednesday, thursday, friday, saturday) + lazy val DayOfTheWeek_values = Seq (sunday , monday , tuesday , wednesday , thursday , friday , saturday) } @@ -135,9 +135,9 @@ case class EnumSpec () test ("the names of the elements in enumerations") ( check ( - obtained = DayOfTheWeekEnum_ ().values.map ( x => x.toString) + obtained = DayOfTheWeekEnum_ ().values.map ( x => x .toString) ) ( - expected = Seq ("DayOfTheWeek_(0,Sunday)", "DayOfTheWeek_(1,Monday)", "DayOfTheWeek_(2,Tuesday)", "DayOfTheWeek_(3,Wednesday)", "DayOfTheWeek_(4,Thursday)", "DayOfTheWeek_(5,Friday)", "DayOfTheWeek_(6,Saturday)") + expected = Seq ("DayOfTheWeek_(0,Sunday)" , "DayOfTheWeek_(1,Monday)" , "DayOfTheWeek_(2,Tuesday)" , "DayOfTheWeek_(3,Wednesday)" , "DayOfTheWeek_(4,Thursday)" , "DayOfTheWeek_(5,Friday)" , "DayOfTheWeek_(6,Saturday)") ) ) @@ -156,21 +156,24 @@ case class OptionSDSpec () lazy val result_if_empty : String = "It is empty." - def result_if_non_empty (value : String) : String = "Its value is " + value + "." + def result_if_non_empty (value : String) : String = + "Its value is " + value + "." - def int_to_string (n : Int) : String = "" + n + def int_to_string (n : Int) : String = + "" + n - def maybe_int_to_string (n : Int) : SomeSD_ [String] = SomeSD_ [String] ("" + n) + def maybe_int_to_string (n : Int) : SomeSD_ [String] = + SomeSD_ [String] ("" + n) def maybe_string_to_int (s : String) : OptionSD [Int] = - OptionSDBuilder_ ().build ( - Try ( Integer.parseInt (s.trim) ) + OptionSDBuilder_ () .build ( + Try (Integer .parseInt (s .trim) ) .toOption ) test ("should test an empty option") ( check ( - obtained = empty_opt.isEmpty && ! empty_opt.isDefined && ! empty_opt.isNonEmpty + obtained = empty_opt .isEmpty && ! empty_opt .isDefined && ! empty_opt .isNonEmpty ) ( expected = true ) @@ -180,7 +183,7 @@ case class OptionSDSpec () test ("should test a non empty option") ( check ( - obtained = ! non_empty_opt.isEmpty && non_empty_opt.isDefined && non_empty_opt.isNonEmpty + obtained = ! non_empty_opt .isEmpty && non_empty_opt .isDefined && non_empty_opt .isNonEmpty ) ( expected = true ) @@ -190,7 +193,7 @@ case class OptionSDSpec () test ("should get a default value, when empty") ( check ( - obtained = (NoneSD_ [Int] () ).getOrElse (1) + obtained = (NoneSD_ [Int] () ) .getOrElse (1) ) ( expected = 1 ) @@ -198,7 +201,7 @@ case class OptionSDSpec () test ("should get a value") ( check ( - obtained = (SomeSD_ [Int] (2) ).getOrElse (1) + obtained = (SomeSD_ [Int] (2) ) .getOrElse (1) ) ( expected = 2 ) @@ -206,7 +209,7 @@ case class OptionSDSpec () test ("should open an empty option") ( check ( - obtained = (NoneSD_ [String] () ).opt (ifEmpty = result_if_empty) (ifNonEmpty = result_if_non_empty) + obtained = (NoneSD_ [String] () ) .opt (ifEmpty = result_if_empty) (ifNonEmpty = result_if_non_empty) ) ( expected = "It is empty." ) @@ -214,7 +217,7 @@ case class OptionSDSpec () test ("should open an non empty option") ( check ( - obtained = (SomeSD_ [String] ("0") ).opt (ifEmpty = result_if_empty) (ifNonEmpty = result_if_non_empty) + obtained = (SomeSD_ [String] ("0") ) .opt (ifEmpty = result_if_empty) (ifNonEmpty = result_if_non_empty) ) ( expected = "Its value is 0." ) @@ -222,7 +225,7 @@ case class OptionSDSpec () test ("should try fold an empty option") ( check ( - obtained = (NoneSD_ [String] () ).fold (ifEmpty = result_if_empty) (f = result_if_non_empty) + obtained = (NoneSD_ [String] () ) .fold (ifEmpty = result_if_empty) (f = result_if_non_empty) ) ( expected = "It is empty." ) @@ -230,7 +233,7 @@ case class OptionSDSpec () test ("should try fold an non empty option") ( check ( - obtained = (SomeSD_ [String] ("0") ).fold (ifEmpty = result_if_empty) (f = result_if_non_empty) + obtained = (SomeSD_ [String] ("0") ) .fold (ifEmpty = result_if_empty) (f = result_if_non_empty) ) ( expected = "Its value is 0." ) @@ -238,7 +241,7 @@ case class OptionSDSpec () test ("should map empty to empty") ( check ( - obtained = (NoneSD_ [Int] () ).map (int_to_string) + obtained = (NoneSD_ [Int] () ) .map (int_to_string) ) ( expected = NoneSD_ [String] () ) @@ -246,7 +249,7 @@ case class OptionSDSpec () test ("should map a non-empty to another non-empty") ( check ( - obtained = (SomeSD_ [Int] (2) ).map (int_to_string) + obtained = (SomeSD_ [Int] (2) ) .map (int_to_string) ) ( expected = SomeSD_ [String] ("2") ) @@ -254,7 +257,7 @@ case class OptionSDSpec () test ("should flat map empty to empty") ( check ( - obtained = (NoneSD_ [Int] () ).flatMap (maybe_int_to_string) + obtained = (NoneSD_ [Int] () ) .flatMap (maybe_int_to_string) ) ( expected = NoneSD_ [String] () ) @@ -262,7 +265,7 @@ case class OptionSDSpec () test ("should flat map a non-empty to another non-empty") ( check ( - obtained = (SomeSD_ [Int] (2) ).flatMap (maybe_int_to_string) + obtained = (SomeSD_ [Int] (2) ) .flatMap (maybe_int_to_string) ) ( expected = SomeSD_ [String] ("2") ) @@ -271,11 +274,11 @@ case class OptionSDSpec () test ("should try how successive applications of open works") ( check ( obtained = - maybe_string_to_int ("1").opt (ifEmpty = _empty_opt ) ( + maybe_string_to_int ("1") .opt (ifEmpty = _empty_opt ) ( ifNonEmpty = a => - maybe_string_to_int ("2").opt (ifEmpty = _empty_opt ) ( + maybe_string_to_int ("2") .opt (ifEmpty = _empty_opt ) ( ifNonEmpty = b => - maybe_string_to_int ("3").opt (ifEmpty = _empty_opt ) ( + maybe_string_to_int ("3") .opt (ifEmpty = _empty_opt ) ( ifNonEmpty = c => SomeSD_ (a + b + c) ) ) ) ) ( @@ -287,7 +290,7 @@ case class OptionSDSpec () test ("toOption with non empty option") ( check ( - obtained = (SomeSD_ [Int] (1) ).toOption + obtained = (SomeSD_ [Int] (1) ) .toOption ) ( expected = Some (1) ) @@ -295,7 +298,7 @@ case class OptionSDSpec () test ("toOption with another non empty option") ( check ( - obtained = (SomeSD_ [Int] (2) ).toOption + obtained = (SomeSD_ [Int] (2) ) .toOption ) ( expected = Some (2) ) @@ -303,7 +306,7 @@ case class OptionSDSpec () test ("toOption with empty option") ( check ( - obtained = (NoneSD_ [Int] () ).toOption + obtained = (NoneSD_ [Int] () ) .toOption ) ( expected = None ) @@ -311,7 +314,7 @@ case class OptionSDSpec () test ("toSeq with non empty option") ( check ( - obtained = (SomeSD_ (1) ).toSeq + obtained = (SomeSD_ (1) ) .toSeq ) ( expected = Seq (1) ) @@ -319,7 +322,7 @@ case class OptionSDSpec () test ("toSeq with another non empty option") ( check ( - obtained = (SomeSD_ (2) ).toSeq + obtained = (SomeSD_ (2) ) .toSeq ) ( expected = Seq (2) ) @@ -327,7 +330,7 @@ case class OptionSDSpec () test ("toSeq with empty option") ( check ( - obtained = (NoneSD_ () ).toSeq + obtained = (NoneSD_ () ) .toSeq ) ( expected = Seq () ) @@ -335,7 +338,7 @@ case class OptionSDSpec () test ("filter should work for None") ( check ( - obtained = (NoneSD_ [Int] () ).filter ( x => true) + obtained = (NoneSD_ [Int] () ) .filter ( x => true) ) ( expected = NoneSD_ [Int] () ) @@ -343,7 +346,7 @@ case class OptionSDSpec () test ("filter should work for Some, if predicate does not hold") ( check ( - obtained = (SomeSD_ [Int] (0) ).filter ( x => x > 0) + obtained = (SomeSD_ [Int] (0) ) .filter ( x => x > 0) ) ( expected = NoneSD_ [Int] () ) @@ -351,7 +354,7 @@ case class OptionSDSpec () test ("filter should work for Some, if predicate holds") ( check ( - obtained = (SomeSD_ [Int] (1) ).filter ( x => x > 0) + obtained = (SomeSD_ [Int] (1) ) .filter ( x => x > 0) ) ( expected = SomeSD_ [Int] (1) ) @@ -368,7 +371,7 @@ case class RecursionSpec () def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) - lazy val example_seq : Seq [Int] = Seq (0, 1, 1, 2, 3, 5, 8) + lazy val example_seq : Seq [Int] = Seq (0 , 1 , 1 , 2 , 3 , 5 , 8) private lazy val _fold_while = FoldWhile_ () @@ -378,44 +381,44 @@ case class RecursionSpec () test ("fold left while with Seq") ( check ( - obtained = _fold_while.apply (example_seq) (_fold0_initial_value) (_fold0_next_value_function) (_fold0_condition) + obtained = _fold_while .apply (example_seq) (_fold0_initial_value) (_fold0_next_value_function) (_fold0_condition) ) ( - expected = Seq ("103", "102", "101", "101", "100") + expected = Seq ("103" , "102" , "101" , "101" , "100") ) ) private lazy val _fold0_initial_value = Seq [String] () private lazy val _fold0_next_value_function : Seq [String] => Int => Seq [String] = - (s : Seq [String]) => (e : Int) => (s.+: ("" + (e + 100) ) ) + (s : Seq [String] ) => (e : Int) => (s .+: ("" + (e + 100) ) ) private lazy val _fold0_condition : Seq [String] => Int => Boolean = (s : Seq [String] ) => (e : Int) => (e < 5) test ("fold left with Seq") ( check ( - obtained = _fold.apply (example_seq) (_fold1_initial_value) (_fold1_next_value_function) + obtained = _fold .apply (example_seq) (_fold1_initial_value) (_fold1_next_value_function) ) ( - expected = Seq ("108", "105", "103", "102", "101", "101", "100") + expected = Seq ("108" , "105" , "103" , "102" , "101" , "101" , "100") ) ) private lazy val _fold1_initial_value = Seq [String] () private lazy val _fold1_next_value_function : Seq [String] => Int => Seq [String] = - (s : Seq [String] ) => (e : Int) => (s.+: ("" + (e + 100) ) ) + (s : Seq [String] ) => (e : Int) => (s .+: ("" + (e + 100) ) ) test ("range with positive number") ( check ( - obtained = _range.apply (8) + obtained = _range .apply (8) ) ( - expected = Seq (0, 1, 2, 3, 4, 5, 6, 7) + expected = Seq (0 , 1 , 2 , 3 , 4 , 5 , 6 , 7) ) ) test ("range with zero size") ( check ( - obtained = _range.apply (-1) + obtained = _range .apply (-1) ) ( expected = Seq () ) @@ -423,7 +426,7 @@ case class RecursionSpec () test ("range with negative number") ( check ( - obtained = _range.apply (-1) + obtained = _range .apply (-1) ) ( expected = Seq () ) @@ -440,13 +443,13 @@ case class SeqSDSpec () def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) - lazy val int_seq : Seq [Int] = Seq (2, 7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9) + lazy val int_seq : Seq [Int] = Seq (2 , 7 , 1 , 8 , 2 , 8 , 1 , 8 , 2 , 8 , 4 , 5 , 9) - lazy val rev_int_seq : Seq [Int] = Seq (9, 5 ,4, 8, 2, 8, 1, 8, 2, 8, 1, 7, 2) + lazy val rev_int_seq : Seq [Int] = Seq (9 , 5 ,4 , 8 , 2 , 8 , 1 , 8 , 2 , 8 , 1 , 7 , 2) test ("should detect an empty sequence") ( check ( - obtained = SeqSDBuilder_ ().build (Seq [Int] () ).opt (ifEmpty = true) (ifNonEmpty = nonEmpty => false) + obtained = SeqSDBuilder_ () .build (Seq [Int] () ) .opt (ifEmpty = true) (ifNonEmpty = nonEmpty => false) ) ( expected = true ) @@ -454,7 +457,7 @@ case class SeqSDSpec () test ("should detect an non empty sequence") ( check ( - obtained = SeqSDBuilder_ ().build (Seq [Int] (1) ).opt (ifEmpty = false) (ifNonEmpty = nonEmpty => true) + obtained = SeqSDBuilder_ () .build (Seq [Int] (1) ) .opt (ifEmpty = false) (ifNonEmpty = nonEmpty => true) ) ( expected = true ) @@ -462,7 +465,7 @@ case class SeqSDSpec () test ("should get the maximum") ( check ( - obtained = SeqSDBuilder_ ().build (int_seq).opt (ifEmpty = empty_opt) (ifNonEmpty = non_empty_opt) + obtained = SeqSDBuilder_ () .build (int_seq) .opt (ifEmpty = empty_opt) (ifNonEmpty = non_empty_opt) ) ( expected = SomeSD_ [Int] (9) ) @@ -478,27 +481,27 @@ case class SeqSDSpec () if ( a > b ) a else b def max (s : NonEmptySeqSD [Int]) : Int = - _fold.apply (s.tail.toSeq) (s.head) (max_of_2) + _fold .apply (s .tail .toSeq) (s .head) (max_of_2) test ("should reverse a sequence") ( check ( - obtained = SeqSDBuilder_ ().build (int_seq).reverse + obtained = SeqSDBuilder_ () .build (int_seq) .reverse ) ( - expected = SeqSDBuilder_ ().build (rev_int_seq) + expected = SeqSDBuilder_ () .build (rev_int_seq) ) ) test ("should reverse another sequence") ( check ( - obtained = SeqSDBuilder_ ().build (int_seq).opt (ifEmpty = empty_seq) (ifNonEmpty = non_empty_seq) + obtained = SeqSDBuilder_ () .build (int_seq) .opt (ifEmpty = empty_seq) (ifNonEmpty = non_empty_seq) ) ( - expected = SeqSDBuilder_ ().build (rev_int_seq) + expected = SeqSDBuilder_ () .build (rev_int_seq) ) ) lazy val empty_seq : SeqSD [Int] = EmptySeqSD_ () - lazy val non_empty_seq : NonEmptySeqSD [Int] => NonEmptySeqSD [Int] = sequence => sequence.reverse + lazy val non_empty_seq : NonEmptySeqSD [Int] => NonEmptySeqSD [Int] = sequence => sequence .reverse } diff --git a/translator/src/test/scala/soda/lib/RecursionSpec.soda b/translator/src/test/scala/soda/lib/RecursionSpec.soda index 18d0b769..3d9685de 100644 --- a/translator/src/test/scala/soda/lib/RecursionSpec.soda +++ b/translator/src/test/scala/soda/lib/RecursionSpec.soda @@ -6,7 +6,7 @@ class RecursionSpec () check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) - example_seq : Seq [Int] = Seq (0, 1, 1, 2, 3, 5, 8) + example_seq : Seq [Int] = Seq (0 , 1 , 1 , 2 , 3 , 5 , 8) _fold_while = FoldWhile_ () @@ -16,44 +16,44 @@ class RecursionSpec () test ("fold left while with Seq") ( check ( - obtained := _fold_while.apply (example_seq) (_fold0_initial_value) (_fold0_next_value_function) (_fold0_condition) + obtained := _fold_while .apply (example_seq) (_fold0_initial_value) (_fold0_next_value_function) (_fold0_condition) ) ( - expected := Seq ("103", "102", "101", "101", "100") + expected := Seq ("103" , "102" , "101" , "101" , "100") ) ) _fold0_initial_value = Seq [String] () _fold0_next_value_function : Seq [String] -> Int -> Seq [String] = - lambda (s : Seq [String]) --> lambda (e : Int) --> (s.+: ("" + (e + 100) ) ) + lambda (s : Seq [String] ) --> lambda (e : Int) --> (s .+: ("" + (e + 100) ) ) _fold0_condition : Seq [String] -> Int -> Boolean = lambda (s : Seq [String] ) --> lambda (e : Int) --> (e < 5) test ("fold left with Seq") ( check ( - obtained := _fold.apply (example_seq) (_fold1_initial_value) (_fold1_next_value_function) + obtained := _fold .apply (example_seq) (_fold1_initial_value) (_fold1_next_value_function) ) ( - expected := Seq ("108", "105", "103", "102", "101", "101", "100") + expected := Seq ("108" , "105" , "103" , "102" , "101" , "101" , "100") ) ) _fold1_initial_value = Seq [String] () _fold1_next_value_function : Seq [String] -> Int -> Seq [String] = - lambda (s : Seq [String] ) --> lambda (e : Int) --> (s.+: ("" + (e + 100) ) ) + lambda (s : Seq [String] ) --> lambda (e : Int) --> (s .+: ("" + (e + 100) ) ) test ("range with positive number") ( check ( - obtained := _range.apply (8) + obtained := _range .apply (8) ) ( - expected := Seq (0, 1, 2, 3, 4, 5, 6, 7) + expected := Seq (0 , 1 , 2 , 3 , 4 , 5 , 6 , 7) ) ) test ("range with zero size") ( check ( - obtained := _range.apply (-1) + obtained := _range .apply (-1) ) ( expected := Seq () ) @@ -61,7 +61,7 @@ class RecursionSpec () test ("range with negative number") ( check ( - obtained := _range.apply (-1) + obtained := _range .apply (-1) ) ( expected := Seq () ) diff --git a/translator/src/test/scala/soda/lib/SeqSDSpec.soda b/translator/src/test/scala/soda/lib/SeqSDSpec.soda index 21312879..fdcf0a47 100644 --- a/translator/src/test/scala/soda/lib/SeqSDSpec.soda +++ b/translator/src/test/scala/soda/lib/SeqSDSpec.soda @@ -6,13 +6,13 @@ class SeqSDSpec () check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) - int_seq : Seq [Int] = Seq (2, 7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9) + int_seq : Seq [Int] = Seq (2 , 7 , 1 , 8 , 2 , 8 , 1 , 8 , 2 , 8 , 4 , 5 , 9) - rev_int_seq : Seq [Int] = Seq (9, 5 ,4, 8, 2, 8, 1, 8, 2, 8, 1, 7, 2) + rev_int_seq : Seq [Int] = Seq (9 , 5 ,4 , 8 , 2 , 8 , 1 , 8 , 2 , 8 , 1 , 7 , 2) test ("should detect an empty sequence") ( check ( - obtained := SeqSDBuilder_ ().build (Seq [Int] () ).opt (ifEmpty := true) (ifNonEmpty := lambda nonEmpty --> false) + obtained := SeqSDBuilder_ () .build (Seq [Int] () ) .opt (ifEmpty := true) (ifNonEmpty := lambda nonEmpty --> false) ) ( expected := true ) @@ -20,7 +20,7 @@ class SeqSDSpec () test ("should detect an non empty sequence") ( check ( - obtained := SeqSDBuilder_ ().build (Seq [Int] (1) ).opt (ifEmpty := false) (ifNonEmpty := lambda nonEmpty --> true) + obtained := SeqSDBuilder_ () .build (Seq [Int] (1) ) .opt (ifEmpty := false) (ifNonEmpty := lambda nonEmpty --> true) ) ( expected := true ) @@ -28,7 +28,7 @@ class SeqSDSpec () test ("should get the maximum") ( check ( - obtained := SeqSDBuilder_ ().build (int_seq).opt (ifEmpty := empty_opt) (ifNonEmpty := non_empty_opt) + obtained := SeqSDBuilder_ () .build (int_seq) .opt (ifEmpty := empty_opt) (ifNonEmpty := non_empty_opt) ) ( expected := SomeSD_ [Int] (9) ) @@ -44,27 +44,27 @@ class SeqSDSpec () if a > b then a else b max (s : NonEmptySeqSD [Int]) : Int = - _fold.apply (s.tail.toSeq) (s.head) (max_of_2) + _fold .apply (s .tail .toSeq) (s .head) (max_of_2) test ("should reverse a sequence") ( check ( - obtained := SeqSDBuilder_ ().build (int_seq).reverse + obtained := SeqSDBuilder_ () .build (int_seq) .reverse ) ( - expected := SeqSDBuilder_ ().build (rev_int_seq) + expected := SeqSDBuilder_ () .build (rev_int_seq) ) ) test ("should reverse another sequence") ( check ( - obtained := SeqSDBuilder_ ().build (int_seq).opt (ifEmpty := empty_seq) (ifNonEmpty := non_empty_seq) + obtained := SeqSDBuilder_ () .build (int_seq) .opt (ifEmpty := empty_seq) (ifNonEmpty := non_empty_seq) ) ( - expected := SeqSDBuilder_ ().build (rev_int_seq) + expected := SeqSDBuilder_ () .build (rev_int_seq) ) ) empty_seq : SeqSD [Int] = EmptySeqSD_ () - non_empty_seq : NonEmptySeqSD [Int] -> NonEmptySeqSD [Int] = lambda sequence --> sequence.reverse + non_empty_seq : NonEmptySeqSD [Int] -> NonEmptySeqSD [Int] = lambda sequence --> sequence .reverse end diff --git a/translator/src/test/scala/soda/translator/block/BlockTranslatorPipelineSpec.soda b/translator/src/test/scala/soda/translator/block/BlockTranslatorPipelineSpec.soda index 709e51db..d03185b8 100644 --- a/translator/src/test/scala/soda/translator/block/BlockTranslatorPipelineSpec.soda +++ b/translator/src/test/scala/soda/translator/block/BlockTranslatorPipelineSpec.soda @@ -9,11 +9,11 @@ class BlockTranslator00 translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( - if block.lines.isEmpty + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( + if block .lines .isEmpty then Seq ("") - else block.lines.++ ( Seq ("tr00") ) + else block .lines .++ (Seq ("tr00") ) ) ) @@ -29,11 +29,11 @@ class BlockTranslator01 translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( - if block.lines.isEmpty + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( + if block .lines .isEmpty then Seq ("") - else block.lines.++ ( Seq ("tr01") ) + else block .lines .++ (Seq ("tr01") ) ) ) @@ -49,11 +49,11 @@ class BlockTranslator02 translate : AnnotatedBlock -> AnnotatedBlock = lambda block --> - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( - if block.lines.isEmpty + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( + if block .lines .isEmpty then Seq ("") - else block.lines.++ ( Seq ("tr02") ) + else block .lines .++ (Seq ("tr02") ) ) ) @@ -73,30 +73,30 @@ class BlockTranslatorPipelineSpec () instance = BlockTranslatorPipeline_ ( Seq ( - BlockTranslator00_ (), - BlockTranslator01_ (), + BlockTranslator00_ () , + BlockTranslator01_ () , BlockTranslator02_ () ) ) original = - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( - Seq ( "first line" ) + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( + Seq ("first line" ) ) ) test ("block translator pipeline") ( check ( - obtained := instance.translate (original) + obtained := instance .translate (original) ) ( expected := - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( Seq ( - "first line", - "tr00", - "tr01", + "first line" , + "tr00" , + "tr01" , "tr02" ) ) diff --git a/translator/src/test/scala/soda/translator/block/Package.scala b/translator/src/test/scala/soda/translator/block/Package.scala index 6cbc0620..dfd80ebe 100644 --- a/translator/src/test/scala/soda/translator/block/Package.scala +++ b/translator/src/test/scala/soda/translator/block/Package.scala @@ -15,11 +15,11 @@ trait BlockTranslator00 lazy val translate : AnnotatedBlock => AnnotatedBlock = block => - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( - if ( block.lines.isEmpty + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( + if ( block .lines .isEmpty ) Seq ("") - else block.lines.++ ( Seq ("tr00") ) + else block .lines .++ (Seq ("tr00") ) ) ) @@ -37,11 +37,11 @@ trait BlockTranslator01 lazy val translate : AnnotatedBlock => AnnotatedBlock = block => - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( - if ( block.lines.isEmpty + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( + if ( block .lines .isEmpty ) Seq ("") - else block.lines.++ ( Seq ("tr01") ) + else block .lines .++ (Seq ("tr01") ) ) ) @@ -59,11 +59,11 @@ trait BlockTranslator02 lazy val translate : AnnotatedBlock => AnnotatedBlock = block => - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( - if ( block.lines.isEmpty + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( + if ( block .lines .isEmpty ) Seq ("") - else block.lines.++ ( Seq ("tr02") ) + else block .lines .++ (Seq ("tr02") ) ) ) @@ -85,30 +85,30 @@ case class BlockTranslatorPipelineSpec () lazy val instance = BlockTranslatorPipeline_ ( Seq ( - BlockTranslator00_ (), - BlockTranslator01_ (), + BlockTranslator00_ () , + BlockTranslator01_ () , BlockTranslator02_ () ) ) lazy val original = - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( - Seq ( "first line" ) + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( + Seq ("first line" ) ) ) test ("block translator pipeline") ( check ( - obtained = instance.translate (original) + obtained = instance .translate (original) ) ( expected = - AnnotationFactory_ ().annotate ( - BlockBuilder_ ().build ( + AnnotationFactory_ () .annotate ( + BlockBuilder_ () .build ( Seq ( - "first line", - "tr00", - "tr01", + "first line" , + "tr00" , + "tr01" , "tr02" ) ) diff --git a/translator/src/test/scala/soda/translator/extension/tocoq/CoqFullTranslationSpec.soda b/translator/src/test/scala/soda/translator/extension/tocoq/CoqFullTranslationSpec.soda index a1d5565a..6493c351 100644 --- a/translator/src/test/scala/soda/translator/extension/tocoq/CoqFullTranslationSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/tocoq/CoqFullTranslationSpec.soda @@ -33,15 +33,15 @@ class CoqFullTranslationSpec () DefaultBlockSequenceTranslator_ ( MicroTranslatorToCoq_() ) - ).translate (read_file (input_file_name) ) + ) .translate (read_file (input_file_name) ) ) ( expected := read_file (expected_file_name) ) read_file (file_name : String) : String = @new String ( - Files.readAllBytes ( - Paths.get (getClass.getResource (file_name).toURI) + Files .readAllBytes ( + Paths .get (getClass .getResource (file_name) .toURI) ) ) diff --git a/translator/src/test/scala/soda/translator/extension/tocoq/Package.scala b/translator/src/test/scala/soda/translator/extension/tocoq/Package.scala index 67cc2b0d..b70a18f0 100644 --- a/translator/src/test/scala/soda/translator/extension/tocoq/Package.scala +++ b/translator/src/test/scala/soda/translator/extension/tocoq/Package.scala @@ -39,15 +39,15 @@ case class CoqFullTranslationSpec () DefaultBlockSequenceTranslator_ ( MicroTranslatorToCoq_() ) - ).translate (read_file (input_file_name) ) + ) .translate (read_file (input_file_name) ) ) ( expected = read_file (expected_file_name) ) def read_file (file_name : String) : String = new String ( - Files.readAllBytes ( - Paths.get (getClass.getResource (file_name).toURI) + Files .readAllBytes ( + Paths .get (getClass .getResource (file_name) .toURI) ) ) diff --git a/translator/src/test/scala/soda/translator/extension/todoc/DocFullTranslationSpec.soda b/translator/src/test/scala/soda/translator/extension/todoc/DocFullTranslationSpec.soda index 43103a4b..533cdd1b 100644 --- a/translator/src/test/scala/soda/translator/extension/todoc/DocFullTranslationSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/todoc/DocFullTranslationSpec.soda @@ -26,15 +26,15 @@ class DocFullTranslationSpec () test_translation_with (input_file_name : String) (expected_file_name : String) : Assertion = check ( - obtained := TranslatorToDoc_ ().translate_content (read_file (input_file_name) ) + obtained := TranslatorToDoc_ () .translate_content (read_file (input_file_name) ) ) ( expected := read_file (expected_file_name) ) read_file (file_name : String) : String = @new String ( - Files.readAllBytes ( - Paths.get (getClass.getResource (file_name).toURI) + Files .readAllBytes ( + Paths .get (getClass .getResource (file_name) .toURI) ) ) diff --git a/translator/src/test/scala/soda/translator/extension/todoc/MicroTranslatorToDocSpec.soda b/translator/src/test/scala/soda/translator/extension/todoc/MicroTranslatorToDocSpec.soda index 32c1bd73..5a162ebd 100644 --- a/translator/src/test/scala/soda/translator/extension/todoc/MicroTranslatorToDocSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/todoc/MicroTranslatorToDocSpec.soda @@ -35,7 +35,7 @@ class MicroTranslatorToDocSpec () test ("Document generation of a snippet") ( check ( - obtained := instance.translate (original_snippet) + obtained := instance .translate (original_snippet) ) ( expected := translated_snippet ) diff --git a/translator/src/test/scala/soda/translator/extension/todoc/Package.scala b/translator/src/test/scala/soda/translator/extension/todoc/Package.scala index 9b2085e9..c2bb7848 100644 --- a/translator/src/test/scala/soda/translator/extension/todoc/Package.scala +++ b/translator/src/test/scala/soda/translator/extension/todoc/Package.scala @@ -32,15 +32,15 @@ case class DocFullTranslationSpec () def test_translation_with (input_file_name : String) (expected_file_name : String) : Assertion = check ( - obtained = TranslatorToDoc_ ().translate_content (read_file (input_file_name) ) + obtained = TranslatorToDoc_ () .translate_content (read_file (input_file_name) ) ) ( expected = read_file (expected_file_name) ) def read_file (file_name : String) : String = new String ( - Files.readAllBytes ( - Paths.get (getClass.getResource (file_name).toURI) + Files .readAllBytes ( + Paths .get (getClass .getResource (file_name) .toURI) ) ) @@ -87,7 +87,7 @@ case class MicroTranslatorToDocSpec () test ("Document generation of a snippet") ( check ( - obtained = instance.translate (original_snippet) + obtained = instance .translate (original_snippet) ) ( expected = translated_snippet ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/BeautifierSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/BeautifierSpec.soda index c1ba3230..61cc5dce 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/BeautifierSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/BeautifierSpec.soda @@ -20,7 +20,7 @@ class BeautifierSpec () DefaultBlockSequenceTranslator_ ( MicroTranslatorToScala_() ) - ).translate (original) + ) .translate (original) ) ( expected := " def beautify_this ( original : String ) : String = \n" + " original . replaceAll(\" \" , \" \") \n" diff --git a/translator/src/test/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslatorSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslatorSpec.soda index 49ad7f7c..9385ee51 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslatorSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/ClassConstructorBlockTranslatorSpec.soda @@ -120,7 +120,7 @@ class ClassConstructorBlockTranslatorSpec () test ("should produce the constructors for a simple class") ( check ( - obtained := translator.translate (example_program_0) + obtained := translator .translate (example_program_0) ) ( expected := expected_program_0 ) @@ -128,7 +128,7 @@ class ClassConstructorBlockTranslatorSpec () test ("should produce the constructors for a class with type parameters") ( check ( - obtained := translator.translate (example_program_1) + obtained := translator .translate (example_program_1) ) ( expected := expected_program_1 ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/FullTranslationSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/FullTranslationSpec.soda index be943e2e..f92e4dd7 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/FullTranslationSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/FullTranslationSpec.soda @@ -55,15 +55,15 @@ class FullTranslationSpec () DefaultBlockSequenceTranslator_ ( MicroTranslatorToScala_() ) - ).translate (read_file (input_file_name) ) + ) .translate (read_file (input_file_name) ) ) ( expected := read_file (expected_file_name) ) read_file (file_name : String) : String = @new String ( - Files.readAllBytes ( - Paths.get (getClass.getResource (file_name).toURI) + Files .readAllBytes ( + Paths .get (getClass .getResource (file_name) .toURI) ) ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/LazySyntaxSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/LazySyntaxSpec.soda index 7c24a7c2..f1b3fe2d 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/LazySyntaxSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/LazySyntaxSpec.soda @@ -45,7 +45,7 @@ class LazySyntaxSpec () test ("should show what happens when constants are defined in the wrong order") ( check ( - obtained := ExampleWithWrongOrder_ ().this_is_null_but + obtained := ExampleWithWrongOrder_ () .this_is_null_but ) ( expected := "Success!" ) @@ -53,7 +53,7 @@ class LazySyntaxSpec () test ("should show what happens when constants are defined in the right order") ( check ( - obtained := ExampleWithRightOrder_ ().this_is_not_null + obtained := ExampleWithRightOrder_ () .this_is_not_null ) ( expected := "Success!" ) @@ -61,7 +61,7 @@ class LazySyntaxSpec () test ("should show what happens when one work-around is used") ( check ( - obtained := ExampleWithEmptyParentheses_ ().this_is_not_null () + obtained := ExampleWithEmptyParentheses_ () .this_is_not_null () ) ( expected := "Success!" ) @@ -69,7 +69,7 @@ class LazySyntaxSpec () test ("should show what happens when another work-around is used") ( check ( - obtained := AnotherExampleWithEmptyParentheses_ ().this_is_not_null + obtained := AnotherExampleWithEmptyParentheses_ () .this_is_not_null ) ( expected := "Success!" ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda index 786b4569..fe506ab1 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/MicroTranslatorToScalaSpec.soda @@ -19,7 +19,7 @@ class MicroTranslatorToScalaSpec () test ("should translate a small snippet") ( check ( - obtained := instance.translate (" input_lines = Seq (" + + obtained := instance .translate (" input_lines = Seq (" + "\n \" f ( x : Int,\\t\", " + "\n \" y : Int) =\"," + "\n \" x + y\")" + @@ -36,7 +36,7 @@ class MicroTranslatorToScalaSpec () test ("should leave content of apostrophes unchanged") ( check ( - obtained := instance.translate (" a = Seq ('\\'', \'', '\\\"', ' or ', \'or\', '0x00', '->', '/*', '*/')\n") + obtained := instance .translate (" a = Seq ('\\'', \'', '\\\"', ' or ', \'or\', '0x00', '->', '/*', '*/')\n") ) ( expected := " lazy val a = Seq ('\\'', '', '\\\"', ' or ', 'or', '0x00', '->', '/*', '*/')\n" ) @@ -44,7 +44,7 @@ class MicroTranslatorToScalaSpec () test ("should leave content of quotation marks unchanged") ( check ( - obtained := instance.translate (" a = Seq (\"\\\"\", \"\", \"\\\'\", \" or \", \"or\", \"0x00\", \"->\", \"/*\", \"*/\")\n" ) + obtained := instance .translate (" a = Seq (\"\\\"\", \"\", \"\\\'\", \" or \", \"or\", \"0x00\", \"->\", \"/*\", \"*/\")\n" ) ) ( expected := " lazy val a = Seq (\"\\\"\", \"\", \"\\'\", \" or \", \"or\", \"0x00\", \"->\", \"/*\", \"*/\")\n" ) @@ -52,7 +52,7 @@ class MicroTranslatorToScalaSpec () test ("should translate classes") ( check ( - obtained := instance.translate ("class D" + + obtained := instance .translate ("class D" + "\n" + "\n f (x : Int) : Int = x + 1" + "\n" + @@ -137,7 +137,7 @@ class MicroTranslatorToScalaSpec () test ("should translate a class in a class") ( check ( - obtained := instance.translate ("class D" + + obtained := instance .translate ("class D" + "\n" + "\n f (x : Int) : Int = x + 1" + "\n" + @@ -183,7 +183,7 @@ class MicroTranslatorToScalaSpec () test ("should translate type aliases") ( check ( - obtained := instance.translate ("class A [T] = B [T]" + + obtained := instance .translate ("class A [T] = B [T]" + "\n" + "\nclass C = D" + "\n" + @@ -203,7 +203,7 @@ class MicroTranslatorToScalaSpec () test ("should translate a tuple assignment") ( check ( - obtained := instance.translate (" (x, y) = (f (a), g (a))" + + obtained := instance .translate (" (x, y) = (f (a), g (a))" + "\n" + "\n (p, q) =" + "\n h (1, 2)" + @@ -220,7 +220,7 @@ class MicroTranslatorToScalaSpec () test ("should translate a pattern matching") ( check ( - obtained := instance.translate ("fibo (n : Int) : Int = " + + obtained := instance .translate ("fibo (n : Int) : Int = " + "\n match n" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + @@ -240,7 +240,7 @@ class MicroTranslatorToScalaSpec () test ("should translate another pattern matching") ( check ( - obtained := instance.translate ("fibo (n : Int) : Int = " + + obtained := instance .translate ("fibo (n : Int) : Int = " + "\n match n" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + @@ -260,7 +260,7 @@ class MicroTranslatorToScalaSpec () test ("should ignore a pattern matching written in the Scala style") ( check ( - obtained := instance.translate ("fibo (n : Int) : Int = " + + obtained := instance .translate ("fibo (n : Int) : Int = " + "\n n match" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + @@ -279,7 +279,7 @@ class MicroTranslatorToScalaSpec () test ("should translate an explicit lambda expression using lambda") ( check ( - obtained := instance.translate ("plus_1 : Int = lambda (x : Int) --> x + 1" + + obtained := instance .translate ("plus_1 : Int = lambda (x : Int) --> x + 1" + "\n" ) ) ( @@ -290,7 +290,7 @@ class MicroTranslatorToScalaSpec () test ("should translate another explicit lambda expression using any") ( check ( - obtained := instance.translate ("plus_1 : Int = any (x : Int) --> x + 1" + + obtained := instance .translate ("plus_1 : Int = any (x : Int) --> x + 1" + "\n" ) ) ( @@ -301,7 +301,7 @@ class MicroTranslatorToScalaSpec () test ("should translate another explicit lambda expression containing parentheses") ( check ( - obtained := instance.translate ("plus_1 (s : Seq [Int] ) : Seq [Int] =" + + obtained := instance .translate ("plus_1 (s : Seq [Int] ) : Seq [Int] =" + "\n s .map (lambda x --> x + 1)" + "\n" ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/MultiLineSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/MultiLineSpec.soda index 88a08b91..dbaf061e 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/MultiLineSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/MultiLineSpec.soda @@ -34,20 +34,20 @@ class MultiLineSpec () " z: Int) =\n" + " x * x + y * y + z * z\n" - original_input_lines = Seq( - " value = 1", - " sequence = Seq(1 ,", - " 2, ", - " 3)", - " f( x: Int,\t", - " y: Int,", - " z: Int) =", + original_input_lines = Seq ( + " value = 1" , + " sequence = Seq(1 ," , + " 2, " , + " 3)" , + " f( x: Int,\t" , + " y: Int," , + " z: Int) =" , " x * x + y * y + z * z") - joined_comma_lines = Seq( - " value = 1", - " sequence = Seq(1 , 2, 3)", - " f( x: Int,\t y: Int, z: Int) =", + joined_comma_lines = Seq ( + " value = 1" , + " sequence = Seq(1 , 2, 3)" , + " f( x: Int,\t y: Int, z: Int) =" , " x * x + y * y + z * z") joined_output = @@ -60,12 +60,12 @@ class MultiLineSpec () " z: Int) =\n" + " x * x + y * y + z * z" - build_block (lines: Seq [String]): AnnotatedBlock = - AnnotationFactory_ ().annotate (BlockBuilder_ ().build (lines) ) + build_block (lines : Seq [String] ) : AnnotatedBlock = + AnnotationFactory_ () .annotate (BlockBuilder_ () .build (lines) ) test ("should split a program in multiple lines") ( check ( - obtained := bp.make_block (original_input) + obtained := bp .make_block (original_input) ) ( expected := build_block (original_input_lines ) ) @@ -75,7 +75,7 @@ class MultiLineSpec () check ( obtained := build_block (joined_comma_lines) ) ( - expected := bp.make_block (joined_output) + expected := bp .make_block (joined_output) ) ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala index b3dc9276..0ddb18db 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/Package.scala +++ b/translator/src/test/scala/soda/translator/extension/toscala/Package.scala @@ -26,7 +26,7 @@ case class BeautifierSpec () DefaultBlockSequenceTranslator_ ( MicroTranslatorToScala_() ) - ).translate (original) + ) .translate (original) ) ( expected = " def beautify_this ( original : String ) : String = \n" + " original . replaceAll(\" \" , \" \") \n" @@ -156,7 +156,7 @@ case class ClassConstructorBlockTranslatorSpec () test ("should produce the constructors for a simple class") ( check ( - obtained = translator.translate (example_program_0) + obtained = translator .translate (example_program_0) ) ( expected = expected_program_0 ) @@ -164,7 +164,7 @@ case class ClassConstructorBlockTranslatorSpec () test ("should produce the constructors for a class with type parameters") ( check ( - obtained = translator.translate (example_program_1) + obtained = translator .translate (example_program_1) ) ( expected = expected_program_1 ) @@ -229,15 +229,15 @@ case class FullTranslationSpec () DefaultBlockSequenceTranslator_ ( MicroTranslatorToScala_() ) - ).translate (read_file (input_file_name) ) + ) .translate (read_file (input_file_name) ) ) ( expected = read_file (expected_file_name) ) def read_file (file_name : String) : String = new String ( - Files.readAllBytes ( - Paths.get (getClass.getResource (file_name).toURI) + Files .readAllBytes ( + Paths .get (getClass .getResource (file_name) .toURI) ) ) @@ -347,7 +347,7 @@ case class LazySyntaxSpec () test ("should show what happens when constants are defined in the wrong order") ( check ( - obtained = ExampleWithWrongOrder_ ().this_is_null_but + obtained = ExampleWithWrongOrder_ () .this_is_null_but ) ( expected = "Success!" ) @@ -355,7 +355,7 @@ case class LazySyntaxSpec () test ("should show what happens when constants are defined in the right order") ( check ( - obtained = ExampleWithRightOrder_ ().this_is_not_null + obtained = ExampleWithRightOrder_ () .this_is_not_null ) ( expected = "Success!" ) @@ -363,7 +363,7 @@ case class LazySyntaxSpec () test ("should show what happens when one work-around is used") ( check ( - obtained = ExampleWithEmptyParentheses_ ().this_is_not_null () + obtained = ExampleWithEmptyParentheses_ () .this_is_not_null () ) ( expected = "Success!" ) @@ -371,7 +371,7 @@ case class LazySyntaxSpec () test ("should show what happens when another work-around is used") ( check ( - obtained = AnotherExampleWithEmptyParentheses_ ().this_is_not_null + obtained = AnotherExampleWithEmptyParentheses_ () .this_is_not_null ) ( expected = "Success!" ) @@ -400,7 +400,7 @@ case class MicroTranslatorToScalaSpec () test ("should translate a small snippet") ( check ( - obtained = instance.translate (" input_lines = Seq (" + + obtained = instance .translate (" input_lines = Seq (" + "\n \" f ( x : Int,\\t\", " + "\n \" y : Int) =\"," + "\n \" x + y\")" + @@ -417,7 +417,7 @@ case class MicroTranslatorToScalaSpec () test ("should leave content of apostrophes unchanged") ( check ( - obtained = instance.translate (" a = Seq ('\\'', \'', '\\\"', ' or ', \'or\', '0x00', '->', '/*', '*/')\n") + obtained = instance .translate (" a = Seq ('\\'', \'', '\\\"', ' or ', \'or\', '0x00', '->', '/*', '*/')\n") ) ( expected = " lazy val a = Seq ('\\'', '', '\\\"', ' or ', 'or', '0x00', '->', '/*', '*/')\n" ) @@ -425,7 +425,7 @@ case class MicroTranslatorToScalaSpec () test ("should leave content of quotation marks unchanged") ( check ( - obtained = instance.translate (" a = Seq (\"\\\"\", \"\", \"\\\'\", \" or \", \"or\", \"0x00\", \"->\", \"/*\", \"*/\")\n" ) + obtained = instance .translate (" a = Seq (\"\\\"\", \"\", \"\\\'\", \" or \", \"or\", \"0x00\", \"->\", \"/*\", \"*/\")\n" ) ) ( expected = " lazy val a = Seq (\"\\\"\", \"\", \"\\'\", \" or \", \"or\", \"0x00\", \"->\", \"/*\", \"*/\")\n" ) @@ -433,7 +433,7 @@ case class MicroTranslatorToScalaSpec () test ("should translate classes") ( check ( - obtained = instance.translate ("class D" + + obtained = instance .translate ("class D" + "\n" + "\n f (x : Int) : Int = x + 1" + "\n" + @@ -518,7 +518,7 @@ case class MicroTranslatorToScalaSpec () test ("should translate a class in a class") ( check ( - obtained = instance.translate ("class D" + + obtained = instance .translate ("class D" + "\n" + "\n f (x : Int) : Int = x + 1" + "\n" + @@ -564,7 +564,7 @@ case class MicroTranslatorToScalaSpec () test ("should translate type aliases") ( check ( - obtained = instance.translate ("class A [T] = B [T]" + + obtained = instance .translate ("class A [T] = B [T]" + "\n" + "\nclass C = D" + "\n" + @@ -584,7 +584,7 @@ case class MicroTranslatorToScalaSpec () test ("should translate a tuple assignment") ( check ( - obtained = instance.translate (" (x, y) = (f (a), g (a))" + + obtained = instance .translate (" (x, y) = (f (a), g (a))" + "\n" + "\n (p, q) =" + "\n h (1, 2)" + @@ -601,7 +601,7 @@ case class MicroTranslatorToScalaSpec () test ("should translate a pattern matching") ( check ( - obtained = instance.translate ("fibo (n : Int) : Int = " + + obtained = instance .translate ("fibo (n : Int) : Int = " + "\n match n" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + @@ -621,7 +621,7 @@ case class MicroTranslatorToScalaSpec () test ("should translate another pattern matching") ( check ( - obtained = instance.translate ("fibo (n : Int) : Int = " + + obtained = instance .translate ("fibo (n : Int) : Int = " + "\n match n" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + @@ -641,7 +641,7 @@ case class MicroTranslatorToScalaSpec () test ("should ignore a pattern matching written in the Scala style") ( check ( - obtained = instance.translate ("fibo (n : Int) : Int = " + + obtained = instance .translate ("fibo (n : Int) : Int = " + "\n n match" + "\n case 0 ==> 1 " + "\n case 1 ==> 1 " + @@ -660,7 +660,7 @@ case class MicroTranslatorToScalaSpec () test ("should translate an explicit lambda expression using lambda") ( check ( - obtained = instance.translate ("plus_1 : Int = lambda (x : Int) --> x + 1" + + obtained = instance .translate ("plus_1 : Int = lambda (x : Int) --> x + 1" + "\n" ) ) ( @@ -671,7 +671,7 @@ case class MicroTranslatorToScalaSpec () test ("should translate another explicit lambda expression using any") ( check ( - obtained = instance.translate ("plus_1 : Int = any (x : Int) --> x + 1" + + obtained = instance .translate ("plus_1 : Int = any (x : Int) --> x + 1" + "\n" ) ) ( @@ -682,7 +682,7 @@ case class MicroTranslatorToScalaSpec () test ("should translate another explicit lambda expression containing parentheses") ( check ( - obtained = instance.translate ("plus_1 (s : Seq [Int] ) : Seq [Int] =" + + obtained = instance .translate ("plus_1 (s : Seq [Int] ) : Seq [Int] =" + "\n s .map (lambda x --> x + 1)" + "\n" ) @@ -731,20 +731,20 @@ case class MultiLineSpec () " z: Int) =\n" + " x * x + y * y + z * z\n" - lazy val original_input_lines = Seq( - " value = 1", - " sequence = Seq(1 ,", - " 2, ", - " 3)", - " f( x: Int,\t", - " y: Int,", - " z: Int) =", + lazy val original_input_lines = Seq ( + " value = 1" , + " sequence = Seq(1 ," , + " 2, " , + " 3)" , + " f( x: Int,\t" , + " y: Int," , + " z: Int) =" , " x * x + y * y + z * z") - lazy val joined_comma_lines = Seq( - " value = 1", - " sequence = Seq(1 , 2, 3)", - " f( x: Int,\t y: Int, z: Int) =", + lazy val joined_comma_lines = Seq ( + " value = 1" , + " sequence = Seq(1 , 2, 3)" , + " f( x: Int,\t y: Int, z: Int) =" , " x * x + y * y + z * z") lazy val joined_output = @@ -757,12 +757,12 @@ case class MultiLineSpec () " z: Int) =\n" + " x * x + y * y + z * z" - def build_block (lines: Seq [String]): AnnotatedBlock = - AnnotationFactory_ ().annotate (BlockBuilder_ ().build (lines) ) + def build_block (lines : Seq [String] ) : AnnotatedBlock = + AnnotationFactory_ () .annotate (BlockBuilder_ () .build (lines) ) test ("should split a program in multiple lines") ( check ( - obtained = bp.make_block (original_input) + obtained = bp .make_block (original_input) ) ( expected = build_block (original_input_lines ) ) @@ -772,7 +772,7 @@ case class MultiLineSpec () check ( obtained = build_block (joined_comma_lines) ) ( - expected = bp.make_block (joined_output) + expected = bp .make_block (joined_output) ) ) @@ -803,7 +803,7 @@ case class ScalaNonSodaSpec () test ("Scala reserved words are replaced") ( check ( - obtained = bp.translate ("" + + obtained = bp .translate ("" + "\nval x =" + "\n while (x != 0)" ) @@ -817,7 +817,7 @@ case class ScalaNonSodaSpec () test ("some synonyms are Scala reserved words") ( check ( - obtained = bp.translate ("" + + obtained = bp .translate ("" + "\nclass A0 [B0 <: C0]" + "\n" + "\nend" + @@ -883,7 +883,7 @@ case class MainSpec () test ("should get the input and output file names without path") ( check ( - obtained = instance.get_input_output_file_names("my_file.soda") + obtained = instance .get_input_output_file_names("my_file.soda") ) ( expected = FileNamePair_("my_file.soda", "my_file.scala") ) @@ -891,7 +891,7 @@ case class MainSpec () test ("should get the input and output file names with path") ( check ( - obtained = instance.get_input_output_file_names("/path/to/file.soda") + obtained = instance .get_input_output_file_names("/path/to/file.soda") ) ( expected = FileNamePair_("/path/to/file.soda", "/path/to/file.scala") ) @@ -920,7 +920,7 @@ case class UpperAndLowerBoundDeclarationSpec () test ("should translate a single upper bound") ( check ( - obtained = instance.translate ("class BlackBox()" + + obtained = instance .translate ("class BlackBox()" + "\n extends " + "\n AbstractBlackBox[A subtype AbstractInput]" + "\n" + @@ -941,7 +941,7 @@ case class UpperAndLowerBoundDeclarationSpec () test ("should translate multiple upper bounds") ( check ( - obtained = instance.translate ( " class BlackBox()" + + obtained = instance .translate ( " class BlackBox()" + "\n extends " + "\n AbstractBlackBox[A subtype AbstractInput]" + "\n AbstractDevice[B subtype AbstractDeviceInput]" + @@ -963,7 +963,7 @@ case class UpperAndLowerBoundDeclarationSpec () test ("should translate a single lower bound") ( check ( - obtained = instance.translate (" class BlackBox()" + + obtained = instance .translate (" class BlackBox()" + "\n extends " + "\n AbstractBlackBox[A supertype (AbstractInput)]" + "\n" + @@ -983,7 +983,7 @@ case class UpperAndLowerBoundDeclarationSpec () test ("should translate multiple lower bounds") ( check ( - obtained = instance.translate (" class BlackBox()" + + obtained = instance .translate (" class BlackBox()" + "\n extends " + "\n AbstractBlackBox[A supertype (AbstractInput)]" + "\n AbstractDevice[B supertype (AbstractDeviceInput)]" + @@ -1005,7 +1005,7 @@ case class UpperAndLowerBoundDeclarationSpec () test ("should translate mixed upper and lower bounds") ( check ( - obtained = instance.translate (" class BlackBox [A subtype AbstractModel] [B subtype AbstractParameter]" + + obtained = instance .translate (" class BlackBox [A subtype AbstractModel] [B subtype AbstractParameter]" + "\n extends " + "\n AbstractBlackBox[A][B]" + "\n AbstractDevice [A] [B] " + diff --git a/translator/src/test/scala/soda/translator/extension/toscala/ScalaNonSodaSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/ScalaNonSodaSpec.soda index d3c107e5..262a8f66 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/ScalaNonSodaSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/ScalaNonSodaSpec.soda @@ -23,7 +23,7 @@ class ScalaNonSodaSpec () test ("Scala reserved words are replaced") ( check ( - obtained := bp.translate ("" + + obtained := bp .translate ("" + "\nval x =" + "\n while (x != 0)" ) @@ -37,7 +37,7 @@ class ScalaNonSodaSpec () test ("some synonyms are Scala reserved words") ( check ( - obtained := bp.translate ("" + + obtained := bp .translate ("" + "\nclass A0 [B0 <: C0]" + "\n" + "\nend" + diff --git a/translator/src/test/scala/soda/translator/extension/toscala/TranslatorToScalaSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/TranslatorToScalaSpec.soda index c774786d..399151cd 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/TranslatorToScalaSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/TranslatorToScalaSpec.soda @@ -10,7 +10,7 @@ class MainSpec () test ("should get the input and output file names without path") ( check ( - obtained := instance.get_input_output_file_names("my_file.soda") + obtained := instance .get_input_output_file_names("my_file.soda") ) ( expected := FileNamePair_("my_file.soda", "my_file.scala") ) @@ -18,7 +18,7 @@ class MainSpec () test ("should get the input and output file names with path") ( check ( - obtained := instance.get_input_output_file_names("/path/to/file.soda") + obtained := instance .get_input_output_file_names("/path/to/file.soda") ) ( expected := FileNamePair_("/path/to/file.soda", "/path/to/file.scala") ) diff --git a/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda b/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda index 36dc3fed..ad68a720 100644 --- a/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda +++ b/translator/src/test/scala/soda/translator/extension/toscala/UpperAndLowerBoundDeclarationSpec.soda @@ -19,7 +19,7 @@ class UpperAndLowerBoundDeclarationSpec () test ("should translate a single upper bound") ( check ( - obtained := instance.translate ("class BlackBox()" + + obtained := instance .translate ("class BlackBox()" + "\n extends " + "\n AbstractBlackBox[A subtype AbstractInput]" + "\n" + @@ -40,7 +40,7 @@ class UpperAndLowerBoundDeclarationSpec () test ("should translate multiple upper bounds") ( check ( - obtained := instance.translate ( " class BlackBox()" + + obtained := instance .translate ( " class BlackBox()" + "\n extends " + "\n AbstractBlackBox[A subtype AbstractInput]" + "\n AbstractDevice[B subtype AbstractDeviceInput]" + @@ -62,7 +62,7 @@ class UpperAndLowerBoundDeclarationSpec () test ("should translate a single lower bound") ( check ( - obtained := instance.translate (" class BlackBox()" + + obtained := instance .translate (" class BlackBox()" + "\n extends " + "\n AbstractBlackBox[A supertype (AbstractInput)]" + "\n" + @@ -82,7 +82,7 @@ class UpperAndLowerBoundDeclarationSpec () test ("should translate multiple lower bounds") ( check ( - obtained := instance.translate (" class BlackBox()" + + obtained := instance .translate (" class BlackBox()" + "\n extends " + "\n AbstractBlackBox[A supertype (AbstractInput)]" + "\n AbstractDevice[B supertype (AbstractDeviceInput)]" + @@ -104,7 +104,7 @@ class UpperAndLowerBoundDeclarationSpec () test ("should translate mixed upper and lower bounds") ( check ( - obtained := instance.translate (" class BlackBox [A subtype AbstractModel] [B subtype AbstractParameter]" + + obtained := instance .translate (" class BlackBox [A subtype AbstractModel] [B subtype AbstractParameter]" + "\n extends " + "\n AbstractBlackBox[A][B]" + "\n AbstractDevice [A] [B] " + diff --git a/translator/src/test/scala/soda/translator/io/DirectoryScannerSpec.soda b/translator/src/test/scala/soda/translator/io/DirectoryScannerSpec.soda index b859590f..d3b41ff8 100644 --- a/translator/src/test/scala/soda/translator/io/DirectoryScannerSpec.soda +++ b/translator/src/test/scala/soda/translator/io/DirectoryScannerSpec.soda @@ -11,19 +11,19 @@ class DirectoryScannerSpec () start = "translator/src/test/resources/soda/example" - single_start_file = @new File (start, "Example.soda") + single_start_file = @new File (start , "Example.soda") test ("scan a file that is not a directory") ( check ( - obtained := DirectoryScanner_ ().get_all_files (single_start_file).toSet + obtained := DirectoryScanner_ () .get_all_files (single_start_file) .toSet ) ( - expected := Seq (single_start_file).toSet + expected := Seq (single_start_file) .toSet ) ) test ("simple scan of all files") ( check ( - obtained := DirectoryScanner_ ().get_all_files ( @new File (start) ).toSet + obtained := DirectoryScanner_ () .get_all_files ( @new File (start) ) .toSet ) ( expected := Seq ( "otherexample", @@ -37,7 +37,7 @@ class DirectoryScannerSpec () "otherexample/OtherExample.txt", "otherexample/Package.scala", "otherexample/Package.soda" - ).map (lambda x --> @new File (start, x) ).toSet + ) .map (lambda x --> @new File (start , x) ) .toSet ) ) diff --git a/translator/src/test/scala/soda/translator/io/Package.scala b/translator/src/test/scala/soda/translator/io/Package.scala index 43787091..48dc5399 100644 --- a/translator/src/test/scala/soda/translator/io/Package.scala +++ b/translator/src/test/scala/soda/translator/io/Package.scala @@ -18,19 +18,19 @@ case class DirectoryScannerSpec () lazy val start = "translator/src/test/resources/soda/example" - lazy val single_start_file = new File (start, "Example.soda") + lazy val single_start_file = new File (start , "Example.soda") test ("scan a file that is not a directory") ( check ( - obtained = DirectoryScanner_ ().get_all_files (single_start_file).toSet + obtained = DirectoryScanner_ () .get_all_files (single_start_file) .toSet ) ( - expected = Seq (single_start_file).toSet + expected = Seq (single_start_file) .toSet ) ) test ("simple scan of all files") ( check ( - obtained = DirectoryScanner_ ().get_all_files ( new File (start) ).toSet + obtained = DirectoryScanner_ () .get_all_files ( new File (start) ) .toSet ) ( expected = Seq ( "otherexample", @@ -44,7 +44,7 @@ case class DirectoryScannerSpec () "otherexample/OtherExample.txt", "otherexample/Package.scala", "otherexample/Package.soda" - ).map ( x => new File (start, x) ).toSet + ) .map ( x => new File (start , x) ) .toSet ) ) diff --git a/translator/src/test/scala/soda/translator/parser/BlockSpec.soda b/translator/src/test/scala/soda/translator/parser/BlockSpec.soda index 8c41c299..f1d36eaa 100644 --- a/translator/src/test/scala/soda/translator/parser/BlockSpec.soda +++ b/translator/src/test/scala/soda/translator/parser/BlockSpec.soda @@ -9,7 +9,7 @@ class BlockSpec () check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) - input = ("\n" + + input = ("\n" + "\n/** This is an example */" + "\n* Example () {" + "\n /* This is a comment */" + @@ -22,16 +22,16 @@ class BlockSpec () /* This is to test how to find commented text. */ test ("should find commented text") ( check ( - obtained := BlockBuilder_ ().build (input).annotated_lines + obtained := BlockBuilder_ () .build (input) .annotated_lines ) ( expected := Seq ( - AnnotatedLine_ ("", is_comment := false), - AnnotatedLine_ ("", is_comment := false), - AnnotatedLine_ ("/** This is an example */", is_comment := true), - AnnotatedLine_ ("* Example () {", is_comment := false), - AnnotatedLine_ (" /* This is a comment */", is_comment := true), - AnnotatedLine_ (" a = \"/** this is not a comment */\"", is_comment := false), - AnnotatedLine_ ("}", is_comment := false) + AnnotatedLine_ ("" , is_comment := false), + AnnotatedLine_ ("" , is_comment := false), + AnnotatedLine_ ("/** This is an example */" , is_comment := true), + AnnotatedLine_ ("* Example () {" , is_comment := false), + AnnotatedLine_ (" /* This is a comment */" , is_comment := true), + AnnotatedLine_ (" a = \"/** this is not a comment */\"" , is_comment := false), + AnnotatedLine_ ("}" , is_comment := false) ) ) ) diff --git a/translator/src/test/scala/soda/translator/parser/Package.scala b/translator/src/test/scala/soda/translator/parser/Package.scala index dff4d45e..a675b880 100644 --- a/translator/src/test/scala/soda/translator/parser/Package.scala +++ b/translator/src/test/scala/soda/translator/parser/Package.scala @@ -16,7 +16,7 @@ case class BlockSpec () def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) - lazy val input = ("\n" + + lazy val input = ("\n" + "\n/** This is an example */" + "\n* Example () {" + "\n /* This is a comment */" + @@ -29,16 +29,16 @@ case class BlockSpec () /* This is to test how to find commented text. */ test ("should find commented text") ( check ( - obtained = BlockBuilder_ ().build (input).annotated_lines + obtained = BlockBuilder_ () .build (input) .annotated_lines ) ( expected = Seq ( - AnnotatedLine_ ("", is_comment = false), - AnnotatedLine_ ("", is_comment = false), - AnnotatedLine_ ("/** This is an example */", is_comment = true), - AnnotatedLine_ ("* Example () {", is_comment = false), - AnnotatedLine_ (" /* This is a comment */", is_comment = true), - AnnotatedLine_ (" a = \"/** this is not a comment */\"", is_comment = false), - AnnotatedLine_ ("}", is_comment = false) + AnnotatedLine_ ("" , is_comment = false), + AnnotatedLine_ ("" , is_comment = false), + AnnotatedLine_ ("/** This is an example */" , is_comment = true), + AnnotatedLine_ ("* Example () {" , is_comment = false), + AnnotatedLine_ (" /* This is a comment */" , is_comment = true), + AnnotatedLine_ (" a = \"/** this is not a comment */\"" , is_comment = false), + AnnotatedLine_ ("}" , is_comment = false) ) ) ) @@ -167,7 +167,7 @@ case class PreprocessorSequenceTranslatorSpec () test ("should test the preprocessor") ( check ( - obtained = block_processor.translate (example_program) + obtained = block_processor .translate (example_program) ) ( expected = expected_output ) diff --git a/translator/src/test/scala/soda/translator/parser/PreprocessorSequenceTranslatorSpec.soda b/translator/src/test/scala/soda/translator/parser/PreprocessorSequenceTranslatorSpec.soda index 435e4167..123518e4 100644 --- a/translator/src/test/scala/soda/translator/parser/PreprocessorSequenceTranslatorSpec.soda +++ b/translator/src/test/scala/soda/translator/parser/PreprocessorSequenceTranslatorSpec.soda @@ -120,7 +120,7 @@ class PreprocessorSequenceTranslatorSpec () test ("should test the preprocessor") ( check ( - obtained := block_processor.translate (example_program) + obtained := block_processor .translate (example_program) ) ( expected := expected_output ) diff --git a/translator/src/test/scala/soda/translator/parser/annotation/BlockAnnotationSpec.soda b/translator/src/test/scala/soda/translator/parser/annotation/BlockAnnotationSpec.soda index 6e033c14..ab082881 100644 --- a/translator/src/test/scala/soda/translator/parser/annotation/BlockAnnotationSpec.soda +++ b/translator/src/test/scala/soda/translator/parser/annotation/BlockAnnotationSpec.soda @@ -13,31 +13,31 @@ class BlockAnnotationSpec () assert (obtained == expected) example_blocks = - ExampleProgram_ ().example_blocks + ExampleProgram_ () .example_blocks - detectors (block: Block): Seq [BlockAnnotationParser] = + detectors (block : Block) : Seq [BlockAnnotationParser] = Seq ( - FunctionDefinitionAnnotation_ (block), - ClassBeginningAnnotation_ (block), - ClassEndAnnotation_ (block, Seq [BlockAnnotationParser] () ), - AbstractDeclarationAnnotation_ (block, Seq [BlockAnnotationParser] () ), - ImportDeclarationAnnotation_ (block), - PackageDeclarationAnnotation_ (block), - ClassAliasAnnotation_ (block), - TheoremBlockAnnotation_ (block), - ProofBlockAnnotation_ (block), - CommentAnnotation_ (block), + FunctionDefinitionAnnotation_ (block) , + ClassBeginningAnnotation_ (block) , + ClassEndAnnotation_ (block , Seq [BlockAnnotationParser] () ) , + AbstractDeclarationAnnotation_ (block , Seq [BlockAnnotationParser] () ) , + ImportDeclarationAnnotation_ (block) , + PackageDeclarationAnnotation_ (block) , + ClassAliasAnnotation_ (block) , + TheoremBlockAnnotation_ (block) , + ProofBlockAnnotation_ (block) , + CommentAnnotation_ (block) , TestDeclarationAnnotation_ (block) ) apply_detectors (block : Block) : Seq [Boolean] = - detectors (block).map (lambda detector --> detector.applies) + detectors (block) .map (lambda detector --> detector .applies) test ("should detect a package declaration") ( check ( obtained := apply_detectors (example_blocks (0) ) ) ( - expected := Seq [Boolean] (false, false, false, false, false, true, false, false, false, false, false) + expected := Seq [Boolean] (false , false , false , false , false , true , false , false , false , false , false) ) ) @@ -45,7 +45,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (1) ) ) ( - expected := Seq [Boolean] (false, false, false, false, false, false, false, false, false, true, false) + expected := Seq [Boolean] (false , false , false , false , false , false , false , false , false , true , false) ) ) @@ -53,7 +53,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (2) ) ) ( - expected := Seq [Boolean] (false, true, false, false, false, false, false, false, false, false, false) + expected := Seq [Boolean] (false , true , false , false , false , false , false , false , false , false , false) ) ) @@ -61,7 +61,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (3) ) ) ( - expected := Seq [Boolean] (false, false, false, true, false, false, false, false, false, false, false) + expected := Seq [Boolean] (false , false , false , true , false , false , false , false , false , false , false) ) ) @@ -69,7 +69,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (4) ) ) ( - expected := Seq [Boolean] (false, false, false, false, true, false, false, false, false, false, false) + expected := Seq [Boolean] (false , false , false , false , true , false , false , false , false , false , false) ) ) @@ -77,7 +77,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (5) ) ) ( - expected := Seq [Boolean] (true, false, false, false, false, false, false, false, false, false, false) + expected := Seq [Boolean] (true , false , false , false , false , false , false , false , false , false , false) ) ) @@ -85,7 +85,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (6) ) ) ( - expected := Seq [Boolean] (true, false, false, false, false, false, false, false, false, false, false) + expected := Seq [Boolean] (true , false , false , false , false , false , false , false , false , false , false) ) ) @@ -93,7 +93,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (7) ) ) ( - expected := Seq [Boolean] (true, false, false, false, false, false, false, false, false, false, false) + expected := Seq [Boolean] (true , false , false , false , false , false , false , false , false , false , false) ) ) @@ -101,7 +101,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (8) ) ) ( - expected := Seq [Boolean] (false, false, false, false, false, false, false, false, false, false, true) + expected := Seq [Boolean] (false , false , false , false , false , false , false , false , false , false , true) ) ) @@ -109,7 +109,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (9) ) ) ( - expected := Seq [Boolean] (false, false, false, false, false, false, false, true, false, false, false) + expected := Seq [Boolean] (false , false , false , false , false , false , false , true , false , false , false) ) ) @@ -117,7 +117,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (10) ) ) ( - expected := Seq [Boolean] (false, false, false, false, false, false, false, false, true, false, false) + expected := Seq [Boolean] (false , false , false , false , false , false , false , false , true , false , false) ) ) @@ -125,7 +125,7 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (11) ) ) ( - expected := Seq [Boolean] (false, false, true, false, false, false, false, false, false, false, false) + expected := Seq [Boolean] (false , false , true , false , false , false , false , false , false , false , false) ) ) @@ -133,13 +133,13 @@ class BlockAnnotationSpec () check ( obtained := apply_detectors (example_blocks (12) ) ) ( - expected := Seq [Boolean] (false, false, false, false, false, false, true, false, false, false, false) + expected := Seq [Boolean] (false , false , false , false , false , false , true , false , false , false , false) ) ) test ("should find only 13 blocks") ( check ( - obtained := example_blocks.length + obtained := example_blocks .length ) ( expected := 13 ) @@ -147,9 +147,9 @@ class BlockAnnotationSpec () test ("should be ordered by the identifier ordinal") ( check ( - obtained := detectors (example_blocks (0) ).map (lambda detector --> detector.identifier.ordinal) + obtained := detectors (example_blocks (0) ) .map (lambda detector --> detector .identifier .ordinal) ) ( - expected := Seq [Int] (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) + expected := Seq [Int] (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11) ) ) diff --git a/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda b/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda index 2c208ac9..0014a2dd 100644 --- a/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda +++ b/translator/src/test/scala/soda/translator/parser/annotation/ClassBeginningAnnotationSpec.soda @@ -12,18 +12,18 @@ class ClassBeginningAnnotationSpec () check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) - example_blocks = ExampleProgram_ ().example_blocks + example_blocks = ExampleProgram_ () .example_blocks - default_block_processor = ExampleProgram_ ().default_block_processor + default_block_processor = ExampleProgram_ () .default_block_processor - example_0 = example_blocks.apply (2) + example_0 = example_blocks .apply (2) - get_as_block (text: String): Block = + get_as_block (text : String) : Block = default_block_processor .make_blocks( default_block_processor .split_blocks (text) - ).head + ) .head example_1 = get_as_block ( @@ -65,9 +65,9 @@ class ClassBeginningAnnotationSpec () test ("should find the right block for ClassBeginningAnnotation") ( check ( - obtained := example_blocks.map (lambda block --> ClassBeginningAnnotation_ (block).applies ) + obtained := example_blocks .map (lambda block --> ClassBeginningAnnotation_ (block) .applies ) ) ( - expected := Seq [Boolean] (false, false, true, false, false, false, false, false, false, false, false, false, false) + expected := Seq [Boolean] (false , false , true , false , false , false , false , false , false , false , false , false , false) ) ) @@ -132,7 +132,7 @@ class ClassBeginningAnnotationSpec () check ( obtained := ClassBeginningAnnotation_ (example_2).type_parameters_and_bounds ) ( - expected := Seq ("A", "B") + expected := Seq ("A" , "B") ) ) @@ -140,7 +140,7 @@ class ClassBeginningAnnotationSpec () check ( obtained := ClassBeginningAnnotation_ (example_2).type_parameters ) ( - expected := Seq ("A", "B") + expected := Seq ("A" , "B") ) ) @@ -180,7 +180,7 @@ class ClassBeginningAnnotationSpec () check ( obtained := ClassBeginningAnnotation_ (example_4).type_parameters_and_bounds ) ( - expected := Seq ("A supertype SubTypeExample", "B subtype SuperTypeExample") + expected := Seq ("A supertype SubTypeExample" , "B subtype SuperTypeExample") ) ) @@ -188,7 +188,7 @@ class ClassBeginningAnnotationSpec () check ( obtained := ClassBeginningAnnotation_ (example_4).type_parameters ) ( - expected := Seq ("A", "B") + expected := Seq ("A" , "B") ) ) diff --git a/translator/src/test/scala/soda/translator/parser/annotation/ExampleProgram.soda b/translator/src/test/scala/soda/translator/parser/annotation/ExampleProgram.soda index 630e67dc..62f59b6c 100644 --- a/translator/src/test/scala/soda/translator/parser/annotation/ExampleProgram.soda +++ b/translator/src/test/scala/soda/translator/parser/annotation/ExampleProgram.soda @@ -57,15 +57,15 @@ class ExampleProgram "\n") default_block_processor : BlockProcessor = - BlockProcessor_( + BlockProcessor_ ( DefaultBlockSequenceTranslator_ ( DefaultBlockTranslator_ () ) ) example_blocks : Seq [Block] = - default_block_processor.make_blocks( - default_block_processor.split_blocks (example_program) + default_block_processor .make_blocks ( + default_block_processor .split_blocks (example_program) ) end diff --git a/translator/src/test/scala/soda/translator/parser/annotation/Package.scala b/translator/src/test/scala/soda/translator/parser/annotation/Package.scala index 1e71d3b4..5584921b 100644 --- a/translator/src/test/scala/soda/translator/parser/annotation/Package.scala +++ b/translator/src/test/scala/soda/translator/parser/annotation/Package.scala @@ -20,31 +20,31 @@ case class BlockAnnotationSpec () assert (obtained == expected) lazy val example_blocks = - ExampleProgram_ ().example_blocks + ExampleProgram_ () .example_blocks - def detectors (block: Block): Seq [BlockAnnotationParser] = + def detectors (block : Block) : Seq [BlockAnnotationParser] = Seq ( - FunctionDefinitionAnnotation_ (block), - ClassBeginningAnnotation_ (block), - ClassEndAnnotation_ (block, Seq [BlockAnnotationParser] () ), - AbstractDeclarationAnnotation_ (block, Seq [BlockAnnotationParser] () ), - ImportDeclarationAnnotation_ (block), - PackageDeclarationAnnotation_ (block), - ClassAliasAnnotation_ (block), - TheoremBlockAnnotation_ (block), - ProofBlockAnnotation_ (block), - CommentAnnotation_ (block), + FunctionDefinitionAnnotation_ (block) , + ClassBeginningAnnotation_ (block) , + ClassEndAnnotation_ (block , Seq [BlockAnnotationParser] () ) , + AbstractDeclarationAnnotation_ (block , Seq [BlockAnnotationParser] () ) , + ImportDeclarationAnnotation_ (block) , + PackageDeclarationAnnotation_ (block) , + ClassAliasAnnotation_ (block) , + TheoremBlockAnnotation_ (block) , + ProofBlockAnnotation_ (block) , + CommentAnnotation_ (block) , TestDeclarationAnnotation_ (block) ) def apply_detectors (block : Block) : Seq [Boolean] = - detectors (block).map ( detector => detector.applies) + detectors (block) .map ( detector => detector .applies) test ("should detect a package declaration") ( check ( obtained = apply_detectors (example_blocks (0) ) ) ( - expected = Seq [Boolean] (false, false, false, false, false, true, false, false, false, false, false) + expected = Seq [Boolean] (false , false , false , false , false , true , false , false , false , false , false) ) ) @@ -52,7 +52,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (1) ) ) ( - expected = Seq [Boolean] (false, false, false, false, false, false, false, false, false, true, false) + expected = Seq [Boolean] (false , false , false , false , false , false , false , false , false , true , false) ) ) @@ -60,7 +60,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (2) ) ) ( - expected = Seq [Boolean] (false, true, false, false, false, false, false, false, false, false, false) + expected = Seq [Boolean] (false , true , false , false , false , false , false , false , false , false , false) ) ) @@ -68,7 +68,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (3) ) ) ( - expected = Seq [Boolean] (false, false, false, true, false, false, false, false, false, false, false) + expected = Seq [Boolean] (false , false , false , true , false , false , false , false , false , false , false) ) ) @@ -76,7 +76,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (4) ) ) ( - expected = Seq [Boolean] (false, false, false, false, true, false, false, false, false, false, false) + expected = Seq [Boolean] (false , false , false , false , true , false , false , false , false , false , false) ) ) @@ -84,7 +84,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (5) ) ) ( - expected = Seq [Boolean] (true, false, false, false, false, false, false, false, false, false, false) + expected = Seq [Boolean] (true , false , false , false , false , false , false , false , false , false , false) ) ) @@ -92,7 +92,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (6) ) ) ( - expected = Seq [Boolean] (true, false, false, false, false, false, false, false, false, false, false) + expected = Seq [Boolean] (true , false , false , false , false , false , false , false , false , false , false) ) ) @@ -100,7 +100,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (7) ) ) ( - expected = Seq [Boolean] (true, false, false, false, false, false, false, false, false, false, false) + expected = Seq [Boolean] (true , false , false , false , false , false , false , false , false , false , false) ) ) @@ -108,7 +108,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (8) ) ) ( - expected = Seq [Boolean] (false, false, false, false, false, false, false, false, false, false, true) + expected = Seq [Boolean] (false , false , false , false , false , false , false , false , false , false , true) ) ) @@ -116,7 +116,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (9) ) ) ( - expected = Seq [Boolean] (false, false, false, false, false, false, false, true, false, false, false) + expected = Seq [Boolean] (false , false , false , false , false , false , false , true , false , false , false) ) ) @@ -124,7 +124,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (10) ) ) ( - expected = Seq [Boolean] (false, false, false, false, false, false, false, false, true, false, false) + expected = Seq [Boolean] (false , false , false , false , false , false , false , false , true , false , false) ) ) @@ -132,7 +132,7 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (11) ) ) ( - expected = Seq [Boolean] (false, false, true, false, false, false, false, false, false, false, false) + expected = Seq [Boolean] (false , false , true , false , false , false , false , false , false , false , false) ) ) @@ -140,13 +140,13 @@ case class BlockAnnotationSpec () check ( obtained = apply_detectors (example_blocks (12) ) ) ( - expected = Seq [Boolean] (false, false, false, false, false, false, true, false, false, false, false) + expected = Seq [Boolean] (false , false , false , false , false , false , true , false , false , false , false) ) ) test ("should find only 13 blocks") ( check ( - obtained = example_blocks.length + obtained = example_blocks .length ) ( expected = 13 ) @@ -154,9 +154,9 @@ case class BlockAnnotationSpec () test ("should be ordered by the identifier ordinal") ( check ( - obtained = detectors (example_blocks (0) ).map ( detector => detector.identifier.ordinal) + obtained = detectors (example_blocks (0) ) .map ( detector => detector .identifier .ordinal) ) ( - expected = Seq [Int] (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) + expected = Seq [Int] (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11) ) ) @@ -176,18 +176,18 @@ case class ClassBeginningAnnotationSpec () def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion = assert (obtained == expected) - lazy val example_blocks = ExampleProgram_ ().example_blocks + lazy val example_blocks = ExampleProgram_ () .example_blocks - lazy val default_block_processor = ExampleProgram_ ().default_block_processor + lazy val default_block_processor = ExampleProgram_ () .default_block_processor - lazy val example_0 = example_blocks.apply (2) + lazy val example_0 = example_blocks .apply (2) - def get_as_block (text: String): Block = + def get_as_block (text : String) : Block = default_block_processor .make_blocks( default_block_processor .split_blocks (text) - ).head + ) .head lazy val example_1 = get_as_block ( @@ -229,9 +229,9 @@ case class ClassBeginningAnnotationSpec () test ("should find the right block for ClassBeginningAnnotation") ( check ( - obtained = example_blocks.map ( block => ClassBeginningAnnotation_ (block).applies ) + obtained = example_blocks .map ( block => ClassBeginningAnnotation_ (block) .applies ) ) ( - expected = Seq [Boolean] (false, false, true, false, false, false, false, false, false, false, false, false, false) + expected = Seq [Boolean] (false , false , true , false , false , false , false , false , false , false , false , false , false) ) ) @@ -295,7 +295,7 @@ case class ClassBeginningAnnotationSpec () check ( obtained = ClassBeginningAnnotation_ (example_2).type_parameters_and_bounds ) ( - expected = Seq ("A", "B") + expected = Seq ("A" , "B") ) ) @@ -303,7 +303,7 @@ case class ClassBeginningAnnotationSpec () check ( obtained = ClassBeginningAnnotation_ (example_2).type_parameters ) ( - expected = Seq ("A", "B") + expected = Seq ("A" , "B") ) ) @@ -343,7 +343,7 @@ case class ClassBeginningAnnotationSpec () check ( obtained = ClassBeginningAnnotation_ (example_4).type_parameters_and_bounds ) ( - expected = Seq ("A supertype SubTypeExample", "B subtype SuperTypeExample") + expected = Seq ("A supertype SubTypeExample" , "B subtype SuperTypeExample") ) ) @@ -351,7 +351,7 @@ case class ClassBeginningAnnotationSpec () check ( obtained = ClassBeginningAnnotation_ (example_4).type_parameters ) ( - expected = Seq ("A", "B") + expected = Seq ("A" , "B") ) ) @@ -416,15 +416,15 @@ trait ExampleProgram "\n") lazy val default_block_processor : BlockProcessor = - BlockProcessor_( + BlockProcessor_ ( DefaultBlockSequenceTranslator_ ( DefaultBlockTranslator_ () ) ) lazy val example_blocks : Seq [Block] = - default_block_processor.make_blocks( - default_block_processor.split_blocks (example_program) + default_block_processor .make_blocks ( + default_block_processor .split_blocks (example_program) ) } diff --git a/translator/src/test/scala/soda/translator/replacement/CharTypeSpec.soda b/translator/src/test/scala/soda/translator/replacement/CharTypeSpec.soda index 63869a7e..aadd2300 100644 --- a/translator/src/test/scala/soda/translator/replacement/CharTypeSpec.soda +++ b/translator/src/test/scala/soda/translator/replacement/CharTypeSpec.soda @@ -8,33 +8,33 @@ class CharTypeSpec () test ("should recognize quotation marks") ( check ( - obtained := CharTypeEnum_ ().get_char_type ('"') + obtained := CharTypeEnum_ () .get_char_type ('"') ) ( - expected := CharTypeEnum_ ().quotes_type + expected := CharTypeEnum_ () .quotes_type ) ) test ("should recognize apostrophes") ( check ( - obtained := CharTypeEnum_ ().get_char_type ('\'') + obtained := CharTypeEnum_ () .get_char_type ('\'') ) ( - expected := CharTypeEnum_ ().apostrophe_type + expected := CharTypeEnum_ () .apostrophe_type ) ) test ("should recognize backslash") ( check ( - obtained := CharTypeEnum_ ().get_char_type ('\\') + obtained := CharTypeEnum_ () .get_char_type ('\\') ) ( - expected := CharTypeEnum_ ().backslash_type + expected := CharTypeEnum_ () .backslash_type ) ) test ("should recognize a simple char") ( check ( - obtained := CharTypeEnum_ ().get_char_type ('a') + obtained := CharTypeEnum_ () .get_char_type ('a') ) ( - expected := CharTypeEnum_ ().plain_type + expected := CharTypeEnum_ () .plain_type ) ) @@ -42,11 +42,11 @@ class CharTypeSpec () check ( obtained := "This is plain text with symbols. 0123456789 _ . !?" - .map (lambda ch --> CharTypeEnum_ ().get_char_type (ch) ) + .map (lambda ch --> CharTypeEnum_ () .get_char_type (ch) ) .toSet .toSeq ) ( - expected := Seq ( CharTypeEnum_ ().plain_type ) + expected := Seq (CharTypeEnum_ () .plain_type) ) ) diff --git a/translator/src/test/scala/soda/translator/replacement/Package.scala b/translator/src/test/scala/soda/translator/replacement/Package.scala index 2c777dc4..89d9fc77 100644 --- a/translator/src/test/scala/soda/translator/replacement/Package.scala +++ b/translator/src/test/scala/soda/translator/replacement/Package.scala @@ -16,33 +16,33 @@ case class CharTypeSpec () test ("should recognize quotation marks") ( check ( - obtained = CharTypeEnum_ ().get_char_type ('"') + obtained = CharTypeEnum_ () .get_char_type ('"') ) ( - expected = CharTypeEnum_ ().quotes_type + expected = CharTypeEnum_ () .quotes_type ) ) test ("should recognize apostrophes") ( check ( - obtained = CharTypeEnum_ ().get_char_type ('\'') + obtained = CharTypeEnum_ () .get_char_type ('\'') ) ( - expected = CharTypeEnum_ ().apostrophe_type + expected = CharTypeEnum_ () .apostrophe_type ) ) test ("should recognize backslash") ( check ( - obtained = CharTypeEnum_ ().get_char_type ('\\') + obtained = CharTypeEnum_ () .get_char_type ('\\') ) ( - expected = CharTypeEnum_ ().backslash_type + expected = CharTypeEnum_ () .backslash_type ) ) test ("should recognize a simple char") ( check ( - obtained = CharTypeEnum_ ().get_char_type ('a') + obtained = CharTypeEnum_ () .get_char_type ('a') ) ( - expected = CharTypeEnum_ ().plain_type + expected = CharTypeEnum_ () .plain_type ) ) @@ -50,11 +50,11 @@ case class CharTypeSpec () check ( obtained = "This is plain text with symbols. 0123456789 _ . !?" - .map ( ch => CharTypeEnum_ ().get_char_type (ch) ) + .map ( ch => CharTypeEnum_ () .get_char_type (ch) ) .toSet .toSeq ) ( - expected = Seq ( CharTypeEnum_ ().plain_type ) + expected = Seq (CharTypeEnum_ () .plain_type) ) ) @@ -83,7 +83,7 @@ case class ReplacementAuxSpec () test ("replace_if_found_at_beginning 1") ( check ( - obtained = instance.replace_if_found_at_beginning (line_1) ("class") ("trait") + obtained = instance .replace_if_found_at_beginning (line_1) ("class") ("trait") ) ( expected = "trait has extends with this subtype supertype " ) @@ -91,7 +91,7 @@ case class ReplacementAuxSpec () test ("replace_if_found_at_beginning 2") ( check ( - obtained = instance.replace_if_found_at_beginning (line_1) ("has") ("---") + obtained = instance .replace_if_found_at_beginning (line_1) ("has") ("---") ) ( expected = line_1 ) @@ -99,7 +99,7 @@ case class ReplacementAuxSpec () test ("replace_first 1") ( check ( - obtained = instance.replace_first (line_1) ("class") ("trait") + obtained = instance .replace_first (line_1) ("class") ("trait") ) ( expected = "trait has extends with this subtype supertype " ) @@ -107,7 +107,7 @@ case class ReplacementAuxSpec () test ("replace_first 2") ( check ( - obtained = instance.replace_first (line_1) ("this") ("that") + obtained = instance .replace_first (line_1) ("this") ("that") ) ( expected = "class has extends with that subtype supertype " ) @@ -115,7 +115,7 @@ case class ReplacementAuxSpec () test ("replace_at 1") ( check ( - obtained = instance.replace_at (22) (line_1) (" ") ("out ") + obtained = instance .replace_at (22) (line_1) (" ") ("out ") ) ( expected = "class has extends without this subtype supertype " ) @@ -123,7 +123,7 @@ case class ReplacementAuxSpec () test ("replace_at 2") ( check ( - obtained = instance.replace_at (-1) (line_1) (" ") ("no replacement here") + obtained = instance .replace_at (-1) (line_1) (" ") ("no replacement here") ) ( expected = line_1 ) @@ -131,7 +131,7 @@ case class ReplacementAuxSpec () test ("replace_at 3") ( check ( - obtained = instance.replace_at (line_1.length - 1) (line_1) (" ") ("") + obtained = instance .replace_at (line_1 .length - 1) (line_1) (" ") ("") ) ( expected = "class has extends with this subtype supertype" ) @@ -139,7 +139,7 @@ case class ReplacementAuxSpec () test ("replace_at 4") ( check ( - obtained = instance.replace_at (line_1.length) (line_1) (" ") ("no replacement") + obtained = instance .replace_at (line_1 .length) (line_1) (" ") ("no replacement") ) ( expected = line_1 ) @@ -147,7 +147,7 @@ case class ReplacementAuxSpec () test ("replace_if_found") ( check ( - obtained = instance.replace_if_found (line_1) ("type") ("class") + obtained = instance .replace_if_found (line_1) ("type") ("class") ) ( expected = "class has extends with this subclass superclass " ) @@ -155,7 +155,7 @@ case class ReplacementAuxSpec () test ("replace_all 1") ( check ( - obtained = instance.replace_all (line_1) (" ") (",") + obtained = instance .replace_all (line_1) (" ") (",") ) ( expected = "class,has,extends,with,this,subtype,supertype," ) @@ -163,7 +163,7 @@ case class ReplacementAuxSpec () test ("replace_all 2") ( check ( - obtained = instance.replace_all (line_1) ("z") ("-") + obtained = instance .replace_all (line_1) ("z") ("-") ) ( expected = line_1 ) @@ -171,7 +171,7 @@ case class ReplacementAuxSpec () test ("add_spaces_to_symbols 1") ( check ( - obtained = instance.add_spaces_to_symbols (line_0) ( (Seq [Char] (',') ).toSet ) + obtained = instance .add_spaces_to_symbols (line_0) ( (Seq [Char] (',') ) .toSet) ) ( expected = "lambda , if , then , else , match , case" ) @@ -179,7 +179,7 @@ case class ReplacementAuxSpec () test ("add_spaces_to_symbols 2") ( check ( - obtained = instance.add_spaces_to_symbols (line_2) ( (Seq [Char] (',') ).toSet ) + obtained = instance .add_spaces_to_symbols (line_2) ( (Seq [Char] (',') ) .toSet) ) ( expected = " false , true , not , and , or , package , import , theorem , proof , is , lambda" ) @@ -187,7 +187,7 @@ case class ReplacementAuxSpec () test ("add_spaces_to_symbols 3") ( check ( - obtained = instance.add_spaces_to_symbols (line_1) ( (Seq [Char] ('a', 'e', 'i', 'o', 'u') ).toSet ) + obtained = instance .add_spaces_to_symbols (line_1) ( (Seq [Char] ('a', 'e', 'i', 'o', 'u') ) .toSet) ) ( expected = "cl a ss h a s e xt e nds w i th th i s s u btyp e s u p e rtyp e " ) @@ -195,7 +195,7 @@ case class ReplacementAuxSpec () test ("remove_space_from_scala_line") ( check ( - obtained = instance.remove_space_from_scala_line (line_3) + obtained = instance .remove_space_from_scala_line (line_3) ) ( expected = " @new, @tailrec, @override" ) @@ -203,7 +203,7 @@ case class ReplacementAuxSpec () test ("add_after_spaces_or_pattern 1") ( check ( - obtained = instance.add_after_spaces_or_pattern (line_1) ("class") (" here") + obtained = instance .add_after_spaces_or_pattern (line_1) ("class") (" here") ) ( expected = "class here has extends with this subtype supertype " ) @@ -211,7 +211,7 @@ case class ReplacementAuxSpec () test ("add_after_spaces_or_pattern 2") ( check ( - obtained = instance.add_after_spaces_or_pattern (line_1) ("has") (" here ") + obtained = instance .add_after_spaces_or_pattern (line_1) ("has") (" here ") ) ( expected = " here class has extends with this subtype supertype " ) @@ -219,7 +219,7 @@ case class ReplacementAuxSpec () test ("add_after_spaces_or_pattern 3") ( check ( - obtained = instance.add_after_spaces_or_pattern (line_3) ("@new") (", here") + obtained = instance .add_after_spaces_or_pattern (line_3) ("@new") (", here") ) ( expected = " @new, here, @tailrec, @override " ) @@ -246,7 +246,7 @@ case class ReplacementSpec () check ( obtained = Replacement_ ("\u03BB") - .replace_all ("\u03BB") (_sc.lambda_reserved_word) + .replace_all ("\u03BB") (_sc .lambda_reserved_word) .line ) ( expected = "lambda" @@ -267,11 +267,11 @@ case class ReplacementSpec () test ("Unicode replacement 3") ( check ( obtained = - Replacement_ (_sc.case_arrow_unicode_symbol) - .replace_all (_sc.case_arrow_unicode_symbol) (_sc.case_reserved_word) + Replacement_ (_sc .case_arrow_unicode_symbol) + .replace_all (_sc .case_arrow_unicode_symbol) (_sc .case_reserved_word) .line ) ( - expected = _sc.case_reserved_word + expected = _sc .case_reserved_word ) ) @@ -288,56 +288,56 @@ case class TokenizerSpec () test ("should tokenize a small example") ( check ( - obtained = Tokenizer_ (" val Constant = \"my text\"").tokens + obtained = Tokenizer_ (" val Constant = \"my text\"") .tokens ) ( expected = Seq ( - Token_ (" val Constant = ", ParserStateEnum_ ().plain, 0), - Token_ ("\"my text\"", ParserStateEnum_ ().quotes_state, 19), - Token_ ("", ParserStateEnum_ ().plain, 28) + Token_ (" val Constant = " , ParserStateEnum_ () .plain , 0), + Token_ ("\"my text\"" , ParserStateEnum_ () .quotes_state , 19), + Token_ ("" , ParserStateEnum_ () .plain , 28) ) ) ) test ("should tokenize a common tab in a string") ( check ( - obtained = Tokenizer_ (" x = \"abc\tde\"").tokens + obtained = Tokenizer_ (" x = \"abc\tde\"") .tokens ) ( expected = Seq ( - Token_ (" x = ", ParserStateEnum_ ().plain, 0), - Token_ ("\"abc\tde\"", ParserStateEnum_ ().quotes_state, 6), - Token_ ("", ParserStateEnum_ ().plain, 14) + Token_ (" x = " , ParserStateEnum_ () .plain , 0), + Token_ ("\"abc\tde\"" , ParserStateEnum_ () .quotes_state , 6), + Token_ ("" , ParserStateEnum_ () .plain , 14) ) ) ) test ("should tokenize an escaped tab in a string") ( check ( - obtained = Tokenizer_ (" x = \"abc\\tde\"").tokens + obtained = Tokenizer_ (" x = \"abc\\tde\"") .tokens ) ( expected = Seq ( - Token_ (" x = ", ParserStateEnum_ ().plain, 0), - Token_ ("\"abc\\tde\"", ParserStateEnum_ ().quotes_state, 6), - Token_ ("", ParserStateEnum_ ().plain, 15) + Token_ (" x = " , ParserStateEnum_ () .plain , 0), + Token_ ("\"abc\\tde\"" , ParserStateEnum_ () .quotes_state , 6), + Token_ ("" , ParserStateEnum_ () .plain , 15) ) ) ) test ("should tokenize a single function definition") ( check ( - obtained = Tokenizer_ ("def f (x: Int): Int = x").tokens + obtained = Tokenizer_ ("def f (x: Int): Int = x") .tokens ) ( expected = Seq ( - Token_ ("def f (x: Int): Int = x", ParserStateEnum_ ().plain, 0) + Token_ ("def f (x: Int): Int = x" , ParserStateEnum_ () .plain , 0) ) ) ) test ("should tokenize a function call") ( check ( - obtained = Tokenizer_ ("\tas_digits (5 * number)").tokens + obtained = Tokenizer_ ("\tas_digits (5 * number)") .tokens ) ( expected = Seq ( - Token_ ("\tas_digits (5 * number)", ParserStateEnum_ ().plain, 0) + Token_ ("\tas_digits (5 * number)" , ParserStateEnum_ () .plain , 0) ) ) ) diff --git a/translator/src/test/scala/soda/translator/replacement/ReplacementAuxSpec.soda b/translator/src/test/scala/soda/translator/replacement/ReplacementAuxSpec.soda index 5084b117..2cfa184a 100644 --- a/translator/src/test/scala/soda/translator/replacement/ReplacementAuxSpec.soda +++ b/translator/src/test/scala/soda/translator/replacement/ReplacementAuxSpec.soda @@ -20,7 +20,7 @@ class ReplacementAuxSpec () test ("replace_if_found_at_beginning 1") ( check ( - obtained := instance.replace_if_found_at_beginning (line_1) ("class") ("trait") + obtained := instance .replace_if_found_at_beginning (line_1) ("class") ("trait") ) ( expected := "trait has extends with this subtype supertype " ) @@ -28,7 +28,7 @@ class ReplacementAuxSpec () test ("replace_if_found_at_beginning 2") ( check ( - obtained := instance.replace_if_found_at_beginning (line_1) ("has") ("---") + obtained := instance .replace_if_found_at_beginning (line_1) ("has") ("---") ) ( expected := line_1 ) @@ -36,7 +36,7 @@ class ReplacementAuxSpec () test ("replace_first 1") ( check ( - obtained := instance.replace_first (line_1) ("class") ("trait") + obtained := instance .replace_first (line_1) ("class") ("trait") ) ( expected := "trait has extends with this subtype supertype " ) @@ -44,7 +44,7 @@ class ReplacementAuxSpec () test ("replace_first 2") ( check ( - obtained := instance.replace_first (line_1) ("this") ("that") + obtained := instance .replace_first (line_1) ("this") ("that") ) ( expected := "class has extends with that subtype supertype " ) @@ -52,7 +52,7 @@ class ReplacementAuxSpec () test ("replace_at 1") ( check ( - obtained := instance.replace_at (22) (line_1) (" ") ("out ") + obtained := instance .replace_at (22) (line_1) (" ") ("out ") ) ( expected := "class has extends without this subtype supertype " ) @@ -60,7 +60,7 @@ class ReplacementAuxSpec () test ("replace_at 2") ( check ( - obtained := instance.replace_at (-1) (line_1) (" ") ("no replacement here") + obtained := instance .replace_at (-1) (line_1) (" ") ("no replacement here") ) ( expected := line_1 ) @@ -68,7 +68,7 @@ class ReplacementAuxSpec () test ("replace_at 3") ( check ( - obtained := instance.replace_at (line_1.length - 1) (line_1) (" ") ("") + obtained := instance .replace_at (line_1 .length - 1) (line_1) (" ") ("") ) ( expected := "class has extends with this subtype supertype" ) @@ -76,7 +76,7 @@ class ReplacementAuxSpec () test ("replace_at 4") ( check ( - obtained := instance.replace_at (line_1.length) (line_1) (" ") ("no replacement") + obtained := instance .replace_at (line_1 .length) (line_1) (" ") ("no replacement") ) ( expected := line_1 ) @@ -84,7 +84,7 @@ class ReplacementAuxSpec () test ("replace_if_found") ( check ( - obtained := instance.replace_if_found (line_1) ("type") ("class") + obtained := instance .replace_if_found (line_1) ("type") ("class") ) ( expected := "class has extends with this subclass superclass " ) @@ -92,7 +92,7 @@ class ReplacementAuxSpec () test ("replace_all 1") ( check ( - obtained := instance.replace_all (line_1) (" ") (",") + obtained := instance .replace_all (line_1) (" ") (",") ) ( expected := "class,has,extends,with,this,subtype,supertype," ) @@ -100,7 +100,7 @@ class ReplacementAuxSpec () test ("replace_all 2") ( check ( - obtained := instance.replace_all (line_1) ("z") ("-") + obtained := instance .replace_all (line_1) ("z") ("-") ) ( expected := line_1 ) @@ -108,7 +108,7 @@ class ReplacementAuxSpec () test ("add_spaces_to_symbols 1") ( check ( - obtained := instance.add_spaces_to_symbols (line_0) ( (Seq [Char] (',') ).toSet ) + obtained := instance .add_spaces_to_symbols (line_0) ( (Seq [Char] (',') ) .toSet) ) ( expected := "lambda , if , then , else , match , case" ) @@ -116,7 +116,7 @@ class ReplacementAuxSpec () test ("add_spaces_to_symbols 2") ( check ( - obtained := instance.add_spaces_to_symbols (line_2) ( (Seq [Char] (',') ).toSet ) + obtained := instance .add_spaces_to_symbols (line_2) ( (Seq [Char] (',') ) .toSet) ) ( expected := " false , true , not , and , or , package , import , theorem , proof , is , lambda" ) @@ -124,7 +124,7 @@ class ReplacementAuxSpec () test ("add_spaces_to_symbols 3") ( check ( - obtained := instance.add_spaces_to_symbols (line_1) ( (Seq [Char] ('a', 'e', 'i', 'o', 'u') ).toSet ) + obtained := instance .add_spaces_to_symbols (line_1) ( (Seq [Char] ('a', 'e', 'i', 'o', 'u') ) .toSet) ) ( expected := "cl a ss h a s e xt e nds w i th th i s s u btyp e s u p e rtyp e " ) @@ -132,7 +132,7 @@ class ReplacementAuxSpec () test ("remove_space_from_scala_line") ( check ( - obtained := instance.remove_space_from_scala_line (line_3) + obtained := instance .remove_space_from_scala_line (line_3) ) ( expected := " @new, @tailrec, @override" ) @@ -140,7 +140,7 @@ class ReplacementAuxSpec () test ("add_after_spaces_or_pattern 1") ( check ( - obtained := instance.add_after_spaces_or_pattern (line_1) ("class") (" here") + obtained := instance .add_after_spaces_or_pattern (line_1) ("class") (" here") ) ( expected := "class here has extends with this subtype supertype " ) @@ -148,7 +148,7 @@ class ReplacementAuxSpec () test ("add_after_spaces_or_pattern 2") ( check ( - obtained := instance.add_after_spaces_or_pattern (line_1) ("has") (" here ") + obtained := instance .add_after_spaces_or_pattern (line_1) ("has") (" here ") ) ( expected := " here class has extends with this subtype supertype " ) @@ -156,7 +156,7 @@ class ReplacementAuxSpec () test ("add_after_spaces_or_pattern 3") ( check ( - obtained := instance.add_after_spaces_or_pattern (line_3) ("@new") (", here") + obtained := instance .add_after_spaces_or_pattern (line_3) ("@new") (", here") ) ( expected := " @new, here, @tailrec, @override " ) diff --git a/translator/src/test/scala/soda/translator/replacement/ReplacementSpec.soda b/translator/src/test/scala/soda/translator/replacement/ReplacementSpec.soda index d8bb4bd2..dceeb2f4 100644 --- a/translator/src/test/scala/soda/translator/replacement/ReplacementSpec.soda +++ b/translator/src/test/scala/soda/translator/replacement/ReplacementSpec.soda @@ -17,7 +17,7 @@ class ReplacementSpec () check ( obtained := Replacement_ ("\u03BB") - .replace_all ("\u03BB") (_sc.lambda_reserved_word) + .replace_all ("\u03BB") (_sc .lambda_reserved_word) .line ) ( expected := "lambda" @@ -38,11 +38,11 @@ class ReplacementSpec () test ("Unicode replacement 3") ( check ( obtained := - Replacement_ (_sc.case_arrow_unicode_symbol) - .replace_all (_sc.case_arrow_unicode_symbol) (_sc.case_reserved_word) + Replacement_ (_sc .case_arrow_unicode_symbol) + .replace_all (_sc .case_arrow_unicode_symbol) (_sc .case_reserved_word) .line ) ( - expected := _sc.case_reserved_word + expected := _sc .case_reserved_word ) ) diff --git a/translator/src/test/scala/soda/translator/replacement/TokenizerSpec.soda b/translator/src/test/scala/soda/translator/replacement/TokenizerSpec.soda index 3a6fa044..56ef10a8 100644 --- a/translator/src/test/scala/soda/translator/replacement/TokenizerSpec.soda +++ b/translator/src/test/scala/soda/translator/replacement/TokenizerSpec.soda @@ -8,56 +8,56 @@ class TokenizerSpec () test ("should tokenize a small example") ( check ( - obtained := Tokenizer_ (" val Constant = \"my text\"").tokens + obtained := Tokenizer_ (" val Constant = \"my text\"") .tokens ) ( expected := Seq ( - Token_ (" val Constant = ", ParserStateEnum_ ().plain, 0), - Token_ ("\"my text\"", ParserStateEnum_ ().quotes_state, 19), - Token_ ("", ParserStateEnum_ ().plain, 28) + Token_ (" val Constant = " , ParserStateEnum_ () .plain , 0), + Token_ ("\"my text\"" , ParserStateEnum_ () .quotes_state , 19), + Token_ ("" , ParserStateEnum_ () .plain , 28) ) ) ) test ("should tokenize a common tab in a string") ( check ( - obtained := Tokenizer_ (" x = \"abc\tde\"").tokens + obtained := Tokenizer_ (" x = \"abc\tde\"") .tokens ) ( expected := Seq ( - Token_ (" x = ", ParserStateEnum_ ().plain, 0), - Token_ ("\"abc\tde\"", ParserStateEnum_ ().quotes_state, 6), - Token_ ("", ParserStateEnum_ ().plain, 14) + Token_ (" x = " , ParserStateEnum_ () .plain , 0), + Token_ ("\"abc\tde\"" , ParserStateEnum_ () .quotes_state , 6), + Token_ ("" , ParserStateEnum_ () .plain , 14) ) ) ) test ("should tokenize an escaped tab in a string") ( check ( - obtained := Tokenizer_ (" x = \"abc\\tde\"").tokens + obtained := Tokenizer_ (" x = \"abc\\tde\"") .tokens ) ( expected := Seq ( - Token_ (" x = ", ParserStateEnum_ ().plain, 0), - Token_ ("\"abc\\tde\"", ParserStateEnum_ ().quotes_state, 6), - Token_ ("", ParserStateEnum_ ().plain, 15) + Token_ (" x = " , ParserStateEnum_ () .plain , 0), + Token_ ("\"abc\\tde\"" , ParserStateEnum_ () .quotes_state , 6), + Token_ ("" , ParserStateEnum_ () .plain , 15) ) ) ) test ("should tokenize a single function definition") ( check ( - obtained := Tokenizer_ ("def f (x: Int): Int = x").tokens + obtained := Tokenizer_ ("def f (x: Int): Int = x") .tokens ) ( expected := Seq ( - Token_ ("def f (x: Int): Int = x", ParserStateEnum_ ().plain, 0) + Token_ ("def f (x: Int): Int = x" , ParserStateEnum_ () .plain , 0) ) ) ) test ("should tokenize a function call") ( check ( - obtained := Tokenizer_ ("\tas_digits (5 * number)").tokens + obtained := Tokenizer_ ("\tas_digits (5 * number)") .tokens ) ( expected := Seq ( - Token_ ("\tas_digits (5 * number)", ParserStateEnum_ ().plain, 0) + Token_ ("\tas_digits (5 * number)" , ParserStateEnum_ () .plain , 0) ) ) ) From 0385fc6826d4688d1387e04ed759f7ed34045d58 Mon Sep 17 00:00:00 2001 From: Julian Mendez Date: Sat, 20 May 2023 13:57:43 +0200 Subject: [PATCH 35/56] Reformat Soda source code in library module --- .../src/main/scala/soda/collection/MSeq.soda | 4 +- .../src/main/scala/soda/collection/Min.soda | 160 +++++++------- .../main/scala/soda/collection/Package.scala | 164 +++++++-------- .../soda/collection/example/ListExample.soda | 54 ++--- .../scala/soda/collection/example/Main.soda | 46 ++-- .../soda/collection/example/Package.scala | 100 ++++----- .../test/scala/soda/collection/MinSpec.soda | 198 +++++++++--------- .../test/scala/soda/collection/Package.scala | 198 +++++++++--------- .../collection/example/ListExampleSpec.soda | 128 +++++------ .../soda/collection/example/Package.scala | 128 +++++------ 10 files changed, 590 insertions(+), 590 deletions(-) diff --git a/library/src/main/scala/soda/collection/MSeq.soda b/library/src/main/scala/soda/collection/MSeq.soda index 35e098c3..c724ac66 100644 --- a/library/src/main/scala/soda/collection/MSeq.soda +++ b/library/src/main/scala/soda/collection/MSeq.soda @@ -6,7 +6,7 @@ class MSeq [A] opt [B] (ifEmpty : B) (ifNonEmpty : NESeq [A] -> B) : B = match this - case NESeq_ (head, tail) ==> ifNonEmpty (NESeq_ (head, tail) ) + case NESeq_ (head , tail) ==> ifNonEmpty (NESeq_ (head , tail) ) case otherwise ==> ifEmpty end @@ -16,7 +16,7 @@ class MSeqRec [A] @tailrec _tailrec_fold_while [B] (sequence : MSeq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B = match sequence - case NESeq_ (head, tail) ==> + case NESeq_ (head , tail) ==> if not condition (current_value) (head) then current_value else _tailrec_fold_while (tail) (next_value_function (current_value) (head) ) (next_value_function) (condition) diff --git a/library/src/main/scala/soda/collection/Min.soda b/library/src/main/scala/soda/collection/Min.soda index 3ac98fc0..ed2ec47a 100644 --- a/library/src/main/scala/soda/collection/Min.soda +++ b/library/src/main/scala/soda/collection/Min.soda @@ -3,28 +3,28 @@ class MSeqTranslator [A] @tailrec _tailrec_foldLeftSeq [B] (sequence : Seq [A] ) (current_value : B) (next_value : B -> A -> B) : B = - if sequence.isEmpty + if sequence .isEmpty then current_value - else _tailrec_foldLeftSeq (sequence.tail) (next_value (current_value) (sequence.head) ) (next_value) + else _tailrec_foldLeftSeq (sequence .tail) (next_value (current_value) (sequence .head) ) (next_value) foldLeftSeq [B] (sequence : Seq [A] ) (initial_value : B) (next_value : B -> A -> B) : B = _tailrec_foldLeftSeq (sequence) (initial_value) (next_value) asMSeq (seq : Seq [A] ) : MSeq [A] = - Min_ ().reverse (foldLeftSeq [MSeq [A] ] (seq) (_asMSeq_initial_value) (_asMSeq_next_value) ) + Min_ () .reverse (foldLeftSeq [MSeq [A] ] (seq) (_asMSeq_initial_value) (_asMSeq_next_value) ) - _asMSeq_initial_value : MSeq [A] = Min_ ().empty + _asMSeq_initial_value : MSeq [A] = Min_ () .empty _asMSeq_next_value (acc : MSeq [A] ) (elem : A) : MSeq [A] = - Min_ ().prepended (acc) (elem) + Min_ () .prepended (acc) (elem) asSeq (mseq : MSeq [A] ) : Seq [A] = - (Min_ ().foldLeft (mseq) (_asSeq_initial_value) (_asSeq_next_value) ).reverse + (Min_ () .foldLeft (mseq) (_asSeq_initial_value) (_asSeq_next_value) ) .reverse _asSeq_initial_value : Seq [A] = Seq () _asSeq_next_value (acc : Seq [A] ) (elem : A) : Seq [A] = - acc.+: (elem) + acc .+: (elem) end @@ -46,38 +46,38 @@ class Min [A] empty : ESeq [A] = ESeq_ () prepended (s : MSeq [A] ) (e : A) : NESeq [A] = - NESeq_ (e, s) + NESeq_ (e , s) head (s : NESeq [A] ) : A = - s.head + s .head tail (s : NESeq [A] ) : MSeq [A] = - s.tail + s .tail nonEmpty (s : MSeq [A] ) : Boolean = not isEmpty (s) isEmpty (s : MSeq [A] ) : Boolean = - s.isEmpty + s .isEmpty /* */ foldLeftWhile [B] (s : MSeq [A] ) (initial_value : B) (next_value : B -> A -> B) (condition : B -> A -> Boolean) : B = - MSeqRec_ [A] ().fold_while [B] (s) (initial_value) (next_value) (condition) + MSeqRec_ [A] () .fold_while [B] (s) (initial_value) (next_value) (condition) foldLeft [B] (s : MSeq [A] ) (initial_value : B) (next_value : B -> A -> B) : B = foldLeftWhile (s) (initial_value) (next_value) (lambda (acc : B) --> lambda (elem : A) --> true) reverse (s : MSeq [A] ) : MSeq [A] = - s.opt [MSeq [A] ] ( + s .opt [MSeq [A] ] ( ifEmpty := empty) ( ifNonEmpty := lambda neseq --> reverseNonEmpty (neseq) ) reverseNonEmpty (s : NESeq [A] ) : NESeq [A] = - foldLeft (s.tail) (_reverseNonEmpty_initial_value (s) ) (_reverseNonEmpty_next_value) + foldLeft (s .tail) (_reverseNonEmpty_initial_value (s) ) (_reverseNonEmpty_next_value) - _reverseNonEmpty_initial_value (s : NESeq [A] ) : NESeq [A] = prepended (empty) (s.head) + _reverseNonEmpty_initial_value (s : NESeq [A] ) : NESeq [A] = prepended (empty) (s .head) _reverseNonEmpty_next_value (acc : MSeq [A] ) (elem : A) : NESeq [A] = prepended (acc) (elem) @@ -90,39 +90,39 @@ class Min [A] acc + 1 indexOf (s : MSeq [A] ) (e : A) : Int = - (foldLeftWhile (s) (_indexOf_initial_value (e) ) (_indexOf_next_value) (_indexOf_condition) ).position + (foldLeftWhile (s) (_indexOf_initial_value (e) ) (_indexOf_next_value) (_indexOf_condition) ) .position - _indexOf_initial_value (element : A) : IndexFoldTuple [A] = IndexFoldTuple_ [A] (0, -1, element) + _indexOf_initial_value (element : A) : IndexFoldTuple [A] = IndexFoldTuple_ [A] (0 , -1 , element) _indexOf_next_value (tuple : IndexFoldTuple [A] ) (current_element : A) : IndexFoldTuple [A] = IndexFoldTuple_ [A] ( - tuple.index + 1, + tuple .index + 1, _get_index_if_element_found (tuple) (current_element) , - tuple.element + tuple .element ) _get_index_if_element_found (tuple : IndexFoldTuple [A] ) (current_element : A) : Int = - if current_element == tuple.element - then tuple.index - else tuple.position + if current_element == tuple .element + then tuple .index + else tuple .position _indexOf_condition (tuple : IndexFoldTuple [A] ) (elem : A) : Boolean = - tuple.position == -1 + tuple .position == -1 contains (s : MSeq [A] ) (e : A) : Boolean = - (foldLeftWhile (s) (_contains_initial_value (e) ) (_contains_next_value) (_contains_condition) ).contained + (foldLeftWhile (s) (_contains_initial_value (e) ) (_contains_next_value) (_contains_condition) ) .contained _contains_initial_value (element : A) : ContainsFoldTuple [A] = - ContainsFoldTuple_ (false, element) + ContainsFoldTuple_ (false , element) _contains_next_value (tuple : ContainsFoldTuple [A] ) (elem : A) : ContainsFoldTuple [A] = - ContainsFoldTuple_ (elem == tuple.element, tuple.element) + ContainsFoldTuple_ (elem == tuple .element , tuple .element) _contains_condition (tuple : ContainsFoldTuple [A] ) (elem : A) : Boolean = - not tuple.contained + not tuple .contained at (s : MSeq [A] ) (n : Int) : OptionSD [A] = - s.opt [OptionSD [A] ] ( + s .opt [OptionSD [A] ] ( ifEmpty := NoneSD_ [A] () ) ( ifNonEmpty := (lambda neseq --> _retrieve_if_in_range (neseq) (n) ) ) @@ -133,57 +133,57 @@ class Min [A] else SomeSD_ [A] (_atNonEmpty (xs) (n) ) _atNonEmpty (xs : NESeq [A] ) (n : Int) : A = - (foldLeftWhile (xs) (_atNonEmpty_initial_value (xs) (n) ) (_atNonEmpty_next_value) (_atNonEmpty_condition) ).elem + (foldLeftWhile (xs) (_atNonEmpty_initial_value (xs) (n) ) (_atNonEmpty_next_value) (_atNonEmpty_condition) ) .elem _atNonEmpty_initial_value (xs : NESeq [A] ) (position : Int ) : AtFoldTuple [A] = - AtFoldTuple_ [A] (xs.head, -1, position) + AtFoldTuple_ [A] (xs .head , -1 , position) _atNonEmpty_next_value (tuple : AtFoldTuple [A] ) (elem : A) : AtFoldTuple [A] = - AtFoldTuple_ [A] (elem, tuple.index + 1, tuple.position) + AtFoldTuple_ [A] (elem , tuple .index + 1 , tuple .position) _atNonEmpty_condition (tuple : AtFoldTuple [A] ) (elem : A) : Boolean = - tuple.index < tuple.position + tuple .index < tuple .position /* */ take (s : MSeq [A] ) (n : Int) : MSeq [A] = - reverse ( (foldLeftWhile (s) (_take_initial_value (n) ) (_take_next_value) (_take_condition) ).seq ) + reverse ( (foldLeftWhile (s) (_take_initial_value (n) ) (_take_next_value) (_take_condition) ) .seq ) - _take_initial_value (length : Int ) : TakeDropFoldTuple [A] = TakeDropFoldTuple_ [A] (empty, 0, length) + _take_initial_value (length : Int ) : TakeDropFoldTuple [A] = TakeDropFoldTuple_ [A] (empty , 0 , length) _take_next_value (tuple : TakeDropFoldTuple [A] ) (elem : A) : TakeDropFoldTuple [A] = - TakeDropFoldTuple_ [A] (prepended (tuple.seq) (elem), tuple.index + 1, tuple.length) + TakeDropFoldTuple_ [A] (prepended (tuple .seq) (elem) , tuple .index + 1 , tuple .length) - _take_condition (tuple : TakeDropFoldTuple [A] ) (elem : A) : Boolean = tuple.index < tuple.length + _take_condition (tuple : TakeDropFoldTuple [A] ) (elem : A) : Boolean = tuple .index < tuple .length drop (s : MSeq [A] ) (n : Int) : MSeq [A] = - (foldLeftWhile (s) (_drop_initial_value (s) (n) ) (_drop_next_value) (_drop_condition) ).seq + (foldLeftWhile (s) (_drop_initial_value (s) (n) ) (_drop_next_value) (_drop_condition) ) .seq - _drop_initial_value (s : MSeq [A] ) (length : Int) : TakeDropFoldTuple [A] = TakeDropFoldTuple_ [A] (s, 0, length) + _drop_initial_value (s : MSeq [A] ) (length : Int) : TakeDropFoldTuple [A] = TakeDropFoldTuple_ [A] (s , 0 , length) _drop_next_value (tuple : TakeDropFoldTuple [A] ) (elem : A) : TakeDropFoldTuple [A] = - tuple.seq.opt ( - ifEmpty := TakeDropFoldTuple_ [A] (tuple.seq, tuple.index + 1, tuple.length) ) ( - ifNonEmpty := lambda neseq --> TakeDropFoldTuple_ [A] (neseq.tail, tuple.index + 1, tuple.length) + tuple .seq .opt ( + ifEmpty := TakeDropFoldTuple_ [A] (tuple .seq , tuple .index + 1 , tuple .length) ) ( + ifNonEmpty := lambda neseq --> TakeDropFoldTuple_ [A] (neseq .tail , tuple .index + 1 , tuple .length) ) _drop_condition (tuple : TakeDropFoldTuple [A] ) (elem : A) : Boolean = - tuple.index < tuple.length + tuple .index < tuple .length takeWhile (s : MSeq [A] ) (p : A -> Boolean) : MSeq [A] = - reverse ( (spanRevRec (s) (p) ).left) + reverse ( (spanRevRec (s) (p) ) .left) dropWhile (s : MSeq [A] ) (p : A -> Boolean) : MSeq [A] = - (spanRevRec (s) (p) ).right + (spanRevRec (s) (p) ) .right splitAt (s : MSeq [A] ) (n : Int) : MSeqPair [A] = - MSeqPair_ (take (s) (n), drop (s) (n) ) + MSeqPair_ (take (s) (n) , drop (s) (n) ) span (s : MSeq [A] ) (p : A -> Boolean) : MSeqPair [A] = _span_with (s) (p) (spanRevRec (s) (p) ) _span_with (s : MSeq [A] ) (p : A -> Boolean) (pair : MSeqPair [A] ) : MSeqPair [A] = - MSeqPair_ (reverse (pair.left), pair.right) + MSeqPair_ (reverse (pair .left) , pair .right) /* */ @@ -191,7 +191,7 @@ class Min [A] reverse (prepended (reverse (s) ) (e) ) last (s : NESeq [A] ) : A = - reverseNonEmpty (s).head + reverseNonEmpty (s) .head concat (s0 : MSeq [A] ) (s1 : MSeq [A] ) : MSeq [A] = foldLeft (reverse (s0) ) (_concat_initial_value (s1) ) (_concat_next_value) @@ -205,74 +205,74 @@ class Min [A] /* */ forall (s : MSeq [A] ) (p : A -> Boolean) : Boolean = - (foldLeftWhile (s) (_forall_initial_value (p) ) (_forall_next_value) (_forall_condition) ).status + (foldLeftWhile (s) (_forall_initial_value (p) ) (_forall_next_value) (_forall_condition) ) .status - _forall_initial_value (condition : A -> Boolean ) : ForallExistsFoldTuple [A] = ForallExistsFoldTuple_ (true, condition) + _forall_initial_value (condition : A -> Boolean ) : ForallExistsFoldTuple [A] = ForallExistsFoldTuple_ (true , condition) _forall_next_value (tuple : ForallExistsFoldTuple [A] ) (elem : A) : ForallExistsFoldTuple [A] = - ForallExistsFoldTuple_ (tuple.status and tuple.condition (elem), tuple.condition) + ForallExistsFoldTuple_ (tuple .status and tuple .condition (elem) , tuple .condition) _forall_condition (tuple : ForallExistsFoldTuple [A] ) (elem : A) : Boolean = - tuple.status + tuple .status exists (s : MSeq [A] ) (p : A -> Boolean ) : Boolean = - (foldLeftWhile (s) (_exists_initial_value (p) ) (_exists_next_value) (_exists_condition) ).status + (foldLeftWhile (s) (_exists_initial_value (p) ) (_exists_next_value) (_exists_condition) ) .status - _exists_initial_value (condition : A -> Boolean ) : ForallExistsFoldTuple [A] = ForallExistsFoldTuple_ (false, condition) + _exists_initial_value (condition : A -> Boolean ) : ForallExistsFoldTuple [A] = ForallExistsFoldTuple_ (false , condition) _exists_next_value (tuple : ForallExistsFoldTuple [A] ) (elem : A) : ForallExistsFoldTuple [A] = - ForallExistsFoldTuple_ (tuple.status or tuple.condition (elem), tuple.condition) + ForallExistsFoldTuple_ (tuple .status or tuple .condition (elem) , tuple .condition) _exists_condition (tuple : ForallExistsFoldTuple [A] ) (elem : A) : Boolean = - not tuple.status + not tuple .status find (s : MSeq [A] ) (p : A -> Boolean) : OptionSD [A] = - (foldLeftWhile (s) (_find_initial_value (p) ) (_find_next_value) (_find_condition) ).maybe_element + (foldLeftWhile (s) (_find_initial_value (p) ) (_find_next_value) (_find_condition) ) .maybe_element _find_initial_value (condition : A -> Boolean) : FindFoldTuple [A] = - FindFoldTuple_ (NoneSD_ [A] (), condition) + FindFoldTuple_ (NoneSD_ [A] () , condition) _find_next_value (tuple : FindFoldTuple [A] ) (elem : A) : FindFoldTuple [A] = - if tuple.condition (elem) - then FindFoldTuple_ (SomeSD_ [A] (elem), tuple.condition) - else FindFoldTuple_ (NoneSD_ [A] (), tuple.condition) + if tuple .condition (elem) + then FindFoldTuple_ (SomeSD_ [A] (elem) , tuple .condition) + else FindFoldTuple_ (NoneSD_ [A] () , tuple .condition) _find_condition (tuple : FindFoldTuple [A] ) (elem : A) : Boolean = - tuple.maybe_element.isEmpty + tuple .maybe_element .isEmpty filter (s : MSeq [A] ) (p : A -> Boolean) : MSeq [A] = - reverse ( (foldLeft (s) (_filter_initial_value (p) ) (_filter_next_value) ).sequence ) + reverse ( (foldLeft (s) (_filter_initial_value (p) ) (_filter_next_value) ) .sequence ) _filter_initial_value (condition : A -> Boolean) : FilterFoldTuple [A] = - FilterFoldTuple_ (empty, condition) + FilterFoldTuple_ (empty , condition) _filter_next_value (tuple : FilterFoldTuple [A] ) (elem : A) : FilterFoldTuple [A] = FilterFoldTuple_ ( _prepend_when_condition (tuple) (elem) , - tuple.condition + tuple .condition ) _prepend_when_condition (tuple : FilterFoldTuple [A] ) (elem : A) : MSeq [A] = - if tuple.condition (elem) - then prepended (tuple.sequence) (elem) - else tuple.sequence + if tuple .condition (elem) + then prepended (tuple .sequence) (elem) + else tuple .sequence map0 (s : MSeq [A] ) (f : A -> A) : MSeq [A] = - reverse ( (foldLeft (s) (_map0_initial_value (f) ) (_map0_next_value) ).sequence) + reverse ( (foldLeft (s) (_map0_initial_value (f) ) (_map0_next_value) ) .sequence) _map0_initial_value (mapping : A -> A) : Map0FoldTuple [A] = - Map0FoldTuple_ (empty, mapping) + Map0FoldTuple_ (empty , mapping) _map0_next_value (tuple : Map0FoldTuple [A] ) (elem : A) : Map0FoldTuple [A] = - Map0FoldTuple_ (prepended (tuple.sequence) (tuple.mapping (elem) ), tuple.mapping) + Map0FoldTuple_ (prepended (tuple .sequence) (tuple .mapping (elem) ) , tuple .mapping) /** *
-   * def foldLeft [B] (z : B) (op : (B, A) -> B) : B =
+   * def foldLeft [B] (z : B) (op : (B , A) -> B) : B =
    * . var result = z
    * . it = iterator
    * . while (it.hasNext) {
-   * . . result = op (result, it.next () )
+   * . . result = op (result , it.next () )
    * . }
    * . result
    * end
@@ -289,27 +289,27 @@ class Min [A]
     _spanRevRec_for (foldLeftWhile (s0) (_spanRevRec_initial_value (s0) (p) ) (_spanRevRec_next_value) (_spanRevRec_condition) )
 
   _spanRevRec_for (tuple: SpanRevFoldTuple [A] ) : MSeqPair [A] =
-    MSeqPair_ (tuple.right, tuple.left)
+    MSeqPair_ (tuple .right , tuple .left)
 
   _spanRevRec_initial_value (s0 : MSeq [A] ) (condition : A -> Boolean) : SpanRevFoldTuple [A] =
-    SpanRevFoldTuple_ [A] (s0, empty, true, condition)
+    SpanRevFoldTuple_ [A] (s0 , empty , true , condition)
 
   _spanRevRec_next_value (tuple : SpanRevFoldTuple [A] ) (elem : A) : SpanRevFoldTuple [A] =
-    tuple.left.opt [SpanRevFoldTuple [A] ] (
-      ifEmpty := SpanRevFoldTuple_ [A] (tuple.left, tuple.right, false, tuple.condition) ) (
+    tuple .left .opt [SpanRevFoldTuple [A] ] (
+      ifEmpty := SpanRevFoldTuple_ [A] (tuple .left , tuple .right , false , tuple .condition) ) (
       ifNonEmpty := lambda neleft --> _aux_next_value (tuple) (neleft)
     )
 
   _spanRevRec_condition (tuple : SpanRevFoldTuple [A] ) (elem : A) : Boolean =
-    tuple.taking
+    tuple .taking
 
   _aux_next_value (tuple : SpanRevFoldTuple [A] ) (neleft : NESeq [A] ) : SpanRevFoldTuple [A] =
-    _aux_next_value_for (tuple) (neleft) (tuple.condition (neleft.head) )
+    _aux_next_value_for (tuple) (neleft) (tuple .condition (neleft .head) )
 
   _aux_next_value_for (tuple : SpanRevFoldTuple [A] ) (neleft : NESeq [A] ) (new_taking : Boolean) : SpanRevFoldTuple [A] =
     if new_taking
-    then SpanRevFoldTuple_ [A] (neleft.tail, prepended (tuple.right) (neleft.head), new_taking, tuple.condition)
-    else SpanRevFoldTuple_ [A] (neleft, tuple.right, new_taking, tuple.condition)
+    then SpanRevFoldTuple_ [A] (neleft .tail , prepended (tuple .right) (neleft .head) , new_taking , tuple .condition)
+    else SpanRevFoldTuple_ [A] (neleft , tuple .right , new_taking , tuple .condition)
 
 end
 
diff --git a/library/src/main/scala/soda/collection/Package.scala b/library/src/main/scala/soda/collection/Package.scala
index d560bf67..313b06eb 100644
--- a/library/src/main/scala/soda/collection/Package.scala
+++ b/library/src/main/scala/soda/collection/Package.scala
@@ -15,7 +15,7 @@ trait MSeq [A]
 
   def opt [B] (ifEmpty : B) (ifNonEmpty : NESeq [A] => B) : B =
     this match  {
-      case NESeq_ (head, tail) => ifNonEmpty (NESeq_ (head, tail) )
+      case NESeq_ (head , tail) => ifNonEmpty (NESeq_ (head , tail) )
       case otherwise => ifEmpty
     }
 
@@ -30,7 +30,7 @@ trait MSeqRec [A]
         @tailrec  final
   private def _tailrec_fold_while [B] (sequence : MSeq [A] ) (current_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B =
     sequence match  {
-      case NESeq_ (head, tail) =>
+      case NESeq_ (head , tail) =>
         if ( ! condition (current_value) (head)
         ) current_value
         else _tailrec_fold_while (tail) (next_value_function (current_value) (head) ) (next_value_function) (condition)
@@ -92,28 +92,28 @@ trait MSeqTranslator [A]
   import scala.annotation.tailrec
         @tailrec  final
   private def _tailrec_foldLeftSeq [B] (sequence : Seq [A] ) (current_value : B) (next_value : B => A => B) : B =
-    if ( sequence.isEmpty
+    if ( sequence .isEmpty
     ) current_value
-    else _tailrec_foldLeftSeq (sequence.tail) (next_value (current_value) (sequence.head) ) (next_value)
+    else _tailrec_foldLeftSeq (sequence .tail) (next_value (current_value) (sequence .head) ) (next_value)
 
   def foldLeftSeq [B] (sequence : Seq [A] ) (initial_value : B) (next_value : B => A => B) : B =
     _tailrec_foldLeftSeq (sequence) (initial_value) (next_value)
 
   def asMSeq (seq : Seq [A] ) : MSeq [A] =
-    Min_ ().reverse (foldLeftSeq [MSeq [A] ] (seq) (_asMSeq_initial_value) (_asMSeq_next_value) )
+    Min_ () .reverse (foldLeftSeq [MSeq [A] ] (seq) (_asMSeq_initial_value) (_asMSeq_next_value) )
 
-  private lazy val _asMSeq_initial_value : MSeq [A] = Min_ ().empty
+  private lazy val _asMSeq_initial_value : MSeq [A] = Min_ () .empty
 
   private def _asMSeq_next_value (acc : MSeq [A] ) (elem : A) : MSeq [A] =
-    Min_ ().prepended (acc) (elem)
+    Min_ () .prepended (acc) (elem)
 
   def asSeq (mseq : MSeq [A] ) : Seq [A] =
-    (Min_ ().foldLeft (mseq) (_asSeq_initial_value) (_asSeq_next_value) ).reverse
+    (Min_ () .foldLeft (mseq) (_asSeq_initial_value) (_asSeq_next_value) ) .reverse
 
   private lazy val _asSeq_initial_value : Seq [A] = Seq ()
 
   private def _asSeq_next_value (acc : Seq [A] ) (elem : A) : Seq [A] =
-    acc.+: (elem)
+    acc .+: (elem)
 
 }
 
@@ -139,38 +139,38 @@ trait Min [A]
   lazy val empty : ESeq [A] = ESeq_ ()
 
   def prepended (s : MSeq [A] ) (e : A) : NESeq [A] =
-    NESeq_ (e, s)
+    NESeq_ (e , s)
 
   def head (s : NESeq [A] ) : A =
-    s.head
+    s .head
 
   def tail (s : NESeq [A] ) : MSeq [A] =
-    s.tail
+    s .tail
 
   def nonEmpty (s : MSeq [A] ) : Boolean =
     ! isEmpty (s)
 
   def isEmpty (s : MSeq [A] ) : Boolean =
-    s.isEmpty
+    s .isEmpty
 
   /* */
 
   def foldLeftWhile [B] (s : MSeq [A] ) (initial_value : B) (next_value : B => A => B) (condition : B => A => Boolean) : B =
-    MSeqRec_ [A] ().fold_while [B] (s) (initial_value) (next_value) (condition)
+    MSeqRec_ [A] () .fold_while [B] (s) (initial_value) (next_value) (condition)
 
   def foldLeft [B] (s : MSeq [A] ) (initial_value : B) (next_value : B => A => B) : B =
     foldLeftWhile (s) (initial_value) (next_value) ( (acc : B) =>  (elem : A) => true)
 
   def reverse (s : MSeq [A] ) : MSeq [A] =
-    s.opt [MSeq [A] ] (
+    s .opt [MSeq [A] ] (
       ifEmpty = empty) (
       ifNonEmpty =  neseq => reverseNonEmpty (neseq)
     )
 
   def reverseNonEmpty (s : NESeq [A] ) : NESeq [A] =
-    foldLeft (s.tail) (_reverseNonEmpty_initial_value (s) ) (_reverseNonEmpty_next_value)
+    foldLeft (s .tail) (_reverseNonEmpty_initial_value (s) ) (_reverseNonEmpty_next_value)
 
-  private def _reverseNonEmpty_initial_value (s : NESeq [A] ) : NESeq [A] = prepended (empty) (s.head)
+  private def _reverseNonEmpty_initial_value (s : NESeq [A] ) : NESeq [A] = prepended (empty) (s .head)
 
   private def _reverseNonEmpty_next_value (acc : MSeq [A] ) (elem : A) : NESeq [A] = prepended (acc) (elem)
 
@@ -183,39 +183,39 @@ trait Min [A]
     acc + 1
 
   def indexOf (s : MSeq [A] ) (e : A) : Int =
-    (foldLeftWhile (s) (_indexOf_initial_value (e) ) (_indexOf_next_value) (_indexOf_condition) ).position
+    (foldLeftWhile (s) (_indexOf_initial_value (e) ) (_indexOf_next_value) (_indexOf_condition) ) .position
 
-  private def _indexOf_initial_value (element : A) : IndexFoldTuple [A] = IndexFoldTuple_ [A] (0, -1, element)
+  private def _indexOf_initial_value (element : A) : IndexFoldTuple [A] = IndexFoldTuple_ [A] (0 , -1 , element)
 
   private def _indexOf_next_value (tuple : IndexFoldTuple [A] ) (current_element : A) : IndexFoldTuple [A] =
     IndexFoldTuple_ [A] (
-      tuple.index + 1,
+      tuple .index + 1,
       _get_index_if_element_found (tuple) (current_element) ,
-      tuple.element
+      tuple .element
     )
 
   private def _get_index_if_element_found (tuple : IndexFoldTuple [A] ) (current_element : A) : Int =
-    if ( current_element == tuple.element
-    ) tuple.index
-    else tuple.position
+    if ( current_element == tuple .element
+    ) tuple .index
+    else tuple .position
 
   private def _indexOf_condition (tuple : IndexFoldTuple [A] ) (elem : A) : Boolean =
-    tuple.position == -1
+    tuple .position == -1
 
   def contains (s : MSeq [A] ) (e : A) : Boolean =
-    (foldLeftWhile (s) (_contains_initial_value (e) ) (_contains_next_value) (_contains_condition) ).contained
+    (foldLeftWhile (s) (_contains_initial_value (e) ) (_contains_next_value) (_contains_condition) ) .contained
 
   private def _contains_initial_value (element : A) : ContainsFoldTuple [A] =
-    ContainsFoldTuple_ (false, element)
+    ContainsFoldTuple_ (false , element)
 
   private def _contains_next_value (tuple : ContainsFoldTuple [A] ) (elem : A) : ContainsFoldTuple [A] =
-    ContainsFoldTuple_ (elem == tuple.element, tuple.element)
+    ContainsFoldTuple_ (elem == tuple .element , tuple .element)
 
   private def _contains_condition (tuple : ContainsFoldTuple [A] ) (elem : A) : Boolean =
-    ! tuple.contained
+    ! tuple .contained
 
   def at (s : MSeq [A] ) (n : Int) : OptionSD [A] =
-    s.opt [OptionSD [A] ] (
+    s .opt [OptionSD [A] ] (
       ifEmpty = NoneSD_ [A] () ) (
       ifNonEmpty = ( neseq => _retrieve_if_in_range (neseq) (n) )
     )
@@ -226,57 +226,57 @@ trait Min [A]
      else SomeSD_ [A] (_atNonEmpty (xs) (n) )
 
   private def _atNonEmpty (xs : NESeq [A] ) (n : Int) : A =
-    (foldLeftWhile (xs) (_atNonEmpty_initial_value (xs) (n) ) (_atNonEmpty_next_value) (_atNonEmpty_condition) ).elem
+    (foldLeftWhile (xs) (_atNonEmpty_initial_value (xs) (n) ) (_atNonEmpty_next_value) (_atNonEmpty_condition) ) .elem
 
   private def _atNonEmpty_initial_value (xs : NESeq [A] ) (position : Int ) : AtFoldTuple [A] =
-    AtFoldTuple_ [A] (xs.head, -1, position)
+    AtFoldTuple_ [A] (xs .head , -1 , position)
 
   private def _atNonEmpty_next_value (tuple : AtFoldTuple [A] ) (elem : A) : AtFoldTuple [A] =
-    AtFoldTuple_ [A] (elem, tuple.index + 1, tuple.position)
+    AtFoldTuple_ [A] (elem , tuple .index + 1 , tuple .position)
 
   private def _atNonEmpty_condition (tuple : AtFoldTuple [A] ) (elem : A) : Boolean =
-    tuple.index < tuple.position
+    tuple .index < tuple .position
 
   /* */
 
   def take (s : MSeq [A] ) (n : Int) : MSeq [A] =
-    reverse ( (foldLeftWhile (s) (_take_initial_value (n) ) (_take_next_value) (_take_condition) ).seq )
+    reverse ( (foldLeftWhile (s) (_take_initial_value (n) ) (_take_next_value) (_take_condition) ) .seq )
 
-  private def _take_initial_value (length : Int ) : TakeDropFoldTuple [A] = TakeDropFoldTuple_ [A] (empty, 0, length)
+  private def _take_initial_value (length : Int ) : TakeDropFoldTuple [A] = TakeDropFoldTuple_ [A] (empty , 0 , length)
 
   private def _take_next_value (tuple : TakeDropFoldTuple [A] ) (elem : A) : TakeDropFoldTuple [A] =
-    TakeDropFoldTuple_ [A] (prepended (tuple.seq) (elem), tuple.index + 1, tuple.length)
+    TakeDropFoldTuple_ [A] (prepended (tuple .seq) (elem) , tuple .index + 1 , tuple .length)
 
-  private def _take_condition (tuple : TakeDropFoldTuple [A] ) (elem : A) : Boolean = tuple.index < tuple.length
+  private def _take_condition (tuple : TakeDropFoldTuple [A] ) (elem : A) : Boolean = tuple .index < tuple .length
 
   def drop (s : MSeq [A] ) (n : Int) : MSeq [A] =
-    (foldLeftWhile (s) (_drop_initial_value (s) (n) ) (_drop_next_value) (_drop_condition) ).seq
+    (foldLeftWhile (s) (_drop_initial_value (s) (n) ) (_drop_next_value) (_drop_condition) ) .seq
 
-  private def _drop_initial_value (s : MSeq [A] ) (length : Int) : TakeDropFoldTuple [A] = TakeDropFoldTuple_ [A] (s, 0, length)
+  private def _drop_initial_value (s : MSeq [A] ) (length : Int) : TakeDropFoldTuple [A] = TakeDropFoldTuple_ [A] (s , 0 , length)
 
   private def _drop_next_value (tuple : TakeDropFoldTuple [A] ) (elem : A) : TakeDropFoldTuple [A] =
-    tuple.seq.opt (
-      ifEmpty = TakeDropFoldTuple_ [A] (tuple.seq, tuple.index + 1, tuple.length) ) (
-      ifNonEmpty =  neseq => TakeDropFoldTuple_ [A] (neseq.tail, tuple.index + 1, tuple.length)
+    tuple .seq .opt (
+      ifEmpty = TakeDropFoldTuple_ [A] (tuple .seq , tuple .index + 1 , tuple .length) ) (
+      ifNonEmpty =  neseq => TakeDropFoldTuple_ [A] (neseq .tail , tuple .index + 1 , tuple .length)
     )
 
   private def _drop_condition (tuple : TakeDropFoldTuple [A] ) (elem : A) : Boolean =
-    tuple.index < tuple.length
+    tuple .index < tuple .length
 
   def takeWhile (s : MSeq [A] ) (p : A => Boolean) : MSeq [A] =
-    reverse ( (spanRevRec (s) (p) ).left)
+    reverse ( (spanRevRec (s) (p) ) .left)
 
   def dropWhile (s : MSeq [A] ) (p : A => Boolean) : MSeq [A] =
-    (spanRevRec (s) (p) ).right
+    (spanRevRec (s) (p) ) .right
 
   def splitAt (s : MSeq [A] ) (n : Int) : MSeqPair [A] =
-    MSeqPair_ (take (s) (n), drop (s) (n) )
+    MSeqPair_ (take (s) (n) , drop (s) (n) )
 
   def span (s : MSeq [A] ) (p : A => Boolean) : MSeqPair [A] =
     _span_with (s) (p) (spanRevRec (s) (p) )
 
   private def _span_with (s : MSeq [A] ) (p : A => Boolean) (pair : MSeqPair [A] ) : MSeqPair [A] =
-    MSeqPair_ (reverse (pair.left), pair.right)
+    MSeqPair_ (reverse (pair .left) , pair .right)
 
   /* */
 
@@ -284,7 +284,7 @@ trait Min [A]
     reverse (prepended (reverse (s) ) (e) )
 
   def last (s : NESeq [A] ) : A =
-    reverseNonEmpty (s).head
+    reverseNonEmpty (s) .head
 
   def concat (s0 : MSeq [A] ) (s1 : MSeq [A] ) : MSeq [A] =
     foldLeft (reverse (s0) ) (_concat_initial_value (s1) ) (_concat_next_value)
@@ -298,74 +298,74 @@ trait Min [A]
   /* */
 
   def forall (s : MSeq [A] ) (p : A => Boolean) : Boolean =
-    (foldLeftWhile (s) (_forall_initial_value (p) ) (_forall_next_value) (_forall_condition) ).status
+    (foldLeftWhile (s) (_forall_initial_value (p) ) (_forall_next_value) (_forall_condition) ) .status
 
-  private def _forall_initial_value (condition : A => Boolean ) : ForallExistsFoldTuple [A] = ForallExistsFoldTuple_ (true, condition)
+  private def _forall_initial_value (condition : A => Boolean ) : ForallExistsFoldTuple [A] = ForallExistsFoldTuple_ (true , condition)
 
   private def _forall_next_value (tuple : ForallExistsFoldTuple [A] ) (elem : A) : ForallExistsFoldTuple [A] =
-    ForallExistsFoldTuple_ (tuple.status && tuple.condition (elem), tuple.condition)
+    ForallExistsFoldTuple_ (tuple .status && tuple .condition (elem) , tuple .condition)
 
   private def _forall_condition (tuple : ForallExistsFoldTuple [A] ) (elem : A) : Boolean =
-    tuple.status
+    tuple .status
 
   def exists (s : MSeq [A] ) (p : A => Boolean ) : Boolean =
-    (foldLeftWhile (s) (_exists_initial_value (p) ) (_exists_next_value) (_exists_condition) ).status
+    (foldLeftWhile (s) (_exists_initial_value (p) ) (_exists_next_value) (_exists_condition) ) .status
 
-  private def _exists_initial_value (condition : A => Boolean ) : ForallExistsFoldTuple [A] = ForallExistsFoldTuple_ (false, condition)
+  private def _exists_initial_value (condition : A => Boolean ) : ForallExistsFoldTuple [A] = ForallExistsFoldTuple_ (false , condition)
 
   private def _exists_next_value (tuple : ForallExistsFoldTuple [A] ) (elem : A) : ForallExistsFoldTuple [A] =
-    ForallExistsFoldTuple_ (tuple.status || tuple.condition (elem), tuple.condition)
+    ForallExistsFoldTuple_ (tuple .status || tuple .condition (elem) , tuple .condition)
 
   private def _exists_condition (tuple : ForallExistsFoldTuple [A] ) (elem : A) : Boolean =
-    ! tuple.status
+    ! tuple .status
 
   def find (s : MSeq [A] ) (p : A => Boolean) : OptionSD [A] =
-    (foldLeftWhile (s) (_find_initial_value (p) ) (_find_next_value) (_find_condition) ).maybe_element
+    (foldLeftWhile (s) (_find_initial_value (p) ) (_find_next_value) (_find_condition) ) .maybe_element
 
   private def _find_initial_value (condition : A => Boolean) : FindFoldTuple [A] =
-    FindFoldTuple_ (NoneSD_ [A] (), condition)
+    FindFoldTuple_ (NoneSD_ [A] () , condition)
 
   private def _find_next_value (tuple : FindFoldTuple [A] ) (elem : A) : FindFoldTuple [A] =
-    if ( tuple.condition (elem)
-    ) FindFoldTuple_ (SomeSD_ [A] (elem), tuple.condition)
-    else FindFoldTuple_ (NoneSD_ [A] (), tuple.condition)
+    if ( tuple .condition (elem)
+    ) FindFoldTuple_ (SomeSD_ [A] (elem) , tuple .condition)
+    else FindFoldTuple_ (NoneSD_ [A] () , tuple .condition)
 
   private def _find_condition (tuple : FindFoldTuple [A] ) (elem : A) : Boolean =
-    tuple.maybe_element.isEmpty
+    tuple .maybe_element .isEmpty
 
   def filter (s : MSeq [A] ) (p : A => Boolean) : MSeq [A] =
-    reverse ( (foldLeft (s) (_filter_initial_value (p) ) (_filter_next_value) ).sequence )
+    reverse ( (foldLeft (s) (_filter_initial_value (p) ) (_filter_next_value) ) .sequence )
 
   private def _filter_initial_value (condition : A => Boolean) : FilterFoldTuple [A] =
-    FilterFoldTuple_ (empty, condition)
+    FilterFoldTuple_ (empty , condition)
 
   private def _filter_next_value (tuple : FilterFoldTuple [A] ) (elem : A) :  FilterFoldTuple [A] =
     FilterFoldTuple_ (
       _prepend_when_condition (tuple) (elem) ,
-      tuple.condition
+      tuple .condition
     )
 
   private def _prepend_when_condition (tuple : FilterFoldTuple [A] ) (elem : A) :  MSeq [A] =
-    if ( tuple.condition (elem)
-    ) prepended (tuple.sequence) (elem)
-    else tuple.sequence
+    if ( tuple .condition (elem)
+    ) prepended (tuple .sequence) (elem)
+    else tuple .sequence
 
   def map0 (s : MSeq [A] ) (f : A => A) : MSeq [A] =
-    reverse ( (foldLeft (s) (_map0_initial_value (f) ) (_map0_next_value) ).sequence)
+    reverse ( (foldLeft (s) (_map0_initial_value (f) ) (_map0_next_value) ) .sequence)
 
   private def _map0_initial_value (mapping : A => A) : Map0FoldTuple [A] =
-    Map0FoldTuple_ (empty, mapping)
+    Map0FoldTuple_ (empty , mapping)
 
   private def _map0_next_value (tuple : Map0FoldTuple [A] ) (elem : A) : Map0FoldTuple [A] =
-    Map0FoldTuple_ (prepended (tuple.sequence) (tuple.mapping (elem) ), tuple.mapping)
+    Map0FoldTuple_ (prepended (tuple .sequence) (tuple .mapping (elem) ) , tuple .mapping)
 
   /**
    * 
-   * def foldLeft [B] (z : B) (op : (B, A) -> B) : B =
+   * def foldLeft [B] (z : B) (op : (B , A) -> B) : B =
    * . var result = z
    * . it = iterator
    * . while (it.hasNext) {
-   * . . result = op (result, it.next () )
+   * . . result = op (result , it.next () )
    * . }
    * . result
    * end
@@ -382,27 +382,27 @@ trait Min [A]
     _spanRevRec_for (foldLeftWhile (s0) (_spanRevRec_initial_value (s0) (p) ) (_spanRevRec_next_value) (_spanRevRec_condition) )
 
   private def _spanRevRec_for (tuple: SpanRevFoldTuple [A] ) : MSeqPair [A] =
-    MSeqPair_ (tuple.right, tuple.left)
+    MSeqPair_ (tuple .right , tuple .left)
 
   private def _spanRevRec_initial_value (s0 : MSeq [A] ) (condition : A => Boolean) : SpanRevFoldTuple [A] =
-    SpanRevFoldTuple_ [A] (s0, empty, true, condition)
+    SpanRevFoldTuple_ [A] (s0 , empty , true , condition)
 
   private def _spanRevRec_next_value (tuple : SpanRevFoldTuple [A] ) (elem : A) : SpanRevFoldTuple [A] =
-    tuple.left.opt [SpanRevFoldTuple [A] ] (
-      ifEmpty = SpanRevFoldTuple_ [A] (tuple.left, tuple.right, false, tuple.condition) ) (
+    tuple .left .opt [SpanRevFoldTuple [A] ] (
+      ifEmpty = SpanRevFoldTuple_ [A] (tuple .left , tuple .right , false , tuple .condition) ) (
       ifNonEmpty =  neleft => _aux_next_value (tuple) (neleft)
     )
 
   private def _spanRevRec_condition (tuple : SpanRevFoldTuple [A] ) (elem : A) : Boolean =
-    tuple.taking
+    tuple .taking
 
   private def _aux_next_value (tuple : SpanRevFoldTuple [A] ) (neleft : NESeq [A] ) : SpanRevFoldTuple [A] =
-    _aux_next_value_for (tuple) (neleft) (tuple.condition (neleft.head) )
+    _aux_next_value_for (tuple) (neleft) (tuple .condition (neleft .head) )
 
   private def _aux_next_value_for (tuple : SpanRevFoldTuple [A] ) (neleft : NESeq [A] ) (new_taking : Boolean) : SpanRevFoldTuple [A] =
     if ( new_taking
-    ) SpanRevFoldTuple_ [A] (neleft.tail, prepended (tuple.right) (neleft.head), new_taking, tuple.condition)
-    else SpanRevFoldTuple_ [A] (neleft, tuple.right, new_taking, tuple.condition)
+    ) SpanRevFoldTuple_ [A] (neleft .tail , prepended (tuple .right) (neleft .head) , new_taking , tuple .condition)
+    else SpanRevFoldTuple_ [A] (neleft , tuple .right , new_taking , tuple .condition)
 
 }
 
diff --git a/library/src/main/scala/soda/collection/example/ListExample.soda b/library/src/main/scala/soda/collection/example/ListExample.soda
index c0b9f370..3a07bdf6 100644
--- a/library/src/main/scala/soda/collection/example/ListExample.soda
+++ b/library/src/main/scala/soda/collection/example/ListExample.soda
@@ -11,79 +11,79 @@ class ListExample
 
   a : Seq [Char] = Seq ('A', 'B', 'C', 'D', 'E', 'F')
 
-  b : Seq [Int] = Seq (10, 20, 30, 40, 50, 60)
+  b : Seq [Int] = Seq (10 , 20 , 30 , 40 , 50 , 60)
 
   a_example : Pair [Seq [Char] ] =
-    Pair_("a", a)
+    Pair_("a" , a)
 
   b_example : Pair [Seq [Int] ] =
-    Pair_("b", b)
+    Pair_("b" , b)
 
   take_example : Pair [Seq [Char] ] =
-    Pair_("a.take(3)", a.take (3) )
+    Pair_("a .take (3)" , a .take (3) )
 
   takeRight_example : Pair [Seq [Char] ] =
-    Pair_("a.takeRight(3)", a.takeRight (3) )
+    Pair_("a .takeRight (3)" , a .takeRight (3) )
 
   takeWhile_example : Pair [Seq [Char] ] =
-    Pair_("a.takeWhile(lambda x --> not (x == 'E'))", a.takeWhile (lambda x --> not (x == 'E') ) )
+    Pair_("a .takeWhile (lambda x --> not (x == 'E') )" , a .takeWhile (lambda x --> not (x == 'E') ) )
 
   drop_example : Pair [Seq [Char] ] =
-    Pair_("a.drop(2)", a.drop (2))
+    Pair_("a .drop (2)" , a .drop (2) )
 
   dropRight_example : Pair [Seq [Char] ] =
-    Pair_("a.dropRight(2)", a.dropRight (2))
+    Pair_("a .dropRight (2)" , a .dropRight (2))
 
   dropWhile_example : Pair [Seq [Char] ] =
-    Pair_("a.dropWhile(lambda x --> not (x == 'E'))", a.dropWhile (lambda x --> not (x == 'E') ) )
+    Pair_("a .dropWhile (lambda x --> not (x == 'E'))" , a .dropWhile (lambda x --> not (x == 'E') ) )
 
-  splitAt_example : Pair [(Seq [Char], Seq [Char] ) ] =
-    Pair_("a.splitAt(3)", a.splitAt (3) )
+  splitAt_example : Pair [Tuple2 [Seq [Char] ] [Seq [Char] ] ] =
+    Pair_("a .splitAt (3)" , a .splitAt (3) )
 
   indices_example : Pair [Range] =
-    Pair_("a.indices", a.indices)
+    Pair_("a .indices" , a .indices)
 
-  zipWithIndex_example : Pair [Seq [ Tuple2 [Char] [Int] ] ] =
-    Pair_("a.zipWithIndex", a.zipWithIndex)
+  zipWithIndex_example : Pair [Seq [Tuple2 [Char] [Int] ] ] =
+    Pair_("a .zipWithIndex" , a .zipWithIndex)
 
-  zip_example : Pair [Seq [ Tuple2 [Char] [Int] ] ] =
-    Pair_("a.zip(b)", a.zip (b))
+  zip_example : Pair [Seq [Tuple2 [Char] [Int] ] ] =
+    Pair_("a .zip (b)" , a .zip (b) )
 
   reverse_example : Pair [Seq [Char] ] =
-    Pair_("a.reverse", a.reverse)
+    Pair_("a .reverse" , a .reverse)
 
   /**
    * A mnemonic for `+:` vs. `:+` is that the COLon goes on the COLlection side.
    */
   prepended_example : Pair [Seq [Char] ] =
-    Pair_("a.+:('X')", (a.+: ('X') ) )
+    Pair_("a .+: ('X')" , (a .+: ('X') ) )
 
   /**
    * A mnemonic for `+:` vs. `:+` is that the COLon goes on the COLlection side.
    */
   appended_example : Pair [Seq [Char] ] =
-    Pair_("a.:+('X')", (a.:+ ('X') ) )
+    Pair_("a .:+ ('X')" , (a .:+ ('X') ) )
 
   concat_example : Pair [Seq [Int] ] =
-    Pair_("a.map(_.toInt).++(b)", a.map (_.toInt).++ (b) )
+    Pair_("a .map (lambda x --> x .toInt) .++ (b)" , a .map (lambda x --> x .toInt) .++ (b) )
 
-  span_example : Pair [(Seq [Char], Seq [Char])] =
-    Pair_("a.span(lambda x --> not (x == 'D'))", a.span (lambda x --> not (x == 'D') ) )
+  span_example : Pair [(Seq [Char] , Seq [Char])] =
+    Pair_("a .span (lambda x --> not (x == 'D') )" , a .span (lambda x --> not (x == 'D') ) )
 
   map_example : Pair [Seq [Int] ] =
-    Pair_("a.map(lambda x --> x.toInt)", a.map (lambda x --> x.toInt) )
+    Pair_("a .map (lambda x --> x .toInt)" , a .map (lambda x --> x .toInt) )
 
   filter_example : Pair [Seq [Char] ] =
-    Pair_("a.filter(lambda x --> x.toInt % 2 == 0)", a.filter (lambda x --> x.toInt % 2 == 0) )
+    Pair_("a .filter (lambda x --> x .toInt % 2 == 0)" , a .filter (lambda x --> x .toInt % 2 == 0) )
 
   fold_example : Pair [Int] =
-    Pair_("b.fold(0)(lambda (a, b) --> a + b)", b.fold (0)(lambda (a, b) --> a + b) )
+    Pair_("b .fold(0) (lambda (a , b) --> a + b)" , b .fold (0) (lambda (a , b) --> a + b) )
 
   foldLeft_example : Pair [Seq [Char] ] =
-    Pair_("a.foldLeft(Seq('*'))(lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", a.foldLeft (Seq ('*') )(lambda (list, elem) --> "(" + list + " :+ " + elem + ")") )
+    Pair_("a .foldLeft (Seq ('*') ) (lambda (list , elem) --> \"(\" + list + \" :+ \" + elem + \")\")" , a .foldLeft (Seq ('*') ) (lambda (list , elem) --> "(" + list + " :+ " + elem + ")") )
 
   foldRight_example : Pair [Seq [Char] ] =
-    Pair_("a.foldRight(Seq('*'))(lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", a.foldRight (Seq ('*') )(lambda (elem, list) --> "(" + elem + " +: " + list + ")") )
+    Pair_("a .foldRight (Seq ('*') ) (lambda (elem , list) --> \"(\" + elem + \" +: \" + list + \")\")" , a.foldRight (Seq ('*') ) (lambda (elem , list) --> "(" + elem + " +: " + list + ")") )
 
 end
 
diff --git a/library/src/main/scala/soda/collection/example/Main.soda b/library/src/main/scala/soda/collection/example/Main.soda
index d61110e7..397ccd18 100644
--- a/library/src/main/scala/soda/collection/example/Main.soda
+++ b/library/src/main/scala/soda/collection/example/Main.soda
@@ -5,30 +5,30 @@ class Main
 
   all_examples =
     Seq (
-      e.a_example,
-      e.b_example,
-      e.take_example,
-      e.takeRight_example,
-      e.takeWhile_example,
-      e.drop_example,
-      e.dropRight_example,
-      e.dropWhile_example,
-      e.splitAt_example,
-      e.indices_example,
-      e.zipWithIndex_example,
-      e.zip_example,
-      e.reverse_example,
-      e.prepended_example,
-      e.appended_example,
-      e.concat_example,
-      e.span_example,
-      e.map_example,
-      e.filter_example,
-      e.fold_example,
-      e.foldLeft_example,
-      e.foldRight_example
+      e .a_example,
+      e .b_example,
+      e .take_example,
+      e .takeRight_example,
+      e .takeWhile_example,
+      e .drop_example,
+      e .dropRight_example,
+      e .dropWhile_example,
+      e .splitAt_example,
+      e .indices_example,
+      e .zipWithIndex_example,
+      e .zip_example,
+      e .reverse_example,
+      e .prepended_example,
+      e .appended_example,
+      e .concat_example,
+      e .span_example,
+      e .map_example,
+      e .filter_example,
+      e .fold_example,
+      e .foldLeft_example,
+      e .foldRight_example
     )
-    .map (lambda pair --> pair.name + " = " + pair.result.toString)
+    .map (lambda pair --> pair .name + " = " + pair .result .toString)
     .mkString ("\n")
 
   main (arguments : Array [String] ) : Unit =
diff --git a/library/src/main/scala/soda/collection/example/Package.scala b/library/src/main/scala/soda/collection/example/Package.scala
index 7db46788..d6b972cd 100644
--- a/library/src/main/scala/soda/collection/example/Package.scala
+++ b/library/src/main/scala/soda/collection/example/Package.scala
@@ -21,79 +21,79 @@ trait ListExample
 
   lazy val a : Seq [Char] = Seq ('A', 'B', 'C', 'D', 'E', 'F')
 
-  lazy val b : Seq [Int] = Seq (10, 20, 30, 40, 50, 60)
+  lazy val b : Seq [Int] = Seq (10 , 20 , 30 , 40 , 50 , 60)
 
   lazy val a_example : Pair [Seq [Char] ] =
-    Pair_("a", a)
+    Pair_("a" , a)
 
   lazy val b_example : Pair [Seq [Int] ] =
-    Pair_("b", b)
+    Pair_("b" , b)
 
   lazy val take_example : Pair [Seq [Char] ] =
-    Pair_("a.take(3)", a.take (3) )
+    Pair_("a .take (3)" , a .take (3) )
 
   lazy val takeRight_example : Pair [Seq [Char] ] =
-    Pair_("a.takeRight(3)", a.takeRight (3) )
+    Pair_("a .takeRight (3)" , a .takeRight (3) )
 
   lazy val takeWhile_example : Pair [Seq [Char] ] =
-    Pair_("a.takeWhile(lambda x --> not (x == 'E'))", a.takeWhile ( x => ! (x == 'E') ) )
+    Pair_("a .takeWhile (lambda x --> not (x == 'E') )" , a .takeWhile ( x => ! (x == 'E') ) )
 
   lazy val drop_example : Pair [Seq [Char] ] =
-    Pair_("a.drop(2)", a.drop (2))
+    Pair_("a .drop (2)" , a .drop (2) )
 
   lazy val dropRight_example : Pair [Seq [Char] ] =
-    Pair_("a.dropRight(2)", a.dropRight (2))
+    Pair_("a .dropRight (2)" , a .dropRight (2))
 
   lazy val dropWhile_example : Pair [Seq [Char] ] =
-    Pair_("a.dropWhile(lambda x --> not (x == 'E'))", a.dropWhile ( x => ! (x == 'E') ) )
+    Pair_("a .dropWhile (lambda x --> not (x == 'E'))" , a .dropWhile ( x => ! (x == 'E') ) )
 
-  lazy val splitAt_example : Pair [(Seq [Char], Seq [Char] ) ] =
-    Pair_("a.splitAt(3)", a.splitAt (3) )
+  lazy val splitAt_example : Pair [Tuple2 [Seq [Char] , Seq [Char] ] ] =
+    Pair_("a .splitAt (3)" , a .splitAt (3) )
 
   lazy val indices_example : Pair [Range] =
-    Pair_("a.indices", a.indices)
+    Pair_("a .indices" , a .indices)
 
-  lazy val zipWithIndex_example : Pair [Seq [ Tuple2 [Char, Int] ] ] =
-    Pair_("a.zipWithIndex", a.zipWithIndex)
+  lazy val zipWithIndex_example : Pair [Seq [Tuple2 [Char, Int] ] ] =
+    Pair_("a .zipWithIndex" , a .zipWithIndex)
 
-  lazy val zip_example : Pair [Seq [ Tuple2 [Char, Int] ] ] =
-    Pair_("a.zip(b)", a.zip (b))
+  lazy val zip_example : Pair [Seq [Tuple2 [Char, Int] ] ] =
+    Pair_("a .zip (b)" , a .zip (b) )
 
   lazy val reverse_example : Pair [Seq [Char] ] =
-    Pair_("a.reverse", a.reverse)
+    Pair_("a .reverse" , a .reverse)
 
   /**
    * A mnemonic for `+:` vs. `:+` is that the COLon goes on the COLlection side.
    */
   lazy val prepended_example : Pair [Seq [Char] ] =
-    Pair_("a.+:('X')", (a.+: ('X') ) )
+    Pair_("a .+: ('X')" , (a .+: ('X') ) )
 
   /**
    * A mnemonic for `+:` vs. `:+` is that the COLon goes on the COLlection side.
    */
   lazy val appended_example : Pair [Seq [Char] ] =
-    Pair_("a.:+('X')", (a.:+ ('X') ) )
+    Pair_("a .:+ ('X')" , (a .:+ ('X') ) )
 
   lazy val concat_example : Pair [Seq [Int] ] =
-    Pair_("a.map(_.toInt).++(b)", a.map (_.toInt).++ (b) )
+    Pair_("a .map (lambda x --> x .toInt) .++ (b)" , a .map ( x => x .toInt) .++ (b) )
 
-  lazy val span_example : Pair [(Seq [Char], Seq [Char])] =
-    Pair_("a.span(lambda x --> not (x == 'D'))", a.span ( x => ! (x == 'D') ) )
+  lazy val span_example : Pair [(Seq [Char] , Seq [Char])] =
+    Pair_("a .span (lambda x --> not (x == 'D') )" , a .span ( x => ! (x == 'D') ) )
 
   lazy val map_example : Pair [Seq [Int] ] =
-    Pair_("a.map(lambda x --> x.toInt)", a.map ( x => x.toInt) )
+    Pair_("a .map (lambda x --> x .toInt)" , a .map ( x => x .toInt) )
 
   lazy val filter_example : Pair [Seq [Char] ] =
-    Pair_("a.filter(lambda x --> x.toInt % 2 == 0)", a.filter ( x => x.toInt % 2 == 0) )
+    Pair_("a .filter (lambda x --> x .toInt % 2 == 0)" , a .filter ( x => x .toInt % 2 == 0) )
 
   lazy val fold_example : Pair [Int] =
-    Pair_("b.fold(0)(lambda (a, b) --> a + b)", b.fold (0)( (a, b) => a + b) )
+    Pair_("b .fold(0) (lambda (a , b) --> a + b)" , b .fold (0) ( (a , b) => a + b) )
 
   lazy val foldLeft_example : Pair [Seq [Char] ] =
-    Pair_("a.foldLeft(Seq('*'))(lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", a.foldLeft (Seq ('*') )( (list, elem) => "(" + list + " :+ " + elem + ")") )
+    Pair_("a .foldLeft (Seq ('*') ) (lambda (list , elem) --> \"(\" + list + \" :+ \" + elem + \")\")" , a .foldLeft (Seq ('*') ) ( (list , elem) => "(" + list + " :+ " + elem + ")") )
 
   lazy val foldRight_example : Pair [Seq [Char] ] =
-    Pair_("a.foldRight(Seq('*'))(lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", a.foldRight (Seq ('*') )( (elem, list) => "(" + elem + " +: " + list + ")") )
+    Pair_("a .foldRight (Seq ('*') ) (lambda (elem , list) --> \"(\" + elem + \" +: \" + list + \")\")" , a.foldRight (Seq ('*') ) ( (elem , list) => "(" + elem + " +: " + list + ")") )
 
 }
 
@@ -107,30 +107,30 @@ trait Main
 
   lazy val all_examples =
     Seq (
-      e.a_example,
-      e.b_example,
-      e.take_example,
-      e.takeRight_example,
-      e.takeWhile_example,
-      e.drop_example,
-      e.dropRight_example,
-      e.dropWhile_example,
-      e.splitAt_example,
-      e.indices_example,
-      e.zipWithIndex_example,
-      e.zip_example,
-      e.reverse_example,
-      e.prepended_example,
-      e.appended_example,
-      e.concat_example,
-      e.span_example,
-      e.map_example,
-      e.filter_example,
-      e.fold_example,
-      e.foldLeft_example,
-      e.foldRight_example
+      e .a_example,
+      e .b_example,
+      e .take_example,
+      e .takeRight_example,
+      e .takeWhile_example,
+      e .drop_example,
+      e .dropRight_example,
+      e .dropWhile_example,
+      e .splitAt_example,
+      e .indices_example,
+      e .zipWithIndex_example,
+      e .zip_example,
+      e .reverse_example,
+      e .prepended_example,
+      e .appended_example,
+      e .concat_example,
+      e .span_example,
+      e .map_example,
+      e .filter_example,
+      e .fold_example,
+      e .foldLeft_example,
+      e .foldRight_example
     )
-    .map ( pair => pair.name + " = " + pair.result.toString)
+    .map ( pair => pair .name + " = " + pair .result .toString)
     .mkString ("\n")
 
   def main (arguments : Array [String] ) : Unit =
diff --git a/library/src/test/scala/soda/collection/MinSpec.soda b/library/src/test/scala/soda/collection/MinSpec.soda
index 09f0a885..fe82928f 100644
--- a/library/src/test/scala/soda/collection/MinSpec.soda
+++ b/library/src/test/scala/soda/collection/MinSpec.soda
@@ -13,32 +13,32 @@ class MinSpec ()
 
   empty : ESeq [Int] = ESeq_ [Int] ()
 
-  exampleSeq : Seq [Int] = Seq (0, 1, 1, 2, 3, 5, 8)
+  exampleSeq : Seq [Int] = Seq (0 , 1 , 1 , 2 , 3 , 5 , 8)
 
   revExampleSeq : Seq [Int] = exampleSeq.reverse
 
-  prepend_elem (list : MSeq [Int]) (elem : Int) : NESeq [Int] = Min_ ().prepended (list) (elem)
+  prepend_elem (list : MSeq [Int]) (elem : Int) : NESeq [Int] = Min_ () .prepended (list) (elem)
 
   _fold = Fold_ ()
 
-  _initial_value : NESeq [Int] = NESeq_ [Int] (revExampleSeq.head, ESeq_ [Int] () )
+  _initial_value : NESeq [Int] = NESeq_ [Int] (revExampleSeq .head , ESeq_ [Int] () )
 
   example : NESeq [Int] =
-    _fold.apply (revExampleSeq.tail) (_initial_value) (prepend_elem)
+    _fold .apply (revExampleSeq .tail) (_initial_value) (prepend_elem)
 
   test ("prepended") (
     check (
       obtained := _prepended_sequence
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq [Int] (1, 0, 1, 1, 2, 3, 5, 8) )
+      expected := MSeqTranslator_ () .asMSeq (Seq [Int] (1 , 0 , 1 , 1 , 2 , 3 , 5 , 8) )
     )
   )
 
-  _prepended_sequence : MSeq [Int] = Min_ ().prepended (example) (1)
+  _prepended_sequence : MSeq [Int] = Min_ () .prepended (example) (1)
 
   test ("head") (
     check (
-      obtained := Min_ ().head (example)
+      obtained := Min_ () .head (example)
     ) (
       expected := 0
     )
@@ -46,23 +46,23 @@ class MinSpec ()
 
   test ("tail") (
     check (
-      obtained := Min_ ().tail (example)
+      obtained := Min_ () .tail (example)
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (1, 1, 2, 3, 5, 8) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (1 , 1 , 2 , 3 , 5 , 8) )
     )
   )
 
   test ("reverse") (
     check (
-      obtained := Min_ ().reverse (example)
+      obtained := Min_ () .reverse (example)
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (8, 5, 3, 2, 1, 1, 0) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (8 , 5 , 3 , 2 , 1 , 1 , 0) )
     )
   )
 
   test ("length") (
     check (
-      obtained := Min_ ().length (example)
+      obtained := Min_ () .length (example)
     ) (
       expected := 7
     )
@@ -70,7 +70,7 @@ class MinSpec ()
 
   test ("indexOf something found") (
     check (
-      obtained := Min_ ().indexOf (example) (8)
+      obtained := Min_ () .indexOf (example) (8)
     ) (
       expected := 6
     )
@@ -78,7 +78,7 @@ class MinSpec ()
 
   test ("indexOf something not found") (
     check (
-      obtained := Min_ ().indexOf (example) (7)
+      obtained := Min_ () .indexOf (example) (7)
     ) (
       expected := -1
     )
@@ -86,7 +86,7 @@ class MinSpec ()
 
   test ("contains something found") (
     check (
-      obtained := Min_ ().contains (example) (8)
+      obtained := Min_ () .contains (example) (8)
     ) (
       expected := true
     )
@@ -94,7 +94,7 @@ class MinSpec ()
 
   test ("contains something not found") (
     check (
-      obtained := Min_ ().contains (example) (7)
+      obtained := Min_ () .contains (example) (7)
     ) (
       expected := false
     )
@@ -102,7 +102,7 @@ class MinSpec ()
 
   test ("at") (
     check (
-      obtained := Min_ ().at (example) (4)
+      obtained := Min_ () .at (example) (4)
     ) (
       expected := SomeSD_ (3)
     )
@@ -110,15 +110,15 @@ class MinSpec ()
 
   test ("take with Seq 0") (
     check (
-      obtained := exampleSeq.take (5)
+      obtained := exampleSeq .take (5)
     ) (
-      expected := Seq (0, 1, 1, 2, 3)
+      expected := Seq (0 , 1 , 1 , 2 , 3)
     )
   )
 
   test ("take with Seq 1") (
     check (
-      obtained := exampleSeq.take (-100)
+      obtained := exampleSeq .take (-100)
     ) (
       expected := Seq ()
     )
@@ -126,7 +126,7 @@ class MinSpec ()
 
   test ("take with Seq 2") (
     check (
-      obtained := exampleSeq.take (100)
+      obtained := exampleSeq .take (100)
     ) (
       expected := exampleSeq
     )
@@ -134,15 +134,15 @@ class MinSpec ()
 
   test ("take 0") (
     check (
-      obtained := Min_ ().take (example) (5)
+      obtained := Min_ () .take (example) (5)
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2, 3) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1 , 2 , 3) )
     )
   )
 
   test ("take 1") (
     check (
-      obtained := Min_ ().take (example) (-100)
+      obtained := Min_ () .take (example) (-100)
     ) (
       expected := empty
     )
@@ -150,7 +150,7 @@ class MinSpec ()
 
   test ("take 2") (
     check (
-      obtained := Min_ ().take (example) (100)
+      obtained := Min_ () .take (example) (100)
     ) (
       expected := example
     )
@@ -158,15 +158,15 @@ class MinSpec ()
 
   test ("drop with Seq 0") (
     check (
-      obtained := exampleSeq.drop (3)
+      obtained := exampleSeq .drop (3)
     ) (
-      expected := Seq (2, 3, 5, 8)
+      expected := Seq (2 , 3 , 5 , 8)
     )
   )
 
   test ("drop with Seq 1") (
     check (
-      obtained := exampleSeq.drop (-100)
+      obtained := exampleSeq .drop (-100)
     ) (
       expected := exampleSeq
     )
@@ -174,7 +174,7 @@ class MinSpec ()
 
   test ("drop with Seq 2") (
     check (
-      obtained := exampleSeq.drop (100)
+      obtained := exampleSeq .drop (100)
     ) (
       expected := Seq ()
     )
@@ -182,15 +182,15 @@ class MinSpec ()
 
   test ("drop 0") (
     check (
-      obtained := Min_ ().drop (example) (3)
+      obtained := Min_ () .drop (example) (3)
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (2, 3, 5, 8) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (2 , 3 , 5 , 8) )
     )
   )
 
   test ("drop 1") (
     check (
-      obtained := Min_ ().drop (example) (-100)
+      obtained := Min_ () .drop (example) (-100)
     ) (
       expected := example
     )
@@ -198,7 +198,7 @@ class MinSpec ()
 
   test ("drop 2") (
     check (
-      obtained := Min_ ().drop (example) (100)
+      obtained := Min_ () .drop (example) (100)
     ) (
       expected := empty
     )
@@ -206,79 +206,79 @@ class MinSpec ()
 
   test ("takeWhile with Seq") (
     check (
-      obtained := exampleSeq.takeWhile (lambda e --> not (e == 3) )
+      obtained := exampleSeq .takeWhile (lambda e --> not (e == 3) )
     ) (
-      expected := Seq (0, 1, 1, 2)
+      expected := Seq (0 , 1 , 1 , 2)
     )
   )
 
   test ("takeWhile") (
     check (
-      obtained := Min_ ().takeWhile (example) (lambda e --> not (e == 3) )
+      obtained := Min_ () .takeWhile (example) (lambda e --> not (e == 3) )
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1 , 2) )
     )
   )
 
   test ("dropWhile with Seq") (
     check (
-      obtained := exampleSeq.dropWhile (lambda e --> not (e == 3) )
+      obtained := exampleSeq .dropWhile (lambda e --> not (e == 3) )
     ) (
-      expected := Seq (3, 5, 8)
+      expected := Seq (3 , 5 , 8)
     )
   )
 
   test ("dropWhile") (
     check (
-      obtained := Min_ ().dropWhile (example) (lambda e --> not (e == 3) )
+      obtained := Min_ () .dropWhile (example) (lambda e --> not (e == 3) )
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (3, 5, 8) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (3 , 5 , 8) )
     )
   )
 
   test ("splitAt with Seq") (
     check (
-      obtained := exampleSeq.splitAt (3)
+      obtained := exampleSeq .splitAt (3)
     ) (
-      expected := Tuple2 (Seq (0, 1, 1), Seq (2, 3, 5, 8) )
+      expected := Tuple2 (Seq (0 , 1 , 1) , Seq (2 , 3 , 5 , 8) )
     )
   )
 
   test ("splitAt") (
     check (
-      obtained := Min_ ().splitAt (example) (3)
+      obtained := Min_ () .splitAt (example) (3)
     ) (
-      expected := MSeqPair_ (MSeqTranslator_ ().asMSeq (Seq (0, 1, 1) ), MSeqTranslator_ ().asMSeq (Seq (2, 3, 5, 8) ) )
+      expected := MSeqPair_ (MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1) ) , MSeqTranslator_ () .asMSeq (Seq (2 , 3 , 5 , 8) ) )
     )
   )
 
   test ("span with Seq") (
     check (
-      obtained := exampleSeq.span (lambda x --> not (x == 5) )
+      obtained := exampleSeq .span (lambda x --> not (x == 5) )
     ) (
-      expected := Tuple2 (Seq (0, 1, 1, 2, 3), Seq (5, 8) )
+      expected := Tuple2 (Seq (0 , 1 , 1 , 2 , 3) , Seq (5 , 8) )
     )
   )
 
   test ("span") (
     check (
-      obtained := Min_ ().span (example) (lambda (x : Int) --> not (x == 5) )
+      obtained := Min_ () .span (example) (lambda (x : Int) --> not (x == 5) )
     ) (
-      expected := MSeqPair_ (MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2, 3) ), MSeqTranslator_ ().asMSeq (Seq (5, 8) ) )
+      expected := MSeqPair_ (MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1 , 2 , 3) ) , MSeqTranslator_ () .asMSeq (Seq (5 , 8) ) )
     )
   )
 
   test ("append") (
     check (
-      obtained := Min_ ().appended (example) (13)
+      obtained := Min_ () .appended (example) (13)
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2, 3, 5, 8, 13) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1 , 2 , 3 , 5 , 8 , 13) )
     )
   )
 
   test ("last") (
     check (
-      obtained := Min_ ().last (example)
+      obtained := Min_ () .last (example)
     ) (
       expected := 8
     )
@@ -286,23 +286,23 @@ class MinSpec ()
 
   test ("concat") (
     check (
-      obtained := Min_ ().concat (example) (MSeqTranslator_ ().asMSeq (Seq (13, 21, 34, 55) ) )
+      obtained := Min_ () .concat (example) (MSeqTranslator_ () .asMSeq (Seq (13 , 21 , 34 , 55) ) )
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55) )
     )
   )
 
   test ("slice with Seq 0") (
     check (
-      obtained := exampleSeq.slice (2, 5)
+      obtained := exampleSeq .slice (2 , 5)
     ) (
-      expected := Seq (1, 2, 3)
+      expected := Seq (1 , 2 , 3)
     )
   )
 
   test ("slice with Seq 1") (
     check (
-      obtained := exampleSeq.slice (5, 2)
+      obtained := exampleSeq .slice (5 , 2)
     ) (
       expected := Seq ()
     )
@@ -310,7 +310,7 @@ class MinSpec ()
 
   test ("slice with Seq 2") (
     check (
-      obtained := exampleSeq.slice (3, 3)
+      obtained := exampleSeq .slice (3 , 3)
     ) (
       expected := Seq ()
     )
@@ -318,7 +318,7 @@ class MinSpec ()
 
   test ("slice with Seq 3") (
     check (
-      obtained := exampleSeq.slice (100, 5)
+      obtained := exampleSeq .slice (100 , 5)
     ) (
       expected := Seq ()
     )
@@ -326,7 +326,7 @@ class MinSpec ()
 
   test ("slice with Seq 4") (
     check (
-      obtained := exampleSeq.slice (100, 200)
+      obtained := exampleSeq .slice (100 , 200)
     ) (
       expected := Seq ()
     )
@@ -334,7 +334,7 @@ class MinSpec ()
 
   test ("slice with Seq 5") (
     check (
-      obtained := exampleSeq.slice (-100, 200)
+      obtained := exampleSeq .slice (-100 , 200)
     ) (
       expected := exampleSeq
     )
@@ -342,15 +342,15 @@ class MinSpec ()
 
   test ("slice 0") (
     check (
-      obtained := Min_ ().slice (example) (2) (5)
+      obtained := Min_ () .slice (example) (2) (5)
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (1, 2, 3) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (1 , 2 , 3) )
     )
   )
 
   test ("slice 1") (
     check (
-      obtained := Min_ ().slice (example) (5) (2)
+      obtained := Min_ () .slice (example) (5) (2)
     ) (
       expected := empty
     )
@@ -358,7 +358,7 @@ class MinSpec ()
 
   test ("slice 2") (
     check (
-      obtained := Min_ ().slice (example) (3) (3)
+      obtained := Min_ () .slice (example) (3) (3)
     ) (
       expected := empty
     )
@@ -366,7 +366,7 @@ class MinSpec ()
 
   test ("slice 3") (
     check (
-      obtained := Min_ ().slice (example) (100) (5)
+      obtained := Min_ () .slice (example) (100) (5)
     ) (
       expected := empty
     )
@@ -374,7 +374,7 @@ class MinSpec ()
 
   test ("slice 4") (
     check (
-      obtained := Min_ ().slice (example) (100) (200)
+      obtained := Min_ () .slice (example) (100) (200)
     ) (
       expected := empty
     )
@@ -382,7 +382,7 @@ class MinSpec ()
 
   test ("slice 5") (
     check (
-      obtained := Min_ ().slice (example) (-100) (200)
+      obtained := Min_ () .slice (example) (-100) (200)
     ) (
       expected := example
     )
@@ -390,7 +390,7 @@ class MinSpec ()
 
   test ("forall with Seq 0") (
     check (
-      obtained := exampleSeq.forall (lambda x --> not (x == 7) )
+      obtained := exampleSeq .forall (lambda x --> not (x == 7) )
     ) (
       expected := true
     )
@@ -398,7 +398,7 @@ class MinSpec ()
 
   test ("forall with Seq 1") (
     check (
-      obtained := exampleSeq.forall (lambda x --> x < 7)
+      obtained := exampleSeq .forall (lambda x --> x < 7)
     ) (
       expected := false
     )
@@ -406,7 +406,7 @@ class MinSpec ()
 
   test ("forall with Seq 2") (
     check (
-      obtained := Seq ().forall (lambda x --> x == 7)
+      obtained := Seq () .forall (lambda x --> x == 7)
     ) (
       expected := true
     )
@@ -414,7 +414,7 @@ class MinSpec ()
 
   test ("forall 0") (
     check (
-      obtained := Min_ ().forall (example) (lambda x --> not (x == 7) )
+      obtained := Min_ () .forall (example) (lambda x --> not (x == 7) )
     ) (
       expected := true
     )
@@ -422,7 +422,7 @@ class MinSpec ()
 
   test ("forall 1") (
     check (
-      obtained := Min_ ().forall (example) (lambda x --> x < 7)
+      obtained := Min_ () .forall (example) (lambda x --> x < 7)
     ) (
       expected := false
     )
@@ -430,7 +430,7 @@ class MinSpec ()
 
   test ("forall 2") (
     check (
-      obtained := Min_ ().forall (empty) (lambda x --> x == 7)
+      obtained := Min_ () .forall (empty) (lambda x --> x == 7)
     ) (
       expected := true
     )
@@ -438,7 +438,7 @@ class MinSpec ()
 
   test ("exists with Seq 0") (
     check (
-      obtained := exampleSeq.exists (lambda x --> x == 8)
+      obtained := exampleSeq .exists (lambda x --> x == 8)
     ) (
       expected := true
     )
@@ -446,7 +446,7 @@ class MinSpec ()
 
   test ("exists with Seq 1") (
     check (
-      obtained := exampleSeq.exists (lambda x --> x == 7)
+      obtained := exampleSeq .exists (lambda x --> x == 7)
     ) (
       expected := false
     )
@@ -454,7 +454,7 @@ class MinSpec ()
 
   test ("exists with Seq 2") (
     check (
-      obtained := Seq ().exists (lambda x --> x == 7)
+      obtained := Seq () .exists (lambda x --> x == 7)
     ) (
       expected := false
     )
@@ -462,7 +462,7 @@ class MinSpec ()
 
   test ("exists 0") (
     check (
-      obtained := Min_ ().exists (example) (lambda x --> x == 8)
+      obtained := Min_ () .exists (example) (lambda x --> x == 8)
     ) (
       expected := true
     )
@@ -470,7 +470,7 @@ class MinSpec ()
 
   test ("exists 1") (
     check (
-      obtained := Min_ ().exists (example) (lambda x --> x == 7)
+      obtained := Min_ () .exists (example) (lambda x --> x == 7)
     ) (
       expected := false
     )
@@ -478,7 +478,7 @@ class MinSpec ()
 
   test ("exists 2") (
     check (
-      obtained := Min_ ().exists (empty) (lambda x --> x == 7)
+      obtained := Min_ () .exists (empty) (lambda x --> x == 7)
     ) (
       expected := false
     )
@@ -486,7 +486,7 @@ class MinSpec ()
 
   test ("find with Seq 0") (
     check (
-      obtained := exampleSeq.find (lambda x --> not (x == 7) )
+      obtained := exampleSeq .find (lambda x --> not (x == 7) )
     ) (
       expected := Some (0)
     )
@@ -494,7 +494,7 @@ class MinSpec ()
 
   test ("find with Seq 1") (
     check (
-      obtained := exampleSeq.find (lambda x --> x == 8)
+      obtained := exampleSeq .find (lambda x --> x == 8)
     ) (
       expected := Some (8)
     )
@@ -502,7 +502,7 @@ class MinSpec ()
 
   test ("find with Seq 2") (
     check (
-      obtained := Seq ().find (lambda x --> x == 7)
+      obtained := Seq () .find (lambda x --> x == 7)
     ) (
       expected := None
     )
@@ -510,7 +510,7 @@ class MinSpec ()
 
   test ("find 0") (
     check (
-      obtained := Min_ ().find (example) (lambda x --> not (x == 7) )
+      obtained := Min_ () .find (example) (lambda x --> not (x == 7) )
     ) (
       expected := SomeSD_ (0)
     )
@@ -518,7 +518,7 @@ class MinSpec ()
 
   test ("find 1") (
     check (
-      obtained := Min_ ().find (example) (lambda x --> x == 8)
+      obtained := Min_ () .find (example) (lambda x --> x == 8)
     ) (
       expected := SomeSD_ (8)
     )
@@ -526,7 +526,7 @@ class MinSpec ()
 
   test ("find 2") (
     check (
-      obtained := Min_ ().find (empty) (lambda x --> x == 7)
+      obtained := Min_ () .find (empty) (lambda x --> x == 7)
     ) (
       expected := NoneSD_ ()
     )
@@ -534,51 +534,51 @@ class MinSpec ()
 
   test ("filter with Seq") (
     check (
-      obtained := exampleSeq.filter (lambda x --> x % 3 == 0)
+      obtained := exampleSeq .filter (lambda x --> x % 3 == 0)
     ) (
-      expected := Seq (0, 3)
+      expected := Seq (0 , 3)
     )
   )
 
   test ("filter") (
     check (
-      obtained := Min_ ().filter (example) (lambda x --> x % 3 == 0)
+      obtained := Min_ () .filter (example) (lambda x --> x % 3 == 0)
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (0, 3) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (0 , 3) )
     )
   )
 
   test ("map with Seq") (
     check (
-      obtained := exampleSeq.map (lambda x --> x + 100)
+      obtained := exampleSeq .map (lambda x --> x + 100)
     ) (
-      expected := Seq (100, 101, 101, 102, 103, 105, 108)
+      expected := Seq (100 , 101 , 101 , 102 , 103 , 105 , 108)
     )
   )
 
   test ("map in the same type") (
     check (
-      obtained := Min_ ().map0 (example) (lambda x --> x + 100)
+      obtained := Min_ () .map0 (example) (lambda x --> x + 100)
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (100, 101, 101, 102, 103, 105, 108) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (100 , 101 , 101 , 102 , 103 , 105 , 108) )
     )
   )
 
   test ("foldLeft with Seq") (
     check (
-      obtained := exampleSeq.foldLeft (Seq [Int] () ) (lambda (s : Seq [Int], e : Int) --> s.+: ( (e + 100) ) )
+      obtained := exampleSeq .foldLeft (Seq [Int] () ) (lambda (s : Seq [Int] , e : Int) --> s .+: ( (e + 100) ) )
     ) (
-      expected := Seq (108, 105, 103, 102, 101, 101, 100)
+      expected := Seq (108 , 105 , 103 , 102 , 101 , 101 , 100)
     )
   )
 
   test ("foldLeft in the same type") (
     check (
-      obtained := Min_ ().foldLeft0 (example) (Min_ ().empty) (
-         lambda (s : MSeq [Int] ) --> lambda (e : Int) -> Min_ ().prepended (s) (e + 100)
+      obtained := Min_ () .foldLeft0 (example) (Min_ () .empty) (
+         lambda (s : MSeq [Int] ) --> lambda (e : Int) -> Min_ () .prepended (s) (e + 100)
       )
     ) (
-      expected := MSeqTranslator_ ().asMSeq (Seq (108, 105, 103, 102, 101, 101, 100) )
+      expected := MSeqTranslator_ () .asMSeq (Seq (108 , 105 , 103 , 102 , 101 , 101 , 100) )
     )
   )
 
diff --git a/library/src/test/scala/soda/collection/Package.scala b/library/src/test/scala/soda/collection/Package.scala
index e3ed14ca..3f66856c 100644
--- a/library/src/test/scala/soda/collection/Package.scala
+++ b/library/src/test/scala/soda/collection/Package.scala
@@ -20,32 +20,32 @@ case class MinSpec ()
 
   lazy val empty : ESeq [Int] = ESeq_ [Int] ()
 
-  lazy val exampleSeq : Seq [Int] = Seq (0, 1, 1, 2, 3, 5, 8)
+  lazy val exampleSeq : Seq [Int] = Seq (0 , 1 , 1 , 2 , 3 , 5 , 8)
 
   lazy val revExampleSeq : Seq [Int] = exampleSeq.reverse
 
-  def prepend_elem (list : MSeq [Int]) (elem : Int) : NESeq [Int] = Min_ ().prepended (list) (elem)
+  def prepend_elem (list : MSeq [Int]) (elem : Int) : NESeq [Int] = Min_ () .prepended (list) (elem)
 
   private lazy val _fold = Fold_ ()
 
-  private lazy val _initial_value : NESeq [Int] = NESeq_ [Int] (revExampleSeq.head, ESeq_ [Int] () )
+  private lazy val _initial_value : NESeq [Int] = NESeq_ [Int] (revExampleSeq .head , ESeq_ [Int] () )
 
   lazy val example : NESeq [Int] =
-    _fold.apply (revExampleSeq.tail) (_initial_value) (prepend_elem)
+    _fold .apply (revExampleSeq .tail) (_initial_value) (prepend_elem)
 
   test ("prepended") (
     check (
       obtained = _prepended_sequence
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq [Int] (1, 0, 1, 1, 2, 3, 5, 8) )
+      expected = MSeqTranslator_ () .asMSeq (Seq [Int] (1 , 0 , 1 , 1 , 2 , 3 , 5 , 8) )
     )
   )
 
-  private lazy val _prepended_sequence : MSeq [Int] = Min_ ().prepended (example) (1)
+  private lazy val _prepended_sequence : MSeq [Int] = Min_ () .prepended (example) (1)
 
   test ("head") (
     check (
-      obtained = Min_ ().head (example)
+      obtained = Min_ () .head (example)
     ) (
       expected = 0
     )
@@ -53,23 +53,23 @@ case class MinSpec ()
 
   test ("tail") (
     check (
-      obtained = Min_ ().tail (example)
+      obtained = Min_ () .tail (example)
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (1, 1, 2, 3, 5, 8) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (1 , 1 , 2 , 3 , 5 , 8) )
     )
   )
 
   test ("reverse") (
     check (
-      obtained = Min_ ().reverse (example)
+      obtained = Min_ () .reverse (example)
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (8, 5, 3, 2, 1, 1, 0) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (8 , 5 , 3 , 2 , 1 , 1 , 0) )
     )
   )
 
   test ("length") (
     check (
-      obtained = Min_ ().length (example)
+      obtained = Min_ () .length (example)
     ) (
       expected = 7
     )
@@ -77,7 +77,7 @@ case class MinSpec ()
 
   test ("indexOf something found") (
     check (
-      obtained = Min_ ().indexOf (example) (8)
+      obtained = Min_ () .indexOf (example) (8)
     ) (
       expected = 6
     )
@@ -85,7 +85,7 @@ case class MinSpec ()
 
   test ("indexOf something not found") (
     check (
-      obtained = Min_ ().indexOf (example) (7)
+      obtained = Min_ () .indexOf (example) (7)
     ) (
       expected = -1
     )
@@ -93,7 +93,7 @@ case class MinSpec ()
 
   test ("contains something found") (
     check (
-      obtained = Min_ ().contains (example) (8)
+      obtained = Min_ () .contains (example) (8)
     ) (
       expected = true
     )
@@ -101,7 +101,7 @@ case class MinSpec ()
 
   test ("contains something not found") (
     check (
-      obtained = Min_ ().contains (example) (7)
+      obtained = Min_ () .contains (example) (7)
     ) (
       expected = false
     )
@@ -109,7 +109,7 @@ case class MinSpec ()
 
   test ("at") (
     check (
-      obtained = Min_ ().at (example) (4)
+      obtained = Min_ () .at (example) (4)
     ) (
       expected = SomeSD_ (3)
     )
@@ -117,15 +117,15 @@ case class MinSpec ()
 
   test ("take with Seq 0") (
     check (
-      obtained = exampleSeq.take (5)
+      obtained = exampleSeq .take (5)
     ) (
-      expected = Seq (0, 1, 1, 2, 3)
+      expected = Seq (0 , 1 , 1 , 2 , 3)
     )
   )
 
   test ("take with Seq 1") (
     check (
-      obtained = exampleSeq.take (-100)
+      obtained = exampleSeq .take (-100)
     ) (
       expected = Seq ()
     )
@@ -133,7 +133,7 @@ case class MinSpec ()
 
   test ("take with Seq 2") (
     check (
-      obtained = exampleSeq.take (100)
+      obtained = exampleSeq .take (100)
     ) (
       expected = exampleSeq
     )
@@ -141,15 +141,15 @@ case class MinSpec ()
 
   test ("take 0") (
     check (
-      obtained = Min_ ().take (example) (5)
+      obtained = Min_ () .take (example) (5)
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2, 3) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1 , 2 , 3) )
     )
   )
 
   test ("take 1") (
     check (
-      obtained = Min_ ().take (example) (-100)
+      obtained = Min_ () .take (example) (-100)
     ) (
       expected = empty
     )
@@ -157,7 +157,7 @@ case class MinSpec ()
 
   test ("take 2") (
     check (
-      obtained = Min_ ().take (example) (100)
+      obtained = Min_ () .take (example) (100)
     ) (
       expected = example
     )
@@ -165,15 +165,15 @@ case class MinSpec ()
 
   test ("drop with Seq 0") (
     check (
-      obtained = exampleSeq.drop (3)
+      obtained = exampleSeq .drop (3)
     ) (
-      expected = Seq (2, 3, 5, 8)
+      expected = Seq (2 , 3 , 5 , 8)
     )
   )
 
   test ("drop with Seq 1") (
     check (
-      obtained = exampleSeq.drop (-100)
+      obtained = exampleSeq .drop (-100)
     ) (
       expected = exampleSeq
     )
@@ -181,7 +181,7 @@ case class MinSpec ()
 
   test ("drop with Seq 2") (
     check (
-      obtained = exampleSeq.drop (100)
+      obtained = exampleSeq .drop (100)
     ) (
       expected = Seq ()
     )
@@ -189,15 +189,15 @@ case class MinSpec ()
 
   test ("drop 0") (
     check (
-      obtained = Min_ ().drop (example) (3)
+      obtained = Min_ () .drop (example) (3)
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (2, 3, 5, 8) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (2 , 3 , 5 , 8) )
     )
   )
 
   test ("drop 1") (
     check (
-      obtained = Min_ ().drop (example) (-100)
+      obtained = Min_ () .drop (example) (-100)
     ) (
       expected = example
     )
@@ -205,7 +205,7 @@ case class MinSpec ()
 
   test ("drop 2") (
     check (
-      obtained = Min_ ().drop (example) (100)
+      obtained = Min_ () .drop (example) (100)
     ) (
       expected = empty
     )
@@ -213,79 +213,79 @@ case class MinSpec ()
 
   test ("takeWhile with Seq") (
     check (
-      obtained = exampleSeq.takeWhile ( e => ! (e == 3) )
+      obtained = exampleSeq .takeWhile ( e => ! (e == 3) )
     ) (
-      expected = Seq (0, 1, 1, 2)
+      expected = Seq (0 , 1 , 1 , 2)
     )
   )
 
   test ("takeWhile") (
     check (
-      obtained = Min_ ().takeWhile (example) ( e => ! (e == 3) )
+      obtained = Min_ () .takeWhile (example) ( e => ! (e == 3) )
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1 , 2) )
     )
   )
 
   test ("dropWhile with Seq") (
     check (
-      obtained = exampleSeq.dropWhile ( e => ! (e == 3) )
+      obtained = exampleSeq .dropWhile ( e => ! (e == 3) )
     ) (
-      expected = Seq (3, 5, 8)
+      expected = Seq (3 , 5 , 8)
     )
   )
 
   test ("dropWhile") (
     check (
-      obtained = Min_ ().dropWhile (example) ( e => ! (e == 3) )
+      obtained = Min_ () .dropWhile (example) ( e => ! (e == 3) )
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (3, 5, 8) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (3 , 5 , 8) )
     )
   )
 
   test ("splitAt with Seq") (
     check (
-      obtained = exampleSeq.splitAt (3)
+      obtained = exampleSeq .splitAt (3)
     ) (
-      expected = Tuple2 (Seq (0, 1, 1), Seq (2, 3, 5, 8) )
+      expected = Tuple2 (Seq (0 , 1 , 1) , Seq (2 , 3 , 5 , 8) )
     )
   )
 
   test ("splitAt") (
     check (
-      obtained = Min_ ().splitAt (example) (3)
+      obtained = Min_ () .splitAt (example) (3)
     ) (
-      expected = MSeqPair_ (MSeqTranslator_ ().asMSeq (Seq (0, 1, 1) ), MSeqTranslator_ ().asMSeq (Seq (2, 3, 5, 8) ) )
+      expected = MSeqPair_ (MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1) ) , MSeqTranslator_ () .asMSeq (Seq (2 , 3 , 5 , 8) ) )
     )
   )
 
   test ("span with Seq") (
     check (
-      obtained = exampleSeq.span ( x => ! (x == 5) )
+      obtained = exampleSeq .span ( x => ! (x == 5) )
     ) (
-      expected = Tuple2 (Seq (0, 1, 1, 2, 3), Seq (5, 8) )
+      expected = Tuple2 (Seq (0 , 1 , 1 , 2 , 3) , Seq (5 , 8) )
     )
   )
 
   test ("span") (
     check (
-      obtained = Min_ ().span (example) ( (x : Int) => ! (x == 5) )
+      obtained = Min_ () .span (example) ( (x : Int) => ! (x == 5) )
     ) (
-      expected = MSeqPair_ (MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2, 3) ), MSeqTranslator_ ().asMSeq (Seq (5, 8) ) )
+      expected = MSeqPair_ (MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1 , 2 , 3) ) , MSeqTranslator_ () .asMSeq (Seq (5 , 8) ) )
     )
   )
 
   test ("append") (
     check (
-      obtained = Min_ ().appended (example) (13)
+      obtained = Min_ () .appended (example) (13)
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2, 3, 5, 8, 13) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1 , 2 , 3 , 5 , 8 , 13) )
     )
   )
 
   test ("last") (
     check (
-      obtained = Min_ ().last (example)
+      obtained = Min_ () .last (example)
     ) (
       expected = 8
     )
@@ -293,23 +293,23 @@ case class MinSpec ()
 
   test ("concat") (
     check (
-      obtained = Min_ ().concat (example) (MSeqTranslator_ ().asMSeq (Seq (13, 21, 34, 55) ) )
+      obtained = Min_ () .concat (example) (MSeqTranslator_ () .asMSeq (Seq (13 , 21 , 34 , 55) ) )
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (0 , 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55) )
     )
   )
 
   test ("slice with Seq 0") (
     check (
-      obtained = exampleSeq.slice (2, 5)
+      obtained = exampleSeq .slice (2 , 5)
     ) (
-      expected = Seq (1, 2, 3)
+      expected = Seq (1 , 2 , 3)
     )
   )
 
   test ("slice with Seq 1") (
     check (
-      obtained = exampleSeq.slice (5, 2)
+      obtained = exampleSeq .slice (5 , 2)
     ) (
       expected = Seq ()
     )
@@ -317,7 +317,7 @@ case class MinSpec ()
 
   test ("slice with Seq 2") (
     check (
-      obtained = exampleSeq.slice (3, 3)
+      obtained = exampleSeq .slice (3 , 3)
     ) (
       expected = Seq ()
     )
@@ -325,7 +325,7 @@ case class MinSpec ()
 
   test ("slice with Seq 3") (
     check (
-      obtained = exampleSeq.slice (100, 5)
+      obtained = exampleSeq .slice (100 , 5)
     ) (
       expected = Seq ()
     )
@@ -333,7 +333,7 @@ case class MinSpec ()
 
   test ("slice with Seq 4") (
     check (
-      obtained = exampleSeq.slice (100, 200)
+      obtained = exampleSeq .slice (100 , 200)
     ) (
       expected = Seq ()
     )
@@ -341,7 +341,7 @@ case class MinSpec ()
 
   test ("slice with Seq 5") (
     check (
-      obtained = exampleSeq.slice (-100, 200)
+      obtained = exampleSeq .slice (-100 , 200)
     ) (
       expected = exampleSeq
     )
@@ -349,15 +349,15 @@ case class MinSpec ()
 
   test ("slice 0") (
     check (
-      obtained = Min_ ().slice (example) (2) (5)
+      obtained = Min_ () .slice (example) (2) (5)
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (1, 2, 3) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (1 , 2 , 3) )
     )
   )
 
   test ("slice 1") (
     check (
-      obtained = Min_ ().slice (example) (5) (2)
+      obtained = Min_ () .slice (example) (5) (2)
     ) (
       expected = empty
     )
@@ -365,7 +365,7 @@ case class MinSpec ()
 
   test ("slice 2") (
     check (
-      obtained = Min_ ().slice (example) (3) (3)
+      obtained = Min_ () .slice (example) (3) (3)
     ) (
       expected = empty
     )
@@ -373,7 +373,7 @@ case class MinSpec ()
 
   test ("slice 3") (
     check (
-      obtained = Min_ ().slice (example) (100) (5)
+      obtained = Min_ () .slice (example) (100) (5)
     ) (
       expected = empty
     )
@@ -381,7 +381,7 @@ case class MinSpec ()
 
   test ("slice 4") (
     check (
-      obtained = Min_ ().slice (example) (100) (200)
+      obtained = Min_ () .slice (example) (100) (200)
     ) (
       expected = empty
     )
@@ -389,7 +389,7 @@ case class MinSpec ()
 
   test ("slice 5") (
     check (
-      obtained = Min_ ().slice (example) (-100) (200)
+      obtained = Min_ () .slice (example) (-100) (200)
     ) (
       expected = example
     )
@@ -397,7 +397,7 @@ case class MinSpec ()
 
   test ("forall with Seq 0") (
     check (
-      obtained = exampleSeq.forall ( x => ! (x == 7) )
+      obtained = exampleSeq .forall ( x => ! (x == 7) )
     ) (
       expected = true
     )
@@ -405,7 +405,7 @@ case class MinSpec ()
 
   test ("forall with Seq 1") (
     check (
-      obtained = exampleSeq.forall ( x => x < 7)
+      obtained = exampleSeq .forall ( x => x < 7)
     ) (
       expected = false
     )
@@ -413,7 +413,7 @@ case class MinSpec ()
 
   test ("forall with Seq 2") (
     check (
-      obtained = Seq ().forall ( x => x == 7)
+      obtained = Seq () .forall ( x => x == 7)
     ) (
       expected = true
     )
@@ -421,7 +421,7 @@ case class MinSpec ()
 
   test ("forall 0") (
     check (
-      obtained = Min_ ().forall (example) ( x => ! (x == 7) )
+      obtained = Min_ () .forall (example) ( x => ! (x == 7) )
     ) (
       expected = true
     )
@@ -429,7 +429,7 @@ case class MinSpec ()
 
   test ("forall 1") (
     check (
-      obtained = Min_ ().forall (example) ( x => x < 7)
+      obtained = Min_ () .forall (example) ( x => x < 7)
     ) (
       expected = false
     )
@@ -437,7 +437,7 @@ case class MinSpec ()
 
   test ("forall 2") (
     check (
-      obtained = Min_ ().forall (empty) ( x => x == 7)
+      obtained = Min_ () .forall (empty) ( x => x == 7)
     ) (
       expected = true
     )
@@ -445,7 +445,7 @@ case class MinSpec ()
 
   test ("exists with Seq 0") (
     check (
-      obtained = exampleSeq.exists ( x => x == 8)
+      obtained = exampleSeq .exists ( x => x == 8)
     ) (
       expected = true
     )
@@ -453,7 +453,7 @@ case class MinSpec ()
 
   test ("exists with Seq 1") (
     check (
-      obtained = exampleSeq.exists ( x => x == 7)
+      obtained = exampleSeq .exists ( x => x == 7)
     ) (
       expected = false
     )
@@ -461,7 +461,7 @@ case class MinSpec ()
 
   test ("exists with Seq 2") (
     check (
-      obtained = Seq ().exists ( x => x == 7)
+      obtained = Seq () .exists ( x => x == 7)
     ) (
       expected = false
     )
@@ -469,7 +469,7 @@ case class MinSpec ()
 
   test ("exists 0") (
     check (
-      obtained = Min_ ().exists (example) ( x => x == 8)
+      obtained = Min_ () .exists (example) ( x => x == 8)
     ) (
       expected = true
     )
@@ -477,7 +477,7 @@ case class MinSpec ()
 
   test ("exists 1") (
     check (
-      obtained = Min_ ().exists (example) ( x => x == 7)
+      obtained = Min_ () .exists (example) ( x => x == 7)
     ) (
       expected = false
     )
@@ -485,7 +485,7 @@ case class MinSpec ()
 
   test ("exists 2") (
     check (
-      obtained = Min_ ().exists (empty) ( x => x == 7)
+      obtained = Min_ () .exists (empty) ( x => x == 7)
     ) (
       expected = false
     )
@@ -493,7 +493,7 @@ case class MinSpec ()
 
   test ("find with Seq 0") (
     check (
-      obtained = exampleSeq.find ( x => ! (x == 7) )
+      obtained = exampleSeq .find ( x => ! (x == 7) )
     ) (
       expected = Some (0)
     )
@@ -501,7 +501,7 @@ case class MinSpec ()
 
   test ("find with Seq 1") (
     check (
-      obtained = exampleSeq.find ( x => x == 8)
+      obtained = exampleSeq .find ( x => x == 8)
     ) (
       expected = Some (8)
     )
@@ -509,7 +509,7 @@ case class MinSpec ()
 
   test ("find with Seq 2") (
     check (
-      obtained = Seq ().find ( x => x == 7)
+      obtained = Seq () .find ( x => x == 7)
     ) (
       expected = None
     )
@@ -517,7 +517,7 @@ case class MinSpec ()
 
   test ("find 0") (
     check (
-      obtained = Min_ ().find (example) ( x => ! (x == 7) )
+      obtained = Min_ () .find (example) ( x => ! (x == 7) )
     ) (
       expected = SomeSD_ (0)
     )
@@ -525,7 +525,7 @@ case class MinSpec ()
 
   test ("find 1") (
     check (
-      obtained = Min_ ().find (example) ( x => x == 8)
+      obtained = Min_ () .find (example) ( x => x == 8)
     ) (
       expected = SomeSD_ (8)
     )
@@ -533,7 +533,7 @@ case class MinSpec ()
 
   test ("find 2") (
     check (
-      obtained = Min_ ().find (empty) ( x => x == 7)
+      obtained = Min_ () .find (empty) ( x => x == 7)
     ) (
       expected = NoneSD_ ()
     )
@@ -541,51 +541,51 @@ case class MinSpec ()
 
   test ("filter with Seq") (
     check (
-      obtained = exampleSeq.filter ( x => x % 3 == 0)
+      obtained = exampleSeq .filter ( x => x % 3 == 0)
     ) (
-      expected = Seq (0, 3)
+      expected = Seq (0 , 3)
     )
   )
 
   test ("filter") (
     check (
-      obtained = Min_ ().filter (example) ( x => x % 3 == 0)
+      obtained = Min_ () .filter (example) ( x => x % 3 == 0)
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (0, 3) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (0 , 3) )
     )
   )
 
   test ("map with Seq") (
     check (
-      obtained = exampleSeq.map ( x => x + 100)
+      obtained = exampleSeq .map ( x => x + 100)
     ) (
-      expected = Seq (100, 101, 101, 102, 103, 105, 108)
+      expected = Seq (100 , 101 , 101 , 102 , 103 , 105 , 108)
     )
   )
 
   test ("map in the same type") (
     check (
-      obtained = Min_ ().map0 (example) ( x => x + 100)
+      obtained = Min_ () .map0 (example) ( x => x + 100)
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (100, 101, 101, 102, 103, 105, 108) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (100 , 101 , 101 , 102 , 103 , 105 , 108) )
     )
   )
 
   test ("foldLeft with Seq") (
     check (
-      obtained = exampleSeq.foldLeft (Seq [Int] () ) ( (s : Seq [Int], e : Int) => s.+: ( (e + 100) ) )
+      obtained = exampleSeq .foldLeft (Seq [Int] () ) ( (s : Seq [Int] , e : Int) => s .+: ( (e + 100) ) )
     ) (
-      expected = Seq (108, 105, 103, 102, 101, 101, 100)
+      expected = Seq (108 , 105 , 103 , 102 , 101 , 101 , 100)
     )
   )
 
   test ("foldLeft in the same type") (
     check (
-      obtained = Min_ ().foldLeft0 (example) (Min_ ().empty) (
-          (s : MSeq [Int] ) =>  (e : Int) => Min_ ().prepended (s) (e + 100)
+      obtained = Min_ () .foldLeft0 (example) (Min_ () .empty) (
+          (s : MSeq [Int] ) =>  (e : Int) => Min_ () .prepended (s) (e + 100)
       )
     ) (
-      expected = MSeqTranslator_ ().asMSeq (Seq (108, 105, 103, 102, 101, 101, 100) )
+      expected = MSeqTranslator_ () .asMSeq (Seq (108 , 105 , 103 , 102 , 101 , 101 , 100) )
     )
   )
 
diff --git a/library/src/test/scala/soda/collection/example/ListExampleSpec.soda b/library/src/test/scala/soda/collection/example/ListExampleSpec.soda
index b73b899c..e27f934c 100644
--- a/library/src/test/scala/soda/collection/example/ListExampleSpec.soda
+++ b/library/src/test/scala/soda/collection/example/ListExampleSpec.soda
@@ -8,177 +8,177 @@ class ListExampleSpec ()
 
   test ("should test a") (
     check (
-      obtained := ListExample_ ().a_example
+      obtained := ListExample_ () .a_example
     ) (
-      expected := Pair_ ("a", List ('A', 'B', 'C', 'D', 'E', 'F'))
+      expected := Pair_ ("a" , List ('A' , 'B' , 'C' , 'D' , 'E' , 'F'))
     )
   )
 
   test ("should test b") (
     check (
-      obtained := ListExample_ ().b_example
+      obtained := ListExample_ () .b_example
     ) (
-      expected := Pair_ ("b", List (10, 20, 30, 40, 50, 60))
+      expected := Pair_ ("b" , List (10 , 20 , 30 , 40 , 50 , 60))
     )
   )
 
-  test ("should test a.take") (
+  test ("should test a .take") (
     check (
-      obtained := ListExample_ ().take_example
+      obtained := ListExample_ () .take_example
     ) (
-      expected := Pair_ ("a.take(3)", List ('A', 'B', 'C'))
+      expected := Pair_ ("a .take (3)" , List ('A' , 'B' , 'C'))
     )
   )
 
-  test ("should test a.takeRight") (
+  test ("should test a .takeRight") (
     check (
-      obtained := ListExample_ ().takeRight_example
+      obtained := ListExample_ () .takeRight_example
     ) (
-      expected := Pair_ ("a.takeRight(3)", List ('D', 'E', 'F'))
+      expected := Pair_ ("a .takeRight (3)" , List ('D' , 'E' , 'F'))
     )
   )
 
-  test ("should test a.takeWhile") (
+  test ("should test a .takeWhile") (
     check (
-      obtained := ListExample_ ().takeWhile_example
+      obtained := ListExample_ () .takeWhile_example
     ) (
-      expected := Pair_ ("a.takeWhile(lambda x --> not (x == 'E'))", List ('A', 'B', 'C', 'D'))
+      expected := Pair_ ("a .takeWhile (lambda x --> not (x == 'E') )" , List ('A' , 'B' , 'C' , 'D'))
     )
   )
 
-  test ("should test a.drop") (
+  test ("should test a .drop") (
     check (
-      obtained := ListExample_ ().drop_example
+      obtained := ListExample_ () .drop_example
     ) (
-      expected := Pair_ ("a.drop(2)", List ('C', 'D', 'E', 'F'))
+      expected := Pair_ ("a .drop (2)" , List ('C' , 'D' , 'E' , 'F'))
     )
   )
 
-  test ("should test a.dropRight") (
+  test ("should test a .dropRight") (
     check (
-      obtained := ListExample_ ().dropRight_example
+      obtained := ListExample_ () .dropRight_example
     ) (
-     expected := Pair_ ("a.dropRight(2)", List ('A', 'B', 'C', 'D'))
+     expected := Pair_ ("a .dropRight (2)" , List ('A' , 'B' , 'C' , 'D'))
     )
   )
 
-  test ("should test a.dropWhile") (
+  test ("should test a .dropWhile") (
     check (
-      obtained := ListExample_ ().dropWhile_example
+      obtained := ListExample_ () .dropWhile_example
     ) (
-      expected := Pair_ ("a.dropWhile(lambda x --> not (x == 'E'))", List ('E', 'F'))
+      expected := Pair_ ("a .dropWhile (lambda x --> not (x == 'E'))" , List ('E' , 'F'))
     )
   )
 
-  test ("should test a.splitAt") (
+  test ("should test a .splitAt") (
     check (
-      obtained := ListExample_ ().splitAt_example
+      obtained := ListExample_ () .splitAt_example
     ) (
-      expected := Pair_ ("a.splitAt(3)", (List ('A', 'B', 'C'), List ('D', 'E', 'F')))
+      expected := Pair_ ("a .splitAt (3)" , (List ('A' , 'B' , 'C') , List ('D' , 'E' , 'F')))
     )
   )
 
-  test ("should test a.indices") (
+  test ("should test a .indices") (
     check (
-      obtained := ListExample_ ().indices_example
+      obtained := ListExample_ () .indices_example
     ) (
-      expected := Pair_ ("a.indices", Range(0, 6))
+      expected := Pair_ ("a .indices" , Range(0 , 6))
     )
   )
 
-  test ("should test a.zipWithIndex") (
+  test ("should test a .zipWithIndex") (
     check (
-      obtained := ListExample_ ().zipWithIndex_example
+      obtained := ListExample_ () .zipWithIndex_example
     ) (
-      expected := Pair_ ("a.zipWithIndex", List (('A',0), ('B',1), ('C',2), ('D',3), ('E',4), ('F',5)))
+      expected := Pair_ ("a .zipWithIndex" , List (('A',0) , ('B',1) , ('C',2) , ('D',3) , ('E',4) , ('F',5)))
     )
   )
 
-  test ("should test a.zip") (
+  test ("should test a .zip") (
     check (
-      obtained := ListExample_ ().zip_example
+      obtained := ListExample_ () .zip_example
     ) (
-      expected := Pair_ ("a.zip(b)", List (('A', 10), ('B', 20), ('C', 30), ('D', 40), ('E', 50), ('F', 60)))
+      expected := Pair_ ("a .zip (b)" , List (('A' , 10) , ('B' , 20) , ('C' , 30) , ('D' , 40) , ('E' , 50) , ('F' , 60)))
     )
   )
 
-  test ("should test a.reverse") (
+  test ("should test a .reverse") (
     check (
-      obtained := ListExample_ ().reverse_example
+      obtained := ListExample_ () .reverse_example
     ) (
-      expected := Pair_ ("a.reverse", List ('F', 'E', 'D', 'C', 'B', 'A'))
+      expected := Pair_ ("a .reverse" , List ('F' , 'E' , 'D' , 'C' , 'B' , 'A'))
     )
   )
 
-  test ("should test a.+") (
+  test ("should test a .+") (
     check (
-      obtained := ListExample_ ().prepended_example
+      obtained := ListExample_ () .prepended_example
     ) (
-      expected := Pair_ ("a.+:('X')", List ('X', 'A', 'B', 'C', 'D', 'E', 'F'))
+      expected := Pair_ ("a .+: ('X')" , List ('X' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F'))
     )
   )
 
-  test ("should test a.:") (
+  test ("should test a .:") (
     check (
-      obtained := ListExample_ ().appended_example
+      obtained := ListExample_ () .appended_example
     ) (
-      expected := Pair_ ("a.:+('X')", List ('A', 'B', 'C', 'D', 'E', 'F', 'X'))
+      expected := Pair_ ("a .:+ ('X')" , List ('A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'X'))
     )
   )
 
-  test ("should test a.++") (
+  test ("should test a .++") (
     check (
-      obtained := ListExample_ ().concat_example
+      obtained := ListExample_ () .concat_example
     ) (
-      expected := Pair_ ("a.map(_.toInt).++(b)", List (65, 66, 67, 68, 69, 70, 10, 20, 30, 40, 50, 60))
+      expected := Pair_ ("a .map (lambda x --> x .toInt) .++ (b)" , List (65 , 66 , 67 , 68 , 69 , 70 , 10 , 20 , 30 , 40 , 50 , 60))
     )
   )
 
-  test ("should test a.span") (
+  test ("should test a .span") (
     check (
-      obtained := ListExample_ ().span_example
+      obtained := ListExample_ () .span_example
     ) (
-      expected := Pair_ ("a.span(lambda x --> not (x == 'D'))", (List ('A', 'B', 'C'), List ('D', 'E', 'F')))
+      expected := Pair_ ("a .span (lambda x --> not (x == 'D') )" , (List ('A' , 'B' , 'C') , List ('D' , 'E' , 'F')))
     )
   )
 
-  test ("should test a.map") (
+  test ("should test a .map") (
     check (
-      obtained := ListExample_ ().map_example
+      obtained := ListExample_ () .map_example
     ) (
-      expected := Pair_ ("a.map(lambda x --> x.toInt)", List (65, 66, 67, 68, 69, 70))
+      expected := Pair_ ("a .map (lambda x --> x .toInt)" , List (65 , 66 , 67 , 68 , 69 , 70))
     )
   )
 
-  test ("should test a.filter") (
+  test ("should test a .filter") (
     check (
-      obtained := ListExample_ ().filter_example
+      obtained := ListExample_ () .filter_example
     ) (
-      expected := Pair_ ("a.filter(lambda x --> x.toInt % 2 == 0)", List ('B', 'D', 'F'))
+      expected := Pair_ ("a .filter (lambda x --> x .toInt % 2 == 0)" , List ('B' , 'D' , 'F'))
     )
   )
 
-  test ("should test b.fold") (
+  test ("should test b .fold") (
     check (
-      obtained := ListExample_ ().fold_example
+      obtained := ListExample_ () .fold_example
     ) (
-      expected := Pair_ ("b.fold(0)(lambda (a, b) --> a + b)", 210)
+      expected := Pair_ ("b .fold(0) (lambda (a , b) --> a + b)" , 210)
     )
   )
 
-  test ("should test a.foldLeft") (
+  test ("should test a .foldLeft") (
     check (
-      obtained := ListExample_ ().foldLeft_example
+      obtained := ListExample_ () .foldLeft_example
     ) (
-      expected := Pair_ ("a.foldLeft(Seq('*'))(lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", "((((((List(*) :+ A) :+ B) :+ C) :+ D) :+ E) :+ F)".toCharArray.toSeq)
+      expected := Pair_ ("a .foldLeft (Seq ('*') ) (lambda (list , elem) --> \"(\" + list + \" :+ \" + elem + \")\")" , "((((((List(*) :+ A) :+ B) :+ C) :+ D) :+ E) :+ F)".toCharArray.toSeq)
     )
   )
 
-  test ("should test a.foldRight") (
+  test ("should test a .foldRight") (
     check (
-      obtained := ListExample_ ().foldRight_example
+      obtained := ListExample_ () .foldRight_example
     ) (
-      expected := Pair_ ("a.foldRight(Seq('*'))(lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", "(A +: (B +: (C +: (D +: (E +: (F +: List(*)))))))".toCharArray.toSeq)
+      expected := Pair_ ("a .foldRight (Seq ('*') ) (lambda (elem , list) --> \"(\" + elem + \" +: \" + list + \")\")" , "(A +: (B +: (C +: (D +: (E +: (F +: List(*)))))))".toCharArray.toSeq)
     )
   )
 
diff --git a/library/src/test/scala/soda/collection/example/Package.scala b/library/src/test/scala/soda/collection/example/Package.scala
index 3c9f2d0e..fc634366 100644
--- a/library/src/test/scala/soda/collection/example/Package.scala
+++ b/library/src/test/scala/soda/collection/example/Package.scala
@@ -16,177 +16,177 @@ case class ListExampleSpec ()
 
   test ("should test a") (
     check (
-      obtained = ListExample_ ().a_example
+      obtained = ListExample_ () .a_example
     ) (
-      expected = Pair_ ("a", List ('A', 'B', 'C', 'D', 'E', 'F'))
+      expected = Pair_ ("a" , List ('A' , 'B' , 'C' , 'D' , 'E' , 'F'))
     )
   )
 
   test ("should test b") (
     check (
-      obtained = ListExample_ ().b_example
+      obtained = ListExample_ () .b_example
     ) (
-      expected = Pair_ ("b", List (10, 20, 30, 40, 50, 60))
+      expected = Pair_ ("b" , List (10 , 20 , 30 , 40 , 50 , 60))
     )
   )
 
-  test ("should test a.take") (
+  test ("should test a .take") (
     check (
-      obtained = ListExample_ ().take_example
+      obtained = ListExample_ () .take_example
     ) (
-      expected = Pair_ ("a.take(3)", List ('A', 'B', 'C'))
+      expected = Pair_ ("a .take (3)" , List ('A' , 'B' , 'C'))
     )
   )
 
-  test ("should test a.takeRight") (
+  test ("should test a .takeRight") (
     check (
-      obtained = ListExample_ ().takeRight_example
+      obtained = ListExample_ () .takeRight_example
     ) (
-      expected = Pair_ ("a.takeRight(3)", List ('D', 'E', 'F'))
+      expected = Pair_ ("a .takeRight (3)" , List ('D' , 'E' , 'F'))
     )
   )
 
-  test ("should test a.takeWhile") (
+  test ("should test a .takeWhile") (
     check (
-      obtained = ListExample_ ().takeWhile_example
+      obtained = ListExample_ () .takeWhile_example
     ) (
-      expected = Pair_ ("a.takeWhile(lambda x --> not (x == 'E'))", List ('A', 'B', 'C', 'D'))
+      expected = Pair_ ("a .takeWhile (lambda x --> not (x == 'E') )" , List ('A' , 'B' , 'C' , 'D'))
     )
   )
 
-  test ("should test a.drop") (
+  test ("should test a .drop") (
     check (
-      obtained = ListExample_ ().drop_example
+      obtained = ListExample_ () .drop_example
     ) (
-      expected = Pair_ ("a.drop(2)", List ('C', 'D', 'E', 'F'))
+      expected = Pair_ ("a .drop (2)" , List ('C' , 'D' , 'E' , 'F'))
     )
   )
 
-  test ("should test a.dropRight") (
+  test ("should test a .dropRight") (
     check (
-      obtained = ListExample_ ().dropRight_example
+      obtained = ListExample_ () .dropRight_example
     ) (
-     expected = Pair_ ("a.dropRight(2)", List ('A', 'B', 'C', 'D'))
+     expected = Pair_ ("a .dropRight (2)" , List ('A' , 'B' , 'C' , 'D'))
     )
   )
 
-  test ("should test a.dropWhile") (
+  test ("should test a .dropWhile") (
     check (
-      obtained = ListExample_ ().dropWhile_example
+      obtained = ListExample_ () .dropWhile_example
     ) (
-      expected = Pair_ ("a.dropWhile(lambda x --> not (x == 'E'))", List ('E', 'F'))
+      expected = Pair_ ("a .dropWhile (lambda x --> not (x == 'E'))" , List ('E' , 'F'))
     )
   )
 
-  test ("should test a.splitAt") (
+  test ("should test a .splitAt") (
     check (
-      obtained = ListExample_ ().splitAt_example
+      obtained = ListExample_ () .splitAt_example
     ) (
-      expected = Pair_ ("a.splitAt(3)", (List ('A', 'B', 'C'), List ('D', 'E', 'F')))
+      expected = Pair_ ("a .splitAt (3)" , (List ('A' , 'B' , 'C') , List ('D' , 'E' , 'F')))
     )
   )
 
-  test ("should test a.indices") (
+  test ("should test a .indices") (
     check (
-      obtained = ListExample_ ().indices_example
+      obtained = ListExample_ () .indices_example
     ) (
-      expected = Pair_ ("a.indices", Range(0, 6))
+      expected = Pair_ ("a .indices" , Range(0 , 6))
     )
   )
 
-  test ("should test a.zipWithIndex") (
+  test ("should test a .zipWithIndex") (
     check (
-      obtained = ListExample_ ().zipWithIndex_example
+      obtained = ListExample_ () .zipWithIndex_example
     ) (
-      expected = Pair_ ("a.zipWithIndex", List (('A',0), ('B',1), ('C',2), ('D',3), ('E',4), ('F',5)))
+      expected = Pair_ ("a .zipWithIndex" , List (('A',0) , ('B',1) , ('C',2) , ('D',3) , ('E',4) , ('F',5)))
     )
   )
 
-  test ("should test a.zip") (
+  test ("should test a .zip") (
     check (
-      obtained = ListExample_ ().zip_example
+      obtained = ListExample_ () .zip_example
     ) (
-      expected = Pair_ ("a.zip(b)", List (('A', 10), ('B', 20), ('C', 30), ('D', 40), ('E', 50), ('F', 60)))
+      expected = Pair_ ("a .zip (b)" , List (('A' , 10) , ('B' , 20) , ('C' , 30) , ('D' , 40) , ('E' , 50) , ('F' , 60)))
     )
   )
 
-  test ("should test a.reverse") (
+  test ("should test a .reverse") (
     check (
-      obtained = ListExample_ ().reverse_example
+      obtained = ListExample_ () .reverse_example
     ) (
-      expected = Pair_ ("a.reverse", List ('F', 'E', 'D', 'C', 'B', 'A'))
+      expected = Pair_ ("a .reverse" , List ('F' , 'E' , 'D' , 'C' , 'B' , 'A'))
     )
   )
 
-  test ("should test a.+") (
+  test ("should test a .+") (
     check (
-      obtained = ListExample_ ().prepended_example
+      obtained = ListExample_ () .prepended_example
     ) (
-      expected = Pair_ ("a.+:('X')", List ('X', 'A', 'B', 'C', 'D', 'E', 'F'))
+      expected = Pair_ ("a .+: ('X')" , List ('X' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F'))
     )
   )
 
-  test ("should test a.:") (
+  test ("should test a .:") (
     check (
-      obtained = ListExample_ ().appended_example
+      obtained = ListExample_ () .appended_example
     ) (
-      expected = Pair_ ("a.:+('X')", List ('A', 'B', 'C', 'D', 'E', 'F', 'X'))
+      expected = Pair_ ("a .:+ ('X')" , List ('A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'X'))
     )
   )
 
-  test ("should test a.++") (
+  test ("should test a .++") (
     check (
-      obtained = ListExample_ ().concat_example
+      obtained = ListExample_ () .concat_example
     ) (
-      expected = Pair_ ("a.map(_.toInt).++(b)", List (65, 66, 67, 68, 69, 70, 10, 20, 30, 40, 50, 60))
+      expected = Pair_ ("a .map (lambda x --> x .toInt) .++ (b)" , List (65 , 66 , 67 , 68 , 69 , 70 , 10 , 20 , 30 , 40 , 50 , 60))
     )
   )
 
-  test ("should test a.span") (
+  test ("should test a .span") (
     check (
-      obtained = ListExample_ ().span_example
+      obtained = ListExample_ () .span_example
     ) (
-      expected = Pair_ ("a.span(lambda x --> not (x == 'D'))", (List ('A', 'B', 'C'), List ('D', 'E', 'F')))
+      expected = Pair_ ("a .span (lambda x --> not (x == 'D') )" , (List ('A' , 'B' , 'C') , List ('D' , 'E' , 'F')))
     )
   )
 
-  test ("should test a.map") (
+  test ("should test a .map") (
     check (
-      obtained = ListExample_ ().map_example
+      obtained = ListExample_ () .map_example
     ) (
-      expected = Pair_ ("a.map(lambda x --> x.toInt)", List (65, 66, 67, 68, 69, 70))
+      expected = Pair_ ("a .map (lambda x --> x .toInt)" , List (65 , 66 , 67 , 68 , 69 , 70))
     )
   )
 
-  test ("should test a.filter") (
+  test ("should test a .filter") (
     check (
-      obtained = ListExample_ ().filter_example
+      obtained = ListExample_ () .filter_example
     ) (
-      expected = Pair_ ("a.filter(lambda x --> x.toInt % 2 == 0)", List ('B', 'D', 'F'))
+      expected = Pair_ ("a .filter (lambda x --> x .toInt % 2 == 0)" , List ('B' , 'D' , 'F'))
     )
   )
 
-  test ("should test b.fold") (
+  test ("should test b .fold") (
     check (
-      obtained = ListExample_ ().fold_example
+      obtained = ListExample_ () .fold_example
     ) (
-      expected = Pair_ ("b.fold(0)(lambda (a, b) --> a + b)", 210)
+      expected = Pair_ ("b .fold(0) (lambda (a , b) --> a + b)" , 210)
     )
   )
 
-  test ("should test a.foldLeft") (
+  test ("should test a .foldLeft") (
     check (
-      obtained = ListExample_ ().foldLeft_example
+      obtained = ListExample_ () .foldLeft_example
     ) (
-      expected = Pair_ ("a.foldLeft(Seq('*'))(lambda (list, elem) --> \"(\" + list + \" :+ \" + elem + \")\")", "((((((List(*) :+ A) :+ B) :+ C) :+ D) :+ E) :+ F)".toCharArray.toSeq)
+      expected = Pair_ ("a .foldLeft (Seq ('*') ) (lambda (list , elem) --> \"(\" + list + \" :+ \" + elem + \")\")" , "((((((List(*) :+ A) :+ B) :+ C) :+ D) :+ E) :+ F)".toCharArray.toSeq)
     )
   )
 
-  test ("should test a.foldRight") (
+  test ("should test a .foldRight") (
     check (
-      obtained = ListExample_ ().foldRight_example
+      obtained = ListExample_ () .foldRight_example
     ) (
-      expected = Pair_ ("a.foldRight(Seq('*'))(lambda (elem, list) --> \"(\" + elem + \" +: \" + list + \")\")", "(A +: (B +: (C +: (D +: (E +: (F +: List(*)))))))".toCharArray.toSeq)
+      expected = Pair_ ("a .foldRight (Seq ('*') ) (lambda (elem , list) --> \"(\" + elem + \" +: \" + list + \")\")" , "(A +: (B +: (C +: (D +: (E +: (F +: List(*)))))))".toCharArray.toSeq)
     )
   )
 

From eae84d03ab00b633d00146800444d8a8a14e852b Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Sat, 20 May 2023 14:40:21 +0200
Subject: [PATCH 36/56] Reformat Soda source code in example module

---
 .../soda/example/algorithms/Package.scala     | 50 +++++-----
 .../example/algorithms/PatternMatching.soda   |  6 +-
 .../soda/example/algorithms/SaladMaker.soda   |  4 +-
 .../algorithms/ScalaReservedWordEscaping.soda |  4 +-
 .../soda/example/algorithms/SortExample.soda  | 36 +++----
 .../ethicalissues/fairness/Fairness.soda      |  2 +-
 .../ethicalissues/fairness/Package.scala      |  2 +-
 .../ethicalissues/pricemonitor/Package.scala  | 22 ++---
 .../pricemonitor/PriceMonitor.soda            |  4 +-
 .../pricemonitor/Requirement1Monitor.soda     |  2 +-
 .../pricemonitor/Requirement2Monitor.soda     |  2 +-
 .../pricemonitor/Requirement3Monitor.soda     | 14 +--
 .../example/forcoq/algorithms/Package.scala   |  2 +-
 .../forcoq/algorithms/RecursionForCoq.soda    |  2 +-
 .../scala/soda/example/forcoq/lib/List.soda   | 10 +-
 .../scala/soda/example/forcoq/lib/Nat.soda    |  4 +-
 .../soda/example/forcoq/lib/Package.scala     | 14 +--
 .../soda/example/inanutshell/InANutshell.soda |  6 +-
 .../soda/example/inanutshell/Package.scala    |  6 +-
 .../mathematics/FactorialWithFold.soda        |  2 +-
 .../soda/example/mathematics/HardProblem.soda | 34 +++----
 .../soda/example/mathematics/Package.scala    | 70 +++++++-------
 .../soda/example/mathematics/PiIterator.soda  | 34 +++----
 .../soda/example/miniexample/MiniExample.soda |  2 +-
 .../soda/example/miniexample/Package.scala    |  2 +-
 .../soda/example/algorithms/FizzBuzzSpec.soda | 24 ++---
 .../soda/example/algorithms/Package.scala     | 94 +++++++++----------
 .../algorithms/PatternMatchingSpec.soda       | 18 ++--
 .../example/algorithms/SaladMakerSpec.soda    | 18 ++--
 .../example/algorithms/SortExampleSpec.soda   | 34 +++----
 .../ethicalissues/fairness/FairnessSpec.soda  |  8 +-
 .../ethicalissues/fairness/Package.scala      |  8 +-
 .../ethicalissues/pricemonitor/Package.scala  | 50 +++++-----
 .../pricemonitor/PriceMonitorSpec.soda        | 50 +++++-----
 .../example/forcoq/algorithms/Package.scala   | 24 ++---
 .../algorithms/RecursionForCoqSpec.soda       | 24 ++---
 .../soda/example/forcoq/lib/ListSpec.soda     |  8 +-
 .../soda/example/forcoq/lib/NatSpec.soda      |  8 +-
 .../soda/example/forcoq/lib/Package.scala     | 16 ++--
 .../mathematics/FactorialForCoqSpec.soda      | 12 +--
 .../FiboExampleInSodaForCoqSpec.soda          | 12 +--
 .../example/forcoq/mathematics/Package.scala  | 32 +++----
 .../TriangularNumberForCoqSpec.soda           | 12 +--
 .../example/mathematics/FactorialSpec.soda    | 14 +--
 .../example/mathematics/FiboExampleSpec.soda  |  6 +-
 .../example/mathematics/HardProblemSpec.soda  | 44 ++++-----
 .../soda/example/mathematics/Package.scala    | 66 ++++++-------
 .../example/mathematics/PiIteratorSpec.soda   |  4 +-
 48 files changed, 461 insertions(+), 461 deletions(-)

diff --git a/examples/src/main/scala/soda/example/algorithms/Package.scala b/examples/src/main/scala/soda/example/algorithms/Package.scala
index abe9646b..1618d0a7 100644
--- a/examples/src/main/scala/soda/example/algorithms/Package.scala
+++ b/examples/src/main/scala/soda/example/algorithms/Package.scala
@@ -127,9 +127,9 @@ trait PatternMatching
 
   def get_type_name (p : Parameter) : String =
     p match  {
-      case Singleton_ (x) => (Singleton_ (x) ).name + "(x)"
-      case Pair_ (x , y) => (Pair_ (x , y) ).name + "(x, y)"
-      case Triplet_ (x , y , z) => (Triplet_ (x , y , z) ).name + "(x, y, z)"
+      case Singleton_ (x) => (Singleton_ (x) ) .name + " (x)"
+      case Pair_ (x , y) => (Pair_ (x , y) ) .name + " (x , y)"
+      case Triplet_ (x , y , z) => (Triplet_ (x , y , z) ) .name + " (x , y , z)"
       case otherwise => ""
     }
 
@@ -199,9 +199,9 @@ trait SaladMaker
     (next_ingredient_function : Salad => Ingredient => Salad)
     (condition_to_continue : Salad => Ingredient => Boolean)
       : Salad =
-    if ( ingredients_so_far.isEmpty || (! condition_to_continue (salad_so_far) (ingredients_so_far.head) )
+    if ( ingredients_so_far .isEmpty || (! condition_to_continue (salad_so_far) (ingredients_so_far .head) )
     ) salad_so_far
-    else _tailrec_prepare_salad (ingredients_so_far.tail) (next_ingredient_function (salad_so_far) (ingredients_so_far.head) ) (next_ingredient_function) (condition_to_continue)
+    else _tailrec_prepare_salad (ingredients_so_far .tail) (next_ingredient_function (salad_so_far) (ingredients_so_far .head) ) (next_ingredient_function) (condition_to_continue)
 
 }
 
@@ -215,10 +215,10 @@ trait ScalaReservedWordEscaping
 
   private lazy val __soda__val = 1
 
-  private def __soda__def [A, B] (key : A) (value : B) : MyPair [A, B] = MyPair_ (key, value)
+  private def __soda__def [A, B] (key : A) (value : B) : MyPair [A, B] = MyPair_ (key , value)
 
   private def __soda__while [A, B] (seq : Seq [A] ) (cond : A => Boolean) (funct : A => B) : Seq [B] =
-    seq.takeWhile (cond).map (funct)
+    seq .takeWhile (cond) .map (funct)
 
   private lazy val __soda__protected = "protected"
 
@@ -267,7 +267,7 @@ trait SortExampleWithAt
     sequence
       .indices
       .filter ( index => index > 0)
-      .forall ( index => sequence.apply (index - 1) <= sequence.apply (index) )
+      .forall ( index => sequence .apply (index - 1) <= sequence .apply (index) )
 
 }
 
@@ -283,8 +283,8 @@ trait SortExampleWithZip
 
   def is_sorted_for (sequence : Seq [Int] ) : Boolean =
     sequence
-      .zip (sequence.tail)
-      .forall ( pair => (pair._1 <= pair._2) )
+      .zip (sequence .tail)
+      .forall ( pair => (pair ._1 <= pair ._2) )
 
 }
 
@@ -312,9 +312,9 @@ trait SortAlgorithmExampleWithFold
      sequence => sort_for (sequence)
 
   def sort_for (sequence : Seq [Int] ) : Seq [Int] =
-    if ( sequence.length < 2
+    if ( sequence .length < 2
     ) sequence
-    else _fold.apply (sequence) (_initial_value) (_next_value_function)
+    else _fold .apply (sequence) (_initial_value) (_next_value_function)
 
   private lazy val _initial_value = Seq [Int] ()
 
@@ -323,13 +323,13 @@ trait SortAlgorithmExampleWithFold
 
   def insert_sorted (sequence : Seq [Int] ) (element : Int) : Seq [Int] =
     concatenate (
-      first_part = sequence.takeWhile ( x => x < element) ) (
+      first_part = sequence .takeWhile ( x => x < element) ) (
       middle = Seq (element) ) (
-      last_part = sequence.dropWhile ( x => x < element)
+      last_part = sequence .dropWhile ( x => x < element)
     )
 
   def concatenate (first_part : Seq [Int] ) (middle : Seq [Int] ) (last_part : Seq [Int] ) : Seq [Int] =
-    first_part.++ (middle.++ (last_part) )
+    first_part .++ (middle .++ (last_part) )
 
 }
 
@@ -343,10 +343,10 @@ trait ConstrainedSortAlgorithm
   import   soda.lib.NoneSD_
 
   def sort (sequence : Seq [Int] ) : OptionSD [Seq [Int] ] =
-    sort_with ( SortAlgorithmExampleWithFold_ ().sort (sequence) )
+    sort_with (SortAlgorithmExampleWithFold_ () .sort (sequence) )
 
   def sort_with (sorted_sequence : Seq [Int] ) : OptionSD [Seq [Int] ] =
-    if ( SortExampleWithZip_ ().is_sorted (sorted_sequence)
+    if ( SortExampleWithZip_ () .is_sorted (sorted_sequence)
     ) SomeSD_ (sorted_sequence)
     else NoneSD_ [Seq [Int] ] ()
 
@@ -410,9 +410,9 @@ trait NonEmptySortedSequence [A <: Comparable [A] ]
      element => add_for (element)
 
   def add_for (element : A) : SortedSequence [A] =
-    NonEmptySortedSequence_ (aux.insert_sorted (sequence) (element) )
+    NonEmptySortedSequence_ (aux .insert_sorted (sequence) (element) )
 
-  lazy val invariant : Boolean = aux.is_sorted (sequence)
+  lazy val invariant : Boolean = aux .is_sorted (sequence)
 
 }
 
@@ -422,12 +422,12 @@ trait NonEmptySortedSequenceAux [A <: Comparable [A] ]
 {
 
   def is_less_than (x : A) (y : A) : Boolean =
-    x.compareTo (y) < 0
+    x .compareTo (y) < 0
 
   def is_sorted (other_sequence : Seq [A] ) : Boolean =
     other_sequence
-      .zip (other_sequence.tail)
-      .forall ( pair => is_less_than (pair._1) (pair._2) )
+      .zip (other_sequence .tail)
+      .forall ( pair => is_less_than (pair ._1) (pair ._2) )
 
   def insert_sorted (original_sequence : Seq [A] ) (element : A) : Seq [A] =
     concatenate (
@@ -437,7 +437,7 @@ trait NonEmptySortedSequenceAux [A <: Comparable [A] ]
     )
 
   def concatenate (first_part : Seq [A] ) (middle : Seq [A] ) (last_part : Seq [A] ) : Seq [A] =
-    first_part.++ (middle.++ (last_part) )
+    first_part .++ (middle .++ (last_part) )
 
 }
 
@@ -451,12 +451,12 @@ trait SortedSequenceBuilder [A <: Comparable [A] ]
   private lazy val _fold = Fold_ ()
 
   def build (sequence : Seq [A] ) : SortedSequence [A] =
-    _fold.apply (sequence) (_initial_value) (_next_value_function)
+    _fold .apply (sequence) (_initial_value) (_next_value_function)
 
   private lazy val _initial_value : SortedSequence [A] = EmptySortedSequence_ [A] ()
 
   private def _next_value_function (sorted_sequence : SortedSequence [A] ) (element : A) : SortedSequence [A] =
-    sorted_sequence.add (element)
+    sorted_sequence .add (element)
 
 }
 
diff --git a/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda b/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda
index 32584641..10ef6500 100644
--- a/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda
+++ b/examples/src/main/scala/soda/example/algorithms/PatternMatching.soda
@@ -17,9 +17,9 @@ class PatternMatching
 
   get_type_name (p : Parameter) : String =
     match p
-      case Singleton_ (x) ==> (Singleton_ (x) ).name + "(x)"
-      case Pair_ (x , y) ==> (Pair_ (x , y) ).name + "(x, y)"
-      case Triplet_ (x , y , z) ==> (Triplet_ (x , y , z) ).name + "(x, y, z)"
+      case Singleton_ (x) ==> (Singleton_ (x) ) .name + " (x)"
+      case Pair_ (x , y) ==> (Pair_ (x , y) ) .name + " (x , y)"
+      case Triplet_ (x , y , z) ==> (Triplet_ (x , y , z) ) .name + " (x , y , z)"
       case otherwise ==> ""
 
 end
diff --git a/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda b/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda
index fa8360f3..f5960513 100644
--- a/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda
+++ b/examples/src/main/scala/soda/example/algorithms/SaladMaker.soda
@@ -16,9 +16,9 @@ class SaladMaker
     (next_ingredient_function : Salad -> Ingredient -> Salad)
     (condition_to_continue : Salad -> Ingredient -> Boolean)
       : Salad =
-    if ingredients_so_far.isEmpty or (not condition_to_continue (salad_so_far) (ingredients_so_far.head) )
+    if ingredients_so_far .isEmpty or (not condition_to_continue (salad_so_far) (ingredients_so_far .head) )
     then salad_so_far
-    else _tailrec_prepare_salad (ingredients_so_far.tail) (next_ingredient_function (salad_so_far) (ingredients_so_far.head) ) (next_ingredient_function) (condition_to_continue)
+    else _tailrec_prepare_salad (ingredients_so_far .tail) (next_ingredient_function (salad_so_far) (ingredients_so_far .head) ) (next_ingredient_function) (condition_to_continue)
 
 end
 
diff --git a/examples/src/main/scala/soda/example/algorithms/ScalaReservedWordEscaping.soda b/examples/src/main/scala/soda/example/algorithms/ScalaReservedWordEscaping.soda
index 7c990f65..dc63e096 100644
--- a/examples/src/main/scala/soda/example/algorithms/ScalaReservedWordEscaping.soda
+++ b/examples/src/main/scala/soda/example/algorithms/ScalaReservedWordEscaping.soda
@@ -5,10 +5,10 @@ class ScalaReservedWordEscaping
 
   val = 1
 
-  def [A] [B] (key : A) (value : B) : MyPair [A] [B] = MyPair_ (key, value)
+  def [A] [B] (key : A) (value : B) : MyPair [A] [B] = MyPair_ (key , value)
 
   while [A] [B] (seq : Seq [A] ) (cond : A -> Boolean) (funct : A -> B) : Seq [B] =
-    seq.takeWhile (cond).map (funct)
+    seq .takeWhile (cond) .map (funct)
 
   protected = "protected"
 
diff --git a/examples/src/main/scala/soda/example/algorithms/SortExample.soda b/examples/src/main/scala/soda/example/algorithms/SortExample.soda
index 27f7f374..d1632291 100644
--- a/examples/src/main/scala/soda/example/algorithms/SortExample.soda
+++ b/examples/src/main/scala/soda/example/algorithms/SortExample.soda
@@ -17,7 +17,7 @@ class SortExampleWithAt
     sequence
       .indices
       .filter (lambda index --> index > 0)
-      .forall (lambda index --> sequence.apply (index - 1) <= sequence.apply (index) )
+      .forall (lambda index --> sequence .apply (index - 1) <= sequence .apply (index) )
 
 end
 
@@ -30,8 +30,8 @@ class SortExampleWithZip
 
   is_sorted_for (sequence : Seq [Int] ) : Boolean =
     sequence
-      .zip (sequence.tail)
-      .forall (lambda pair --> (pair._1 <= pair._2) )
+      .zip (sequence .tail)
+      .forall (lambda pair --> (pair ._1 <= pair ._2) )
 
 end
 
@@ -55,9 +55,9 @@ class SortAlgorithmExampleWithFold
     lambda sequence --> sort_for (sequence)
 
   sort_for (sequence : Seq [Int] ) : Seq [Int] =
-    if sequence.length < 2
+    if sequence .length < 2
     then sequence
-    else _fold.apply (sequence) (_initial_value) (_next_value_function)
+    else _fold .apply (sequence) (_initial_value) (_next_value_function)
 
   _initial_value = Seq [Int] ()
 
@@ -66,13 +66,13 @@ class SortAlgorithmExampleWithFold
 
   insert_sorted (sequence : Seq [Int] ) (element : Int) : Seq [Int] =
     concatenate (
-      first_part := sequence.takeWhile (lambda x --> x < element) ) (
+      first_part := sequence .takeWhile (lambda x --> x < element) ) (
       middle := Seq (element) ) (
-      last_part := sequence.dropWhile (lambda x --> x < element)
+      last_part := sequence .dropWhile (lambda x --> x < element)
     )
 
   concatenate (first_part : Seq [Int] ) (middle : Seq [Int] ) (last_part : Seq [Int] ) : Seq [Int] =
-    first_part.++ (middle.++ (last_part) )
+    first_part .++ (middle .++ (last_part) )
 
 end
 
@@ -84,10 +84,10 @@ class ConstrainedSortAlgorithm
     soda.lib.NoneSD_
 
   sort (sequence : Seq [Int] ) : OptionSD [Seq [Int] ] =
-    sort_with ( SortAlgorithmExampleWithFold_ ().sort (sequence) )
+    sort_with (SortAlgorithmExampleWithFold_ () .sort (sequence) )
 
   sort_with (sorted_sequence : Seq [Int] ) : OptionSD [Seq [Int] ] =
-    if SortExampleWithZip_ ().is_sorted (sorted_sequence)
+    if SortExampleWithZip_ () .is_sorted (sorted_sequence)
     then SomeSD_ (sorted_sequence)
     else NoneSD_ [Seq [Int] ] ()
 
@@ -142,21 +142,21 @@ class NonEmptySortedSequence [A subtype Comparable [A] ]
     lambda element --> add_for (element)
 
   add_for (element : A) : SortedSequence [A] =
-    NonEmptySortedSequence_ (aux.insert_sorted (sequence) (element) )
+    NonEmptySortedSequence_ (aux .insert_sorted (sequence) (element) )
 
-  invariant : Boolean = aux.is_sorted (sequence)
+  invariant : Boolean = aux .is_sorted (sequence)
 
 end
 
 class NonEmptySortedSequenceAux [A subtype Comparable [A] ]
 
   is_less_than (x : A) (y : A) : Boolean =
-    x.compareTo (y) < 0
+    x .compareTo (y) < 0
 
   is_sorted (other_sequence : Seq [A] ) : Boolean =
     other_sequence
-      .zip (other_sequence.tail)
-      .forall (lambda pair --> is_less_than (pair._1) (pair._2) )
+      .zip (other_sequence .tail)
+      .forall (lambda pair --> is_less_than (pair ._1) (pair ._2) )
 
   insert_sorted (original_sequence : Seq [A] ) (element : A) : Seq [A] =
     concatenate (
@@ -166,7 +166,7 @@ class NonEmptySortedSequenceAux [A subtype Comparable [A] ]
     )
 
   concatenate (first_part : Seq [A] ) (middle : Seq [A] ) (last_part : Seq [A] ) : Seq [A] =
-    first_part.++ (middle.++ (last_part) )
+    first_part .++ (middle .++ (last_part) )
 
 end
 
@@ -178,12 +178,12 @@ class SortedSequenceBuilder [A subtype Comparable [A] ]
   _fold = Fold_ ()
 
   build (sequence : Seq [A] ) : SortedSequence [A] =
-    _fold.apply (sequence) (_initial_value) (_next_value_function)
+    _fold .apply (sequence) (_initial_value) (_next_value_function)
 
   _initial_value : SortedSequence [A] = EmptySortedSequence_ [A] ()
 
   _next_value_function (sorted_sequence : SortedSequence [A] ) (element : A) : SortedSequence [A] =
-    sorted_sequence.add (element)
+    sorted_sequence .add (element)
 
 end
 
diff --git a/examples/src/main/scala/soda/example/ethicalissues/fairness/Fairness.soda b/examples/src/main/scala/soda/example/ethicalissues/fairness/Fairness.soda
index f3e3099f..3c6adf8c 100644
--- a/examples/src/main/scala/soda/example/ethicalissues/fairness/Fairness.soda
+++ b/examples/src/main/scala/soda/example/ethicalissues/fairness/Fairness.soda
@@ -14,7 +14,7 @@ class Fairness
     rank : Applicant -> Double
 
   difference_between (value : Double) (another_value : Double) : Double =
-    Math.abs (value - another_value)
+    Math .abs (value - another_value)
 
   have_similar_ranking (result1 : Double) (result2 : Double) : Boolean =
     difference_between (result1) (result2) < ranking_difference_tolerance
diff --git a/examples/src/main/scala/soda/example/ethicalissues/fairness/Package.scala b/examples/src/main/scala/soda/example/ethicalissues/fairness/Package.scala
index 30e6a0f0..fa8d9b96 100644
--- a/examples/src/main/scala/soda/example/ethicalissues/fairness/Package.scala
+++ b/examples/src/main/scala/soda/example/ethicalissues/fairness/Package.scala
@@ -23,7 +23,7 @@ trait Fairness
   def   rank : Applicant => Double
 
   def difference_between (value : Double) (another_value : Double) : Double =
-    Math.abs (value - another_value)
+    Math .abs (value - another_value)
 
   def have_similar_ranking (result1 : Double) (result2 : Double) : Boolean =
     difference_between (result1) (result2) < ranking_difference_tolerance
diff --git a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala
index 2c81b2d9..f8de250f 100644
--- a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala
+++ b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Package.scala
@@ -30,7 +30,7 @@ trait PricingAgent
   lazy val milliseconds_per_day : Long = 24 * 60 * 60 * 1000
 
   def get_days_for (date : Date) : Int =
-    (date.getTime / milliseconds_per_day).toInt
+    (date .getTime / milliseconds_per_day) .toInt
 
 }
 
@@ -53,7 +53,7 @@ trait RequirementMonitor
   def   pricing_agent : PricingAgent
 
   def get_price (customer : Customer) (flight : Flight) (date_in_days : Int) : Int =
-    pricing_agent.get_price (customer) (flight) (date_in_days)
+    pricing_agent .get_price (customer) (flight) (date_in_days)
 
 }
 
@@ -91,7 +91,7 @@ trait Requirement1Monitor
     get_report_with_similarity (price1) (price2) (get_similarity (price1) (price2) )
 
   def get_report_with_similarity (price1 : Int) (price2 : Int) (similarity : Double) : Report1 =
-    Report1_ (minimum_similarity <= similarity, price1, price2, similarity)
+    Report1_ (minimum_similarity <= similarity , price1 , price2 , similarity)
 
   def get_similarity (x : Int) (y : Int) : Double =
     1.0 * (min (x) (y) ) / (max (x) (y) )
@@ -138,7 +138,7 @@ trait Requirement2Monitor
     )
 
   def get_report_with (old_price : Int) (new_price : Int) : Report2 =
-    Report2_ (new_price <= old_price * acceptable_increase, old_price, new_price)
+    Report2_ (new_price <= old_price * acceptable_increase , old_price , new_price)
 
   def get_a_year_before (date_in_days : Int) : Int =
     date_in_days - 365
@@ -173,16 +173,16 @@ trait Requirement3Monitor
     )
 
   def get_report_with (price_of_flight : Int) (price_of_flight_by_segments : Int) : Report3 =
-    Report3_ (price_of_flight <= price_of_flight_by_segments, price_of_flight, price_of_flight_by_segments)
+    Report3_ (price_of_flight <= price_of_flight_by_segments , price_of_flight , price_of_flight_by_segments)
 
   def get_price_of_flight_by_segments (customer : Customer) (flight : Flight) (date_in_days : Int) : Int =
-    sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight).segments) (date_in_days) )
+    sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight) .segments) (date_in_days) )
 
   def get_prices_of_segments (customer : Customer) (segments : Seq [Segment] ) (date_in_days : Int) : Seq [Int] =
-    segments.map ( segment => get_price (customer) (segment) (date_in_days) )
+    segments .map ( segment => get_price (customer) (segment) (date_in_days) )
 
   def sum_prices (prices : Seq [Int] ) : Int =
-    prices.sum
+    prices .sum
 
 }
 
@@ -208,12 +208,12 @@ trait SegmentsForFlight
   def   flight : Flight
 
   lazy val segments : Seq [Segment] =
-    rec_segments_multi (flight.start_airport) (flight.intermediate_airports) (flight.end_airport)
+    rec_segments_multi (flight .start_airport) (flight .intermediate_airports) (flight .end_airport)
 
   def rec_segments_multi (first_airport : String) (intermediate_stops : Seq [String] ) (last_airport : String) : Seq [Segment] =
     intermediate_stops match  {
-      case head :: tail => (rec_segments_multi (head) (tail) (last_airport) ).+: (Segment_ (first_airport, head) )
-      case otherwise => Nil.+: (Segment_ (first_airport, last_airport) )
+      case head :: tail => (rec_segments_multi (head) (tail) (last_airport) ) .+: (Segment_ (first_airport , head) )
+      case otherwise => Nil .+: (Segment_ (first_airport , last_airport) )
     }
 
 }
diff --git a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/PriceMonitor.soda b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/PriceMonitor.soda
index 0607bf30..a063c9ee 100644
--- a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/PriceMonitor.soda
+++ b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/PriceMonitor.soda
@@ -22,7 +22,7 @@ class PricingAgent
   milliseconds_per_day : Long = 24 * 60 * 60 * 1000
 
   get_days_for (date : Date) : Int =
-    (date.getTime / milliseconds_per_day).toInt
+    (date .getTime / milliseconds_per_day) .toInt
 
 end
 
@@ -41,7 +41,7 @@ class RequirementMonitor
     pricing_agent : PricingAgent
 
   get_price (customer : Customer) (flight : Flight) (date_in_days : Int) : Int =
-    pricing_agent.get_price (customer) (flight) (date_in_days)
+    pricing_agent .get_price (customer) (flight) (date_in_days)
 
 end
 
diff --git a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement1Monitor.soda b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement1Monitor.soda
index 75a8b4a6..351512cb 100644
--- a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement1Monitor.soda
+++ b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement1Monitor.soda
@@ -28,7 +28,7 @@ class Requirement1Monitor
     get_report_with_similarity (price1) (price2) (get_similarity (price1) (price2) )
 
   get_report_with_similarity (price1 : Int) (price2 : Int) (similarity : Double) : Report1 =
-    Report1_ (minimum_similarity <= similarity, price1, price2, similarity)
+    Report1_ (minimum_similarity <= similarity , price1 , price2 , similarity)
 
   get_similarity (x : Int) (y : Int) : Double =
     1.0 * (min (x) (y) ) / (max (x) (y) )
diff --git a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement2Monitor.soda b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement2Monitor.soda
index 82e3b3e1..666060ee 100644
--- a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement2Monitor.soda
+++ b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement2Monitor.soda
@@ -24,7 +24,7 @@ class Requirement2Monitor
     )
 
   get_report_with (old_price : Int) (new_price : Int) : Report2 =
-    Report2_ (new_price <= old_price * acceptable_increase, old_price, new_price)
+    Report2_ (new_price <= old_price * acceptable_increase , old_price , new_price)
 
   get_a_year_before (date_in_days : Int) : Int =
     date_in_days - 365
diff --git a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda
index c7c038e8..42ebe343 100644
--- a/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda
+++ b/examples/src/main/scala/soda/example/ethicalissues/pricemonitor/Requirement3Monitor.soda
@@ -22,16 +22,16 @@ class Requirement3Monitor
     )
 
   get_report_with (price_of_flight : Int) (price_of_flight_by_segments : Int) : Report3 =
-    Report3_ (price_of_flight <= price_of_flight_by_segments, price_of_flight, price_of_flight_by_segments)
+    Report3_ (price_of_flight <= price_of_flight_by_segments , price_of_flight , price_of_flight_by_segments)
 
   get_price_of_flight_by_segments (customer : Customer) (flight : Flight) (date_in_days : Int) : Int =
-    sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight).segments) (date_in_days) )
+    sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight) .segments) (date_in_days) )
 
   get_prices_of_segments (customer : Customer) (segments : Seq [Segment] ) (date_in_days : Int) : Seq [Int] =
-    segments.map (lambda segment --> get_price (customer) (segment) (date_in_days) )
+    segments .map (lambda segment --> get_price (customer) (segment) (date_in_days) )
 
   sum_prices (prices : Seq [Int] ) : Int =
-    prices.sum
+    prices .sum
 
 end
 
@@ -53,12 +53,12 @@ class SegmentsForFlight
     flight : Flight
 
   segments : Seq [Segment] =
-    rec_segments_multi (flight.start_airport) (flight.intermediate_airports) (flight.end_airport)
+    rec_segments_multi (flight .start_airport) (flight .intermediate_airports) (flight .end_airport)
 
   rec_segments_multi (first_airport : String) (intermediate_stops : Seq [String] ) (last_airport : String) : Seq [Segment] =
     match intermediate_stops
-      case head :: tail ==> (rec_segments_multi (head) (tail) (last_airport) ).+: (Segment_ (first_airport, head) )
-      case otherwise ==> Nil.+: (Segment_ (first_airport, last_airport) )
+      case head :: tail ==> (rec_segments_multi (head) (tail) (last_airport) ) .+: (Segment_ (first_airport , head) )
+      case otherwise ==> Nil .+: (Segment_ (first_airport , last_airport) )
 
 end
 
diff --git a/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala b/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala
index 3993d0bc..e5eb6e4a 100644
--- a/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala
+++ b/examples/src/main/scala/soda/example/forcoq/algorithms/Package.scala
@@ -31,7 +31,7 @@ trait RecursionForCoq
         @tailrec  final
   private def _tailrec_fold3 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) : B =
     sequence match  {
-      case (head) :: (tail) => _tailrec_fold3 (tail) (next_value_function (current_value) (head)) (next_value_function)
+      case (head) :: (tail) => _tailrec_fold3 (tail) (next_value_function (current_value) (head) ) (next_value_function)
       case otherwise => current_value
     }
 
diff --git a/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda b/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda
index f07091d9..ab14b52a 100644
--- a/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda
+++ b/examples/src/main/scala/soda/example/forcoq/algorithms/RecursionForCoq.soda
@@ -20,7 +20,7 @@ class RecursionForCoq
   @tailrec
   _tailrec_fold3 [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B =
     match sequence
-      case (head) :: (tail) ==> _tailrec_fold3 (tail) (next_value_function (current_value) (head)) (next_value_function)
+      case (head) :: (tail) ==> _tailrec_fold3 (tail) (next_value_function (current_value) (head) ) (next_value_function)
       case otherwise ==> current_value
 
   fold3 [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B =
diff --git a/examples/src/main/scala/soda/example/forcoq/lib/List.soda b/examples/src/main/scala/soda/example/forcoq/lib/List.soda
index 81616d69..1865d633 100644
--- a/examples/src/main/scala/soda/example/forcoq/lib/List.soda
+++ b/examples/src/main/scala/soda/example/forcoq/lib/List.soda
@@ -24,7 +24,7 @@ class SeqList
   @tailrec
   _tailrec_reverse [A] (a : list [A] ) (b : list [A] ) : list [A] =
     match a
-      case cons_ (e, s) ==> _tailrec_reverse (s) ( cons_ (e, b) )
+      case cons_ (e , s) ==> _tailrec_reverse (s) (cons_ (e , b) )
       case otherwise ==> b
 
   reverse [A] (s : list [A] ) : list [A] =
@@ -33,20 +33,20 @@ class SeqList
   @tailrec
   _tailrec_from_Seq [A] (a : Seq [A] ) (b : list [A] ) : list [A] =
     match a
-      case (e) :: (s) ==> _tailrec_from_Seq (s) (cons_ (e, b) )
+      case (e) :: (s) ==> _tailrec_from_Seq (s) (cons_ (e , b) )
       case otherwise ==> b
 
   from_Seq [A] (a : Seq [A] ) : list [A] =
-    reverse (_tailrec_from_Seq (a) ( nil_ [A] () ) )
+    reverse (_tailrec_from_Seq (a) (nil_ [A] () ) )
 
   @tailrec
   _tailrec_to_Seq [A] (a : list [A] ) (b : Seq [A] ) : Seq [A] =
     match a
-      case cons_ (e, s) ==> _tailrec_to_Seq (s) ( b .+: (e) )
+      case cons_ (e , s) ==> _tailrec_to_Seq (s) (b .+: (e) )
       case otherwise ==> b
 
   to_Seq [A] (a : list [A] ) : Seq [A] =
-    (_tailrec_to_Seq (a) ( Seq [A]() ) ) .reverse
+    (_tailrec_to_Seq (a) (Seq [A] () ) ) .reverse
 
 end
 
diff --git a/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda b/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda
index 26b2af38..4d29b288 100644
--- a/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda
+++ b/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda
@@ -38,13 +38,13 @@ class S
     lambda a --> add_for (a)
 
   add_for (a : nat) : nat =
-    t.from_non_negative( (t.to_Int (k) + 1) + t.to_Int (a) )
+    t .from_non_negative( (t .to_Int (k) + 1) + t .to_Int (a) )
 
   mul : nat ->  nat =
     lambda a --> mul_for (a)
 
   mul_for (a : nat) : nat =
-    t.from_non_negative( (t.to_Int (k) + 1) * t.to_Int (a) )
+    t .from_non_negative( (t .to_Int (k) + 1) * t .to_Int (a) )
 
 end
 
diff --git a/examples/src/main/scala/soda/example/forcoq/lib/Package.scala b/examples/src/main/scala/soda/example/forcoq/lib/Package.scala
index 98a66ad0..218d52b0 100644
--- a/examples/src/main/scala/soda/example/forcoq/lib/Package.scala
+++ b/examples/src/main/scala/soda/example/forcoq/lib/Package.scala
@@ -41,7 +41,7 @@ trait SeqList
         @tailrec  final
   private def _tailrec_reverse [A] (a : list [A] ) (b : list [A] ) : list [A] =
     a match  {
-      case cons_ (e, s) => _tailrec_reverse (s) ( cons_ (e, b) )
+      case cons_ (e , s) => _tailrec_reverse (s) (cons_ (e , b) )
       case otherwise => b
     }
 
@@ -52,23 +52,23 @@ trait SeqList
         @tailrec  final
   private def _tailrec_from_Seq [A] (a : Seq [A] ) (b : list [A] ) : list [A] =
     a match  {
-      case (e) :: (s) => _tailrec_from_Seq (s) (cons_ (e, b) )
+      case (e) :: (s) => _tailrec_from_Seq (s) (cons_ (e , b) )
       case otherwise => b
     }
 
   def from_Seq [A] (a : Seq [A] ) : list [A] =
-    reverse (_tailrec_from_Seq (a) ( nil_ [A] () ) )
+    reverse (_tailrec_from_Seq (a) (nil_ [A] () ) )
 
   import scala.annotation.tailrec
         @tailrec  final
   private def _tailrec_to_Seq [A] (a : list [A] ) (b : Seq [A] ) : Seq [A] =
     a match  {
-      case cons_ (e, s) => _tailrec_to_Seq (s) ( b .+: (e) )
+      case cons_ (e , s) => _tailrec_to_Seq (s) (b .+: (e) )
       case otherwise => b
     }
 
   def to_Seq [A] (a : list [A] ) : Seq [A] =
-    (_tailrec_to_Seq (a) ( Seq [A]() ) ) .reverse
+    (_tailrec_to_Seq (a) (Seq [A] () ) ) .reverse
 
 }
 
@@ -119,13 +119,13 @@ trait S
      a => add_for (a)
 
   def add_for (a : nat) : nat =
-    t.from_non_negative( (t.to_Int (k) + 1) + t.to_Int (a) )
+    t .from_non_negative( (t .to_Int (k) + 1) + t .to_Int (a) )
 
   lazy val mul : nat =>  nat =
      a => mul_for (a)
 
   def mul_for (a : nat) : nat =
-    t.from_non_negative( (t.to_Int (k) + 1) * t.to_Int (a) )
+    t .from_non_negative( (t .to_Int (k) + 1) * t .to_Int (a) )
 
 }
 
diff --git a/examples/src/main/scala/soda/example/inanutshell/InANutshell.soda b/examples/src/main/scala/soda/example/inanutshell/InANutshell.soda
index fc647d38..c1bac66b 100644
--- a/examples/src/main/scala/soda/example/inanutshell/InANutshell.soda
+++ b/examples/src/main/scala/soda/example/inanutshell/InANutshell.soda
@@ -63,8 +63,8 @@ class Example
 
   min_max (a : Int) (b : Int) : MinMaxPair =
     MinMaxPair_ (
-      min := MaxAndMin_ ().min (a) (b),
-      max := MaxAndMin_ ().max (a) (b)
+      min := MaxAndMin_ () .min (a) (b),
+      max := MaxAndMin_ () .max (a) (b)
     )
 
 end
@@ -79,7 +79,7 @@ end
 class ComparableMax [A subtype Comparable]
 
   max (a : A) (b : A) : A =
-    if a.is_greater_than (b)
+    if a .is_greater_than (b)
     then a
     else b
 
diff --git a/examples/src/main/scala/soda/example/inanutshell/Package.scala b/examples/src/main/scala/soda/example/inanutshell/Package.scala
index 84a8b686..7ea80d76 100644
--- a/examples/src/main/scala/soda/example/inanutshell/Package.scala
+++ b/examples/src/main/scala/soda/example/inanutshell/Package.scala
@@ -80,8 +80,8 @@ trait Example
 
   def min_max (a : Int) (b : Int) : MinMaxPair =
     MinMaxPair_ (
-      min = MaxAndMin_ ().min (a) (b),
-      max = MaxAndMin_ ().max (a) (b)
+      min = MaxAndMin_ () .min (a) (b),
+      max = MaxAndMin_ () .max (a) (b)
     )
 
 }
@@ -101,7 +101,7 @@ trait ComparableMax [A <: Comparable]
 {
 
   def max (a : A) (b : A) : A =
-    if ( a.is_greater_than (b)
+    if ( a .is_greater_than (b)
     ) a
     else b
 
diff --git a/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda b/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda
index 16a4ac45..9094d546 100644
--- a/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda
+++ b/examples/src/main/scala/soda/example/mathematics/FactorialWithFold.soda
@@ -8,7 +8,7 @@ class FactorialWithFold
   apply (n : Int) : Int =
     if n < 0
     then 0
-    else _fold.apply (_range.apply (n) ) (1) (any product --> any k --> (product * (k + 1) ) )
+    else _fold .apply (_range .apply (n) ) (1) (any product --> any k --> (product * (k + 1) ) )
 
 end
 
diff --git a/examples/src/main/scala/soda/example/mathematics/HardProblem.soda b/examples/src/main/scala/soda/example/mathematics/HardProblem.soda
index 673d7304..9073f96e 100644
--- a/examples/src/main/scala/soda/example/mathematics/HardProblem.soda
+++ b/examples/src/main/scala/soda/example/mathematics/HardProblem.soda
@@ -46,21 +46,21 @@ class Memoizer [A] [B]
       compute_for (input)
 
   compute_for (input : InputPair [A] [B] ) : OutputPair [A] [B] =
-    _compute_with (input.memoized_values.get (input.value) ) (input)
+    _compute_with (input .memoized_values .get (input .value) ) (input)
 
   _compute_with (maybe_res : Option [B] ) (input : InputPair [A] [B] ) : OutputPair [A] [B] =
-    if maybe_res.isEmpty
+    if maybe_res .isEmpty
     then compute_and_update (input)
-    else OutputPair_ (maybe_res.get, input.memoized_values)
+    else OutputPair_ (maybe_res .get, input .memoized_values)
 
   compute_and_update (input : InputPair [A] [B] ) : OutputPair [A] [B] =
-    _compute_and_update_with (input.value) (main_function (input) )
+    _compute_and_update_with (input .value) (main_function (input) )
 
   _compute_and_update_with (input_value : A) (output : OutputPair [A] [B] ) : OutputPair [A] [B] =
-    _add_element (output, Tuple2 (input_value, output.value) )
+    _add_element (output, Tuple2 (input_value, output .value) )
 
   _add_element (output : OutputPair [A] [B], new_pair : Tuple2 [A] [B] ) : OutputPair [A] [B] =
-    OutputPair_ (output.value, output.memoized_values + new_pair)
+    OutputPair_ (output .value, output .memoized_values + new_pair)
 
 end
 
@@ -80,19 +80,19 @@ class HardProblem
 
   main_function : InputPair [Int] [Int] -> OutputPair [Int] [Int] =
     lambda input -->
-      if input.value == 1
-      then OutputPair_ (0, input.memoized_values)
-      else _plus_one (compute (InputPair_ (one_step (input.value), input.memoized_values) ) )
+      if input .value == 1
+      then OutputPair_ (0, input .memoized_values)
+      else _plus_one (compute (InputPair_ (one_step (input .value), input .memoized_values) ) )
 
   _plus_one (pair : OutputPair [Int] [Int] ) : OutputPair [Int] [Int] =
-    OutputPair_ (1 + pair.value, pair.memoized_values)
+    OutputPair_ (1 + pair .value, pair .memoized_values)
 
   abs_compute : InputPair [Int] [Int] -> OutputPair [Int] [Int] =
     lambda input -->
       compute_for (input)
 
   compute_for (input : InputPair [Int] [Int] ) : OutputPair [Int] [Int] =
-    memoizer.compute (input)
+    memoizer .compute (input)
 
 end
 
@@ -107,15 +107,15 @@ class MemoizedFibonacci
       main_function_for (input)
 
   main_function_for (input : InputPair [Int] [Int] ): OutputPair [Int] [Int] =
-    if (input.value == 0) or (input.value == 1)
-    then OutputPair_ (input.value, input.memoized_values )
-    else _compute_and_update_1 (compute (InputPair_ (input.value - 2, input.memoized_values ) ) ) (input.value)
+    if (input .value == 0) or (input .value == 1)
+    then OutputPair_ (input .value, input .memoized_values )
+    else _compute_and_update_1 (compute (InputPair_ (input .value - 2, input .memoized_values ) ) ) (input .value)
 
   _compute_and_update_1 (first_tuple : OutputPair [Int] [Int] ) (n : Int ) : OutputPair [Int] [Int] =
-    _compute_and_update_2 (first_tuple.value) (compute (InputPair_ (n - 1, first_tuple.memoized_values) ) ) (n)
+    _compute_and_update_2 (first_tuple .value) (compute (InputPair_ (n - 1, first_tuple .memoized_values) ) ) (n)
 
   _compute_and_update_2 (first_value : Int) (second_tuple : OutputPair [Int] [Int] ) (n : Int ) : OutputPair [Int] [Int] =
-    _compute_and_update_3 (_get_next_fibo (first_value) (second_tuple.value) ) (second_tuple.memoized_values) (n)
+    _compute_and_update_3 (_get_next_fibo (first_value) (second_tuple .value) ) (second_tuple .memoized_values) (n)
 
   _compute_and_update_3 (res : Int) (second_map : Map [Int] [Int] ) (n : Int) : OutputPair [Int] [Int] =
     OutputPair_ (res, second_map + Tuple2 (n, res) )
@@ -128,7 +128,7 @@ class MemoizedFibonacci
       compute_for (input)
 
   compute_for (input : InputPair [Int] [Int] ) : OutputPair [Int] [Int] =
-    memoizer.compute (input)
+    memoizer .compute (input)
 
 end
 
diff --git a/examples/src/main/scala/soda/example/mathematics/Package.scala b/examples/src/main/scala/soda/example/mathematics/Package.scala
index daef1c7c..9f140511 100644
--- a/examples/src/main/scala/soda/example/mathematics/Package.scala
+++ b/examples/src/main/scala/soda/example/mathematics/Package.scala
@@ -58,7 +58,7 @@ trait FactorialWithFold
   def apply (n : Int) : Int =
     if ( n < 0
     ) 0
-    else _fold.apply (_range.apply (n) ) (1) ( product =>  k => (product * (k + 1) ) )
+    else _fold .apply (_range .apply (n) ) (1) ( product =>  k => (product * (k + 1) ) )
 
 }
 
@@ -152,21 +152,21 @@ trait Memoizer [A, B]
       compute_for (input)
 
   def compute_for (input : InputPair [A, B] ) : OutputPair [A, B] =
-    _compute_with (input.memoized_values.get (input.value) ) (input)
+    _compute_with (input .memoized_values .get (input .value) ) (input)
 
   private def _compute_with (maybe_res : Option [B] ) (input : InputPair [A, B] ) : OutputPair [A, B] =
-    if ( maybe_res.isEmpty
+    if ( maybe_res .isEmpty
     ) compute_and_update (input)
-    else OutputPair_ (maybe_res.get, input.memoized_values)
+    else OutputPair_ (maybe_res .get, input .memoized_values)
 
   def compute_and_update (input : InputPair [A, B] ) : OutputPair [A, B] =
-    _compute_and_update_with (input.value) (main_function (input) )
+    _compute_and_update_with (input .value) (main_function (input) )
 
   private def _compute_and_update_with (input_value : A) (output : OutputPair [A, B] ) : OutputPair [A, B] =
-    _add_element (output, Tuple2 (input_value, output.value) )
+    _add_element (output, Tuple2 (input_value, output .value) )
 
   private def _add_element (output : OutputPair [A, B], new_pair : Tuple2 [A, B] ) : OutputPair [A, B] =
-    OutputPair_ (output.value, output.memoized_values + new_pair)
+    OutputPair_ (output .value, output .memoized_values + new_pair)
 
 }
 
@@ -189,19 +189,19 @@ trait HardProblem
 
   lazy val main_function : InputPair [Int, Int] => OutputPair [Int, Int] =
      input =>
-      if ( input.value == 1
-      ) OutputPair_ (0, input.memoized_values)
-      else _plus_one (compute (InputPair_ (one_step (input.value), input.memoized_values) ) )
+      if ( input .value == 1
+      ) OutputPair_ (0, input .memoized_values)
+      else _plus_one (compute (InputPair_ (one_step (input .value), input .memoized_values) ) )
 
   private def _plus_one (pair : OutputPair [Int, Int] ) : OutputPair [Int, Int] =
-    OutputPair_ (1 + pair.value, pair.memoized_values)
+    OutputPair_ (1 + pair .value, pair .memoized_values)
 
   lazy val abs_compute : InputPair [Int, Int] => OutputPair [Int, Int] =
      input =>
       compute_for (input)
 
   def compute_for (input : InputPair [Int, Int] ) : OutputPair [Int, Int] =
-    memoizer.compute (input)
+    memoizer .compute (input)
 
 }
 
@@ -219,15 +219,15 @@ trait MemoizedFibonacci
       main_function_for (input)
 
   def main_function_for (input : InputPair [Int, Int] ): OutputPair [Int, Int] =
-    if ( (input.value == 0) || (input.value == 1)
-    ) OutputPair_ (input.value, input.memoized_values )
-    else _compute_and_update_1 (compute (InputPair_ (input.value - 2, input.memoized_values ) ) ) (input.value)
+    if ( (input .value == 0) || (input .value == 1)
+    ) OutputPair_ (input .value, input .memoized_values )
+    else _compute_and_update_1 (compute (InputPair_ (input .value - 2, input .memoized_values ) ) ) (input .value)
 
   private def _compute_and_update_1 (first_tuple : OutputPair [Int, Int] ) (n : Int ) : OutputPair [Int, Int] =
-    _compute_and_update_2 (first_tuple.value) (compute (InputPair_ (n - 1, first_tuple.memoized_values) ) ) (n)
+    _compute_and_update_2 (first_tuple .value) (compute (InputPair_ (n - 1, first_tuple .memoized_values) ) ) (n)
 
   private def _compute_and_update_2 (first_value : Int) (second_tuple : OutputPair [Int, Int] ) (n : Int ) : OutputPair [Int, Int] =
-    _compute_and_update_3 (_get_next_fibo (first_value) (second_tuple.value) ) (second_tuple.memoized_values) (n)
+    _compute_and_update_3 (_get_next_fibo (first_value) (second_tuple .value) ) (second_tuple .memoized_values) (n)
 
   private def _compute_and_update_3 (res : Int) (second_map : Map [Int, Int] ) (n : Int) : OutputPair [Int, Int] =
     OutputPair_ (res, second_map + Tuple2 (n, res) )
@@ -240,7 +240,7 @@ trait MemoizedFibonacci
       compute_for (input)
 
   def compute_for (input : InputPair [Int, Int] ) : OutputPair [Int, Int] =
-    memoizer.compute (input)
+    memoizer .compute (input)
 
 }
 
@@ -271,22 +271,22 @@ trait PiIterator
     _tailrec_take (n) (Seq () ) (_initial_status) (_get_next (_initial_status) )
 
   private lazy val _initial_status =
-    Status_ (r = 0, n = 3, q = 1, t = 1, l = 3, k = 1)
+    Status_ (r = 0 , n = 3 , q = 1 , t = 1 , l = 3 , k = 1)
 
   import scala.annotation.tailrec
         @tailrec  final
   private def _tailrec_compute_new_status (s : Status) : Status =
-    if ( (4 * s.q + s.r - s.t) < (s.n * s.t)
+    if ( (4 * s .q + s .r - s .t) < (s .n * s .t)
     ) s
     else
       _tailrec_compute_new_status (
         Status_ (
-          r = (2 * s.q + s.r) * s.l,
-          n = ( (s.q * (7 * s.k) + 2 + (s.r * s.l) ) / (s.t * s.l) ).toInt,
-          q = s.q * s.k,
-          t = s.t * s.l,
-          l = s.l + 2,
-          k = s.k + 1
+          r = (2 * s .q + s .r) * s .l ,
+          n = ( (s .q * (7 * s .k) + 2 + (s .r * s .l) ) / (s .t * s .l) ) .toInt ,
+          q = s .q * s .k ,
+          t = s .t * s .l ,
+          l = s .l + 2 ,
+          k = s .k + 1
         )
       )
 
@@ -297,22 +297,22 @@ trait PiIterator
         @tailrec  final
   private def _tailrec_take (n : Int) (rev_seq : Seq [Int] ) (s : Status) (t : IntAndStatus) : Seq [Int] =
     if ( n == 0
-    ) rev_seq.reverse
-    else _tailrec_take (n - 1) (rev_seq.+: (t.digit) ) (t.new_status) (_get_next (t.new_status) )
+    ) rev_seq .reverse
+    else _tailrec_take (n - 1) (rev_seq .+: (t .digit) ) (t .new_status) (_get_next (t .new_status) )
 
   private def _get_next (s : Status) : IntAndStatus =
     _get_next_with_new_status (_compute_new_status (s) )
 
   private def _get_next_with_new_status (s : Status) : IntAndStatus =
     IntAndStatus_ (
-      s.n,
+      s .n ,
       Status_ (
-        r = 10 * (s.r - s.n * s.t),
-        n = ( ( (10 * (3 * s.q + s.r) ) / s.t) - (10 * s.n) ).toInt,
-        q = s.q * 10,
-        t = s.t,
-        l = s.l,
-        k = s.k
+        r = 10 * (s .r - s .n * s .t) ,
+        n = ( ( (10 * (3 * s .q + s .r) ) / s .t) - (10 * s .n) ) .toInt ,
+        q = s .q * 10 ,
+        t = s .t ,
+        l = s .l ,
+        k = s .k
       )
     )
 
diff --git a/examples/src/main/scala/soda/example/mathematics/PiIterator.soda b/examples/src/main/scala/soda/example/mathematics/PiIterator.soda
index c986df09..108c35b8 100644
--- a/examples/src/main/scala/soda/example/mathematics/PiIterator.soda
+++ b/examples/src/main/scala/soda/example/mathematics/PiIterator.soda
@@ -20,21 +20,21 @@ class PiIterator
     _tailrec_take (n) (Seq () ) (_initial_status) (_get_next (_initial_status) )
 
   _initial_status =
-    Status_ (r := 0, n := 3, q := 1, t := 1, l := 3, k := 1)
+    Status_ (r := 0 , n := 3 , q := 1 , t := 1 , l := 3 , k := 1)
 
   @tailrec
   _tailrec_compute_new_status (s : Status) : Status =
-    if (4 * s.q + s.r - s.t) < (s.n * s.t)
+    if (4 * s .q + s .r - s .t) < (s .n * s .t)
     then s
     else
       _tailrec_compute_new_status (
         Status_ (
-          r := (2 * s.q + s.r) * s.l,
-          n := ( (s.q * (7 * s.k) + 2 + (s.r * s.l) ) / (s.t * s.l) ).toInt,
-          q := s.q * s.k,
-          t := s.t * s.l,
-          l := s.l + 2,
-          k := s.k + 1
+          r := (2 * s .q + s .r) * s .l ,
+          n := ( (s .q * (7 * s .k) + 2 + (s .r * s .l) ) / (s .t * s .l) ) .toInt ,
+          q := s .q * s .k ,
+          t := s .t * s .l ,
+          l := s .l + 2 ,
+          k := s .k + 1
         )
       )
 
@@ -44,22 +44,22 @@ class PiIterator
   @tailrec
   _tailrec_take (n : Int) (rev_seq : Seq [Int] ) (s : Status) (t : IntAndStatus) : Seq [Int] =
     if n == 0
-    then rev_seq.reverse
-    else _tailrec_take (n - 1) (rev_seq.+: (t.digit) ) (t.new_status) (_get_next (t.new_status) )
+    then rev_seq .reverse
+    else _tailrec_take (n - 1) (rev_seq .+: (t .digit) ) (t .new_status) (_get_next (t .new_status) )
 
   _get_next (s : Status) : IntAndStatus =
     _get_next_with_new_status (_compute_new_status (s) )
 
   _get_next_with_new_status (s : Status) : IntAndStatus =
     IntAndStatus_ (
-      s.n,
+      s .n ,
       Status_ (
-        r := 10 * (s.r - s.n * s.t),
-        n := ( ( (10 * (3 * s.q + s.r) ) / s.t) - (10 * s.n) ).toInt,
-        q := s.q * 10,
-        t := s.t,
-        l := s.l,
-        k := s.k
+        r := 10 * (s .r - s .n * s .t) ,
+        n := ( ( (10 * (3 * s .q + s .r) ) / s .t) - (10 * s .n) ) .toInt ,
+        q := s .q * 10 ,
+        t := s .t ,
+        l := s .l ,
+        k := s .k
       )
     )
 
diff --git a/examples/src/main/scala/soda/example/miniexample/MiniExample.soda b/examples/src/main/scala/soda/example/miniexample/MiniExample.soda
index 69ef7143..eef7ba5b 100644
--- a/examples/src/main/scala/soda/example/miniexample/MiniExample.soda
+++ b/examples/src/main/scala/soda/example/miniexample/MiniExample.soda
@@ -15,7 +15,7 @@ end
 class Main
 
   main (arguments : Array [String] ) : Unit =
-    MiniExample_ ().run ()
+    MiniExample_ () .run ()
 
 end
 
diff --git a/examples/src/main/scala/soda/example/miniexample/Package.scala b/examples/src/main/scala/soda/example/miniexample/Package.scala
index e0a5c141..97b6f2e6 100644
--- a/examples/src/main/scala/soda/example/miniexample/Package.scala
+++ b/examples/src/main/scala/soda/example/miniexample/Package.scala
@@ -25,7 +25,7 @@ trait Main
 {
 
   def main (arguments : Array [String] ) : Unit =
-    MiniExample_ ().run ()
+    MiniExample_ () .run ()
 
 }
 
diff --git a/examples/src/test/scala/soda/example/algorithms/FizzBuzzSpec.soda b/examples/src/test/scala/soda/example/algorithms/FizzBuzzSpec.soda
index e1783742..67e9a5e4 100644
--- a/examples/src/test/scala/soda/example/algorithms/FizzBuzzSpec.soda
+++ b/examples/src/test/scala/soda/example/algorithms/FizzBuzzSpec.soda
@@ -7,16 +7,16 @@ class FizzBuzzSpec ()
     assert (obtained == expected)
 
   expected_result = Seq (
-    "1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz",
-    "11", "Fizz", "13", "14", "FizzBuzz", "16", "17", "Fizz", "19", "Buzz",
-    "Fizz", "22", "23", "Fizz", "Buzz", "26", "Fizz", "28", "29", "FizzBuzz",
-    "31", "32", "Fizz", "34", "Buzz", "Fizz", "37", "38", "Fizz", "Buzz",
-    "41", "Fizz", "43", "44", "FizzBuzz", "46", "47", "Fizz", "49", "Buzz",
-    "Fizz", "52", "53", "Fizz", "Buzz", "56", "Fizz", "58", "59", "FizzBuzz",
-    "61", "62", "Fizz", "64", "Buzz", "Fizz", "67", "68", "Fizz", "Buzz",
-    "71", "Fizz", "73", "74", "FizzBuzz", "76", "77", "Fizz", "79", "Buzz",
-    "Fizz", "82", "83", "Fizz", "Buzz", "86", "Fizz", "88", "89", "FizzBuzz",
-    "91", "92", "Fizz", "94", "Buzz", "Fizz", "97", "98", "Fizz", "Buzz"
+    "1" , "2" , "Fizz" , "4" , "Buzz" , "Fizz" , "7" , "8" , "Fizz" , "Buzz" ,
+    "11" , "Fizz" , "13" , "14" , "FizzBuzz" , "16" , "17" , "Fizz" , "19" , "Buzz" ,
+    "Fizz" , "22" , "23" , "Fizz" , "Buzz" , "26" , "Fizz" , "28" , "29" , "FizzBuzz" ,
+    "31" , "32" , "Fizz" , "34" , "Buzz" , "Fizz" , "37" , "38" , "Fizz" , "Buzz" ,
+    "41" , "Fizz" , "43" , "44" , "FizzBuzz" , "46" , "47" , "Fizz" , "49" , "Buzz" ,
+    "Fizz" , "52" , "53" , "Fizz" , "Buzz" , "56" , "Fizz" , "58" , "59" , "FizzBuzz" ,
+    "61" , "62" , "Fizz" , "64" , "Buzz" , "Fizz" , "67" , "68" , "Fizz" , "Buzz" ,
+    "71" , "Fizz" , "73" , "74" , "FizzBuzz" , "76" , "77" , "Fizz" , "79" , "Buzz" ,
+    "Fizz" , "82" , "83" , "Fizz" , "Buzz" , "86" , "Fizz" , "88" , "89" , "FizzBuzz" ,
+    "91" , "92" , "Fizz" , "94" , "Buzz" , "Fizz" , "97" , "98" , "Fizz" , "Buzz"
   )
 
   _fizz_buzz = FizzBuzz_ ()
@@ -25,7 +25,7 @@ class FizzBuzzSpec ()
 
   test ("first elements of FizzBuzz") (
     check (
-      obtained := _fizz_buzz.apply
+      obtained := _fizz_buzz .apply
     ) (
       expected := expected_result
     )
@@ -33,7 +33,7 @@ class FizzBuzzSpec ()
 
   test ("first elements of FizzBuzz with pattern matching") (
     check (
-      obtained := _fizz_buzz_pattern_matching.apply
+      obtained := _fizz_buzz_pattern_matching .apply
     ) (
       expected := expected_result
     )
diff --git a/examples/src/test/scala/soda/example/algorithms/Package.scala b/examples/src/test/scala/soda/example/algorithms/Package.scala
index b6f23f05..7e5c83e3 100644
--- a/examples/src/test/scala/soda/example/algorithms/Package.scala
+++ b/examples/src/test/scala/soda/example/algorithms/Package.scala
@@ -15,16 +15,16 @@ case class FizzBuzzSpec ()
     assert (obtained == expected)
 
   lazy val expected_result = Seq (
-    "1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz",
-    "11", "Fizz", "13", "14", "FizzBuzz", "16", "17", "Fizz", "19", "Buzz",
-    "Fizz", "22", "23", "Fizz", "Buzz", "26", "Fizz", "28", "29", "FizzBuzz",
-    "31", "32", "Fizz", "34", "Buzz", "Fizz", "37", "38", "Fizz", "Buzz",
-    "41", "Fizz", "43", "44", "FizzBuzz", "46", "47", "Fizz", "49", "Buzz",
-    "Fizz", "52", "53", "Fizz", "Buzz", "56", "Fizz", "58", "59", "FizzBuzz",
-    "61", "62", "Fizz", "64", "Buzz", "Fizz", "67", "68", "Fizz", "Buzz",
-    "71", "Fizz", "73", "74", "FizzBuzz", "76", "77", "Fizz", "79", "Buzz",
-    "Fizz", "82", "83", "Fizz", "Buzz", "86", "Fizz", "88", "89", "FizzBuzz",
-    "91", "92", "Fizz", "94", "Buzz", "Fizz", "97", "98", "Fizz", "Buzz"
+    "1" , "2" , "Fizz" , "4" , "Buzz" , "Fizz" , "7" , "8" , "Fizz" , "Buzz" ,
+    "11" , "Fizz" , "13" , "14" , "FizzBuzz" , "16" , "17" , "Fizz" , "19" , "Buzz" ,
+    "Fizz" , "22" , "23" , "Fizz" , "Buzz" , "26" , "Fizz" , "28" , "29" , "FizzBuzz" ,
+    "31" , "32" , "Fizz" , "34" , "Buzz" , "Fizz" , "37" , "38" , "Fizz" , "Buzz" ,
+    "41" , "Fizz" , "43" , "44" , "FizzBuzz" , "46" , "47" , "Fizz" , "49" , "Buzz" ,
+    "Fizz" , "52" , "53" , "Fizz" , "Buzz" , "56" , "Fizz" , "58" , "59" , "FizzBuzz" ,
+    "61" , "62" , "Fizz" , "64" , "Buzz" , "Fizz" , "67" , "68" , "Fizz" , "Buzz" ,
+    "71" , "Fizz" , "73" , "74" , "FizzBuzz" , "76" , "77" , "Fizz" , "79" , "Buzz" ,
+    "Fizz" , "82" , "83" , "Fizz" , "Buzz" , "86" , "Fizz" , "88" , "89" , "FizzBuzz" ,
+    "91" , "92" , "Fizz" , "94" , "Buzz" , "Fizz" , "97" , "98" , "Fizz" , "Buzz"
   )
 
   private lazy val _fizz_buzz = FizzBuzz_ ()
@@ -33,7 +33,7 @@ case class FizzBuzzSpec ()
 
   test ("first elements of FizzBuzz") (
     check (
-      obtained = _fizz_buzz.apply
+      obtained = _fizz_buzz .apply
     ) (
       expected = expected_result
     )
@@ -41,7 +41,7 @@ case class FizzBuzzSpec ()
 
   test ("first elements of FizzBuzz with pattern matching") (
     check (
-      obtained = _fizz_buzz_pattern_matching.apply
+      obtained = _fizz_buzz_pattern_matching .apply
     ) (
       expected = expected_result
     )
@@ -62,7 +62,7 @@ case class PatternMatchingSpec ()
 
   test ("get value and name of singleton - 1") (
     check (
-      obtained = instance.get_value (Singleton_ (5) )
+      obtained = instance .get_value (Singleton_ (5) )
     ) (
       expected = 5
     )
@@ -70,15 +70,15 @@ case class PatternMatchingSpec ()
 
   test ("get value and name of singleton - 2") (
     check (
-      obtained = instance.get_type_name (Singleton_ (5) )
+      obtained = instance .get_type_name (Singleton_ (5) )
     ) (
-      expected = "singleton(x)"
+      expected = "singleton (x)"
     )
   )
 
   test ("get value and name of pair - 1") (
     check (
-      obtained = instance.get_value (Pair_ (10, 100) )
+      obtained = instance .get_value (Pair_ (10 , 100) )
     ) (
       expected = 55
     )
@@ -86,15 +86,15 @@ case class PatternMatchingSpec ()
 
   test ("get value and name of pair - 2") (
     check (
-      obtained = instance.get_type_name (Pair_ (10, 100) )
+      obtained = instance .get_type_name (Pair_ (10 , 100) )
     ) (
-      expected = "pair(x, y)"
+      expected = "pair (x , y)"
     )
   )
 
   test ("get value and name of triplet - 1") (
     check (
-      obtained = instance.get_value (Triplet_ (9, 100, 890) )
+      obtained = instance .get_value (Triplet_ (9 , 100 , 890) )
     ) (
       expected = 333
     )
@@ -102,9 +102,9 @@ case class PatternMatchingSpec ()
 
   test ("get value and name of triplet - 2") (
     check (
-      obtained = instance.get_type_name (Triplet_ (9, 100, 890) )
+      obtained = instance .get_type_name (Triplet_ (9 , 100 , 890) )
     ) (
-      expected = "triplet(x, y, z)"
+      expected = "triplet (x , y , z)"
     )
   )
 
@@ -126,15 +126,15 @@ case class SaladIngredient_ (ordinal : Int, name : String) extends SaladIngredie
 trait SaladIngredientConstant
 {
 
-  lazy val tomato = SaladIngredient_ (1, "tomato")
+  lazy val tomato = SaladIngredient_ (1 , "tomato")
 
-  lazy val lettuce = SaladIngredient_ (2, "lettuce")
+  lazy val lettuce = SaladIngredient_ (2 , "lettuce")
 
-  lazy val sunflower_seeds = SaladIngredient_ (3, "sunflower seeds")
+  lazy val sunflower_seeds = SaladIngredient_ (3 , "sunflower seeds")
 
-  lazy val olive_oil = SaladIngredient_ (4, "olive_oil")
+  lazy val olive_oil = SaladIngredient_ (4 , "olive_oil")
 
-  lazy val SaladIngredient_values = Seq (tomato, lettuce, sunflower_seeds, olive_oil)
+  lazy val SaladIngredient_values = Seq (tomato , lettuce , sunflower_seeds , olive_oil)
 
 }
 
@@ -150,23 +150,23 @@ case class SaladMakerSpec ()
     assert (obtained == expected)
 
   def add_next_ingredient (salad_so_far : Seq [SaladIngredient] ) (ingredient : SaladIngredient) : Seq [SaladIngredient] =
-    salad_so_far.+: (ingredient)
+    salad_so_far .+: (ingredient)
 
   def has_salad_at_most_2_ingredients (salad_so_far : Seq [SaladIngredient] ) (next_ingredient : SaladIngredient) : Boolean =
-    salad_so_far.length < 3
+    salad_so_far .length < 3
 
   private lazy val _salad_maker = SaladMaker_ ()
 
   test ("salad maker") (
     check (
-      obtained = _salad_maker.apply (
+      obtained = _salad_maker .apply (
         list_of_ingredients = SaladIngredient_values) (
         initial_bowl = Seq [SaladIngredient] () ) (
         next_ingredient_function = add_next_ingredient) (
         condition_to_continue = has_salad_at_most_2_ingredients
       )
     ) (
-      expected = Seq (sunflower_seeds, lettuce, tomato)
+      expected = Seq (sunflower_seeds , lettuce , tomato)
     )
   )
 
@@ -183,13 +183,13 @@ case class SortExampleSpec ()
   def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  lazy val sorted_sequence = Seq (1, 3, 5, 5, 8, 9)
+  lazy val sorted_sequence = Seq (1 , 3 , 5 , 5 , 8 , 9)
 
-  lazy val unsorted_sequence = Seq (1, 3, 5, 4, 8, 9)
+  lazy val unsorted_sequence = Seq (1 , 3 , 5 , 4 , 8 , 9)
 
   test ("test sorted sequence with at") (
     check (
-      obtained = SortExampleWithAt_ ().is_sorted (sorted_sequence)
+      obtained = SortExampleWithAt_ () .is_sorted (sorted_sequence)
     ) (
       expected = true
     )
@@ -197,7 +197,7 @@ case class SortExampleSpec ()
 
   test ("test unsorted sequence with at") (
     check (
-      obtained = SortExampleWithAt_ ().is_sorted (unsorted_sequence)
+      obtained = SortExampleWithAt_ () .is_sorted (unsorted_sequence)
     ) (
       expected = false
     )
@@ -205,7 +205,7 @@ case class SortExampleSpec ()
 
   test ("test sorted sequence with zip") (
     check (
-      obtained = SortExampleWithZip_ ().is_sorted (sorted_sequence)
+      obtained = SortExampleWithZip_ () .is_sorted (sorted_sequence)
     ) (
       expected = true
     )
@@ -213,7 +213,7 @@ case class SortExampleSpec ()
 
   test ("test unsorted sequence with zip") (
     check (
-      obtained = SortExampleWithZip_ ().is_sorted (unsorted_sequence)
+      obtained = SortExampleWithZip_ () .is_sorted (unsorted_sequence)
     ) (
       expected = false
     )
@@ -221,33 +221,33 @@ case class SortExampleSpec ()
 
   test ("insert sorted simple") (
     check (
-      obtained = SortAlgorithmExampleWithFold_ ().insert_sorted (Seq (1, 2, 3, 6, 8, 9) ) (5)
+      obtained = SortAlgorithmExampleWithFold_ () .insert_sorted (Seq (1 , 2 , 3 , 6 , 8 , 9) ) (5)
     ) (
-      expected = Seq (1, 2, 3, 5, 6, 8, 9)
+      expected = Seq (1 , 2 , 3 , 5 , 6 , 8 , 9)
     )
   )
 
   test ("insert sorted with repetition") (
     check (
-      obtained = SortAlgorithmExampleWithFold_ ().insert_sorted (Seq (1, 2, 3, 5, 6, 8, 9) ) (5)
+      obtained = SortAlgorithmExampleWithFold_ () .insert_sorted (Seq (1 , 2 , 3 , 5 , 6 , 8 , 9) ) (5)
     ) (
-      expected = Seq (1, 2, 3, 5, 5, 6, 8, 9)
+      expected = Seq (1 , 2 , 3 , 5 , 5 , 6 , 8 , 9)
     )
   )
 
   test ("sort unsorted sequence") (
     check (
-      obtained = SortAlgorithmExampleWithFold_ ().sort (Seq (3, 5, 1, 9, 8, 4) )
+      obtained = SortAlgorithmExampleWithFold_ () .sort (Seq (3 , 5 , 1 , 9 , 8 , 4) )
     ) (
-      expected = Seq (1, 3, 4, 5, 8 ,9)
+      expected = Seq (1 , 3 , 4 , 5 , 8 , 9)
     )
   )
 
   test ("sort unsorted sequence applying constraints to verify correctness") (
     check (
-      obtained = ConstrainedSortAlgorithm_ ().sort (Seq (3, 5, 1, 9, 8, 4) )
+      obtained = ConstrainedSortAlgorithm_ () .sort (Seq (3 , 5 , 1 , 9 , 8 , 4) )
     ) (
-      expected = SomeSD_ (Seq (1, 3, 4, 5, 8 ,9) )
+      expected = SomeSD_ (Seq (1 , 3 , 4 , 5 , 8 , 9) )
     )
   )
 
@@ -255,11 +255,11 @@ case class SortExampleSpec ()
     check (
       obtained =
         SortedSequenceBuilder_ [Integer] ()
-          .build ( Seq (3, 5, 1, 9, 8, 4).map ( x => Integer.valueOf (x) ) )
+          .build (Seq (3 , 5 , 1 , 9 , 8 , 4) .map ( x => Integer .valueOf (x) ) )
           .sequence
-          .map ( x => x.intValue)
+          .map ( x => x .intValue)
     ) (
-      expected = Seq (1, 3, 4, 5, 8 ,9)
+      expected = Seq (1 , 3 , 4 , 5 , 8 , 9)
     )
   )
 
diff --git a/examples/src/test/scala/soda/example/algorithms/PatternMatchingSpec.soda b/examples/src/test/scala/soda/example/algorithms/PatternMatchingSpec.soda
index 833db25b..6d19ca68 100644
--- a/examples/src/test/scala/soda/example/algorithms/PatternMatchingSpec.soda
+++ b/examples/src/test/scala/soda/example/algorithms/PatternMatchingSpec.soda
@@ -10,7 +10,7 @@ class PatternMatchingSpec ()
 
   test ("get value and name of singleton - 1") (
     check (
-      obtained := instance.get_value (Singleton_ (5) )
+      obtained := instance .get_value (Singleton_ (5) )
     ) (
       expected := 5
     )
@@ -18,15 +18,15 @@ class PatternMatchingSpec ()
 
   test ("get value and name of singleton - 2") (
     check (
-      obtained := instance.get_type_name (Singleton_ (5) )
+      obtained := instance .get_type_name (Singleton_ (5) )
     ) (
-      expected := "singleton(x)"
+      expected := "singleton (x)"
     )
   )
 
   test ("get value and name of pair - 1") (
     check (
-      obtained := instance.get_value (Pair_ (10, 100) )
+      obtained := instance .get_value (Pair_ (10 , 100) )
     ) (
       expected := 55
     )
@@ -34,15 +34,15 @@ class PatternMatchingSpec ()
 
   test ("get value and name of pair - 2") (
     check (
-      obtained := instance.get_type_name (Pair_ (10, 100) )
+      obtained := instance .get_type_name (Pair_ (10 , 100) )
     ) (
-      expected := "pair(x, y)"
+      expected := "pair (x , y)"
     )
   )
 
   test ("get value and name of triplet - 1") (
     check (
-      obtained := instance.get_value (Triplet_ (9, 100, 890) )
+      obtained := instance .get_value (Triplet_ (9 , 100 , 890) )
     ) (
       expected := 333
     )
@@ -50,9 +50,9 @@ class PatternMatchingSpec ()
 
   test ("get value and name of triplet - 2") (
     check (
-      obtained := instance.get_type_name (Triplet_ (9, 100, 890) )
+      obtained := instance .get_type_name (Triplet_ (9 , 100 , 890) )
     ) (
-      expected := "triplet(x, y, z)"
+      expected := "triplet (x , y , z)"
     )
   )
 
diff --git a/examples/src/test/scala/soda/example/algorithms/SaladMakerSpec.soda b/examples/src/test/scala/soda/example/algorithms/SaladMakerSpec.soda
index 250b8db9..417de013 100644
--- a/examples/src/test/scala/soda/example/algorithms/SaladMakerSpec.soda
+++ b/examples/src/test/scala/soda/example/algorithms/SaladMakerSpec.soda
@@ -11,15 +11,15 @@ end
 
 class SaladIngredientConstant
 
-  tomato = SaladIngredient_ (1, "tomato")
+  tomato = SaladIngredient_ (1 , "tomato")
 
-  lettuce = SaladIngredient_ (2, "lettuce")
+  lettuce = SaladIngredient_ (2 , "lettuce")
 
-  sunflower_seeds = SaladIngredient_ (3, "sunflower seeds")
+  sunflower_seeds = SaladIngredient_ (3 , "sunflower seeds")
 
-  olive_oil = SaladIngredient_ (4, "olive_oil")
+  olive_oil = SaladIngredient_ (4 , "olive_oil")
 
-  SaladIngredient_values = Seq (tomato, lettuce, sunflower_seeds, olive_oil)
+  SaladIngredient_values = Seq (tomato , lettuce , sunflower_seeds , olive_oil)
 
 end
 
@@ -32,23 +32,23 @@ class SaladMakerSpec ()
     assert (obtained == expected)
 
   add_next_ingredient (salad_so_far : Seq [SaladIngredient] ) (ingredient : SaladIngredient) : Seq [SaladIngredient] =
-    salad_so_far.+: (ingredient)
+    salad_so_far .+: (ingredient)
 
   has_salad_at_most_2_ingredients (salad_so_far : Seq [SaladIngredient] ) (next_ingredient : SaladIngredient) : Boolean =
-    salad_so_far.length < 3
+    salad_so_far .length < 3
 
   _salad_maker = SaladMaker_ ()
 
   test ("salad maker") (
     check (
-      obtained := _salad_maker.apply (
+      obtained := _salad_maker .apply (
         list_of_ingredients := SaladIngredient_values) (
         initial_bowl := Seq [SaladIngredient] () ) (
         next_ingredient_function := add_next_ingredient) (
         condition_to_continue := has_salad_at_most_2_ingredients
       )
     ) (
-      expected := Seq (sunflower_seeds, lettuce, tomato)
+      expected := Seq (sunflower_seeds , lettuce , tomato)
     )
   )
 
diff --git a/examples/src/test/scala/soda/example/algorithms/SortExampleSpec.soda b/examples/src/test/scala/soda/example/algorithms/SortExampleSpec.soda
index 47e7bfcb..f81a1b2e 100644
--- a/examples/src/test/scala/soda/example/algorithms/SortExampleSpec.soda
+++ b/examples/src/test/scala/soda/example/algorithms/SortExampleSpec.soda
@@ -9,13 +9,13 @@ class SortExampleSpec ()
   check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  sorted_sequence = Seq (1, 3, 5, 5, 8, 9)
+  sorted_sequence = Seq (1 , 3 , 5 , 5 , 8 , 9)
 
-  unsorted_sequence = Seq (1, 3, 5, 4, 8, 9)
+  unsorted_sequence = Seq (1 , 3 , 5 , 4 , 8 , 9)
 
   test ("test sorted sequence with at") (
     check (
-      obtained := SortExampleWithAt_ ().is_sorted (sorted_sequence)
+      obtained := SortExampleWithAt_ () .is_sorted (sorted_sequence)
     ) (
       expected := true
     )
@@ -23,7 +23,7 @@ class SortExampleSpec ()
 
   test ("test unsorted sequence with at") (
     check (
-      obtained := SortExampleWithAt_ ().is_sorted (unsorted_sequence)
+      obtained := SortExampleWithAt_ () .is_sorted (unsorted_sequence)
     ) (
       expected := false
     )
@@ -31,7 +31,7 @@ class SortExampleSpec ()
 
   test ("test sorted sequence with zip") (
     check (
-      obtained := SortExampleWithZip_ ().is_sorted (sorted_sequence)
+      obtained := SortExampleWithZip_ () .is_sorted (sorted_sequence)
     ) (
       expected := true
     )
@@ -39,7 +39,7 @@ class SortExampleSpec ()
 
   test ("test unsorted sequence with zip") (
     check (
-      obtained := SortExampleWithZip_ ().is_sorted (unsorted_sequence)
+      obtained := SortExampleWithZip_ () .is_sorted (unsorted_sequence)
     ) (
       expected := false
     )
@@ -47,33 +47,33 @@ class SortExampleSpec ()
 
   test ("insert sorted simple") (
     check (
-      obtained := SortAlgorithmExampleWithFold_ ().insert_sorted (Seq (1, 2, 3, 6, 8, 9) ) (5)
+      obtained := SortAlgorithmExampleWithFold_ () .insert_sorted (Seq (1 , 2 , 3 , 6 , 8 , 9) ) (5)
     ) (
-      expected := Seq (1, 2, 3, 5, 6, 8, 9)
+      expected := Seq (1 , 2 , 3 , 5 , 6 , 8 , 9)
     )
   )
 
   test ("insert sorted with repetition") (
     check (
-      obtained := SortAlgorithmExampleWithFold_ ().insert_sorted (Seq (1, 2, 3, 5, 6, 8, 9) ) (5)
+      obtained := SortAlgorithmExampleWithFold_ () .insert_sorted (Seq (1 , 2 , 3 , 5 , 6 , 8 , 9) ) (5)
     ) (
-      expected := Seq (1, 2, 3, 5, 5, 6, 8, 9)
+      expected := Seq (1 , 2 , 3 , 5 , 5 , 6 , 8 , 9)
     )
   )
 
   test ("sort unsorted sequence") (
     check (
-      obtained := SortAlgorithmExampleWithFold_ ().sort (Seq (3, 5, 1, 9, 8, 4) )
+      obtained := SortAlgorithmExampleWithFold_ () .sort (Seq (3 , 5 , 1 , 9 , 8 , 4) )
     ) (
-      expected := Seq (1, 3, 4, 5, 8 ,9)
+      expected := Seq (1 , 3 , 4 , 5 , 8 , 9)
     )
   )
 
   test ("sort unsorted sequence applying constraints to verify correctness") (
     check (
-      obtained := ConstrainedSortAlgorithm_ ().sort (Seq (3, 5, 1, 9, 8, 4) )
+      obtained := ConstrainedSortAlgorithm_ () .sort (Seq (3 , 5 , 1 , 9 , 8 , 4) )
     ) (
-      expected := SomeSD_ (Seq (1, 3, 4, 5, 8 ,9) )
+      expected := SomeSD_ (Seq (1 , 3 , 4 , 5 , 8 , 9) )
     )
   )
 
@@ -81,11 +81,11 @@ class SortExampleSpec ()
     check (
       obtained :=
         SortedSequenceBuilder_ [Integer] ()
-          .build ( Seq (3, 5, 1, 9, 8, 4).map (lambda x -> Integer.valueOf (x) ) )
+          .build (Seq (3 , 5 , 1 , 9 , 8 , 4) .map (lambda x -> Integer .valueOf (x) ) )
           .sequence
-          .map (lambda x --> x.intValue)
+          .map (lambda x --> x .intValue)
     ) (
-      expected := Seq (1, 3, 4, 5, 8 ,9)
+      expected := Seq (1 , 3 , 4 , 5 , 8 , 9)
     )
   )
 
diff --git a/examples/src/test/scala/soda/example/ethicalissues/fairness/FairnessSpec.soda b/examples/src/test/scala/soda/example/ethicalissues/fairness/FairnessSpec.soda
index 149469f3..60c701c9 100644
--- a/examples/src/test/scala/soda/example/ethicalissues/fairness/FairnessSpec.soda
+++ b/examples/src/test/scala/soda/example/ethicalissues/fairness/FairnessSpec.soda
@@ -8,15 +8,15 @@ class FairnessSpec ()
 
   rank_1 : Applicant -> Double =
     lambda applicant -->
-      applicant.background_score * 2
+      applicant .background_score * 2
 
   rank_2 : Applicant -> Double =
     lambda applicant -->
-      (1 - applicant.background_score) * 2
+      (1 - applicant .background_score) * 2
 
   test ("simple test for fairness (true)") (
     check (
-      obtained := Fairness_ (score_difference_tolerance := 2, ranking_difference_tolerance := 5, rank_1)
+      obtained := Fairness_ (score_difference_tolerance := 2 , ranking_difference_tolerance := 5 , rank_1)
         .is_fair (Applicant_ (78) ) (Applicant_ (77) )
     ) (
       expected := true
@@ -25,7 +25,7 @@ class FairnessSpec ()
 
   test ("simple test for fairness (false)") (
     check (
-      Fairness_ (score_difference_tolerance := 2, ranking_difference_tolerance := 1, rank_2)
+      Fairness_ (score_difference_tolerance := 2 , ranking_difference_tolerance := 1 , rank_2)
         .is_fair (Applicant_ (78) ) (Applicant_ (77) )
     ) (
       expected := false
diff --git a/examples/src/test/scala/soda/example/ethicalissues/fairness/Package.scala b/examples/src/test/scala/soda/example/ethicalissues/fairness/Package.scala
index 26327453..27b6e7ed 100644
--- a/examples/src/test/scala/soda/example/ethicalissues/fairness/Package.scala
+++ b/examples/src/test/scala/soda/example/ethicalissues/fairness/Package.scala
@@ -16,15 +16,15 @@ case class FairnessSpec ()
 
   lazy val rank_1 : Applicant => Double =
      applicant =>
-      applicant.background_score * 2
+      applicant .background_score * 2
 
   lazy val rank_2 : Applicant => Double =
      applicant =>
-      (1 - applicant.background_score) * 2
+      (1 - applicant .background_score) * 2
 
   test ("simple test for fairness (true)") (
     check (
-      obtained = Fairness_ (score_difference_tolerance = 2, ranking_difference_tolerance = 5, rank_1)
+      obtained = Fairness_ (score_difference_tolerance = 2 , ranking_difference_tolerance = 5 , rank_1)
         .is_fair (Applicant_ (78) ) (Applicant_ (77) )
     ) (
       expected = true
@@ -33,7 +33,7 @@ case class FairnessSpec ()
 
   test ("simple test for fairness (false)") (
     check (
-      Fairness_ (score_difference_tolerance = 2, ranking_difference_tolerance = 1, rank_2)
+      Fairness_ (score_difference_tolerance = 2 , ranking_difference_tolerance = 1 , rank_2)
         .is_fair (Applicant_ (78) ) (Applicant_ (77) )
     ) (
       expected = false
diff --git a/examples/src/test/scala/soda/example/ethicalissues/pricemonitor/Package.scala b/examples/src/test/scala/soda/example/ethicalissues/pricemonitor/Package.scala
index 4a24bcad..26731856 100644
--- a/examples/src/test/scala/soda/example/ethicalissues/pricemonitor/Package.scala
+++ b/examples/src/test/scala/soda/example/ethicalissues/pricemonitor/Package.scala
@@ -18,7 +18,7 @@ trait UnfairPricingAgent
           get_price_for (customer) (flight) (date)
 
   def get_price_for (customer : Customer) (flight : Flight) (date : Int) : Int =
-    customer.name.length * (date % 100 + 100 * flight.intermediate_airports.length + 1)
+    customer .name .length * (date % 100 + 100 * flight .intermediate_airports .length + 1)
 
 }
 
@@ -36,7 +36,7 @@ trait FairPricingAgent
           get_price_for (customer) (flight) (date)
 
   def get_price_for (customer : Customer) (flight : Flight) (date : Int) : Int =
-    100 * (flight.intermediate_airports.length + 1)
+    100 * (flight .intermediate_airports .length + 1)
 
 }
 
@@ -57,86 +57,86 @@ case class PriceMonitorSpec ()
 
   lazy val unfair_pricing_agent = UnfairPricingAgent_ ()
 
-  lazy val customer_1 = Customer_ (name = "Jon", ip_address = "127.0.0.1")
+  lazy val customer_1 = Customer_ (name = "Jon" , ip_address = "127.0.0.1")
 
-  lazy val customer_2 = Customer_ (name = "Maria", ip_address = "192.168.1.1")
+  lazy val customer_2 = Customer_ (name = "Maria" , ip_address = "192.168.1.1")
 
-  lazy val flight_1 = Flight_ ("BER", Seq ("FRA", "ARN"), "UMU")
+  lazy val flight_1 = Flight_ ("BER" , Seq ("FRA" , "ARN") , "UMU")
 
   lazy val date_1 = 18898
 
   test ("unfair pricing agent - requirement_monitor 1") (
     check (
-      obtained = Requirement1Monitor_ (unfair_pricing_agent).get_report (customer_1) (customer_2) (flight_1) (date_1)
+      obtained = Requirement1Monitor_ (unfair_pricing_agent) .get_report (customer_1) (customer_2) (flight_1) (date_1)
     ) (
-      expected = Report1_ (false, 897, 1495, 0.6)
+      expected = Report1_ (false , 897 , 1495 , 0.6)
     )
   )
 
   test ("unfair pricing agent - requirement_monitor 2") (
     check (
-      obtained = Requirement2Monitor_ (unfair_pricing_agent).get_report (customer_1) (flight_1) (date_1)
+      obtained = Requirement2Monitor_ (unfair_pricing_agent) .get_report (customer_1) (flight_1) (date_1)
     ) (
-      expected = Report2_ (false, 702, 897)
+      expected = Report2_ (false , 702 , 897)
     )
   )
 
   test ("unfair pricing agent - requirement_monitor 3") (
     check (
-      obtained = Requirement3Monitor_ (unfair_pricing_agent).get_report (customer_1) (flight_1) (date_1)
+      obtained = Requirement3Monitor_ (unfair_pricing_agent) .get_report (customer_1) (flight_1) (date_1)
     ) (
-      expected = Report3_ (false, 897, 891)
+      expected = Report3_ (false , 897 , 891)
     )
   )
 
   test ("fair pricing agent - requirement_monitor 1") (
     check (
-      obtained = Requirement1Monitor_ (fair_pricing_agent).get_report (customer_1) (customer_2) (flight_1) (date_1)
+      obtained = Requirement1Monitor_ (fair_pricing_agent) .get_report (customer_1) (customer_2) (flight_1) (date_1)
     ) (
-      expected = Report1_ (true, 300, 300, 1.0)
+      expected = Report1_ (true , 300 , 300 , 1.0)
     )
   )
 
   test ("fair pricing agent - requirement_monitor 2") (
     check (
-      obtained = Requirement2Monitor_ (fair_pricing_agent).get_report (customer_1) (flight_1) (date_1)
+      obtained = Requirement2Monitor_ (fair_pricing_agent) .get_report (customer_1) (flight_1) (date_1)
     ) (
-      expected = Report2_ (true, 300, 300)
+      expected = Report2_ (true , 300 , 300)
     )
   )
 
   test ("fair pricing agent - requirement_monitor 3") (
     check (
-      obtained = Requirement3Monitor_ (fair_pricing_agent).get_report (customer_1) (flight_1) (date_1)
+      obtained = Requirement3Monitor_ (fair_pricing_agent) .get_report (customer_1) (flight_1) (date_1)
     ) (
-      expected = Report3_ (true, 300, 300)
+      expected = Report3_ (true , 300 , 300)
     )
   )
 
   test ("get number of days for 1970-01-01") (
     check (
-      obtained = fair_pricing_agent.get_days_for (_calendar_0.getTime)
+      obtained = fair_pricing_agent .get_days_for (_calendar_0 .getTime)
     ) (
       expected = 0
     )
   )
 
-  private lazy val _calendar_0 = new Calendar.Builder ()
-    .setTimeZone (TimeZone.getTimeZone ("UTC"))
-    .setDate (1970, 0, 1)
+  private lazy val _calendar_0 = new Calendar .Builder ()
+    .setTimeZone (TimeZone .getTimeZone ("UTC"))
+    .setDate (1970 , 0 , 1)
     .build
 
   test ("get number of days for 2021-09-28") (
     check (
-      obtained = fair_pricing_agent.get_days_for (_calendar_1.getTime)
+      obtained = fair_pricing_agent .get_days_for (_calendar_1 .getTime)
     ) (
       expected = 18898
     )
   )
 
-  private lazy val _calendar_1 = new Calendar.Builder ()
-    .setTimeZone (TimeZone.getTimeZone ("UTC"))
-    .setDate (2021, 8, 28)
+  private lazy val _calendar_1 = new Calendar .Builder ()
+    .setTimeZone (TimeZone .getTimeZone ("UTC"))
+    .setDate (2021 , 8 , 28)
     .build
 
 }
diff --git a/examples/src/test/scala/soda/example/ethicalissues/pricemonitor/PriceMonitorSpec.soda b/examples/src/test/scala/soda/example/ethicalissues/pricemonitor/PriceMonitorSpec.soda
index 0ef771b5..b06a9b8f 100644
--- a/examples/src/test/scala/soda/example/ethicalissues/pricemonitor/PriceMonitorSpec.soda
+++ b/examples/src/test/scala/soda/example/ethicalissues/pricemonitor/PriceMonitorSpec.soda
@@ -10,7 +10,7 @@ class UnfairPricingAgent
           get_price_for (customer) (flight) (date)
 
   get_price_for (customer : Customer) (flight : Flight) (date : Int) : Int =
-    customer.name.length * (date % 100 + 100 * flight.intermediate_airports.length + 1)
+    customer .name .length * (date % 100 + 100 * flight .intermediate_airports .length + 1)
 
 end
 
@@ -25,7 +25,7 @@ class FairPricingAgent
           get_price_for (customer) (flight) (date)
 
   get_price_for (customer : Customer) (flight : Flight) (date : Int) : Int =
-    100 * (flight.intermediate_airports.length + 1)
+    100 * (flight .intermediate_airports .length + 1)
 
 end
 
@@ -44,86 +44,86 @@ class PriceMonitorSpec ()
 
   unfair_pricing_agent = UnfairPricingAgent_ ()
 
-  customer_1 = Customer_ (name := "Jon", ip_address := "127.0.0.1")
+  customer_1 = Customer_ (name := "Jon" , ip_address := "127.0.0.1")
 
-  customer_2 = Customer_ (name := "Maria", ip_address := "192.168.1.1")
+  customer_2 = Customer_ (name := "Maria" , ip_address := "192.168.1.1")
 
-  flight_1 = Flight_ ("BER", Seq ("FRA", "ARN"), "UMU")
+  flight_1 = Flight_ ("BER" , Seq ("FRA" , "ARN") , "UMU")
 
   date_1 = 18898
 
   test ("unfair pricing agent - requirement_monitor 1") (
     check (
-      obtained := Requirement1Monitor_ (unfair_pricing_agent).get_report (customer_1) (customer_2) (flight_1) (date_1)
+      obtained := Requirement1Monitor_ (unfair_pricing_agent) .get_report (customer_1) (customer_2) (flight_1) (date_1)
     ) (
-      expected := Report1_ (false, 897, 1495, 0.6)
+      expected := Report1_ (false , 897 , 1495 , 0.6)
     )
   )
 
   test ("unfair pricing agent - requirement_monitor 2") (
     check (
-      obtained := Requirement2Monitor_ (unfair_pricing_agent).get_report (customer_1) (flight_1) (date_1)
+      obtained := Requirement2Monitor_ (unfair_pricing_agent) .get_report (customer_1) (flight_1) (date_1)
     ) (
-      expected := Report2_ (false, 702, 897)
+      expected := Report2_ (false , 702 , 897)
     )
   )
 
   test ("unfair pricing agent - requirement_monitor 3") (
     check (
-      obtained := Requirement3Monitor_ (unfair_pricing_agent).get_report (customer_1) (flight_1) (date_1)
+      obtained := Requirement3Monitor_ (unfair_pricing_agent) .get_report (customer_1) (flight_1) (date_1)
     ) (
-      expected := Report3_ (false, 897, 891)
+      expected := Report3_ (false , 897 , 891)
     )
   )
 
   test ("fair pricing agent - requirement_monitor 1") (
     check (
-      obtained := Requirement1Monitor_ (fair_pricing_agent).get_report (customer_1) (customer_2) (flight_1) (date_1)
+      obtained := Requirement1Monitor_ (fair_pricing_agent) .get_report (customer_1) (customer_2) (flight_1) (date_1)
     ) (
-      expected := Report1_ (true, 300, 300, 1.0)
+      expected := Report1_ (true , 300 , 300 , 1.0)
     )
   )
 
   test ("fair pricing agent - requirement_monitor 2") (
     check (
-      obtained := Requirement2Monitor_ (fair_pricing_agent).get_report (customer_1) (flight_1) (date_1)
+      obtained := Requirement2Monitor_ (fair_pricing_agent) .get_report (customer_1) (flight_1) (date_1)
     ) (
-      expected := Report2_ (true, 300, 300)
+      expected := Report2_ (true , 300 , 300)
     )
   )
 
   test ("fair pricing agent - requirement_monitor 3") (
     check (
-      obtained := Requirement3Monitor_ (fair_pricing_agent).get_report (customer_1) (flight_1) (date_1)
+      obtained := Requirement3Monitor_ (fair_pricing_agent) .get_report (customer_1) (flight_1) (date_1)
     ) (
-      expected := Report3_ (true, 300, 300)
+      expected := Report3_ (true , 300 , 300)
     )
   )
 
   test ("get number of days for 1970-01-01") (
     check (
-      obtained := fair_pricing_agent.get_days_for (_calendar_0.getTime)
+      obtained := fair_pricing_agent .get_days_for (_calendar_0 .getTime)
     ) (
       expected := 0
     )
   )
 
-  _calendar_0 = @new Calendar.Builder ()
-    .setTimeZone (TimeZone.getTimeZone ("UTC"))
-    .setDate (1970, 0, 1)
+  _calendar_0 = @new Calendar .Builder ()
+    .setTimeZone (TimeZone .getTimeZone ("UTC"))
+    .setDate (1970 , 0 , 1)
     .build
 
   test ("get number of days for 2021-09-28") (
     check (
-      obtained := fair_pricing_agent.get_days_for (_calendar_1.getTime)
+      obtained := fair_pricing_agent .get_days_for (_calendar_1 .getTime)
     ) (
       expected := 18898
     )
   )
 
-  _calendar_1 = @new Calendar.Builder ()
-    .setTimeZone (TimeZone.getTimeZone ("UTC"))
-    .setDate (2021, 8, 28)
+  _calendar_1 = @new Calendar .Builder ()
+    .setTimeZone (TimeZone .getTimeZone ("UTC"))
+    .setDate (2021 , 8 , 28)
     .build
 
 end
diff --git a/examples/src/test/scala/soda/example/forcoq/algorithms/Package.scala b/examples/src/test/scala/soda/example/forcoq/algorithms/Package.scala
index 63d9f519..71c8e9a6 100644
--- a/examples/src/test/scala/soda/example/forcoq/algorithms/Package.scala
+++ b/examples/src/test/scala/soda/example/forcoq/algorithms/Package.scala
@@ -14,48 +14,48 @@ case class RecursionForCoqSpec ()
   def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  lazy val example_seq : Seq [Int] = Seq (0, 1, 1, 2, 3, 5, 8)
+  lazy val example_seq : Seq [Int] = Seq (0 , 1 , 1 , 2 , 3 , 5 , 8)
 
   test ("fold left while with Seq") (
     check (
-      obtained = RecursionForCoq_ ().fold4 (example_seq) (_fold_left_while_initial_value) (_fold_left_while_next_value_function) (_fold_left_while_condition)
+      obtained = RecursionForCoq_ () .fold4 (example_seq) (_fold_left_while_initial_value) (_fold_left_while_next_value_function) (_fold_left_while_condition)
     ) (
-      expected = Seq ("103", "102", "101", "101", "100")
+      expected = Seq ("103" , "102" , "101" , "101" , "100")
     )
   )
 
   private lazy val _fold_left_while_initial_value = Seq [String] ()
 
   private lazy val _fold_left_while_next_value_function : Seq [String] => Int => Seq [String] =
-     (s : Seq [String]) =>  (e : Int) => s .+:  ("" +  (e + 100))
+     (s : Seq [String] ) =>  (e : Int) => s  .+: ("" +  (e + 100))
 
   private lazy val _fold_left_while_condition : Seq [String] => Int => Boolean =
-     (s : Seq [String]) =>  (e : Int) => e < 5
+     (s : Seq [String] ) =>  (e : Int) => e < 5
 
   test ("fold left with Seq") (
     check (
-      obtained = RecursionForCoq_ ().fold3 (example_seq) (_fold_left_initial_value) (_fold_left_next_value_function)
+      obtained = RecursionForCoq_ () .fold3 (example_seq) (_fold_left_initial_value) (_fold_left_next_value_function)
     ) (
-      expected = Seq ("108", "105", "103", "102", "101", "101", "100")
+      expected = Seq ("108" , "105" , "103" , "102" , "101" , "101" , "100")
     )
   )
 
   private lazy val _fold_left_initial_value = Seq [String] ()
 
   private lazy val _fold_left_next_value_function : Seq [String] => Int => Seq [String] =
-     (s : Seq [String]) =>  (e : Int) => s .+:  ("" +  (e + 100))
+     (s : Seq [String]) =>  (e : Int) => s .+: ("" + (e + 100))
 
   test ("range with positive number") (
     check (
-      obtained = RecursionForCoq_ ().range  (8)
+      obtained = RecursionForCoq_ () .range (8)
     ) (
-      expected = Seq [Int] (0, 1, 2, 3, 4, 5, 6, 7)
+      expected = Seq [Int] (0 , 1 , 2 , 3 , 4 , 5 , 6 , 7)
     )
   )
 
   test ("range with zero size") (
     check (
-      obtained = RecursionForCoq_ ().range  (-1)
+      obtained = RecursionForCoq_ () .range (-1)
     ) (
       expected = Seq [Int] ()
     )
@@ -63,7 +63,7 @@ case class RecursionForCoqSpec ()
 
   test ("range with negative number") (
     check (
-      obtained = RecursionForCoq_ ().range  (-1)
+      obtained = RecursionForCoq_ () .range (-1)
     ) (
       expected = Seq [Int] ()
     )
diff --git a/examples/src/test/scala/soda/example/forcoq/algorithms/RecursionForCoqSpec.soda b/examples/src/test/scala/soda/example/forcoq/algorithms/RecursionForCoqSpec.soda
index c6756c6d..e143f324 100644
--- a/examples/src/test/scala/soda/example/forcoq/algorithms/RecursionForCoqSpec.soda
+++ b/examples/src/test/scala/soda/example/forcoq/algorithms/RecursionForCoqSpec.soda
@@ -6,48 +6,48 @@ class RecursionForCoqSpec ()
   check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  example_seq : Seq [Int] = Seq (0, 1, 1, 2, 3, 5, 8)
+  example_seq : Seq [Int] = Seq (0 , 1 , 1 , 2 , 3 , 5 , 8)
 
   test ("fold left while with Seq") (
     check (
-      obtained := RecursionForCoq_ ().fold4 (example_seq) (_fold_left_while_initial_value) (_fold_left_while_next_value_function) (_fold_left_while_condition)
+      obtained := RecursionForCoq_ () .fold4 (example_seq) (_fold_left_while_initial_value) (_fold_left_while_next_value_function) (_fold_left_while_condition)
     ) (
-      expected := Seq ("103", "102", "101", "101", "100")
+      expected := Seq ("103" , "102" , "101" , "101" , "100")
     )
   )
 
   _fold_left_while_initial_value = Seq [String] ()
 
   _fold_left_while_next_value_function : Seq [String] -> Int -> Seq [String] =
-    lambda (s : Seq [String]) --> lambda (e : Int) --> s .+:  ("" +  (e + 100))
+    lambda (s : Seq [String] ) --> lambda (e : Int) --> s  .+: ("" +  (e + 100))
 
   _fold_left_while_condition : Seq [String] -> Int -> Boolean =
-    lambda (s : Seq [String]) --> lambda (e : Int) --> e < 5
+    lambda (s : Seq [String] ) --> lambda (e : Int) --> e < 5
 
   test ("fold left with Seq") (
     check (
-      obtained := RecursionForCoq_ ().fold3 (example_seq) (_fold_left_initial_value) (_fold_left_next_value_function)
+      obtained := RecursionForCoq_ () .fold3 (example_seq) (_fold_left_initial_value) (_fold_left_next_value_function)
     ) (
-      expected := Seq ("108", "105", "103", "102", "101", "101", "100")
+      expected := Seq ("108" , "105" , "103" , "102" , "101" , "101" , "100")
     )
   )
 
   _fold_left_initial_value = Seq [String] ()
 
   _fold_left_next_value_function : Seq [String] -> Int -> Seq [String] =
-    lambda (s : Seq [String]) --> lambda (e : Int) --> s .+:  ("" +  (e + 100))
+    lambda (s : Seq [String]) --> lambda (e : Int) --> s .+: ("" + (e + 100))
 
   test ("range with positive number") (
     check (
-      obtained := RecursionForCoq_ ().range  (8)
+      obtained := RecursionForCoq_ () .range (8)
     ) (
-      expected := Seq [Int] (0, 1, 2, 3, 4, 5, 6, 7)
+      expected := Seq [Int] (0 , 1 , 2 , 3 , 4 , 5 , 6 , 7)
     )
   )
 
   test ("range with zero size") (
     check (
-      obtained := RecursionForCoq_ ().range  (-1)
+      obtained := RecursionForCoq_ () .range (-1)
     ) (
       expected := Seq [Int] ()
     )
@@ -55,7 +55,7 @@ class RecursionForCoqSpec ()
 
   test ("range with negative number") (
     check (
-      obtained := RecursionForCoq_ ().range  (-1)
+      obtained := RecursionForCoq_ () .range (-1)
     ) (
       expected := Seq [Int] ()
     )
diff --git a/examples/src/test/scala/soda/example/forcoq/lib/ListSpec.soda b/examples/src/test/scala/soda/example/forcoq/lib/ListSpec.soda
index 0a4374ec..cc5b0a6c 100644
--- a/examples/src/test/scala/soda/example/forcoq/lib/ListSpec.soda
+++ b/examples/src/test/scala/soda/example/forcoq/lib/ListSpec.soda
@@ -8,17 +8,17 @@ class ListSpec ()
 
   test ("list from Seq") (
     check (
-      obtained := SeqList_ ().from_Seq ( Seq [Int] (0, 1, 1, 2, 3, 5) )
+      obtained := SeqList_ () .from_Seq (Seq [Int] (0 , 1 , 1 , 2 , 3 , 5) )
     ) (
-      expected := (cons_ (0, cons_ (1, cons_ (1, cons_ (2, cons_ (3, cons_ (5, nil_ [Int] () ) ) ) ) ) ) )
+      expected := (cons_ (0 , cons_ (1 , cons_ (1 , cons_ (2 , cons_ (3 , cons_ (5 , nil_ [Int] () ) ) ) ) ) ) )
     )
   )
 
   test ("list to Seq") (
     check (
-      obtained := SeqList_ ().to_Seq ( (cons_ (1, cons_ (2, cons_ (4, cons_ (8, cons_ (16, nil_ [Int] () ) ) ) ) ) ) )
+      obtained := SeqList_ () .to_Seq ( (cons_ (1 , cons_ (2 , cons_ (4 , cons_ (8 , cons_ (16 , nil_ [Int] () ) ) ) ) ) ) )
     ) (
-      expected := Seq [Int] (1, 2, 4, 8, 16)
+      expected := Seq [Int] (1 , 2 , 4 , 8 , 16)
     )
   )
 
diff --git a/examples/src/test/scala/soda/example/forcoq/lib/NatSpec.soda b/examples/src/test/scala/soda/example/forcoq/lib/NatSpec.soda
index 9c85024a..ad3ed45a 100644
--- a/examples/src/test/scala/soda/example/forcoq/lib/NatSpec.soda
+++ b/examples/src/test/scala/soda/example/forcoq/lib/NatSpec.soda
@@ -8,7 +8,7 @@ class NatSpec ()
 
   test ("IntNat from non negative") (
     check (
-      obtained := IntNat_ ().from_non_negative (8)
+      obtained := IntNat_ () .from_non_negative (8)
     ) (
       expected := S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) ) ) )
     )
@@ -16,7 +16,7 @@ class NatSpec ()
 
   test ("IntNat to Int") (
     check (
-      obtained := IntNat_ ().to_Int ( S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) )
+      obtained := IntNat_ () .to_Int ( S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) )
     ) (
       expected := 5
     )
@@ -24,7 +24,7 @@ class NatSpec ()
 
   test ("Nat add") (
     check (
-      obtained :=  S_ (S_ (S_ (O_ ( ) ) ) ).add (S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) )
+      obtained :=  S_ (S_ (S_ (O_ ( ) ) ) ) .add (S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) )
     ) (
       expected := S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) ) ) )
     )
@@ -32,7 +32,7 @@ class NatSpec ()
 
   test ("Nat mul") (
     check (
-      obtained := S_ (S_ (S_ (O_ ( ) ) ) ).mul (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) )
+      obtained := S_ (S_ (S_ (O_ ( ) ) ) ) .mul (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) )
     ) (
       expected := S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) ) ) ) ) ) ) )
     )
diff --git a/examples/src/test/scala/soda/example/forcoq/lib/Package.scala b/examples/src/test/scala/soda/example/forcoq/lib/Package.scala
index bd0dc4c9..604401f1 100644
--- a/examples/src/test/scala/soda/example/forcoq/lib/Package.scala
+++ b/examples/src/test/scala/soda/example/forcoq/lib/Package.scala
@@ -16,17 +16,17 @@ case class ListSpec ()
 
   test ("list from Seq") (
     check (
-      obtained = SeqList_ ().from_Seq ( Seq [Int] (0, 1, 1, 2, 3, 5) )
+      obtained = SeqList_ () .from_Seq (Seq [Int] (0 , 1 , 1 , 2 , 3 , 5) )
     ) (
-      expected = (cons_ (0, cons_ (1, cons_ (1, cons_ (2, cons_ (3, cons_ (5, nil_ [Int] () ) ) ) ) ) ) )
+      expected = (cons_ (0 , cons_ (1 , cons_ (1 , cons_ (2 , cons_ (3 , cons_ (5 , nil_ [Int] () ) ) ) ) ) ) )
     )
   )
 
   test ("list to Seq") (
     check (
-      obtained = SeqList_ ().to_Seq ( (cons_ (1, cons_ (2, cons_ (4, cons_ (8, cons_ (16, nil_ [Int] () ) ) ) ) ) ) )
+      obtained = SeqList_ () .to_Seq ( (cons_ (1 , cons_ (2 , cons_ (4 , cons_ (8 , cons_ (16 , nil_ [Int] () ) ) ) ) ) ) )
     ) (
-      expected = Seq [Int] (1, 2, 4, 8, 16)
+      expected = Seq [Int] (1 , 2 , 4 , 8 , 16)
     )
   )
 
@@ -43,7 +43,7 @@ case class NatSpec ()
 
   test ("IntNat from non negative") (
     check (
-      obtained = IntNat_ ().from_non_negative (8)
+      obtained = IntNat_ () .from_non_negative (8)
     ) (
       expected = S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) ) ) )
     )
@@ -51,7 +51,7 @@ case class NatSpec ()
 
   test ("IntNat to Int") (
     check (
-      obtained = IntNat_ ().to_Int ( S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) )
+      obtained = IntNat_ () .to_Int ( S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) )
     ) (
       expected = 5
     )
@@ -59,7 +59,7 @@ case class NatSpec ()
 
   test ("Nat add") (
     check (
-      obtained =  S_ (S_ (S_ (O_ ( ) ) ) ).add (S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) )
+      obtained =  S_ (S_ (S_ (O_ ( ) ) ) ) .add (S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) )
     ) (
       expected = S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) ) ) )
     )
@@ -67,7 +67,7 @@ case class NatSpec ()
 
   test ("Nat mul") (
     check (
-      obtained = S_ (S_ (S_ (O_ ( ) ) ) ).mul (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) )
+      obtained = S_ (S_ (S_ (O_ ( ) ) ) ) .mul (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) )
     ) (
       expected = S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (S_ (O_ ( ) ) ) ) ) ) ) ) ) ) ) ) )
     )
diff --git a/examples/src/test/scala/soda/example/forcoq/mathematics/FactorialForCoqSpec.soda b/examples/src/test/scala/soda/example/forcoq/mathematics/FactorialForCoqSpec.soda
index bbed5d51..4cd6a890 100644
--- a/examples/src/test/scala/soda/example/forcoq/mathematics/FactorialForCoqSpec.soda
+++ b/examples/src/test/scala/soda/example/forcoq/mathematics/FactorialForCoqSpec.soda
@@ -10,21 +10,21 @@ class FactorialForCoqSpec ()
   check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  factorial_values : Seq [ Tuple2 [Int, Int] ] = Seq (
-    (0, 1), (1, 1), (2, 2), (3, 6), (4, 24), (5, 120), (6, 720)
+  factorial_values : Seq [Tuple2 [Int] [Int] ] = Seq (
+    (0 , 1) , (1 , 1) , (2 , 2) , (3 , 6) , (4 , 24) , (5 , 120) , (6 , 720)
   )
 
-  factorial_values_with_nat : Seq [ Tuple2 [nat, nat] ] =
+  factorial_values_with_nat : Seq [ Tuple2 [nat] [nat] ] =
     factorial_values
       .map (lambda pair -->
-        Tuple2 ( IntNat_ ().from_non_negative (pair._1), IntNat_ ().from_non_negative (pair._2) )
+        Tuple2 (IntNat_ () .from_non_negative (pair ._1), IntNat_ () .from_non_negative (pair ._2) )
       )
 
   test ("should test the factorial function for Coq") (
     check (
       obtained := factorial_values_with_nat
-        .map (lambda pair --> pair._1)
-        .map (lambda n --> Tuple2 (n, FactorialForCoq_ ().get_factorial (n) ) )
+        .map (lambda pair --> pair ._1)
+        .map (lambda n --> Tuple2 (n , FactorialForCoq_ () .get_factorial (n) ) )
     ) (
       expected := factorial_values_with_nat
     )
diff --git a/examples/src/test/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoqSpec.soda b/examples/src/test/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoqSpec.soda
index 47adb253..73cfe3e7 100644
--- a/examples/src/test/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoqSpec.soda
+++ b/examples/src/test/scala/soda/example/forcoq/mathematics/FiboExampleInSodaForCoqSpec.soda
@@ -10,21 +10,21 @@ class FiboExampleInSodaForCoqSpec ()
   check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  fibonacci_values : Seq [ Tuple2 [Int, Int] ] = Seq (
-    (0, 0), (1, 1), (2, 1), (3, 2), (4, 3), (5, 5), (6, 8), (7, 13), (8, 21), (9, 34), (10, 55)
+  fibonacci_values : Seq [Tuple2 [Int] [Int] ] = Seq (
+    (0 , 0) , (1 , 1) , (2 , 1) , (3 , 2) , (4 , 3) , (5 , 5) , (6 , 8) , (7 , 13) , (8 , 21) , (9 , 34) , (10 , 55)
   )
 
-  fibonacci_values_with_nat : Seq [ Tuple2 [nat, nat] ] =
+  fibonacci_values_with_nat : Seq [Tuple2 [nat] [nat] ] =
     fibonacci_values
       .map (lambda pair -->
-        Tuple2 ( IntNat_ ().from_non_negative (pair._1), IntNat_ ().from_non_negative (pair._2) )
+        Tuple2 (IntNat_ () .from_non_negative (pair ._1), IntNat_ () .from_non_negative (pair ._2) )
       )
 
   test ("should test the fibonacci function for Coq") (
     check (
       obtained := fibonacci_values_with_nat
-        .map (lambda pair --> pair._1)
-        .map (lambda n --> Tuple2 (n, FiboExampleInSodaForCoq_ ().fib (n) ) )
+        .map (lambda pair --> pair ._1)
+        .map (lambda n --> Tuple2 (n , FiboExampleInSodaForCoq_ () .fib (n) ) )
     ) (
       expected := fibonacci_values_with_nat
     )
diff --git a/examples/src/test/scala/soda/example/forcoq/mathematics/Package.scala b/examples/src/test/scala/soda/example/forcoq/mathematics/Package.scala
index 914c4467..2fc54f67 100644
--- a/examples/src/test/scala/soda/example/forcoq/mathematics/Package.scala
+++ b/examples/src/test/scala/soda/example/forcoq/mathematics/Package.scala
@@ -17,21 +17,21 @@ case class FactorialForCoqSpec ()
   def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  lazy val factorial_values : Seq [ Tuple2 [Int, Int] ] = Seq (
-    (0, 1), (1, 1), (2, 2), (3, 6), (4, 24), (5, 120), (6, 720)
+  lazy val factorial_values : Seq [Tuple2 [Int, Int] ] = Seq (
+    (0 , 1) , (1 , 1) , (2 , 2) , (3 , 6) , (4 , 24) , (5 , 120) , (6 , 720)
   )
 
   lazy val factorial_values_with_nat : Seq [ Tuple2 [nat, nat] ] =
     factorial_values
       .map ( pair =>
-        Tuple2 ( IntNat_ ().from_non_negative (pair._1), IntNat_ ().from_non_negative (pair._2) )
+        Tuple2 (IntNat_ () .from_non_negative (pair ._1), IntNat_ () .from_non_negative (pair ._2) )
       )
 
   test ("should test the factorial function for Coq") (
     check (
       obtained = factorial_values_with_nat
-        .map ( pair => pair._1)
-        .map ( n => Tuple2 (n, FactorialForCoq_ ().get_factorial (n) ) )
+        .map ( pair => pair ._1)
+        .map ( n => Tuple2 (n , FactorialForCoq_ () .get_factorial (n) ) )
     ) (
       expected = factorial_values_with_nat
     )
@@ -51,21 +51,21 @@ case class FiboExampleInSodaForCoqSpec ()
   def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  lazy val fibonacci_values : Seq [ Tuple2 [Int, Int] ] = Seq (
-    (0, 0), (1, 1), (2, 1), (3, 2), (4, 3), (5, 5), (6, 8), (7, 13), (8, 21), (9, 34), (10, 55)
+  lazy val fibonacci_values : Seq [Tuple2 [Int, Int] ] = Seq (
+    (0 , 0) , (1 , 1) , (2 , 1) , (3 , 2) , (4 , 3) , (5 , 5) , (6 , 8) , (7 , 13) , (8 , 21) , (9 , 34) , (10 , 55)
   )
 
-  lazy val fibonacci_values_with_nat : Seq [ Tuple2 [nat, nat] ] =
+  lazy val fibonacci_values_with_nat : Seq [Tuple2 [nat, nat] ] =
     fibonacci_values
       .map ( pair =>
-        Tuple2 ( IntNat_ ().from_non_negative (pair._1), IntNat_ ().from_non_negative (pair._2) )
+        Tuple2 (IntNat_ () .from_non_negative (pair ._1), IntNat_ () .from_non_negative (pair ._2) )
       )
 
   test ("should test the fibonacci function for Coq") (
     check (
       obtained = fibonacci_values_with_nat
-        .map ( pair => pair._1)
-        .map ( n => Tuple2 (n, FiboExampleInSodaForCoq_ ().fib (n) ) )
+        .map ( pair => pair ._1)
+        .map ( n => Tuple2 (n , FiboExampleInSodaForCoq_ () .fib (n) ) )
     ) (
       expected = fibonacci_values_with_nat
     )
@@ -85,21 +85,21 @@ case class TriangularNumberForCoqSpec ()
   def check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  lazy val triangular_number_values : Seq [ Tuple2 [Int, Int] ] = Seq (
-    (0, 0), (1, 1), (2, 3), (3, 6), (4, 10), (5, 15), (6, 21)
+  lazy val triangular_number_values : Seq [Tuple2 [Int, Int] ] = Seq (
+    (0 , 0) , (1 , 1) , (2 , 3) , (3 , 6) , (4 , 10) , (5 , 15) , (6 , 21)
   )
 
   lazy val triangular_number_with_nat : Seq [ Tuple2 [nat, nat] ] =
     triangular_number_values
       .map ( pair =>
-       Tuple2 ( IntNat_ ().from_non_negative (pair._1),  IntNat_ ().from_non_negative (pair._2) )
+       Tuple2 (IntNat_ () .from_non_negative (pair ._1) , IntNat_ () .from_non_negative (pair ._2) )
       )
 
   test ("should test the triangular for Coq") (
     check (
       obtained = triangular_number_with_nat
-        .map ( pair => pair._1)
-        .map ( n => Tuple2 (n, TriangularNumberForCoq_ ().get_number (n) ) )
+        .map ( pair => pair ._1)
+        .map ( n => Tuple2 (n , TriangularNumberForCoq_ () .get_number (n) ) )
     ) (
       expected = triangular_number_with_nat
     )
diff --git a/examples/src/test/scala/soda/example/forcoq/mathematics/TriangularNumberForCoqSpec.soda b/examples/src/test/scala/soda/example/forcoq/mathematics/TriangularNumberForCoqSpec.soda
index fbfe17c6..7c772fd9 100644
--- a/examples/src/test/scala/soda/example/forcoq/mathematics/TriangularNumberForCoqSpec.soda
+++ b/examples/src/test/scala/soda/example/forcoq/mathematics/TriangularNumberForCoqSpec.soda
@@ -10,21 +10,21 @@ class TriangularNumberForCoqSpec ()
   check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  triangular_number_values : Seq [ Tuple2 [Int, Int] ] = Seq (
-    (0, 0), (1, 1), (2, 3), (3, 6), (4, 10), (5, 15), (6, 21)
+  triangular_number_values : Seq [Tuple2 [Int] [Int] ] = Seq (
+    (0 , 0) , (1 , 1) , (2 , 3) , (3 , 6) , (4 , 10) , (5 , 15) , (6 , 21)
   )
 
-  triangular_number_with_nat : Seq [ Tuple2 [nat, nat] ] =
+  triangular_number_with_nat : Seq [ Tuple2 [nat] [nat] ] =
     triangular_number_values
       .map (lambda pair -->
-       Tuple2 ( IntNat_ ().from_non_negative (pair._1),  IntNat_ ().from_non_negative (pair._2) )
+       Tuple2 (IntNat_ () .from_non_negative (pair ._1) , IntNat_ () .from_non_negative (pair ._2) )
       )
 
   test ("should test the triangular for Coq") (
     check (
       obtained := triangular_number_with_nat
-        .map (lambda pair --> pair._1)
-        .map (lambda n --> Tuple2 (n, TriangularNumberForCoq_ ().get_number (n) ) )
+        .map (lambda pair --> pair ._1)
+        .map (lambda n --> Tuple2 (n , TriangularNumberForCoq_ () .get_number (n) ) )
     ) (
       expected := triangular_number_with_nat
     )
diff --git a/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda b/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda
index 945f7e1f..b527f835 100644
--- a/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda
+++ b/examples/src/test/scala/soda/example/mathematics/FactorialSpec.soda
@@ -7,7 +7,7 @@ class FactorialSpec ()
     assert (obtained == expected)
 
   factorial_values = Seq (
-    (-1, 0), (0, 1), (1, 1), (2, 2), (3, 6), (4, 24), (5, 120), (6, 720), (7, 5040), (8, 40320), (9, 362880), (10, 3628800)
+    (-1 , 0) , (0 , 1) , (1 , 1) , (2 , 2) , (3 , 6) , (4 , 24) , (5 , 120) , (6 , 720) , (7 , 5040) , (8 , 40320) , (9 , 362880) , (10 , 3628800)
   )
 
   _factorial_concise = FactorialConcise_ ()
@@ -19,8 +19,8 @@ class FactorialSpec ()
   test ("should test the factorial - concise version") (
     check (
       obtained := factorial_values
-        .map (lambda pair --> pair._1)
-        .map (lambda n --> Tuple2 (n, _factorial_concise.apply (n) ) )
+        .map (lambda pair --> pair ._1)
+        .map (lambda n --> Tuple2 (n , _factorial_concise .apply (n) ) )
     ) (
       expected := factorial_values
     )
@@ -29,8 +29,8 @@ class FactorialSpec ()
   test ("should test the factorial - with pattern matching") (
     check (
       obtained := factorial_values
-        .map (lambda pair --> pair._1)
-        .map (lambda n --> Tuple2 (n, _factorial_patten_matching.apply (n) ) )
+        .map (lambda pair --> pair ._1)
+        .map (lambda n --> Tuple2 (n , _factorial_patten_matching .apply (n) ) )
     ) (
       expected := factorial_values
     )
@@ -39,8 +39,8 @@ class FactorialSpec ()
   test ("should test the factorial - with fold") (
     check (
       obtained := factorial_values
-        .map (lambda pair --> pair._1)
-        .map (lambda n --> Tuple2 (n, _factorial_with_fold.apply (n) ) )
+        .map (lambda pair --> pair ._1)
+        .map (lambda n --> Tuple2 (n , _factorial_with_fold .apply (n) ) )
     ) (
       expected := factorial_values
     )
diff --git a/examples/src/test/scala/soda/example/mathematics/FiboExampleSpec.soda b/examples/src/test/scala/soda/example/mathematics/FiboExampleSpec.soda
index ce9d3e63..de01ed8c 100644
--- a/examples/src/test/scala/soda/example/mathematics/FiboExampleSpec.soda
+++ b/examples/src/test/scala/soda/example/mathematics/FiboExampleSpec.soda
@@ -7,7 +7,7 @@ class FiboExampleSpec ()
     assert (obtained == expected)
 
   fibonacci_values = Seq (
-   (0, 0), (1, 1), (2, 1), (3, 2), (4, 3), (5, 5), (6, 8), (7, 13), (8, 21), (9, 34), (10, 55)
+   (0 , 0) , (1 , 1) , (2 , 1) , (3 , 2) , (4 , 3) , (5 , 5) , (6 , 8) , (7 , 13) , (8 , 21) , (9 , 34) , (10 , 55)
   )
 
   _fibo_example_in_soda = FiboExampleInSoda_ ()
@@ -15,8 +15,8 @@ class FiboExampleSpec ()
   test ("should test the fibonacci function") (
     check (
       obtained := fibonacci_values
-        .map (lambda pair --> pair._1)
-        .map (lambda n --> Tuple2 (n, _fibo_example_in_soda.apply (n) ) )
+        .map (lambda pair --> pair ._1)
+        .map (lambda n --> Tuple2 (n , _fibo_example_in_soda .apply (n) ) )
     ) (
       expected := fibonacci_values
     )
diff --git a/examples/src/test/scala/soda/example/mathematics/HardProblemSpec.soda b/examples/src/test/scala/soda/example/mathematics/HardProblemSpec.soda
index 895aced3..2a329ceb 100644
--- a/examples/src/test/scala/soda/example/mathematics/HardProblemSpec.soda
+++ b/examples/src/test/scala/soda/example/mathematics/HardProblemSpec.soda
@@ -6,70 +6,70 @@ class HardProblemSpec ()
   check [A] (obtained : A) (expected : A) : org.scalatest.compatible.Assertion =
     assert (obtained == expected)
 
-  empty_map = Map [Int, Int] ()
+  empty_map = Map [Int] [Int] ()
 
   instance = HardProblem_ ()
 
   test ("hard problem 9") (
     check (
-      obtained := instance.compute (InputPair_ (9, empty_map) )
+      obtained := instance.compute (InputPair_ (9 , empty_map) )
     ) (
-      expected := OutputPair_ (19, Seq ( (9, 19), (28, 18), (14, 17), (7, 16), (22, 15),
-        (11, 14), (34, 13), (17, 12), (52, 11), (26, 10),
-        (13, 9), (40, 8), (20, 7), (10, 6), (5, 5), (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected := OutputPair_ (19 , Seq ( (9 , 19) , (28 , 18) , (14 , 17) , (7 , 16) , (22 , 15),
+        (11 , 14) , (34 , 13) , (17 , 12) , (52 , 11) , (26 , 10),
+        (13 , 9) , (40 , 8) , (20 , 7) , (10 , 6) , (5 , 5) , (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("hard problem 12") (
     check (
-      obtained := instance.compute (InputPair_ (12, empty_map) )
+      obtained := instance .compute (InputPair_ (12 , empty_map) )
     ) (
-      expected := OutputPair_ (9, Seq ( (12, 9), (6, 8), (3, 7), (10, 6), (5, 5),
-        (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected := OutputPair_ (9 , Seq ( (12 , 9) , (6 , 8) , (3 , 7) , (10 , 6) , (5 , 5),
+        (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("hard problem 13") (
     check (
-      obtained := instance.compute (InputPair_ (13, empty_map) )
+      obtained := instance .compute (InputPair_ (13 , empty_map) )
     ) (
-      expected := OutputPair_ (9, Seq ( (13, 9), (40, 8), (20, 7), (10, 6), (5, 5),
-        (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected := OutputPair_ (9 , Seq ( (13 , 9) , (40 , 8) , (20 , 7) , (10 , 6) , (5 , 5),
+        (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("hard problem 14") (
     check (
-      obtained := instance.compute (InputPair_ (14, empty_map) )
+      obtained := instance .compute (InputPair_ (14 , empty_map) )
     ) (
-      expected := OutputPair_ (17, Seq ( (14, 17), (7, 16), (22, 15), (11, 14), (34, 13), (17, 12), (52, 11), (26, 10),
-        (13, 9), (40, 8), (20, 7), (10, 6), (5, 5), (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected := OutputPair_ (17 , Seq ( (14 , 17) , (7 , 16) , (22 , 15) , (11 , 14) , (34 , 13) , (17 , 12) , (52 , 11) , (26 , 10),
+        (13 , 9) , (40 , 8) , (20 , 7) , (10 , 6) , (5 , 5) , (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("hard problem 16") (
     check (
-      obtained := instance.compute (InputPair_ (16, empty_map) )
+      obtained := instance .compute (InputPair_ (16 , empty_map) )
     ) (
-      expected := OutputPair_ (4, Seq ( (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected := OutputPair_ (4 , Seq ( (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("hard problem 20") (
     check (
-      obtained := instance.compute (InputPair_ (20, empty_map) )
+      obtained := instance .compute (InputPair_ (20 , empty_map) )
     ) (
-      expected := OutputPair_ (7, Seq ( (20, 7), (10, 6), (5, 5), (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected := OutputPair_ (7 , Seq ( (20 , 7) , (10 , 6) , (5 , 5) , (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("memoized fibonacci 20") (
     check (
-      obtained := MemoizedFibonacci_ ().compute (InputPair_ (20, empty_map) )
+      obtained := MemoizedFibonacci_ () .compute (InputPair_ (20 , empty_map) )
     ) (
-      expected := OutputPair_ (6765, Seq ( (20, 6765), (19, 4181), (18, 2584), (17, 1597), (16, 987), (15, 610), (14, 377),
-        (13, 233), (12, 144), (11, 89), (10, 55), (9, 34), (8, 21), (7, 13),
-        (6, 8), (5, 5), (4, 3), (3, 2), (2, 1), (1, 1), (0, 0) ).toMap)
+      expected := OutputPair_ (6765 , Seq ( (20 , 6765) , (19 , 4181) , (18 , 2584) , (17 , 1597) , (16 , 987) , (15 , 610) , (14 , 377),
+        (13 , 233) , (12 , 144) , (11 , 89) , (10 , 55) , (9 , 34) , (8 , 21) , (7 , 13),
+        (6 , 8) , (5 , 5) , (4 , 3) , (3 , 2) , (2 , 1) , (1 , 1) , (0 , 0) ) .toMap)
     )
   )
 
diff --git a/examples/src/test/scala/soda/example/mathematics/Package.scala b/examples/src/test/scala/soda/example/mathematics/Package.scala
index 1e716d63..b635b3bd 100644
--- a/examples/src/test/scala/soda/example/mathematics/Package.scala
+++ b/examples/src/test/scala/soda/example/mathematics/Package.scala
@@ -15,7 +15,7 @@ case class FactorialSpec ()
     assert (obtained == expected)
 
   lazy val factorial_values = Seq (
-    (-1, 0), (0, 1), (1, 1), (2, 2), (3, 6), (4, 24), (5, 120), (6, 720), (7, 5040), (8, 40320), (9, 362880), (10, 3628800)
+    (-1 , 0) , (0 , 1) , (1 , 1) , (2 , 2) , (3 , 6) , (4 , 24) , (5 , 120) , (6 , 720) , (7 , 5040) , (8 , 40320) , (9 , 362880) , (10 , 3628800)
   )
 
   private lazy val _factorial_concise = FactorialConcise_ ()
@@ -27,8 +27,8 @@ case class FactorialSpec ()
   test ("should test the factorial - concise version") (
     check (
       obtained = factorial_values
-        .map ( pair => pair._1)
-        .map ( n => Tuple2 (n, _factorial_concise.apply (n) ) )
+        .map ( pair => pair ._1)
+        .map ( n => Tuple2 (n , _factorial_concise .apply (n) ) )
     ) (
       expected = factorial_values
     )
@@ -37,8 +37,8 @@ case class FactorialSpec ()
   test ("should test the factorial - with pattern matching") (
     check (
       obtained = factorial_values
-        .map ( pair => pair._1)
-        .map ( n => Tuple2 (n, _factorial_patten_matching.apply (n) ) )
+        .map ( pair => pair ._1)
+        .map ( n => Tuple2 (n , _factorial_patten_matching .apply (n) ) )
     ) (
       expected = factorial_values
     )
@@ -47,8 +47,8 @@ case class FactorialSpec ()
   test ("should test the factorial - with fold") (
     check (
       obtained = factorial_values
-        .map ( pair => pair._1)
-        .map ( n => Tuple2 (n, _factorial_with_fold.apply (n) ) )
+        .map ( pair => pair ._1)
+        .map ( n => Tuple2 (n , _factorial_with_fold .apply (n) ) )
     ) (
       expected = factorial_values
     )
@@ -66,7 +66,7 @@ case class FiboExampleSpec ()
     assert (obtained == expected)
 
   lazy val fibonacci_values = Seq (
-   (0, 0), (1, 1), (2, 1), (3, 2), (4, 3), (5, 5), (6, 8), (7, 13), (8, 21), (9, 34), (10, 55)
+   (0 , 0) , (1 , 1) , (2 , 1) , (3 , 2) , (4 , 3) , (5 , 5) , (6 , 8) , (7 , 13) , (8 , 21) , (9 , 34) , (10 , 55)
   )
 
   private lazy val _fibo_example_in_soda = FiboExampleInSoda_ ()
@@ -74,8 +74,8 @@ case class FiboExampleSpec ()
   test ("should test the fibonacci function") (
     check (
       obtained = fibonacci_values
-        .map ( pair => pair._1)
-        .map ( n => Tuple2 (n, _fibo_example_in_soda.apply (n) ) )
+        .map ( pair => pair ._1)
+        .map ( n => Tuple2 (n , _fibo_example_in_soda .apply (n) ) )
     ) (
       expected = fibonacci_values
     )
@@ -98,64 +98,64 @@ case class HardProblemSpec ()
 
   test ("hard problem 9") (
     check (
-      obtained = instance.compute (InputPair_ (9, empty_map) )
+      obtained = instance.compute (InputPair_ (9 , empty_map) )
     ) (
-      expected = OutputPair_ (19, Seq ( (9, 19), (28, 18), (14, 17), (7, 16), (22, 15),
-        (11, 14), (34, 13), (17, 12), (52, 11), (26, 10),
-        (13, 9), (40, 8), (20, 7), (10, 6), (5, 5), (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected = OutputPair_ (19 , Seq ( (9 , 19) , (28 , 18) , (14 , 17) , (7 , 16) , (22 , 15),
+        (11 , 14) , (34 , 13) , (17 , 12) , (52 , 11) , (26 , 10),
+        (13 , 9) , (40 , 8) , (20 , 7) , (10 , 6) , (5 , 5) , (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("hard problem 12") (
     check (
-      obtained = instance.compute (InputPair_ (12, empty_map) )
+      obtained = instance .compute (InputPair_ (12 , empty_map) )
     ) (
-      expected = OutputPair_ (9, Seq ( (12, 9), (6, 8), (3, 7), (10, 6), (5, 5),
-        (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected = OutputPair_ (9 , Seq ( (12 , 9) , (6 , 8) , (3 , 7) , (10 , 6) , (5 , 5),
+        (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("hard problem 13") (
     check (
-      obtained = instance.compute (InputPair_ (13, empty_map) )
+      obtained = instance .compute (InputPair_ (13 , empty_map) )
     ) (
-      expected = OutputPair_ (9, Seq ( (13, 9), (40, 8), (20, 7), (10, 6), (5, 5),
-        (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected = OutputPair_ (9 , Seq ( (13 , 9) , (40 , 8) , (20 , 7) , (10 , 6) , (5 , 5),
+        (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("hard problem 14") (
     check (
-      obtained = instance.compute (InputPair_ (14, empty_map) )
+      obtained = instance .compute (InputPair_ (14 , empty_map) )
     ) (
-      expected = OutputPair_ (17, Seq ( (14, 17), (7, 16), (22, 15), (11, 14), (34, 13), (17, 12), (52, 11), (26, 10),
-        (13, 9), (40, 8), (20, 7), (10, 6), (5, 5), (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected = OutputPair_ (17 , Seq ( (14 , 17) , (7 , 16) , (22 , 15) , (11 , 14) , (34 , 13) , (17 , 12) , (52 , 11) , (26 , 10),
+        (13 , 9) , (40 , 8) , (20 , 7) , (10 , 6) , (5 , 5) , (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("hard problem 16") (
     check (
-      obtained = instance.compute (InputPair_ (16, empty_map) )
+      obtained = instance .compute (InputPair_ (16 , empty_map) )
     ) (
-      expected = OutputPair_ (4, Seq ( (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected = OutputPair_ (4 , Seq ( (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("hard problem 20") (
     check (
-      obtained = instance.compute (InputPair_ (20, empty_map) )
+      obtained = instance .compute (InputPair_ (20 , empty_map) )
     ) (
-      expected = OutputPair_ (7, Seq ( (20, 7), (10, 6), (5, 5), (16, 4), (8, 3), (4, 2), (2, 1), (1, 0) ).toMap)
+      expected = OutputPair_ (7 , Seq ( (20 , 7) , (10 , 6) , (5 , 5) , (16 , 4) , (8 , 3) , (4 , 2) , (2 , 1) , (1 , 0) ) .toMap)
     )
   )
 
   test ("memoized fibonacci 20") (
     check (
-      obtained = MemoizedFibonacci_ ().compute (InputPair_ (20, empty_map) )
+      obtained = MemoizedFibonacci_ () .compute (InputPair_ (20 , empty_map) )
     ) (
-      expected = OutputPair_ (6765, Seq ( (20, 6765), (19, 4181), (18, 2584), (17, 1597), (16, 987), (15, 610), (14, 377),
-        (13, 233), (12, 144), (11, 89), (10, 55), (9, 34), (8, 21), (7, 13),
-        (6, 8), (5, 5), (4, 3), (3, 2), (2, 1), (1, 1), (0, 0) ).toMap)
+      expected = OutputPair_ (6765 , Seq ( (20 , 6765) , (19 , 4181) , (18 , 2584) , (17 , 1597) , (16 , 987) , (15 , 610) , (14 , 377),
+        (13 , 233) , (12 , 144) , (11 , 89) , (10 , 55) , (9 , 34) , (8 , 21) , (7 , 13),
+        (6 , 8) , (5 , 5) , (4 , 3) , (3 , 2) , (2 , 1) , (1 , 1) , (0 , 0) ) .toMap)
     )
   )
 
@@ -174,11 +174,11 @@ case class PiIteratorSpec ()
 
   private lazy val _pi_iterator = PiIterator_ ()
 
-  lazy val pi_sequence = _pi_iterator.apply (128)
+  lazy val pi_sequence = _pi_iterator .apply (128)
 
   test ("first digits of Pi") (
     check (
-      obtained = "" + pi_sequence.head + "." + pi_sequence.tail.mkString ("")
+      obtained = "" + pi_sequence .head + "." + pi_sequence .tail .mkString ("")
     ) (
       expected = pi_start
     )
diff --git a/examples/src/test/scala/soda/example/mathematics/PiIteratorSpec.soda b/examples/src/test/scala/soda/example/mathematics/PiIteratorSpec.soda
index ee3545b7..d522cf9b 100644
--- a/examples/src/test/scala/soda/example/mathematics/PiIteratorSpec.soda
+++ b/examples/src/test/scala/soda/example/mathematics/PiIteratorSpec.soda
@@ -10,11 +10,11 @@ class PiIteratorSpec ()
 
   _pi_iterator = PiIterator_ ()
 
-  pi_sequence = _pi_iterator.apply (128)
+  pi_sequence = _pi_iterator .apply (128)
 
   test ("first digits of Pi") (
     check (
-      obtained := "" + pi_sequence.head + "." + pi_sequence.tail.mkString ("")
+      obtained := "" + pi_sequence .head + "." + pi_sequence .tail .mkString ("")
     ) (
       expected := pi_start
     )

From a196ecf11f573101caaf45d39f062dfc7eea3dda Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Sat, 20 May 2023 14:41:10 +0200
Subject: [PATCH 37/56] Update examples

---
 .../example/algorithms/PatternMatching.scala  | 14 +++----
 .../example/algorithms/PatternMatching.soda   |  6 +--
 .../example/algorithms/SaladMaker.scala       |  4 +-
 .../example/algorithms/SaladMaker.soda        |  4 +-
 .../ScalaReservedWordEscaping.scala           |  4 +-
 .../algorithms/ScalaReservedWordEscaping.soda |  4 +-
 .../example/algorithms/SortExample.scala      | 42 +++++++++----------
 .../example/algorithms/SortExample.soda       | 36 ++++++++--------
 .../ethicalissues/fairness/Fairness.scala     |  2 +-
 .../ethicalissues/fairness/Fairness.soda      |  2 +-
 .../pricemonitor/PriceMonitor.scala           |  4 +-
 .../pricemonitor/PriceMonitor.soda            |  4 +-
 .../pricemonitor/Requirement1Monitor.scala    |  2 +-
 .../pricemonitor/Requirement1Monitor.soda     |  2 +-
 .../pricemonitor/Requirement2Monitor.scala    |  2 +-
 .../pricemonitor/Requirement2Monitor.soda     |  2 +-
 .../pricemonitor/Requirement3Monitor.scala    | 14 +++----
 .../pricemonitor/Requirement3Monitor.soda     | 14 +++----
 .../forcoq/algorithms/RecursionForCoq.scala   |  8 ++--
 .../forcoq/algorithms/RecursionForCoq.soda    |  2 +-
 .../translator/example/forcoq/lib/List.scala  | 16 +++----
 .../translator/example/forcoq/lib/List.soda   | 10 ++---
 .../translator/example/forcoq/lib/Nat.scala   |  6 +--
 .../translator/example/forcoq/lib/Nat.soda    |  4 +-
 .../forcoq/mathematics/FactorialForCoq.scala  |  2 +-
 .../mathematics/FiboExampleInSodaForCoq.scala |  2 +-
 .../mathematics/TriangularNumberForCoq.scala  |  2 +-
 .../example/inanutshell/InANutshell.scala     |  6 +--
 .../example/inanutshell/InANutshell.soda      |  6 +--
 .../FactorialPatternMatching.scala            |  2 +-
 .../mathematics/FactorialWithFold.scala       |  2 +-
 .../mathematics/FactorialWithFold.soda        |  2 +-
 .../example/mathematics/HardProblem.scala     | 36 ++++++++--------
 .../example/mathematics/HardProblem.soda      | 34 +++++++--------
 .../example/mathematics/PiIterator.scala      | 34 +++++++--------
 .../example/mathematics/PiIterator.soda       | 34 +++++++--------
 .../example/miniexample/MiniExample.scala     |  2 +-
 .../example/miniexample/MiniExample.soda      |  2 +-
 38 files changed, 187 insertions(+), 187 deletions(-)

diff --git a/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.scala b/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.scala
index dab4c508..7fa76d6e 100644
--- a/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.scala
+++ b/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.scala
@@ -13,17 +13,17 @@ trait PatternMatching
   def get_value (p : Parameter) : Int =
     p match  {
       case Singleton_ (x) => x
-      case Pair_ (x, y) => (x + y) / 2
-      case Triplet_ (x, y, z) => (x + y + z) / 3
-      case x => 0
+      case Pair_ (x , y) => (x + y) / 2
+      case Triplet_ (x , y , z) => (x + y + z) / 3
+      case otherwise => 0
     }
 
   def get_type_name (p : Parameter) : String =
     p match  {
-      case Singleton_ (x) => (Singleton_ (x) ).name + "(x)"
-      case Pair_ (x, y) => (Pair_ (x, y) ).name + "(x, y)"
-      case Triplet_ (x, y, z) => (Triplet_ (x, y, z) ).name + "(x, y, z)"
-      case x => ""
+      case Singleton_ (x) => (Singleton_ (x) ) .name + " (x)"
+      case Pair_ (x , y) => (Pair_ (x , y) ) .name + " (x , y)"
+      case Triplet_ (x , y , z) => (Triplet_ (x , y , z) ) .name + " (x , y , z)"
+      case otherwise => ""
     }
 
 }
diff --git a/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda b/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda
index 32584641..10ef6500 100644
--- a/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda
+++ b/translator/src/test/resources/soda/translator/example/algorithms/PatternMatching.soda
@@ -17,9 +17,9 @@ class PatternMatching
 
   get_type_name (p : Parameter) : String =
     match p
-      case Singleton_ (x) ==> (Singleton_ (x) ).name + "(x)"
-      case Pair_ (x , y) ==> (Pair_ (x , y) ).name + "(x, y)"
-      case Triplet_ (x , y , z) ==> (Triplet_ (x , y , z) ).name + "(x, y, z)"
+      case Singleton_ (x) ==> (Singleton_ (x) ) .name + " (x)"
+      case Pair_ (x , y) ==> (Pair_ (x , y) ) .name + " (x , y)"
+      case Triplet_ (x , y , z) ==> (Triplet_ (x , y , z) ) .name + " (x , y , z)"
       case otherwise ==> ""
 
 end
diff --git a/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.scala b/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.scala
index f0715fac..b2e181d4 100644
--- a/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.scala
+++ b/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.scala
@@ -17,9 +17,9 @@ trait SaladMaker
     (next_ingredient_function : Salad => Ingredient => Salad)
     (condition_to_continue : Salad => Ingredient => Boolean)
       : Salad =
-    if ( ingredients_so_far.isEmpty || (! condition_to_continue (salad_so_far) (ingredients_so_far.head) )
+    if ( ingredients_so_far .isEmpty || (! condition_to_continue (salad_so_far) (ingredients_so_far .head) )
     ) salad_so_far
-    else _tailrec_prepare_salad (ingredients_so_far.tail) (next_ingredient_function (salad_so_far) (ingredients_so_far.head) ) (next_ingredient_function) (condition_to_continue)
+    else _tailrec_prepare_salad (ingredients_so_far .tail) (next_ingredient_function (salad_so_far) (ingredients_so_far .head) ) (next_ingredient_function) (condition_to_continue)
 
 }
 
diff --git a/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda b/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda
index fa8360f3..f5960513 100644
--- a/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda
+++ b/translator/src/test/resources/soda/translator/example/algorithms/SaladMaker.soda
@@ -16,9 +16,9 @@ class SaladMaker
     (next_ingredient_function : Salad -> Ingredient -> Salad)
     (condition_to_continue : Salad -> Ingredient -> Boolean)
       : Salad =
-    if ingredients_so_far.isEmpty or (not condition_to_continue (salad_so_far) (ingredients_so_far.head) )
+    if ingredients_so_far .isEmpty or (not condition_to_continue (salad_so_far) (ingredients_so_far .head) )
     then salad_so_far
-    else _tailrec_prepare_salad (ingredients_so_far.tail) (next_ingredient_function (salad_so_far) (ingredients_so_far.head) ) (next_ingredient_function) (condition_to_continue)
+    else _tailrec_prepare_salad (ingredients_so_far .tail) (next_ingredient_function (salad_so_far) (ingredients_so_far .head) ) (next_ingredient_function) (condition_to_continue)
 
 end
 
diff --git a/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.scala b/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.scala
index 17966720..585828b4 100644
--- a/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.scala
+++ b/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.scala
@@ -5,10 +5,10 @@ trait ScalaReservedWordEscaping
 
   private lazy val __soda__val = 1
 
-  private def __soda__def [A, B] (key : A) (value : B) : MyPair [A, B] = MyPair_ (key, value)
+  private def __soda__def [A, B] (key : A) (value : B) : MyPair [A, B] = MyPair_ (key , value)
 
   private def __soda__while [A, B] (seq : Seq [A] ) (cond : A => Boolean) (funct : A => B) : Seq [B] =
-    seq.takeWhile (cond).map (funct)
+    seq .takeWhile (cond) .map (funct)
 
   private lazy val __soda__protected = "protected"
 
diff --git a/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.soda b/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.soda
index 7c990f65..dc63e096 100644
--- a/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.soda
+++ b/translator/src/test/resources/soda/translator/example/algorithms/ScalaReservedWordEscaping.soda
@@ -5,10 +5,10 @@ class ScalaReservedWordEscaping
 
   val = 1
 
-  def [A] [B] (key : A) (value : B) : MyPair [A] [B] = MyPair_ (key, value)
+  def [A] [B] (key : A) (value : B) : MyPair [A] [B] = MyPair_ (key , value)
 
   while [A] [B] (seq : Seq [A] ) (cond : A -> Boolean) (funct : A -> B) : Seq [B] =
-    seq.takeWhile (cond).map (funct)
+    seq .takeWhile (cond) .map (funct)
 
   protected = "protected"
 
diff --git a/translator/src/test/resources/soda/translator/example/algorithms/SortExample.scala b/translator/src/test/resources/soda/translator/example/algorithms/SortExample.scala
index e5ec40d6..fd7cf6cd 100644
--- a/translator/src/test/resources/soda/translator/example/algorithms/SortExample.scala
+++ b/translator/src/test/resources/soda/translator/example/algorithms/SortExample.scala
@@ -18,8 +18,8 @@ trait SortExampleWithAt
   def is_sorted_for (sequence : Seq [Int] ) : Boolean =
     sequence
       .indices
-      .filter (  index => index > 0)
-      .forall (  index => sequence.apply (index - 1) <= sequence.apply (index) )
+      .filter ( index => index > 0)
+      .forall ( index => sequence .apply (index - 1) <= sequence .apply (index) )
 
 }
 
@@ -35,8 +35,8 @@ trait SortExampleWithZip
 
   def is_sorted_for (sequence : Seq [Int] ) : Boolean =
     sequence
-      .zip (sequence.tail)
-      .forall (  pair => (pair._1 <= pair._2) )
+      .zip (sequence .tail)
+      .forall ( pair => (pair ._1 <= pair ._2) )
 
 }
 
@@ -64,9 +64,9 @@ trait SortAlgorithmExampleWithFold
      sequence => sort_for (sequence)
 
   def sort_for (sequence : Seq [Int] ) : Seq [Int] =
-    if ( sequence.length < 2
+    if ( sequence .length < 2
     ) sequence
-    else _fold.apply (sequence) (_initial_value) (_next_value_function)
+    else _fold .apply (sequence) (_initial_value) (_next_value_function)
 
   private lazy val _initial_value = Seq [Int] ()
 
@@ -75,13 +75,13 @@ trait SortAlgorithmExampleWithFold
 
   def insert_sorted (sequence : Seq [Int] ) (element : Int) : Seq [Int] =
     concatenate (
-      first_part = sequence.takeWhile (  x => x < element) ) (
+      first_part = sequence .takeWhile ( x => x < element) ) (
       middle = Seq (element) ) (
-      last_part = sequence.dropWhile (  x => x < element)
+      last_part = sequence .dropWhile ( x => x < element)
     )
 
   def concatenate (first_part : Seq [Int] ) (middle : Seq [Int] ) (last_part : Seq [Int] ) : Seq [Int] =
-    first_part.++ (middle.++ (last_part) )
+    first_part .++ (middle .++ (last_part) )
 
 }
 
@@ -95,10 +95,10 @@ trait ConstrainedSortAlgorithm
   import   soda.lib.NoneSD_
 
   def sort (sequence : Seq [Int] ) : OptionSD [Seq [Int] ] =
-    sort_with ( SortAlgorithmExampleWithFold_ ().sort (sequence) )
+    sort_with (SortAlgorithmExampleWithFold_ () .sort (sequence) )
 
   def sort_with (sorted_sequence : Seq [Int] ) : OptionSD [Seq [Int] ] =
-    if ( SortExampleWithZip_ ().is_sorted (sorted_sequence)
+    if ( SortExampleWithZip_ () .is_sorted (sorted_sequence)
     ) SomeSD_ (sorted_sequence)
     else NoneSD_ [Seq [Int] ] ()
 
@@ -162,9 +162,9 @@ trait NonEmptySortedSequence [A <: Comparable [A] ]
      element => add_for (element)
 
   def add_for (element : A) : SortedSequence [A] =
-    NonEmptySortedSequence_ (aux.insert_sorted (sequence) (element) )
+    NonEmptySortedSequence_ (aux .insert_sorted (sequence) (element) )
 
-  lazy val invariant : Boolean = aux.is_sorted (sequence)
+  lazy val invariant : Boolean = aux .is_sorted (sequence)
 
 }
 
@@ -174,22 +174,22 @@ trait NonEmptySortedSequenceAux [A <: Comparable [A] ]
 {
 
   def is_less_than (x : A) (y : A) : Boolean =
-    x.compareTo (y) < 0
+    x .compareTo (y) < 0
 
   def is_sorted (other_sequence : Seq [A] ) : Boolean =
     other_sequence
-      .zip (other_sequence.tail)
-      .forall (  pair => is_less_than (pair._1) (pair._2) )
+      .zip (other_sequence .tail)
+      .forall ( pair => is_less_than (pair ._1) (pair ._2) )
 
   def insert_sorted (original_sequence : Seq [A] ) (element : A) : Seq [A] =
     concatenate (
-      first_part = original_sequence.takeWhile (  x => is_less_than (x) (element) ) ) (
+      first_part = original_sequence.takeWhile ( x => is_less_than (x) (element) ) ) (
       middle = Seq (element) ) (
-      last_part = original_sequence.dropWhile (  x => is_less_than (x) (element) )
+      last_part = original_sequence.dropWhile ( x => is_less_than (x) (element) )
     )
 
   def concatenate (first_part : Seq [A] ) (middle : Seq [A] ) (last_part : Seq [A] ) : Seq [A] =
-    first_part.++ (middle.++ (last_part) )
+    first_part .++ (middle .++ (last_part) )
 
 }
 
@@ -203,12 +203,12 @@ trait SortedSequenceBuilder [A <: Comparable [A] ]
   private lazy val _fold = Fold_ ()
 
   def build (sequence : Seq [A] ) : SortedSequence [A] =
-    _fold.apply (sequence) (_initial_value) (_next_value_function)
+    _fold .apply (sequence) (_initial_value) (_next_value_function)
 
   private lazy val _initial_value : SortedSequence [A] = EmptySortedSequence_ [A] ()
 
   private def _next_value_function (sorted_sequence : SortedSequence [A] ) (element : A) : SortedSequence [A] =
-    sorted_sequence.add (element)
+    sorted_sequence .add (element)
 
 }
 
diff --git a/translator/src/test/resources/soda/translator/example/algorithms/SortExample.soda b/translator/src/test/resources/soda/translator/example/algorithms/SortExample.soda
index 27f7f374..d1632291 100644
--- a/translator/src/test/resources/soda/translator/example/algorithms/SortExample.soda
+++ b/translator/src/test/resources/soda/translator/example/algorithms/SortExample.soda
@@ -17,7 +17,7 @@ class SortExampleWithAt
     sequence
       .indices
       .filter (lambda index --> index > 0)
-      .forall (lambda index --> sequence.apply (index - 1) <= sequence.apply (index) )
+      .forall (lambda index --> sequence .apply (index - 1) <= sequence .apply (index) )
 
 end
 
@@ -30,8 +30,8 @@ class SortExampleWithZip
 
   is_sorted_for (sequence : Seq [Int] ) : Boolean =
     sequence
-      .zip (sequence.tail)
-      .forall (lambda pair --> (pair._1 <= pair._2) )
+      .zip (sequence .tail)
+      .forall (lambda pair --> (pair ._1 <= pair ._2) )
 
 end
 
@@ -55,9 +55,9 @@ class SortAlgorithmExampleWithFold
     lambda sequence --> sort_for (sequence)
 
   sort_for (sequence : Seq [Int] ) : Seq [Int] =
-    if sequence.length < 2
+    if sequence .length < 2
     then sequence
-    else _fold.apply (sequence) (_initial_value) (_next_value_function)
+    else _fold .apply (sequence) (_initial_value) (_next_value_function)
 
   _initial_value = Seq [Int] ()
 
@@ -66,13 +66,13 @@ class SortAlgorithmExampleWithFold
 
   insert_sorted (sequence : Seq [Int] ) (element : Int) : Seq [Int] =
     concatenate (
-      first_part := sequence.takeWhile (lambda x --> x < element) ) (
+      first_part := sequence .takeWhile (lambda x --> x < element) ) (
       middle := Seq (element) ) (
-      last_part := sequence.dropWhile (lambda x --> x < element)
+      last_part := sequence .dropWhile (lambda x --> x < element)
     )
 
   concatenate (first_part : Seq [Int] ) (middle : Seq [Int] ) (last_part : Seq [Int] ) : Seq [Int] =
-    first_part.++ (middle.++ (last_part) )
+    first_part .++ (middle .++ (last_part) )
 
 end
 
@@ -84,10 +84,10 @@ class ConstrainedSortAlgorithm
     soda.lib.NoneSD_
 
   sort (sequence : Seq [Int] ) : OptionSD [Seq [Int] ] =
-    sort_with ( SortAlgorithmExampleWithFold_ ().sort (sequence) )
+    sort_with (SortAlgorithmExampleWithFold_ () .sort (sequence) )
 
   sort_with (sorted_sequence : Seq [Int] ) : OptionSD [Seq [Int] ] =
-    if SortExampleWithZip_ ().is_sorted (sorted_sequence)
+    if SortExampleWithZip_ () .is_sorted (sorted_sequence)
     then SomeSD_ (sorted_sequence)
     else NoneSD_ [Seq [Int] ] ()
 
@@ -142,21 +142,21 @@ class NonEmptySortedSequence [A subtype Comparable [A] ]
     lambda element --> add_for (element)
 
   add_for (element : A) : SortedSequence [A] =
-    NonEmptySortedSequence_ (aux.insert_sorted (sequence) (element) )
+    NonEmptySortedSequence_ (aux .insert_sorted (sequence) (element) )
 
-  invariant : Boolean = aux.is_sorted (sequence)
+  invariant : Boolean = aux .is_sorted (sequence)
 
 end
 
 class NonEmptySortedSequenceAux [A subtype Comparable [A] ]
 
   is_less_than (x : A) (y : A) : Boolean =
-    x.compareTo (y) < 0
+    x .compareTo (y) < 0
 
   is_sorted (other_sequence : Seq [A] ) : Boolean =
     other_sequence
-      .zip (other_sequence.tail)
-      .forall (lambda pair --> is_less_than (pair._1) (pair._2) )
+      .zip (other_sequence .tail)
+      .forall (lambda pair --> is_less_than (pair ._1) (pair ._2) )
 
   insert_sorted (original_sequence : Seq [A] ) (element : A) : Seq [A] =
     concatenate (
@@ -166,7 +166,7 @@ class NonEmptySortedSequenceAux [A subtype Comparable [A] ]
     )
 
   concatenate (first_part : Seq [A] ) (middle : Seq [A] ) (last_part : Seq [A] ) : Seq [A] =
-    first_part.++ (middle.++ (last_part) )
+    first_part .++ (middle .++ (last_part) )
 
 end
 
@@ -178,12 +178,12 @@ class SortedSequenceBuilder [A subtype Comparable [A] ]
   _fold = Fold_ ()
 
   build (sequence : Seq [A] ) : SortedSequence [A] =
-    _fold.apply (sequence) (_initial_value) (_next_value_function)
+    _fold .apply (sequence) (_initial_value) (_next_value_function)
 
   _initial_value : SortedSequence [A] = EmptySortedSequence_ [A] ()
 
   _next_value_function (sorted_sequence : SortedSequence [A] ) (element : A) : SortedSequence [A] =
-    sorted_sequence.add (element)
+    sorted_sequence .add (element)
 
 end
 
diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.scala b/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.scala
index df98218f..84de4a5b 100644
--- a/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.scala
+++ b/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.scala
@@ -15,7 +15,7 @@ trait Fairness
   def   rank : Applicant => Double
 
   def difference_between (value : Double) (another_value : Double) : Double =
-    Math.abs (value - another_value)
+    Math .abs (value - another_value)
 
   def have_similar_ranking (result1 : Double) (result2 : Double) : Boolean =
     difference_between (result1) (result2) < ranking_difference_tolerance
diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.soda b/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.soda
index f3e3099f..3c6adf8c 100644
--- a/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.soda
+++ b/translator/src/test/resources/soda/translator/example/ethicalissues/fairness/Fairness.soda
@@ -14,7 +14,7 @@ class Fairness
     rank : Applicant -> Double
 
   difference_between (value : Double) (another_value : Double) : Double =
-    Math.abs (value - another_value)
+    Math .abs (value - another_value)
 
   have_similar_ranking (result1 : Double) (result2 : Double) : Boolean =
     difference_between (result1) (result2) < ranking_difference_tolerance
diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/PriceMonitor.scala b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/PriceMonitor.scala
index 8b3f5942..f084c83a 100644
--- a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/PriceMonitor.scala
+++ b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/PriceMonitor.scala
@@ -22,7 +22,7 @@ trait PricingAgent
   lazy val milliseconds_per_day : Long = 24 * 60 * 60 * 1000
 
   def get_days_for (date : Date) : Int =
-    (date.getTime / milliseconds_per_day).toInt
+    (date .getTime / milliseconds_per_day) .toInt
 
 }
 
@@ -45,7 +45,7 @@ trait RequirementMonitor
   def   pricing_agent : PricingAgent
 
   def get_price (customer : Customer) (flight : Flight) (date_in_days : Int) : Int =
-    pricing_agent.get_price (customer) (flight) (date_in_days)
+    pricing_agent .get_price (customer) (flight) (date_in_days)
 
 }
 
diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/PriceMonitor.soda b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/PriceMonitor.soda
index 0607bf30..a063c9ee 100644
--- a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/PriceMonitor.soda
+++ b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/PriceMonitor.soda
@@ -22,7 +22,7 @@ class PricingAgent
   milliseconds_per_day : Long = 24 * 60 * 60 * 1000
 
   get_days_for (date : Date) : Int =
-    (date.getTime / milliseconds_per_day).toInt
+    (date .getTime / milliseconds_per_day) .toInt
 
 end
 
@@ -41,7 +41,7 @@ class RequirementMonitor
     pricing_agent : PricingAgent
 
   get_price (customer : Customer) (flight : Flight) (date_in_days : Int) : Int =
-    pricing_agent.get_price (customer) (flight) (date_in_days)
+    pricing_agent .get_price (customer) (flight) (date_in_days)
 
 end
 
diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement1Monitor.scala b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement1Monitor.scala
index 8d517a31..88573604 100644
--- a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement1Monitor.scala
+++ b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement1Monitor.scala
@@ -29,7 +29,7 @@ trait Requirement1Monitor
     get_report_with_similarity (price1) (price2) (get_similarity (price1) (price2) )
 
   def get_report_with_similarity (price1 : Int) (price2 : Int) (similarity : Double) : Report1 =
-    Report1_ (minimum_similarity <= similarity, price1, price2, similarity)
+    Report1_ (minimum_similarity <= similarity , price1 , price2 , similarity)
 
   def get_similarity (x : Int) (y : Int) : Double =
     1.0 * (min (x) (y) ) / (max (x) (y) )
diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement1Monitor.soda b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement1Monitor.soda
index 75a8b4a6..351512cb 100644
--- a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement1Monitor.soda
+++ b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement1Monitor.soda
@@ -28,7 +28,7 @@ class Requirement1Monitor
     get_report_with_similarity (price1) (price2) (get_similarity (price1) (price2) )
 
   get_report_with_similarity (price1 : Int) (price2 : Int) (similarity : Double) : Report1 =
-    Report1_ (minimum_similarity <= similarity, price1, price2, similarity)
+    Report1_ (minimum_similarity <= similarity , price1 , price2 , similarity)
 
   get_similarity (x : Int) (y : Int) : Double =
     1.0 * (min (x) (y) ) / (max (x) (y) )
diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement2Monitor.scala b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement2Monitor.scala
index 871cfe02..306d20f7 100644
--- a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement2Monitor.scala
+++ b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement2Monitor.scala
@@ -25,7 +25,7 @@ trait Requirement2Monitor
     )
 
   def get_report_with (old_price : Int) (new_price : Int) : Report2 =
-    Report2_ (new_price <= old_price * acceptable_increase, old_price, new_price)
+    Report2_ (new_price <= old_price * acceptable_increase , old_price , new_price)
 
   def get_a_year_before (date_in_days : Int) : Int =
     date_in_days - 365
diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement2Monitor.soda b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement2Monitor.soda
index 82e3b3e1..666060ee 100644
--- a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement2Monitor.soda
+++ b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement2Monitor.soda
@@ -24,7 +24,7 @@ class Requirement2Monitor
     )
 
   get_report_with (old_price : Int) (new_price : Int) : Report2 =
-    Report2_ (new_price <= old_price * acceptable_increase, old_price, new_price)
+    Report2_ (new_price <= old_price * acceptable_increase , old_price , new_price)
 
   get_a_year_before (date_in_days : Int) : Int =
     date_in_days - 365
diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.scala b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.scala
index 2d996777..6f186a51 100644
--- a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.scala
+++ b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.scala
@@ -23,16 +23,16 @@ trait Requirement3Monitor
     )
 
   def get_report_with (price_of_flight : Int) (price_of_flight_by_segments : Int) : Report3 =
-    Report3_ (price_of_flight <= price_of_flight_by_segments, price_of_flight, price_of_flight_by_segments)
+    Report3_ (price_of_flight <= price_of_flight_by_segments , price_of_flight , price_of_flight_by_segments)
 
   def get_price_of_flight_by_segments (customer : Customer) (flight : Flight) (date_in_days : Int) : Int =
-    sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight).segments) (date_in_days) )
+    sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight) .segments) (date_in_days) )
 
   def get_prices_of_segments (customer : Customer) (segments : Seq [Segment] ) (date_in_days : Int) : Seq [Int] =
-    segments.map (  segment => get_price (customer) (segment) (date_in_days) )
+    segments .map ( segment => get_price (customer) (segment) (date_in_days) )
 
   def sum_prices (prices : Seq [Int] ) : Int =
-    prices.sum
+    prices .sum
 
 }
 
@@ -58,12 +58,12 @@ trait SegmentsForFlight
   def   flight : Flight
 
   lazy val segments : Seq [Segment] =
-    rec_segments_multi (flight.start_airport) (flight.intermediate_airports) (flight.end_airport)
+    rec_segments_multi (flight .start_airport) (flight .intermediate_airports) (flight .end_airport)
 
   def rec_segments_multi (first_airport : String) (intermediate_stops : Seq [String] ) (last_airport : String) : Seq [Segment] =
     intermediate_stops match  {
-      case head :: tail => (rec_segments_multi (head) (tail) (last_airport) ).+: (Segment_ (first_airport, head) )
-      case x => Nil.+: (Segment_ (first_airport, last_airport) )
+      case head :: tail => (rec_segments_multi (head) (tail) (last_airport) ) .+: (Segment_ (first_airport , head) )
+      case otherwise => Nil .+: (Segment_ (first_airport , last_airport) )
     }
 
 }
diff --git a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda
index c7c038e8..42ebe343 100644
--- a/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda
+++ b/translator/src/test/resources/soda/translator/example/ethicalissues/pricemonitor/Requirement3Monitor.soda
@@ -22,16 +22,16 @@ class Requirement3Monitor
     )
 
   get_report_with (price_of_flight : Int) (price_of_flight_by_segments : Int) : Report3 =
-    Report3_ (price_of_flight <= price_of_flight_by_segments, price_of_flight, price_of_flight_by_segments)
+    Report3_ (price_of_flight <= price_of_flight_by_segments , price_of_flight , price_of_flight_by_segments)
 
   get_price_of_flight_by_segments (customer : Customer) (flight : Flight) (date_in_days : Int) : Int =
-    sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight).segments) (date_in_days) )
+    sum_prices (get_prices_of_segments (customer) (SegmentsForFlight_ (flight) .segments) (date_in_days) )
 
   get_prices_of_segments (customer : Customer) (segments : Seq [Segment] ) (date_in_days : Int) : Seq [Int] =
-    segments.map (lambda segment --> get_price (customer) (segment) (date_in_days) )
+    segments .map (lambda segment --> get_price (customer) (segment) (date_in_days) )
 
   sum_prices (prices : Seq [Int] ) : Int =
-    prices.sum
+    prices .sum
 
 end
 
@@ -53,12 +53,12 @@ class SegmentsForFlight
     flight : Flight
 
   segments : Seq [Segment] =
-    rec_segments_multi (flight.start_airport) (flight.intermediate_airports) (flight.end_airport)
+    rec_segments_multi (flight .start_airport) (flight .intermediate_airports) (flight .end_airport)
 
   rec_segments_multi (first_airport : String) (intermediate_stops : Seq [String] ) (last_airport : String) : Seq [Segment] =
     match intermediate_stops
-      case head :: tail ==> (rec_segments_multi (head) (tail) (last_airport) ).+: (Segment_ (first_airport, head) )
-      case otherwise ==> Nil.+: (Segment_ (first_airport, last_airport) )
+      case head :: tail ==> (rec_segments_multi (head) (tail) (last_airport) ) .+: (Segment_ (first_airport , head) )
+      case otherwise ==> Nil .+: (Segment_ (first_airport , last_airport) )
 
 end
 
diff --git a/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.scala b/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.scala
index eb396439..e5b7c7a3 100644
--- a/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.scala
+++ b/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.scala
@@ -10,10 +10,10 @@ trait RecursionForCoq
   private def _tailrec_fold4 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B =
     sequence match  {
       case (head) :: (tail) =>
-         if ( ( ! (condition (current_value) (head) ) )
+         if ( (! (condition (current_value) (head) ) )
          ) current_value
          else _tailrec_fold4 (tail) (next_value_function (current_value) (head)) (next_value_function) (condition)
-      case x => current_value
+      case otherwise => current_value
     }
 
   def fold4 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B => A => B) (condition : B => A => Boolean) : B =
@@ -23,8 +23,8 @@ trait RecursionForCoq
         @tailrec  final
   private def _tailrec_fold3 [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B => A => B) : B =
     sequence match  {
-      case (head) :: (tail) => _tailrec_fold3 (tail) (next_value_function (current_value) (head)) (next_value_function)
-      case x => current_value
+      case (head) :: (tail) => _tailrec_fold3 (tail) (next_value_function (current_value) (head) ) (next_value_function)
+      case otherwise => current_value
     }
 
   def fold3 [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B => A => B) : B =
diff --git a/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda b/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda
index f07091d9..ab14b52a 100644
--- a/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda
+++ b/translator/src/test/resources/soda/translator/example/forcoq/algorithms/RecursionForCoq.soda
@@ -20,7 +20,7 @@ class RecursionForCoq
   @tailrec
   _tailrec_fold3 [A] [B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) : B =
     match sequence
-      case (head) :: (tail) ==> _tailrec_fold3 (tail) (next_value_function (current_value) (head)) (next_value_function)
+      case (head) :: (tail) ==> _tailrec_fold3 (tail) (next_value_function (current_value) (head) ) (next_value_function)
       case otherwise ==> current_value
 
   fold3 [A] [B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) : B =
diff --git a/translator/src/test/resources/soda/translator/example/forcoq/lib/List.scala b/translator/src/test/resources/soda/translator/example/forcoq/lib/List.scala
index 9129eb5b..27e5a2be 100644
--- a/translator/src/test/resources/soda/translator/example/forcoq/lib/List.scala
+++ b/translator/src/test/resources/soda/translator/example/forcoq/lib/List.scala
@@ -33,8 +33,8 @@ trait SeqList
         @tailrec  final
   private def _tailrec_reverse [A] (a : list [A] ) (b : list [A] ) : list [A] =
     a match  {
-      case cons_ (e, s) => _tailrec_reverse (s) ( cons_ (e, b) )
-      case x => b
+      case cons_ (e , s) => _tailrec_reverse (s) (cons_ (e , b) )
+      case otherwise => b
     }
 
   def reverse [A] (s : list [A] ) : list [A] =
@@ -44,23 +44,23 @@ trait SeqList
         @tailrec  final
   private def _tailrec_from_Seq [A] (a : Seq [A] ) (b : list [A] ) : list [A] =
     a match  {
-      case (e) :: (s) => _tailrec_from_Seq (s) (cons_ (e, b) )
-      case x => b
+      case (e) :: (s) => _tailrec_from_Seq (s) (cons_ (e , b) )
+      case otherwise => b
     }
 
   def from_Seq [A] (a : Seq [A] ) : list [A] =
-    reverse (_tailrec_from_Seq (a) ( nil_ [A] () ) )
+    reverse (_tailrec_from_Seq (a) (nil_ [A] () ) )
 
   import scala.annotation.tailrec
         @tailrec  final
   private def _tailrec_to_Seq [A] (a : list [A] ) (b : Seq [A] ) : Seq [A] =
     a match  {
-      case cons_ (e, s) => _tailrec_to_Seq (s) ( b .+: (e) )
-      case x => b
+      case cons_ (e , s) => _tailrec_to_Seq (s) (b .+: (e) )
+      case otherwise => b
     }
 
   def to_Seq [A] (a : list [A] ) : Seq [A] =
-    (_tailrec_to_Seq (a) ( Seq [A]() ) ) .reverse
+    (_tailrec_to_Seq (a) (Seq [A] () ) ) .reverse
 
 }
 
diff --git a/translator/src/test/resources/soda/translator/example/forcoq/lib/List.soda b/translator/src/test/resources/soda/translator/example/forcoq/lib/List.soda
index 81616d69..1865d633 100644
--- a/translator/src/test/resources/soda/translator/example/forcoq/lib/List.soda
+++ b/translator/src/test/resources/soda/translator/example/forcoq/lib/List.soda
@@ -24,7 +24,7 @@ class SeqList
   @tailrec
   _tailrec_reverse [A] (a : list [A] ) (b : list [A] ) : list [A] =
     match a
-      case cons_ (e, s) ==> _tailrec_reverse (s) ( cons_ (e, b) )
+      case cons_ (e , s) ==> _tailrec_reverse (s) (cons_ (e , b) )
       case otherwise ==> b
 
   reverse [A] (s : list [A] ) : list [A] =
@@ -33,20 +33,20 @@ class SeqList
   @tailrec
   _tailrec_from_Seq [A] (a : Seq [A] ) (b : list [A] ) : list [A] =
     match a
-      case (e) :: (s) ==> _tailrec_from_Seq (s) (cons_ (e, b) )
+      case (e) :: (s) ==> _tailrec_from_Seq (s) (cons_ (e , b) )
       case otherwise ==> b
 
   from_Seq [A] (a : Seq [A] ) : list [A] =
-    reverse (_tailrec_from_Seq (a) ( nil_ [A] () ) )
+    reverse (_tailrec_from_Seq (a) (nil_ [A] () ) )
 
   @tailrec
   _tailrec_to_Seq [A] (a : list [A] ) (b : Seq [A] ) : Seq [A] =
     match a
-      case cons_ (e, s) ==> _tailrec_to_Seq (s) ( b .+: (e) )
+      case cons_ (e , s) ==> _tailrec_to_Seq (s) (b .+: (e) )
       case otherwise ==> b
 
   to_Seq [A] (a : list [A] ) : Seq [A] =
-    (_tailrec_to_Seq (a) ( Seq [A]() ) ) .reverse
+    (_tailrec_to_Seq (a) (Seq [A] () ) ) .reverse
 
 end
 
diff --git a/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.scala b/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.scala
index 9ed0568f..cf9f6514 100644
--- a/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.scala
+++ b/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.scala
@@ -42,13 +42,13 @@ trait S
      a => add_for (a)
 
   def add_for (a : nat) : nat =
-    t.from_non_negative( (t.to_Int (k) + 1) + t.to_Int (a) )
+    t .from_non_negative( (t .to_Int (k) + 1) + t .to_Int (a) )
 
   lazy val mul : nat =>  nat =
      a => mul_for (a)
 
   def mul_for (a : nat) : nat =
-    t.from_non_negative( (t.to_Int (k) + 1) * t.to_Int (a) )
+    t .from_non_negative( (t .to_Int (k) + 1) * t .to_Int (a) )
 
 }
 
@@ -79,7 +79,7 @@ trait IntNat
   def to_Int (a : nat) : Int =
     a match  {
       case S_ (k) => 1 + to_Int (k)
-      case x => 0
+      case otherwise => 0
     }
 
 }
diff --git a/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda b/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda
index 26b2af38..4d29b288 100644
--- a/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda
+++ b/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda
@@ -38,13 +38,13 @@ class S
     lambda a --> add_for (a)
 
   add_for (a : nat) : nat =
-    t.from_non_negative( (t.to_Int (k) + 1) + t.to_Int (a) )
+    t .from_non_negative( (t .to_Int (k) + 1) + t .to_Int (a) )
 
   mul : nat ->  nat =
     lambda a --> mul_for (a)
 
   mul_for (a : nat) : nat =
-    t.from_non_negative( (t.to_Int (k) + 1) * t.to_Int (a) )
+    t .from_non_negative( (t .to_Int (k) + 1) * t .to_Int (a) )
 
 end
 
diff --git a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FactorialForCoq.scala b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FactorialForCoq.scala
index c7896aec..04d049b7 100644
--- a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FactorialForCoq.scala
+++ b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FactorialForCoq.scala
@@ -10,7 +10,7 @@ trait FactorialForCoq
   private def _tailrec_get_factorial (m : nat) (product : nat) : nat =
     m match  {
       case S_ (k) => _tailrec_get_factorial (k) (product .mul ( S_ (k) ) )
-      case x => product
+      case otherwise => product
     }
 
   def get_factorial (n : nat) : nat =
diff --git a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FiboExampleInSodaForCoq.scala b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FiboExampleInSodaForCoq.scala
index 0b27f9ec..b25f8cf3 100644
--- a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FiboExampleInSodaForCoq.scala
+++ b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/FiboExampleInSodaForCoq.scala
@@ -11,7 +11,7 @@ trait FiboExampleInSodaForCoq
     m match  {
       case S_ (O_ () ) => b
       case S_ (k) => _tailrec_fib (k) (b) (a .add (b) )
-      case x => a
+      case otherwise => a
     }
 
   def fib (n : nat) =
diff --git a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.scala b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.scala
index eaa5d4f8..3509c832 100644
--- a/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.scala
+++ b/translator/src/test/resources/soda/translator/example/forcoq/mathematics/TriangularNumberForCoq.scala
@@ -10,7 +10,7 @@ trait TriangularNumberForCoq
   private def _tailrec_get_number (m : nat) (acc : nat) : nat =
     m match  {
       case S_ (k) => _tailrec_get_number (k) (acc .add ( S_ (k) ) )
-      case x => acc
+      case otherwise => acc
     }
 
   def get_number (n : nat) : nat =
diff --git a/translator/src/test/resources/soda/translator/example/inanutshell/InANutshell.scala b/translator/src/test/resources/soda/translator/example/inanutshell/InANutshell.scala
index c3ec94d2..ca4f6b9f 100644
--- a/translator/src/test/resources/soda/translator/example/inanutshell/InANutshell.scala
+++ b/translator/src/test/resources/soda/translator/example/inanutshell/InANutshell.scala
@@ -72,8 +72,8 @@ trait Example
 
   def min_max (a : Int) (b : Int) : MinMaxPair =
     MinMaxPair_ (
-      min = MaxAndMin_ ().min (a) (b),
-      max = MaxAndMin_ ().max (a) (b)
+      min = MaxAndMin_ () .min (a) (b),
+      max = MaxAndMin_ () .max (a) (b)
     )
 
 }
@@ -93,7 +93,7 @@ trait ComparableMax [A <: Comparable]
 {
 
   def max (a : A) (b : A) : A =
-    if ( a.is_greater_than (b)
+    if ( a .is_greater_than (b)
     ) a
     else b
 
diff --git a/translator/src/test/resources/soda/translator/example/inanutshell/InANutshell.soda b/translator/src/test/resources/soda/translator/example/inanutshell/InANutshell.soda
index fc647d38..c1bac66b 100644
--- a/translator/src/test/resources/soda/translator/example/inanutshell/InANutshell.soda
+++ b/translator/src/test/resources/soda/translator/example/inanutshell/InANutshell.soda
@@ -63,8 +63,8 @@ class Example
 
   min_max (a : Int) (b : Int) : MinMaxPair =
     MinMaxPair_ (
-      min := MaxAndMin_ ().min (a) (b),
-      max := MaxAndMin_ ().max (a) (b)
+      min := MaxAndMin_ () .min (a) (b),
+      max := MaxAndMin_ () .max (a) (b)
     )
 
 end
@@ -79,7 +79,7 @@ end
 class ComparableMax [A subtype Comparable]
 
   max (a : A) (b : A) : A =
-    if a.is_greater_than (b)
+    if a .is_greater_than (b)
     then a
     else b
 
diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.scala b/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.scala
index 608cbeec..bb864bae 100644
--- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.scala
+++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialPatternMatching.scala
@@ -11,7 +11,7 @@ trait FactorialPatternMatching
   private def _tailrec_get_factorial (n : Int) (product : Int) : Int =
     n match  {
       case 0 => product
-      case x => _tailrec_get_factorial (x - 1) (x * product)
+      case otherwise => _tailrec_get_factorial (n - 1) (n * product)
     }
 
 }
diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala
index 5512afd3..4a97f77b 100644
--- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala
+++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.scala
@@ -8,7 +8,7 @@ trait FactorialWithFold
   def apply (n : Int) : Int =
     if ( n < 0
     ) 0
-    else _fold.apply (_range.apply (n) ) (1) ( product =>  k => (product * (k + 1) ) )
+    else _fold .apply (_range .apply (n) ) (1) ( product =>  k => (product * (k + 1) ) )
 
 }
 
diff --git a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda
index 16a4ac45..9094d546 100644
--- a/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda
+++ b/translator/src/test/resources/soda/translator/example/mathematics/FactorialWithFold.soda
@@ -8,7 +8,7 @@ class FactorialWithFold
   apply (n : Int) : Int =
     if n < 0
     then 0
-    else _fold.apply (_range.apply (n) ) (1) (any product --> any k --> (product * (k + 1) ) )
+    else _fold .apply (_range .apply (n) ) (1) (any product --> any k --> (product * (k + 1) ) )
 
 end
 
diff --git a/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.scala b/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.scala
index e230f550..510c1156 100644
--- a/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.scala
+++ b/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.scala
@@ -21,7 +21,7 @@ case class OutputPair_ [A, B] (value : B, memoized_values : Map [A, B]) extends
 trait MemoizableFunction [A, B]
 {
 
-    /** compute (input : InputPair [A, B] ) : OutputPair [A, B] */
+    /** compute (input : InputPair [A] [B] ) : OutputPair [A] [B] */
   def   abs_compute : InputPair [A, B] => OutputPair [A, B]
 
   def compute (input : InputPair [A, B] ) : OutputPair [A, B] =
@@ -53,21 +53,21 @@ trait Memoizer [A, B]
       compute_for (input)
 
   def compute_for (input : InputPair [A, B] ) : OutputPair [A, B] =
-    _compute_with (input.memoized_values.get (input.value) ) (input)
+    _compute_with (input .memoized_values .get (input .value) ) (input)
 
   private def _compute_with (maybe_res : Option [B] ) (input : InputPair [A, B] ) : OutputPair [A, B] =
-    if ( maybe_res.isEmpty
+    if ( maybe_res .isEmpty
     ) compute_and_update (input)
-    else OutputPair_ (maybe_res.get, input.memoized_values)
+    else OutputPair_ (maybe_res .get, input .memoized_values)
 
   def compute_and_update (input : InputPair [A, B] ) : OutputPair [A, B] =
-    _compute_and_update_with (input.value) (main_function (input) )
+    _compute_and_update_with (input .value) (main_function (input) )
 
   private def _compute_and_update_with (input_value : A) (output : OutputPair [A, B] ) : OutputPair [A, B] =
-    _add_element (output, Tuple2 (input_value, output.value) )
+    _add_element (output, Tuple2 (input_value, output .value) )
 
   private def _add_element (output : OutputPair [A, B], new_pair : Tuple2 [A, B] ) : OutputPair [A, B] =
-    OutputPair_ (output.value, output.memoized_values + new_pair)
+    OutputPair_ (output .value, output .memoized_values + new_pair)
 
 }
 
@@ -90,19 +90,19 @@ trait HardProblem
 
   lazy val main_function : InputPair [Int, Int] => OutputPair [Int, Int] =
      input =>
-      if ( input.value == 1
-      ) OutputPair_ (0, input.memoized_values)
-      else _plus_one (compute (InputPair_ (one_step (input.value), input.memoized_values) ) )
+      if ( input .value == 1
+      ) OutputPair_ (0, input .memoized_values)
+      else _plus_one (compute (InputPair_ (one_step (input .value), input .memoized_values) ) )
 
   private def _plus_one (pair : OutputPair [Int, Int] ) : OutputPair [Int, Int] =
-    OutputPair_ (1 + pair.value, pair.memoized_values)
+    OutputPair_ (1 + pair .value, pair .memoized_values)
 
   lazy val abs_compute : InputPair [Int, Int] => OutputPair [Int, Int] =
      input =>
       compute_for (input)
 
   def compute_for (input : InputPair [Int, Int] ) : OutputPair [Int, Int] =
-    memoizer.compute (input)
+    memoizer .compute (input)
 
 }
 
@@ -120,15 +120,15 @@ trait MemoizedFibonacci
       main_function_for (input)
 
   def main_function_for (input : InputPair [Int, Int] ): OutputPair [Int, Int] =
-    if ( (input.value == 0) || (input.value == 1)
-    ) OutputPair_ (input.value, input.memoized_values )
-    else _compute_and_update_1 (compute (InputPair_ (input.value - 2, input.memoized_values ) ) ) (input.value)
+    if ( (input .value == 0) || (input .value == 1)
+    ) OutputPair_ (input .value, input .memoized_values )
+    else _compute_and_update_1 (compute (InputPair_ (input .value - 2, input .memoized_values ) ) ) (input .value)
 
   private def _compute_and_update_1 (first_tuple : OutputPair [Int, Int] ) (n : Int ) : OutputPair [Int, Int] =
-    _compute_and_update_2 (first_tuple.value) (compute (InputPair_ (n - 1, first_tuple.memoized_values) ) ) (n)
+    _compute_and_update_2 (first_tuple .value) (compute (InputPair_ (n - 1, first_tuple .memoized_values) ) ) (n)
 
   private def _compute_and_update_2 (first_value : Int) (second_tuple : OutputPair [Int, Int] ) (n : Int ) : OutputPair [Int, Int] =
-    _compute_and_update_3 (_get_next_fibo (first_value) (second_tuple.value) ) (second_tuple.memoized_values) (n)
+    _compute_and_update_3 (_get_next_fibo (first_value) (second_tuple .value) ) (second_tuple .memoized_values) (n)
 
   private def _compute_and_update_3 (res : Int) (second_map : Map [Int, Int] ) (n : Int) : OutputPair [Int, Int] =
     OutputPair_ (res, second_map + Tuple2 (n, res) )
@@ -141,7 +141,7 @@ trait MemoizedFibonacci
       compute_for (input)
 
   def compute_for (input : InputPair [Int, Int] ) : OutputPair [Int, Int] =
-    memoizer.compute (input)
+    memoizer .compute (input)
 
 }
 
diff --git a/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.soda b/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.soda
index 673d7304..9073f96e 100644
--- a/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.soda
+++ b/translator/src/test/resources/soda/translator/example/mathematics/HardProblem.soda
@@ -46,21 +46,21 @@ class Memoizer [A] [B]
       compute_for (input)
 
   compute_for (input : InputPair [A] [B] ) : OutputPair [A] [B] =
-    _compute_with (input.memoized_values.get (input.value) ) (input)
+    _compute_with (input .memoized_values .get (input .value) ) (input)
 
   _compute_with (maybe_res : Option [B] ) (input : InputPair [A] [B] ) : OutputPair [A] [B] =
-    if maybe_res.isEmpty
+    if maybe_res .isEmpty
     then compute_and_update (input)
-    else OutputPair_ (maybe_res.get, input.memoized_values)
+    else OutputPair_ (maybe_res .get, input .memoized_values)
 
   compute_and_update (input : InputPair [A] [B] ) : OutputPair [A] [B] =
-    _compute_and_update_with (input.value) (main_function (input) )
+    _compute_and_update_with (input .value) (main_function (input) )
 
   _compute_and_update_with (input_value : A) (output : OutputPair [A] [B] ) : OutputPair [A] [B] =
-    _add_element (output, Tuple2 (input_value, output.value) )
+    _add_element (output, Tuple2 (input_value, output .value) )
 
   _add_element (output : OutputPair [A] [B], new_pair : Tuple2 [A] [B] ) : OutputPair [A] [B] =
-    OutputPair_ (output.value, output.memoized_values + new_pair)
+    OutputPair_ (output .value, output .memoized_values + new_pair)
 
 end
 
@@ -80,19 +80,19 @@ class HardProblem
 
   main_function : InputPair [Int] [Int] -> OutputPair [Int] [Int] =
     lambda input -->
-      if input.value == 1
-      then OutputPair_ (0, input.memoized_values)
-      else _plus_one (compute (InputPair_ (one_step (input.value), input.memoized_values) ) )
+      if input .value == 1
+      then OutputPair_ (0, input .memoized_values)
+      else _plus_one (compute (InputPair_ (one_step (input .value), input .memoized_values) ) )
 
   _plus_one (pair : OutputPair [Int] [Int] ) : OutputPair [Int] [Int] =
-    OutputPair_ (1 + pair.value, pair.memoized_values)
+    OutputPair_ (1 + pair .value, pair .memoized_values)
 
   abs_compute : InputPair [Int] [Int] -> OutputPair [Int] [Int] =
     lambda input -->
       compute_for (input)
 
   compute_for (input : InputPair [Int] [Int] ) : OutputPair [Int] [Int] =
-    memoizer.compute (input)
+    memoizer .compute (input)
 
 end
 
@@ -107,15 +107,15 @@ class MemoizedFibonacci
       main_function_for (input)
 
   main_function_for (input : InputPair [Int] [Int] ): OutputPair [Int] [Int] =
-    if (input.value == 0) or (input.value == 1)
-    then OutputPair_ (input.value, input.memoized_values )
-    else _compute_and_update_1 (compute (InputPair_ (input.value - 2, input.memoized_values ) ) ) (input.value)
+    if (input .value == 0) or (input .value == 1)
+    then OutputPair_ (input .value, input .memoized_values )
+    else _compute_and_update_1 (compute (InputPair_ (input .value - 2, input .memoized_values ) ) ) (input .value)
 
   _compute_and_update_1 (first_tuple : OutputPair [Int] [Int] ) (n : Int ) : OutputPair [Int] [Int] =
-    _compute_and_update_2 (first_tuple.value) (compute (InputPair_ (n - 1, first_tuple.memoized_values) ) ) (n)
+    _compute_and_update_2 (first_tuple .value) (compute (InputPair_ (n - 1, first_tuple .memoized_values) ) ) (n)
 
   _compute_and_update_2 (first_value : Int) (second_tuple : OutputPair [Int] [Int] ) (n : Int ) : OutputPair [Int] [Int] =
-    _compute_and_update_3 (_get_next_fibo (first_value) (second_tuple.value) ) (second_tuple.memoized_values) (n)
+    _compute_and_update_3 (_get_next_fibo (first_value) (second_tuple .value) ) (second_tuple .memoized_values) (n)
 
   _compute_and_update_3 (res : Int) (second_map : Map [Int] [Int] ) (n : Int) : OutputPair [Int] [Int] =
     OutputPair_ (res, second_map + Tuple2 (n, res) )
@@ -128,7 +128,7 @@ class MemoizedFibonacci
       compute_for (input)
 
   compute_for (input : InputPair [Int] [Int] ) : OutputPair [Int] [Int] =
-    memoizer.compute (input)
+    memoizer .compute (input)
 
 end
 
diff --git a/translator/src/test/resources/soda/translator/example/mathematics/PiIterator.scala b/translator/src/test/resources/soda/translator/example/mathematics/PiIterator.scala
index 9adbdaa0..1a0b487b 100644
--- a/translator/src/test/resources/soda/translator/example/mathematics/PiIterator.scala
+++ b/translator/src/test/resources/soda/translator/example/mathematics/PiIterator.scala
@@ -22,22 +22,22 @@ trait PiIterator
     _tailrec_take (n) (Seq () ) (_initial_status) (_get_next (_initial_status) )
 
   private lazy val _initial_status =
-    Status_ (r = 0, n = 3, q = 1, t = 1, l = 3, k = 1)
+    Status_ (r = 0 , n = 3 , q = 1 , t = 1 , l = 3 , k = 1)
 
   import scala.annotation.tailrec
         @tailrec  final
   private def _tailrec_compute_new_status (s : Status) : Status =
-    if ( (4 * s.q + s.r - s.t) < (s.n * s.t)
+    if ( (4 * s .q + s .r - s .t) < (s .n * s .t)
     ) s
     else
       _tailrec_compute_new_status (
         Status_ (
-          r = (2 * s.q + s.r) * s.l,
-          n = ( (s.q * (7 * s.k) + 2 + (s.r * s.l) ) / (s.t * s.l) ).toInt,
-          q = s.q * s.k,
-          t = s.t * s.l,
-          l = s.l + 2,
-          k = s.k + 1
+          r = (2 * s .q + s .r) * s .l ,
+          n = ( (s .q * (7 * s .k) + 2 + (s .r * s .l) ) / (s .t * s .l) ) .toInt ,
+          q = s .q * s .k ,
+          t = s .t * s .l ,
+          l = s .l + 2 ,
+          k = s .k + 1
         )
       )
 
@@ -48,22 +48,22 @@ trait PiIterator
         @tailrec  final
   private def _tailrec_take (n : Int) (rev_seq : Seq [Int] ) (s : Status) (t : IntAndStatus) : Seq [Int] =
     if ( n == 0
-    ) rev_seq.reverse
-    else _tailrec_take (n - 1) (rev_seq.+: (t.digit) ) (t.new_status) (_get_next (t.new_status) )
+    ) rev_seq .reverse
+    else _tailrec_take (n - 1) (rev_seq .+: (t .digit) ) (t .new_status) (_get_next (t .new_status) )
 
   private def _get_next (s : Status) : IntAndStatus =
     _get_next_with_new_status (_compute_new_status (s) )
 
   private def _get_next_with_new_status (s : Status) : IntAndStatus =
     IntAndStatus_ (
-      s.n,
+      s .n ,
       Status_ (
-        r = 10 * (s.r - s.n * s.t),
-        n = ( ( (10 * (3 * s.q + s.r) ) / s.t) - (10 * s.n) ).toInt,
-        q = s.q * 10,
-        t = s.t,
-        l = s.l,
-        k = s.k
+        r = 10 * (s .r - s .n * s .t) ,
+        n = ( ( (10 * (3 * s .q + s .r) ) / s .t) - (10 * s .n) ) .toInt ,
+        q = s .q * 10 ,
+        t = s .t ,
+        l = s .l ,
+        k = s .k
       )
     )
 
diff --git a/translator/src/test/resources/soda/translator/example/mathematics/PiIterator.soda b/translator/src/test/resources/soda/translator/example/mathematics/PiIterator.soda
index c986df09..108c35b8 100644
--- a/translator/src/test/resources/soda/translator/example/mathematics/PiIterator.soda
+++ b/translator/src/test/resources/soda/translator/example/mathematics/PiIterator.soda
@@ -20,21 +20,21 @@ class PiIterator
     _tailrec_take (n) (Seq () ) (_initial_status) (_get_next (_initial_status) )
 
   _initial_status =
-    Status_ (r := 0, n := 3, q := 1, t := 1, l := 3, k := 1)
+    Status_ (r := 0 , n := 3 , q := 1 , t := 1 , l := 3 , k := 1)
 
   @tailrec
   _tailrec_compute_new_status (s : Status) : Status =
-    if (4 * s.q + s.r - s.t) < (s.n * s.t)
+    if (4 * s .q + s .r - s .t) < (s .n * s .t)
     then s
     else
       _tailrec_compute_new_status (
         Status_ (
-          r := (2 * s.q + s.r) * s.l,
-          n := ( (s.q * (7 * s.k) + 2 + (s.r * s.l) ) / (s.t * s.l) ).toInt,
-          q := s.q * s.k,
-          t := s.t * s.l,
-          l := s.l + 2,
-          k := s.k + 1
+          r := (2 * s .q + s .r) * s .l ,
+          n := ( (s .q * (7 * s .k) + 2 + (s .r * s .l) ) / (s .t * s .l) ) .toInt ,
+          q := s .q * s .k ,
+          t := s .t * s .l ,
+          l := s .l + 2 ,
+          k := s .k + 1
         )
       )
 
@@ -44,22 +44,22 @@ class PiIterator
   @tailrec
   _tailrec_take (n : Int) (rev_seq : Seq [Int] ) (s : Status) (t : IntAndStatus) : Seq [Int] =
     if n == 0
-    then rev_seq.reverse
-    else _tailrec_take (n - 1) (rev_seq.+: (t.digit) ) (t.new_status) (_get_next (t.new_status) )
+    then rev_seq .reverse
+    else _tailrec_take (n - 1) (rev_seq .+: (t .digit) ) (t .new_status) (_get_next (t .new_status) )
 
   _get_next (s : Status) : IntAndStatus =
     _get_next_with_new_status (_compute_new_status (s) )
 
   _get_next_with_new_status (s : Status) : IntAndStatus =
     IntAndStatus_ (
-      s.n,
+      s .n ,
       Status_ (
-        r := 10 * (s.r - s.n * s.t),
-        n := ( ( (10 * (3 * s.q + s.r) ) / s.t) - (10 * s.n) ).toInt,
-        q := s.q * 10,
-        t := s.t,
-        l := s.l,
-        k := s.k
+        r := 10 * (s .r - s .n * s .t) ,
+        n := ( ( (10 * (3 * s .q + s .r) ) / s .t) - (10 * s .n) ) .toInt ,
+        q := s .q * 10 ,
+        t := s .t ,
+        l := s .l ,
+        k := s .k
       )
     )
 
diff --git a/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.scala b/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.scala
index 972a35a8..0777b27c 100644
--- a/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.scala
+++ b/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.scala
@@ -17,7 +17,7 @@ trait Main
 {
 
   def main (arguments : Array [String] ) : Unit =
-    MiniExample_ ().run ()
+    MiniExample_ () .run ()
 
 }
 
diff --git a/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.soda b/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.soda
index 69ef7143..eef7ba5b 100644
--- a/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.soda
+++ b/translator/src/test/resources/soda/translator/example/miniexample/MiniExample.soda
@@ -15,7 +15,7 @@ end
 class Main
 
   main (arguments : Array [String] ) : Unit =
-    MiniExample_ ().run ()
+    MiniExample_ () .run ()
 
 end
 

From bd0433ab140b83e6be888749e313a361a6137113 Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Wed, 24 May 2023 17:17:30 +0200
Subject: [PATCH 38/56] Remove Latex documents

---
 documentation/src/site/tex/bibliography.bib   |  46 -
 .../discussion/chapter-01-introduction.tex    | 443 ---------
 .../tex/discussion/chapter-02-description.tex | 838 ------------------
 documentation/src/site/tex/main.tex           |  51 --
 .../tex/manual/appendix-01-reservedwords.tex  |  69 --
 .../site/tex/manual/appendix-02-libraries.tex |  91 --
 .../src/site/tex/manual/chapter-03-usage.tex  | 329 -------
 .../tex/manual/chapter-04-implementation.tex  | 305 -------
 .../site/tex/manual/chapter-05-tutorial.tex   | 258 ------
 9 files changed, 2430 deletions(-)
 delete mode 100644 documentation/src/site/tex/bibliography.bib
 delete mode 100644 documentation/src/site/tex/discussion/chapter-01-introduction.tex
 delete mode 100644 documentation/src/site/tex/discussion/chapter-02-description.tex
 delete mode 100644 documentation/src/site/tex/main.tex
 delete mode 100644 documentation/src/site/tex/manual/appendix-01-reservedwords.tex
 delete mode 100644 documentation/src/site/tex/manual/appendix-02-libraries.tex
 delete mode 100644 documentation/src/site/tex/manual/chapter-03-usage.tex
 delete mode 100644 documentation/src/site/tex/manual/chapter-04-implementation.tex
 delete mode 100644 documentation/src/site/tex/manual/chapter-05-tutorial.tex

diff --git a/documentation/src/site/tex/bibliography.bib b/documentation/src/site/tex/bibliography.bib
deleted file mode 100644
index aa660af3..00000000
--- a/documentation/src/site/tex/bibliography.bib
+++ /dev/null
@@ -1,46 +0,0 @@
-@inproceedings{doi:10.1145/3278721.3278745,
-    abstract = {Ethics by Design concerns the methods, algorithms and tools needed to endow autonomous agents with the capability to reason about the ethical aspects of their decisions, and the methods, tools and formalisms to guarantee that an agent's behavior remains within given moral bounds. In this context some questions arise: How and to what extent can agents understand the social reality in which they operate, and the other intelligences (AI, animals and humans) with which they co-exist? What are the ethical concerns in the emerging new forms of society, and how do we ensure the human dimension is upheld in interactions and decisions by autonomous agents?. But overall, the central question is: "Can we, and should we, build ethically-aware agents?" This paper presents initial conclusions from the thematic day of the same name held at PRIMA2017, on October 2017.},
-    author = {Dignum, Virginia and Baldoni, Matteo and Baroglio, Cristina and Caon, Maurizio and Chatila, Raja and Dennis, Louise and G\'enova, Gonzalo and Haim, Galit and Klie\ss , Malte S. and Lopez-Sanchez, Maite and Micalizio, Roberto and Pav\'on, Juan and Slavkovik, Marija and Smakman, Matthijs and {Van Steenbergen} , Marlies and Tedeschi, Stefano and {Van Der Toree} , Leon and Villata, Serena and {De Wildt} , Tristan},
-    booktitle = {AIES 2018 - Proceedings of the 2018 AAAI/ACM Conference on AI, Ethics, and Society},
-    doi = {10.1145/3278721.3278745},
-    isbn = {9781450360128},
-    keywords = {ACM proceedings,LATEX,text tagging, ethics by design, machine ethics, multi-agent systems},
-    title = {{Ethics by Design: Necessity or Curse?}},
-    pages = {60--66},
-    publisher = {Association for Computing Machinery},
-    address = {New York, NY, USA},
-    year = {2018},
-    month = {12},
-    location = {New Orleans, LA, USA},
-    series = {{AIES '18}}
-}
-
-@article{Casalnuovo2019,
-    abstract = {Code corpora, as observed in large software systems, are now known to be far more repetitive and predictable than natural language corpora. But why? Does the difference simply arise from the syntactic limitations of programming languages? Or does it arise from the differences in authoring decisions made by the writers of these natural and programming language texts? We conjecture that the differences are not entirely due to syntax, but also from the fact that reading and writing code is un-natural for humans, and requires substantial mental effort; so, people prefer to write code in ways that are familiar to both reader and writer. To support this argument, we present results from two sets of studies: 1) a first set aimed at attenuating the effects of syntax, and 2) a second, aimed at measuring repetitiveness of text written in other settings (e.g. second language, technical/specialized jargon), which are also effortful to write. We find that this repetition in source code is not entirely the result of grammar constraints, and thus some repetition must result from human choice. While the evidence we find of similar repetitive behavior in technical and learner corpora does not conclusively show that such language is used by humans to mitigate difficulty, it is consistent with that theory. This discovery of “non-syntactic” repetitive behaviour is actionable, and can be leveraged for statistically significant improvements on the code suggestion task. We discuss this finding, and other future implications on practice, and for research.},
-    archivePrefix = {arXiv},
-    arxivId = {1806.02437},
-    author = {Casalnuovo, Casey and Sagae, Kenji and Devanbu, Prem},
-    doi = {10.1007/s10664-018-9669-7},
-    eprint = {1806.02437},
-    issn = {15737616},
-    journal = {Empirical Software Engineering},
-    keywords = {Corpus comparison,Language modeling,Natural languages,Parse trees,Programming languages,Syntax {\&} grammar},
-    title = {{Studying the difference between natural and programming language corpora}},
-    year = {2019}
-}
-
-@article{Martin2017,
-    abstract = {Building upon the success of best-sellers The Clean Coder and Clean Code, legendary software craftsman Robert C. "Uncle Bob" Martin shows how to bring greater professionalism and discipline to application architecture and design. As with his other books, Martin's Clean Architecture doesn't merely present multiple choices and options, and say "use your best judgment": it tells you what choices to make, and why those choices are critical to your success. Martin offers direct, no-nonsense answers to key architecture and design questions like: What are the best high level structures for different kinds of applications, including web, database, thick-client, console, and embedded apps? What are the core principles of software architecture? What is the role of the architect, and what is he/she really trying to achieve? What are the core principles of software design? How do designs and architectures go wrong, and what can you do about it? What are the disciplines and practices of professional architects and designers? Clean Architecture is essential reading for every software architect, systems analyst, system designer, and software manager -- and for any programmer who aspires to these roles or is impacted by their work.},
-    archivePrefix = {arXiv},
-    arxivId = {arXiv:1011.1669v3},
-    author = {Martin, Robert C.},
-    eprint = {arXiv:1011.1669v3},
-    isbn = {978-0134494166},
-    issn = {13563890},
-    journal = {Prentice Hall},
-    mendeley-groups = {literature/2021/summer{\_}paper},
-    pmid = {15991970},
-    title = {{Clean Architecture: A Craftsman's Guide to Software Structure and Design}},
-    year = {2017}
-}
-
diff --git a/documentation/src/site/tex/discussion/chapter-01-introduction.tex b/documentation/src/site/tex/discussion/chapter-01-introduction.tex
deleted file mode 100644
index 1694c852..00000000
--- a/documentation/src/site/tex/discussion/chapter-01-introduction.tex
+++ /dev/null
@@ -1,443 +0,0 @@
-\chapter{Introduction}
-
-\newcommand{\question}[1]{\textit{#1}}
-
-\newcommand{\comment}[1]{{#1}}
-
-\newcommand{\Sodalogo}{$\lambda $
-
-    \vspace{-5.5pt} $ \bigcup \hspace{-13pt} = $}
-
-
-\section{Why - An Itemized Justification}
-
-\begin{itemize}
-    \item AI systems can be dangerous, not only at an ethical level
-    \item AI systems can be very complex.
-    \item Governance can only be achieved by framing and understanding a system.~\cite{doi:10.1145/3278721.3278745}
-    \item Communication with computers is formal.
-    \item Formal languages are not yet descriptive and resilient to humans, and efficient for computers.
-    \item A new descriptive and efficient language would better ensure that AI systems are not dangerous to humans.
-\end{itemize}
-
-
-
-\textbf{Research Question 1}: How would it be a human-oriented descriptive language used for communication with computers?
-
-
-\textbf{Research Question 2}: How could ethical values be encoded in such a language?
-
-
-\textbf{Research Question 3}: How should an ethical verification system integrate that language?
-
-\subsection{AI Systems risks}
-
-AI systems can outperform single or multiple human beings in specific tasks, like massively performed facial recognition.
-If they are used indulgently, they can threaten human well-being.
-
-\footnote{\url{https://www.cser.ac.uk/research/risks-from-artificial-intelligence/}}
-\footnote{\url{https://futureoflife.org/open-letter-autonomous-weapons/}}.
-\footnote{\url{https://builtin.com/artificial-intelligence}}
-
-Please observe that we are not considering the risks as consequences of the so-called Artificial General Intelligence.
-We consider that the technological gap to reach that point is considerably large and the degree of speculation needed makes it difficult to develop a scientifically solid statement.
-
-\subsection{AI Systems complexity}
-
-Even it is difficult to define precisely what AI means, it is commonly accepted in the literature that they are complex systems.
-
-The problem here is that it is difficult to find a crystal-clear definition of Artificial Intelligence.
-Some people would think of the \textit{new} artificial intelligence as machine learning, which is not only wrong, but also not conducive to a \textit{more accurate} definition.
-For now, and in the context of this report, AI is either one of two things:
-\begin{itemize}
-    \item a very complex computer system
-    \item whatever hasn't been done yet. (Larry Tesler's theorem)
-\end{itemize}
-
-\subsection{Governance of AI Systems}
-
-This means that it is not enough to have an `off-switch'.
-Governance can only be achieved when a system is properly understood by those using it.
-
-When a customer buys a product, and the package is transparent, the customer has more trust than when it is opaque and just has a nice picture.
-The same happens with a system.
-It is good if a recognized expert validates how a system works, but it is a lot better if its users can see it by themselves.
-Transparency together with governance are not `nice-to-have' properties in a trustable system, they are `must-have' properties instead.
-
-\subsection{Communication with computers}
-
-It does not matter how beautiful and human-friendly a graphic interface can look,
-the communication with a system is through a sequence of 0's and 1's that are interpreted by the computer.
-In other words, the human understanding of an approximate explanation does not apply to computers.
-They simulate it, but in the end, everything inside is 0's and 1's.
-
-\comment{
-    This is very difficult to \textit{prove}.
-    Papers that mention \textit{communication} usually is about \textit{communication protocols} or similar topics.
-    This is almost completely unrelated to the human-computer communication.
-    There is also Human-Computer Interaction, which focuses on user interfaces (UI) and user experiences (UX).
-    However, every interaction is translated to a sequence of events or commands, which can be perfectly described by a computer language.
-}
-
-\subsection{Formal languages}
-
-\begin{itemize}
-    \item Why is it hard for people to understand other people's code?
-    \item Why do people write comments in natural language next to the source code?
-    \item Why do developers need debugging tools at all?
-    \item Why cannot most of the people read code as they read a newspaper?
-\end{itemize}
-The answer to the above questions is simple: source code is not easy to read\cite{Casalnuovo2019}.
-Source code needs to be learned, needs to be practiced, and even with many years, pieces of code can be deceiving.
-\footnote{\url{https://www.quora.com/What-are-the-biggest-problems-with-modern-programming-languages}}
-
-It seems that some programming languages are designed to simplify its parsing by computers, and not for other humans.
-
-This can be since the beginning of computing.
-Languages like Fortran, APL, Cobol, and Lisp sought a simplified communication in some sense.
-Fortran is to write mathematical formulas, APL is highly symbolic and minimalistic, Cobol looks like writing English sentences, Lisp is algebraic.
-A long list of programming languages, can prove how hard it is to express things clearly.
-
-Python is probably one of the most popular languages in the direction of achieving being both descriptive and useful.
-
-\comment{
-    This is a difficult topic.
-    How can I make something better without saying that what is done is worse?
-    The answer: every language has its own domain.
-    It is difficult to criticize programming languages with long trajectory.
-    It is better to give a context for their application.
-
-    \begin{tabular}{lll}
-        C
-        & pro: efficient and long running                          \\
-        & con: difficult to maintain, code can be unreadable       \\
-        Python
-        & pro: fast prototyping                                    \\
-        & con: one never knows where it crashes                    \\
-        Java
-        & pro: reliable engineering                                \\
-        & con: verbose and difficult to read                       \\
-        Scala
-        & pro: highly flexible and elegant                         \\
-        & con: things can be written in a completely illegible way \\
-    \end{tabular}
-
-    The list can continue, but how to prove that \textit{none} of the developed languages is \textit{good enough}?
-    The answer: by clustering them in groups sharing similar issues.
-    The clusters are:
-    \begin{itemize}
-        \item Dynamically typed languages
-        \item Imperative language with mutable values
-        \item Highly verbose languages
-        \item Languages with very limited expressive power
-        \item Languages without classes
-        \item Languages without lambda expressions
-        \item Non-portable languages
-        \item Languages without prototyping
-    \end{itemize}
-
-    These clusters capture almost all (if not all) mainstream programming languages, and most of unimplemented formal languages.
-
-    The individual justification of each of the points goes in a different section.
-    Some are rather easy (dynamically typed languages). Other are not that easy (highly verbose languages) because they rely in a perception of quality (how much is too much?) rather in an objective principle.
-
-    There are languages that can be distinguished inspirations:
-    \begin{itemize}
-        \item Coq: because it can create a program and prove its correctness, which competes with the human checking, and it complements with it.
-        Its code can be exported to Haskell.
-        \item Idris: because it is a Haskell dialect based on dependent types.
-        Its programs can be made more reliable than standard Haskell.
-        \item Haskell: because it is a long-running functional language, with a large community.
-        It is a de-facto standard in functional languages.
-        \item Closure: because it is Lisp dialect that runs on the JVM.
-        \item Prolog: because it is highly minimalistic.
-        It is language with long trajectory, and widely accepted in the scientific community.
-        \item Scala: because it is concise, flexible, and seamlessly integrates object orientation with functional programming.
-        \item Python: because it is becoming the de-facto standard language in teaching.
-        Many young students start with Scratch\footnote{\url{https://scratch.mit.edu/}}, but there is a natural transition to Python. In practice many people will understand Python before any other computer language.
-    \end{itemize}
-
-    An important observation that needs to be answered is why relying on humans to understand a program.
-    Python is highly readable, and might be a global standard in 10 years, but there is very little verification on the code before it is already running.
-    Coq, on the other side, is a little more difficult to read, but the compiler can check a proof for the code, and it even can be exported to functional languages.
-    The new language has to have a readability comparable to Python, but the compiler has to help proving its correctness as much as possible.
-
-    For comparison, a human would not normally check whether a spreadsheet software performs the mathematical operations correctly.
-    The human would check that the calculations are done using the right cells with the right operations.
-}
-
-\subsection{A New Language}
-
-A new language is needed, something descriptive and efficient enough.
-In this context, `efficient' does not necessary mean that is faster than C, for example.
-We mean that its execution or evaluation time is in a human scale.
-In other words, a human needs to be able to follow what it is written, and determine whether it is right or wrong.
-This does not mean that a computer cannot help, but it means that a computer is not needed to understand its operation.
-This language needs a way of using it.
-This is discussed in the corresponding section.
-
-
-\section{Why a Language}
-
-A system can check that an AI system is following ethical principles.
-
-The encoding of ethical values and principles should be reachable to those affected.
-If ethical values are encoded in a very complex formalisms, they are not reachable to the affected humans, and could be highly error prone.
-
-The purpose of the language is to have formal specifications that can be \textbf{easily understood by a human reader}, and can be immediately prototyped.
-This is used to verify if ethical values are properly encoded in a verification system.
-
-Human-centered specifications are intended to be clearly understood by humans.
-Please note that this is not necessarily the most abstract form of specification, since a very abstract specification could be hard to understand even for the intended reader.
-
-As a rule of thumb, the \textbf{intended reader} for this language is a human that can read a formal specification, probably a second-year undergraduate student of a scientific or engineering course of studies.
-
-There is a marked distinction between the reader and the writer.
-In standard formalisms, it is common to find that the gap from reading to writing in that formalism can be small or even trivial.
-
-This is not necessarily the case in the language we are presenting.
-The language needs to be very easily understood, although not necessarily very easily written.
-
-The \textbf{intended writer} is then an experienced technician that can model ethical values using the provided constructs, but producing a highly readable description.
-
-
-\section{Properties for the Language}
-
-This section discusses what kind of language is needed.
-
-The following is a list of properties required for a useful specification language for ethical problems.
-
-\begin{itemize}
-    \item Formal semantics
-    \item Consistency
-    \item Decidability
-    \item Unary predicates, properties or types
-    \item Relations or binary predicates
-    \item Logical connectors
-    \item Distinction and counting
-    \item States or time
-    \item Specific domains
-\end{itemize}
-
-
-\section{At-most requirements}
-
-\subsection{Formal semantics}
-
-(filter $\leq $)
-
-A formal semantics is intended to give meaning to the language.
-This could be used not only to present to humans, but also to prove formal properties on the language.
-This allows for rewriting, to have consistency checking and/or formal verification.
-
-(This discards most of the informally developed programming languages.)
-
-\subsection{Consistency}
-
-(filter $\leq $)
-
-The language has to produce consistent specifications.
-Consistency is a key property to ensure that a system really follows what is has been specified.
-In other words, if a specification is not consistent, it is not usable.
-
-Please note that this requires that descriptions are \textbf{well-defined}.
-Some programming languages handle undefined values poorly, letting a program throw an exception when this occurs, instead of preventing it from happening in the first place.
-
-(This property is maybe obvious, but discards unusable formal languages.)
-
-\subsection{Decidability}
-
-(filter $\leq $)
-
-Decidability is intended to ensure that an answer exists and it is computable.
-This comes, of course, to a gray area, since decidability has a high price tag by reducing expressiveness.
-Thus, the requirement is to have a language with a well-defined useful decidable fragment.
-
-
-\section{At-least requirements}
-
-\subsection{Unary predicates, properties or types}
-
-(filter $\geq $)
-
-Predicates and properties are a very natural way of expressing ideas.
-If a formal language does not have them, it becomes more intricate to read.
-
-(This discards low-expressive formalisms, like propositional logic.)
-
-\subsection{Logical connectors}
-
-(filter $\geq $)
-
-The language should include some logical connectors used in natural languages.
-Things like \textit{and}, \textit{or}, \textit{not} should be able to be expressed in a direct way.
-
-(This discards many decidable fragments of FOL, like lightweight description logics. )
-
-\subsection{Distinction and counting}
-
-(filter $\geq $)
-
-Expressing distinction is a simple way to count.
-Without distinction, there is no way to say ``at least 3 elements''.
-
-Even if it is possible, some formalisms do not provide constructs to do it.
-In other words, to say that a set has at least 3 elements, we need to explicitly mention $a, b, c$, and then state
-$\{a, b, c\} \subseteq A$, $a \neq b$, $a \neq c$, $b \neq c$.
-
-This grows quadratically in the number of elements.
-This is not human friendly, and a construct should be provided, something like $size(A) \geq 3$
-
-(This discards formalisms without counting.)
-
-\subsection{Relations or binary predicates}
-
-(filter $\geq $)
-
-Relating objects is necessary to express basic ideas.
-For example, to express that something belongs to someone, it is necessary to relate two elements.
-An alternative would be creating separate predicates for each object or for each owner.
-This grows linearly in the number of properties (for objects or owners) and it is not human friendly.
-
-(This discards formalisms without relations.)
-
-\subsection{States or time}
-
-(filter $\geq $)
-
-It should be possible to reflect the conceptual idea of time and a sequence.
-This means that things happen in a certain order, there is a \textit{before} and an \textit{after}.
-In addition, in these transitions, there are \textit{states} associated.
-This is a human way of understanding \textit{how things go}.
-
-(This discards formalisms without states.)
-
-\subsection{Specific domains}
-
-(filter $\geq $)
-
-It should be possible to describe things going without modelling them completely.
-This means, for example, using operations with floating point, without specifying how floating point works.
-When modelling problems, it is reasonable to assume that underlying types would work as expected.
-
-(This discard formalisms that cannot use specific domains / concrete domains.)
-
-
-\section{State of the Art - Why \Soda}
-
-This is a justification of how \Soda was designed.
-
-This justification is developed resembling a derivation.
-
-The purpose of \Soda is to give more control to humans on what computers do.
-
-This is part of concepts like \textbf{transparency} and \textbf{governance}.
-
-Transparency comes when the user is aware of what a system is doing.
-
-Some parts of the programming of a system are beyond the understanding and interest of most humans.
-However, it is necessary in critical parts that humans need to completely understand their functioning.
-
-Currently, this is achieved using different tools and techniques.
-These include diverse types of tests, best practices, optimal architecture designs, and other rituals to preserve a system under a human control.
-
-\Soda is a language that intends to be easy for and close to humans.
-This language is intended to be simple and direct.
-Because of that, this language can be considered a \textbf{specification language} or a \textbf{description language}.
-
-Several formalisms are suitable for this task.
-The following list is a comprehensive list of categories, although this list is not necessarily exhaustive.
-\begin{itemize}
-    \item Controlled natural languages, like Attempto Controlled English.
-    \item Families of non-classical logics, like modal logics, multi-modal logics, hybrid logics, description logics, epistemic logics, and temporal logics.
-    \item First-order logic.
-    \item Specification languages for software engineering, like Zed.
-    \item Theorem proving assistants, like Coq and Isabelle.
-    \item Descriptive programming languages, like Prolog, SmallTalk, Python, and their dialects.
-    \item Functional programming languages, like Haskell, Scala, Lisp, and their dialects.
-\end{itemize}
-
-Each category has advantages and disadvantages, and can model different aspects of a system.
-
-One of the first properties we want is that a message written with the language has to be \textbf{unambiguous for a human}, either describing formulas or relations.
-While a sentence in a controlled natural language is unambiguous for a computer, it could have some shades of ambiguity for humans.
-The same challenges that writing a formal text has, are present in a controlled language specification.
-
-In addition, some specifications are better described with mathematical formulas than reciting those formulas.
-Natural languages produce confusion in some people, since the common use is not necessarily consistent.
-For example, the fallacy ``$p \to q$ then $\lnot p \to \lnot q$'' is unfortunately very common.
-
-In a specification, we want to \textbf{describe qualities and quantities in a natural way}.
-We want to describe relations between them.
-Non-classical logics are very good to describe qualities, but they can have some limitations to describe quantities.
-This does not mean that it is impossible, but rather unusual, needing to tailor a logic for each particular problem.
-Decidable fragments of non-classical logics can, however, \textbf{verify consistency} in a specification.
-This property is also desirable in the specification language.
-
-Another property is the possibility of \textbf{prototyping the specification}.
-We want that the specification can be \textit{run} in some sense.
-This is very useful to test what the specification says, for example.
-It also lets the user create tests that work as examples of what the specification should model.
-
-First-order logic is with no doubt a powerful tool and it is \textbf{universally understood}.
-However, it is not simple to produce a program that satisfies a specification.
-The power of first-order logic backfires when a human is not aware of its limitations to prototype their specification.
-The semi-decidability of first-order logic is then problematic to automatically generate a prototype.
-
-The Z Specification Language combines the good properties of first-order logic and set theory.
-While this language is more suited for certain types of projects, prototyping is still not straight forward.
-
-Theorem proving assistants, like Coq and Isabelle, are excellent tools to model and prove small theorems.
-
-Some very descriptive languages like SmallTalk and Python are dynamically typed.
-That means that type inconsistencies could be found when the program is already running.
-Python has an imperative approach which can carry in the source code some common errors made in imperative languages, like undetectable side effects or unsafe thread execution.
-
-Prolog is maybe one of the most innovative programming languages.
-It is descriptive, but it is dynamically typed. In addition, it has a single data type, the term, and subtypes atoms, numbers, variables, and compound terms.\footnote{\url{https://en.wikipedia.org/wiki/Prolog_syntax_and_semantics}}
-Prolog uses the cut (!) symbol to operate, and its execution can sometimes become difficult to follow.
-
-Functional languages are then the best candidates to consider.
-Lisp and its dialects, like Clojure and Racket, have still some limitations regarding modelling.
-One of the disadvantages in Lisp is the absence of types.
-This issue is addressed in Racket\footnote{https://racket-lang.org}.
-Another disadvantage of Lisp is the technological gap that needs to be breached when integrating it with the most used technology.
-This issue is addressed in Clojure\footnote{https://clojure.org}, which is integrated with the Java Virtual Machine.
-The abundance of structures with parentheses hinders readability, but it could be suitable for a skilled technician.
-
-Another important functional language is Haskell.
-It is one of the most used and most influential functional languages.
-Haskell allows writing clean, descriptive, statically typed code.
-Its readability is very good and it is easy to write formulas in it.
-
-The only missing piece in Haskell is the definition of objects, although modules are available for a similar purpose.
-In the word of Haskell programmers, object-oriented methods are a \textit{syntactic sugar}.
-However, the source code with that syntactic sugar can make the code more intuitive.
-
-For this \Soda, has \textbf{object-oriented notation}.
-The justification is that humans tend to group and categorize things. % TODO Citation
-Humans are used to put things in shelves, drawers, wardrobes, boxes, rooms, etc., and then look for those things where they are supposed to be.
-Something similar may happen with functions, and objects capture this idea of having the functions (methods) that are related to them.
-
-This is, of course, an arguable position, since for some people having all functions together seems to be more natural.
-The fact of how the most used programming languages have been adopted somehow justifies which preferences were usually considered the most natural.
-The structured programming in Pascal was more adopted than the GOTO-based Basic.
-The object-oriented C++ and Java became more adopted than plain C.
-Many imperative languages, like Java, Python, and C, have functional constructs.
-
-Here are two more things we want in \Soda.
-One is to \textbf{limit its expressiveness to help the user}.
-In other words, the user is able to essentially express the same things, but making fewer errors.
-
-Another thing is \textbf{minimality}.
-The reason beyond that is not only simplify how a specification is written, but also how it is read.
-Maybe Prolog would be, from the formalisms considered here, the language with optimal minimality.
-
-We can finally consider Scala\footnote{https://www.scala-lang.org}, which has every single thing we asked for \Soda, except minimality and limits in the expressiveness to avoid errors.
-
-Scala is a statically-typed general-purpose programming language, is multi-paradigm, and fusions object-oriented and functional paradigms.
-In this fusion, Scala includes tail recursion, something typical of functional languages, and \scalawhile statement, something typical of imperative languages.
-This symbiosis can, unfortunately, lead to mixed programs, which, even for skilled Scala programmers, are difficult to follow.
-
-\Soda is based on a small subset of the purely functional part of Scala, influenced mainly by Haskell and Coq in its design, and in some other aspects, by highly popular languages like Java and Python.
-
diff --git a/documentation/src/site/tex/discussion/chapter-02-description.tex b/documentation/src/site/tex/discussion/chapter-02-description.tex
deleted file mode 100644
index 6cb06eed..00000000
--- a/documentation/src/site/tex/discussion/chapter-02-description.tex
+++ /dev/null
@@ -1,838 +0,0 @@
-\chapter{Description}
-
-\Soda (Symbolic Objective Descriptive Analysis) is a human-centered formalism to describe, formalize, and prototype ethical problems and constraints.
-It could be seen as a specification language or as a functional programming language.
-A specification or piece of source code written in \Soda needs to be especially easy to read, but it does not need to be easy to write.
-
-A prototype written in \Soda does not need to be efficient, as long as it can be executed in a \textit{reasonable time}.
-A reasonable time is not a mathematical definition, but a human perception for a specific task.
-
-The current implementation of \Soda can be translated into Scala, and it relies on its data types.
-Prototypes written in \Soda can be run in the Java Virtual Machine (JVM).
-Therefore, it can be used as a JVM library and use libraries written in Java, Scala, or any other JVM language.
-
-The reasons of translating \Soda into Scala and not just using Scala could be summarized in three main points.
-
-The first point is to have a \textbf{lean syntax}.
-\Soda is expected to maximize transparency of written code.
-In general, less reserved words are used.
-For example, there is no need to distinguish between values (in Scala, \scalaval) and variables (in Scala, \scalavar).
-Also, there is no need to distinguish between public, protected or private methods.
-
-The second point is to have a \textbf{constrained syntax}.
-This means that the only available commands are those of a purely functional approach.
-This prevents creating mutable objects, like when using \scalavar, or changing a class behavior by inheritance, like when using a \scalaclass that is not a \scalacase \ \scalaclass.
-It is worth noticing that, since \Soda is a JVM language, it also accepts JVM mutable objects.
-However, these objects need to be explicitly declared, and can be restricted, if that is necessary.
-
-Finally, the third point is to have \textbf{translation options}.
-\Soda could be translated to other languages that support tail recursion like Kotlin, for example.
-
-
-\section{The Problems to Solve}
-
-\begin{itemize}
-    \item complex syntax
-    \item mutable objects
-    \item ambiguous (to humans) syntax (C / C++)
-    \item intricate symbols (Scala)
-    \item excessive importance of code format (Python)
-    \item excessive verbosity (Java)
-\end{itemize}
-
-
-\section{The Intended User of \Soda}
-
-The purpose of \Soda is to give at least one way that is clear enough to describe things, paying less regard to efficiency.
-
-Let us try to think what problems \Soda tries to solve.
-If we think on the first programming languages, like Fortran, Cobol, and Lisp, they had challenges to parse the source code.
-Newer programming languages, like Python or Scala, have had clearly more powerful computers to do the processing.
-
-Lisp source code can look very flexible, but it could be challenging keeping track of the parentheses.
-
-Fortran has been used by physicist thanks to its important number of libraries for physics.
-Earlier versions of Fortran could not process recursion as we usually do it now, since it did not use a stack for the variables.
-Programming backtracking was extremely intricate.
-
-\Soda allows writing functions as tail recursive, as in other modern functional languages, and the compiler transforms the tail recursion to an iteration.
-
-Someone who needs to understand the code does not necessarily need to know how to write a tail recursion.
-Writing a tail recursion requires some knowledge of algorithms, but reading a tail recursion is very intuitive, in a mathematical way.
-Because of this type of asymmetries, we say that \Soda is a language that is easy to read but not necessarily easy to write.
-
-Since \Soda is intended to maximize transparency, there is no reserved word to declare private methods.
-In object-oriented programming languages, classes and their attributes and methods are declared private to prevent using them outside the intended place.
-In \Soda, a protected class, a constant, or a function name can be identified by using an underscore as prefix.
-Sometimes, many auxiliary functions could be in fact part of an entity by themselves.
-In that case, it is better to collect those functions in a separate class instead of having them protected in the original class.
-
-
-\section{A Descriptive Language}
-
-In traditional programming languages, if we need to represent a big data structure, every byte counts.
-If we need to store numbers between 0 and 250, a byte (8 bits) would suffice.
-However, if we need to store numbers between 0 and 260, we would need one more bit (9 bits), which is practice it would mean to use two bytes (16 bits).
-
-In most cases, we do not care if an integer is 32-bit or 64-bit, and to understand an algorithm, we do not even care if an integer has a fixed length.
-The number of bytes a system uses is a technical issue, and it could complicate the understanding of an algorithm.
-
-This level of detail is usually irrelevant to describe a problem, unless the problem is about this technicality.
-In other words, it is more natural that a human reads about a number, regardless of how many bits that number needs to be represented.
-
-In an algorithm, we explain a sequence of steps to accomplish a particular goal.
-If we want to order an array, we can either swap elements in an array, like in bubble sort, or we can choose a pivot, like in quicksort, or use other strategies.
-
-Is it really important to describe a problem to know how an array is sorted?
-Usually we do not care how an array is being sorted, as long as it takes a \textit{reasonable} time.
-
-Let us consider another example.
-If we are manipulating strings, and we want to find a particular pattern.
-Finding a pattern is a very common problem.
-As long as there is one way of finding a pattern, we do not really care how it is done.
-
-\Soda could be seen mostly as a specification language, where we can specify without saying how.
-It could be seen as a programming language as well.
-
-The important point is that it can provide at least one implementation that is good enough, with an acceptable complexity, to test if something is compliant or not.
-
-
-\section{Purpose of \Soda}
-
-The purpose of \Soda is to give a ``yes'' or ``no'' answer to verify if something is compliant to ethical constraints.
-Ideally, it should also provide an explanation for its answer.
-
-As said before, \Soda is a formalism with some libraries.
-It is not only a restricted variant of a functional language.
-It is also all the collections of requirements that are useful for defining ethical problems.
-
-In an iterative process, new ethical problems are formalized in \Soda, and when patterns are found in many problems, they join its libraries.
-Thus, \Soda contains a collection of small classes and functions to accomplish particular tasks.
-
-In some cases, it could look like a controlled natural language, but it is not its purpose to look like one.
-For example, there are formulas that can be said as a sentence or written as a formula.
-Reading ``the square root of two'' is harder than reading $\sqrt{2}$.
-\Soda code has to be easy to read, not necessarily easy to say, or to write.
-
-
-\section{General features}
-
-The goal of \Soda is to specify without being too specific, giving some freedom for different implementations.
-\Soda tries to keep a good balance between vagueness and concreteness, specificity and generality,
-and what is very descriptive but also technically useful.
-
-This happens in a way that is general enough to abstract implementations, but specific enough to constraint a problem.
-We do not need to define how things are done, as long as they are done correctly and in a reasonable time.
-
-
-\section{Technical Considerations}
-
-\Soda needs to be abstract enough to describe, efficient enough, easy to read, easy to execute, and easy to integrate.
-Because of that, \Soda is a JVM language and can be compiled into Java byte code.
-
-For now, the translator converts \Soda code into Scala code, which in turn can be compiled to byte code.
-For the sake of compatibility with the JVM, \Soda has an \sodaoverride and a \sodanew annotations.
-The \sodaoverride annotations is to be able to override JVM definitions, like method \srccode{toString()} in class \srccode{Object}.
-The \sodanew annotation is to be able to create JVM objects, but it is a technical compromise to be able to translate to Scala 2.
-In the translation to Scala 3 this annotation can be omitted.
-
-\Soda uses the main types provided by Scala.
-For example, numeric types like \srccode{Int}, \srccode{Float}, and immutable collections like \srccode{Seq}, \srccode{List}, \srccode{Array}, and \srccode{Map}.
-The JVM exception handling is done via \srccode{Try}.
-
-
-\section{Philosophy}
-
-\Soda is designed to be a functional specification language.
-There are some general rules that apply to it:
-
-\begin{itemize}
-    \item the specification is intended to be read and understood by a human, so it has to be very clear;
-    \item every defined thing is defined only once, in one place;
-    \item objects are immutable;
-    \item classes cannot be modified, but they can be extended.
-\end{itemize}
-
-
-\section{Mutability}
-
-Mutability is one of the reason that algorithms get more difficult to understand.
-It is not a matter to understand what the algorithms seems to be doing, it is about what it is actually doing.
-Although it could be a practical way to reduce memory usage, it could also be error prone.
-For this reason, \Soda does not have ways to program mutability.
-
-For technical reasons, it is possible to use mutable objects from the JVM in \Soda.
-This is strongly discouraged, since other design decisions are based assuming that objects are immutable.
-
-\Soda does not handle exceptions (except when they come from the JVM).
-The exceptions are caught by Scala classes (like \srccode{Try}), as Scala does.
-
-Functions with side effects, like input and output operations, are discouraged in \Soda.
-In exceptional cases, they could be managed by JVM libraries.
-
-
-\section{Constants and Functions}
-
-In \Soda there are no mutable objects and therefore every value is constant.
-In addition, a function without parameters is computed as a constant, i.e. it is computed only once and remains unchanged.
-
-There is a technical difference between constants and functions with empty parameters.
-As in Scala, the use of parameters is expected to denote side effects, and indicates that the value is recalculated every time they are invoked.
-For constants, \Soda uses \textit{lazy evaluation}, and they are only evaluated when they are used for the first time.
-
-
-\section{Types and Classes}
-
-\Soda is statically typed.
-It has some ideas of object orientation.
-However, there are substantial differences with traditional object-oriented programming.
-
-
-\section{Object Inheritance and Overriding}
-
-\subsection{Classes}
-
-Classes are like traits in Scala and interfaces in Java, and either do not have any implementation, or what is implemented cannot be overridden.
-In addition, classes can contain \textit{abstract} constants and functions, which are only signatures of constants and functions.
-If a class contains such abstract constants or functions, we say that it is an \textit{abstract} class.
-
-It is possible to define the equivalent to case classes in Scala.
-In this context, we call them \textit{concrete} classes.
-They cannot be extended and they have a default constructor.
-
-\subsection{Classes to define concepts}
-
-Classes should contain the smallest number of constants and functions to describe a \textbf{concept}.
-It is important to highlight that the concept should look familiar to a human being for the particular domain being modelled.
-While \srccode{Dog} could be a familiar concept to model in a general domain, \srccode{CanisLupusFamiliaris} could be more appropriate in a zoology-centered domain.
-
-As a matter of design, it is then recommended to have small abstract classes.
-The larger the class, the more vague its purpose, and therefore, the less useful it is.
-
-An extension should only be used when a concept modelled by a class clearly extends another one.
-If a class modelling a concept uses functions from another class modelling a different concept, the former should instantiate the latter to use the constants and functions.
-
-The name of a concrete class that is a default implementation of another class is the name of the abstract class with a suffix underscore.
-
-\begin{lstlisting}[label={lst:exampleDefaultImplementation}]
-class MyModule
-
-  f (x : Int) : Int = x + 1
-
-end
-\end{lstlisting}
-
-The definition of the sequence of constants, functions, and subclasses starts with an left brace (``\srccode{\{}'') and closes with a right brace (``\srccode{\}}'').
-
-All constants and functions in a class are meant to be \textit{final}, i.e. if another classes extends the former, it cannot change any defined constant or function from a super class.
-This is to prevent that the modelled behavior in a class is changed after extending a it.
-For technical reasons, the annotation \sodaoverride can be used to override JVM methods that are implemented already, like \srccode{Any.toString}.
-
-In \Soda, there is a \sodathis reserved word where an object can refer to its own instance, but there is no \scalasuper reserved word.
-The reason is that there is no difference between a constant or function defined in a class or in a super class.
-
-In \Soda, it is possible to define a \textit{type alias}.
-This is just a renaming of a more complex definition.
-
-This can be done by defining a class equals to another class instead of defining the body.
-
-\begin{lstlisting}[label={lst:exampleTypeAlias}]
-  class MyMap = Map [Int, Seq [Int] ]
-
-  class A [T] = Seq [Int, String]
-\end{lstlisting}
-
-This feature is only available when translating to Scala 3.
-
-
-\section{Static Constants and Functions}
-
-In \Soda, there is no concept of static functions.
-It is never assumed that there is one instance of an object.
-The class constructors can be implemented as objects of another class, although not necessary unique.
-
-
-\section{Parametric Types}
-
-Parametric types are technically possible.
-It is possible to put upper bounds in the parameter, to define it as a subtype of another type.
-
-\begin{lstlisting}[label={lst:exampleUpperBoundParameter}]
-class Shape
-
-end
-
-class Movable
-
-end
-
-class Painter [A]
-
-end
-
-class ShapePainter [A subtype Shape]
-
-end
-\end{lstlisting}
-
-In the example, a ShapePainter is an abstract class that can be applied to any Shape or subtype A of a Shape.
-When a concrete class extends ShapePainter, it can use specific functions of a concrete type A, even if they are not in type Shape.
-A concrete class extending ShapeMover requires a parameter that is a Shape and that is Movable.
-
-Usually, parametric types are needed for highly generic data types, like collections.
-Parameters are used to reduce code length, but sometimes smaller code is not necessarily easier to understand.
-Using parametric types could hide a design flaw, when the code looks ``very general'', but in practice is only applicable to one specific type.
-
-
-\section{Style}
-
-\Soda does not require a semicolon to finish each instruction, and the tabulation at the beginning of the line is irrelevant.
-Consecutive lines ending with a comma character (\srccode{,}) are considered to belong to the same line.
-
-Braces in the definition of a function should be avoided whenever that is possible.
-
-Defining a constant or a function requires a space around the `equals' character (\sodadef).
-With \sodadefparam is also possible to define values for parameters when using named parameters.
-
-\begin{lstlisting}[label={lst:exampleFunctionWithoutBraces}]
-class EqualsExample
-
-  answer = f (x := 20) (y := 2)
-
-  f (x : Int) (y : Int) : Int = 2 * x + y
-
-end
-\end{lstlisting}
-
-
-Variables are statically defined and are used as bound variables in typed lambda expressions, and unlike mutable variables in standard imperative languages.
-
-The recommended naming convention is using snake case, i.e. separating the words with underscore.
-Class names should start with a capital letter, functions with a lowercase letter.
-
-In addition, it is recommended to use nouns representing properties for constants and verbs for functions.
-A function should always receive at least one parameter, except when it produces some sort of side effect.
-
-Some exceptions are the constants that start with prefix ``\srccode{is}'', ``\srccode{as}'', and ``\srccode{to}'', which do not need parameters.
-
-In addition, a parameter name should always be a noun, even if the signature is of a function.
-Although redundant, this could be eased by adding the suffix ``\srccode{function}''.
-Thus, the contrast of reading a noun used as a function is reduced.
-
-This example shows the three cases
-
-\begin{lstlisting}[label={lst:exampleFunctionsAsParameter}]
-    naive_definition (values : Seq [Int] ) (weighted_average : Seq [Int] -> Int) : Int =
-      weighted_average (values)
-
-    alternative_definition (values : Seq[Int] ) (compute_weighted_average : Seq[Int] -> Int) : Int =
-      compute_weighted_average (values)
-
-    recommended_definition (values : Seq[Int] ) (weighted_average_function : Seq[Int] -> Int) : Int =
-      weighted_average_function (values)
-\end{lstlisting}
-
-Analogously, for a Boolean function, the suffix ``\srccode{condition}'' could simplify the reading.
-
-Since there are no private functions or constants in a class, the suggestion is to start their name with an underscore.
-
-Recursive functions should start with prefix ``\srccode{rec}'', for example, just ``\srccode{rec}'', or ``\srccode{rec\_find\_elem}''.
-This is to indicate that there is a recursion, and extra care should be taken into account to verify termination.
-
-Although in the current version of \Soda there is no check for detection of recursive calls, this could be implemented in the future.
-For example, a warning or an error could be shown if one or multiple functions participating in recursions do not indicate that with prefix ``rec''.
-
-Since JVM objects use camel case, i.e. multiple words come together starting with a capital letter,
-some \Soda code could use camel case to be integrated with other JVM languages.
-
-The following list is an example to summarize the naming convention.
-
-\begin{itemize}
-    \item \srccode{LocalTranslator} \\
-    \textbf{class} - noun that starts with a capital letter and uses camel case
-
-    \item \srccode{first\_name} \\
-    \textbf{constant} - noun that starts with a lowercase letter and uses snake case
-
-    \item \srccode{translate\_paragraph(s: String)} \\
-    \textbf{function} - predicate that starts with lowercase letter and uses snake case
-
-    \item \srccode{is\_empty} \\
-    \textbf{constant} - predicate ``is-'' that starts with lowercase letter and uses snake case
-
-    \item \srccode{as\_translator} \\
-    \textbf{constant} - predicate ``as-'' that starts with lowercase letter and uses snake case
-
-    \item \srccode{to\_global\_translator} \\
-    \textbf{constant} - predicate ``to-'' that starts with lowercase letter and uses snake case
-
-    \item \srccode{toGlobalTranslator} \\
-    \textbf{constant} - predicate ``to-'' that starts with lowercase letter and uses camel case to be used by JVM projects
-
-    \item \srccode{LocalTranslator\_} \\
-    \textbf{concrete class} - noun that starts with a capital letter and uses camel case and ends with an underscore
-
-    \item \srccode{\_LocalModel} \\
-    \textbf{non-public class} - noun that starts with an underscore and then capital letter and uses camel case
-
-    \item \srccode{\_internal\_identifier} \\
-    \textbf{non-public constant} - noun that starts with an underscore and then a lowercase letter and uses snake case
-
-    \item \srccode{\_find\_internal\_identifier(s: String)} \\
-    \textbf{non-public function} - predicate that starts with an underscore and then a lowercase letter and uses snake case
-
-    \item \srccode{rec\_find\_elem(s: String)} \\
-    \textbf{recursive function} - predicate that starts with prefix ``rec'' and then lowercase letter and uses snake case
-
-\end{itemize}
-
-Example using snake case, recommended in \Soda
-
-\begin{lstlisting}[label={lst:exampleExtendsSnakeCase}]
-/** Class for a registered person, in snake case */
-
-class Registered_person
-
-  abstract
-    first_name : String
-    last_name : String
-
-  _separator = " "
-
-  full_name = first_name + _separator + last_name
-
-end
-\end{lstlisting}
-
-Example using camel case, as in Java:
-\begin{lstlisting}[label={lst:exampleExtendsCamelCase}]
-/** Class for a registered person, in camel case */
-
-class RegisteredPerson
-
-  abstract
-    firstName : String
-    lastName : String
-
-  _separator = " "
-
-  fullName = firstName + _separator + lastName
-
-end
-\end{lstlisting}
-
-
-\section{Comments}
-
-Comments are marked with \srccode{/*} and \srccode{*/}.
-It is possible to use Scaladoc by starting the comment with \srccode{/**}, as in Scala.
-In each line, comments and source code are mutually exclusive: a line that has comments does not have source code, a line that has source code does not have comments.
-
-In general, comments are slightly discouraged, because the code should be descriptive enough. %% TODO : Cite Robert Martin
-If the code is not descriptive enough, it should be refactored instead of commented.
-Comments can very easily get outdated if the source is changed and the comment is not updated.
-
-Comments can be part of the implementation itself as constants in classes.
-The advantage of this type of comment is that it can be accessed in runtime.
-This does not prevent the synchronization issue between written text and written code, though.
-For example,
-
-\begin{lstlisting}[label={lst:exampleClassWithComment}]
-class InterestingClass ()
-
-  doc = "This class is just an example of how to include comments as part of the code."
-
-end
-\end{lstlisting}
-
-A similar feature can be found in Python, for example, where Docstrings can be accessed by reading variable \srccode{\_\_doc\_\_}.
-
-The \srccode{doc} constant is only recommended for concrete classes.
-For abstract classes, the constant should contain a suffix with the class name.
-
-For example,
-\begin{lstlisting}[label={lst:exampleAbstractAndConcreteClassesWithComment}]
-class AbstractClassA
-
-    doc_AbstractClassA = "Documentation of abstract class A. "
-
-end
-
-class AbstractClassB
-  extends
-    AbstractClassA
-
-    doc_AbstractClassB = "Documentation of abstract class B. " + doc_AbstractClassA
-
-end
-\end{lstlisting}
-
-Clearly, an extending class does not need to include the documentation of its superclasses.
-
-
-\section{Minimality and orthogonality}
-
-The importance of minimality and orthogonality is simplification and standardization.
-
-Minimality helps the user to understand remembering a smaller set of reserved words.
-Less reserved words also implies less combinations of them.
-
-Orthogonality helps to achieve common design patterns and helps to define a normal form.
-Patterns make source code easier to understand and to detect mistakes in it.
-
-
-\section{Definitions, theorems, and examples}
-
-In mathematics books, it is common to find Definitions, Theorems, and Examples.
-
-Mathematics uses a very compact notation, defining and redefining symbols to achieve complex expressions.
-Mathematicians take some time to get acquainted to the notation by reading examples, understanding lemmas, theorems, and their proofs.
-Mathematics is believed to be difficult to understand.
-This is often attributed, not only to its complex abstract nature, but also to its notation.
-
-The main purpose of \Soda is to make a formal description easy to understand.
-For this, we can take advantage of similar techniques used in mathematics.
-
-A set of \Soda classes can be seen as \textit{definitions}.
-
-Unit tests are the \textit{examples}, as they contain specific instances.
-
-Properties of classes and their functions can be seen as \textit{theorems}.
-\Soda is not especially designed to prove correctness of programs, but provides some elements thar simplifies the human part on this verification.
-Properties can be proven by using a theorem prover assistant, like Coq or Isabelle, which can export a proof to Haskell code.
-This code should be translated to \Soda.
-
-This approach is currently future work and has not yet implemented.
-There are, however, some automated checks that are already implemented.
-
-\subsection{Static Types}
-
-The first and most relevant check is the static type system.
-This provides the first check in compile time to ensure that \Soda code is consistent.
-
-\subsection{Immutable Variables}
-
-The purely functional approach keeps consistency across the evaluation of a function, because variables do not change.
-
-\subsection{Unambiguous Syntax}
-
-Some functional languages, like Haskell, allow the user to change precedence of its operators, leaving the possibility of writing without parentheses.
-Although this could look aesthetically better, leaves room for ambiguity for the human reader, who might mistake the order of evaluation.
-
-\subsection{Less Format Errors}
-
-Some languages have significant whitespace, like Python.
-This is error-prone and, for example, makes it easier to wrongly put a function outside or inside a class, or execute a function after a block, which should be inside.
-Significant whitespace has been a strong motivation to keep the code well indented, but at a very high price of making code writing more error-prone.
-
-\subsection{Less Verbosity}
-
-Some languages can be very verbose, like Java.
-This verbosity can hinder sometimes the true intention in the code.
-\Soda is designed to be lightweight and say what it is necessary, but not more.
-
-\subsection{Explicit forms}
-
-\texttt{Implicits} is maybe one of the most powerful features of Scala, but also one of the most confusing.
-They are exactly that, implicit, which makes them hard to find without using tools.
-Implicits have been considered overused (and misused) in Scala 2, and motivated a change in Scala 3 as \textit{givens}.
-
-\subsection{Clear Location of Definitions}
-
-In some languages, it is possible to partially define functions, like in Haskell, or predicates, like in Prolog.
-In the latter, having multiple definitions might make it harder to understand or predict how the interpreter will evaluate a program.
-In \Soda, each class and each function is defined only once, in one unique place.
-They are final and immutable, simplifying to the human reader the process of understanding their result.
-
-\subsection{Used to Check}
-
-\Soda is a language designed to \textit{check} whether something is right, rather that \textit{explaining} how it should be done.
-As in an example of sorting a sequence, \Soda can be used to explain a process in a natural way, although not necessarily in an efficient way.
-
-
-\section{Semantics}
-
-\newcommand{\I}[1]{\ensuremath{{#1}^{\mathcal{I}}}}
-
-\newcommand{\DeltaI}{\ensuremath{\Delta _{\mathcal{I}}}}
-\newcommand{\ThetaI}{\ensuremath{\Theta _{\mathcal{I}}}}
-\newcommand{\PhiI}{\ensuremath{\Phi _{\mathcal{I}}}}
-
-\newcommand{\lambd}[2]{\ensuremath{(\lambda {#1} \to {#2})}}
-
-The simplified semantics for \Soda can be defined as follows.
-
-This definition is for a non-recursive definition of \Soda.
-The recursive definition requires extra constraints to prevent undecidability.
-This is discussed in the following section.
-
-An interpretation of a \Soda formula is a tuple $\mathcal{I} = \langle \DeltaI, \PhiI, \ThetaI, \I{\cdot} \rangle$, where $\DeltaI$ is the interpretation domain, $\PhiI$ is a set of functions defined with elements of $\DeltaI$, $\ThetaI$ is a set of type names, and $\I{\cdot}$ is the interpretation function.
-
-As defined above, $\DeltaI \subseteq \PhiI$, because constants are considered functions without parameters.
-
-Let $\mathbb{B}$ the set $\{false, true\}$.
-
-We assume that:
-\begin{itemize}
-    \item $\mathbb{B} \subseteq \DeltaI$
-    \item $\lambd{x: \mathbb{B}}{\lnot x} \in \PhiI$
-    \item $\lambd{x: \mathbb{B}}{\lambd{y: \mathbb{B}}{x \land y}} \in \PhiI$
-    \item $\lambd{x: \mathbb{B}}{\lambd{y: \mathbb{B}}{x \lor y}} \in \PhiI$
-\end{itemize}
-
-A \textbf{function definition} is a formula of the form
-\[f = e\]
-such that $f$ is a function name and $e$ is an expression.
-$f$ is the \textbf{definiendum} and $e$ is the \textbf{definiens}.
-
-
-At this point, we can distinguish between \textbf{recursive function definition} and \textbf{non-recursive function definition} considering whether $f$ occurs free on $e$,
-as in the first case, or not, as in the second case.
-
-Please observe that a non-recursive function definition can be recursive by using another function, for example:
-\begin{center}
-    \[f = g\]
-    \[g = f\]
-\end{center}
-are two non-recursive function definitions that are mutually recursive.
-
-An \textbf{atomic function definition} is a non-recursive function definition of the form
-\[f = g_{A}\]
-such that $f$ is a fresh function name, not occurring in $g_{A}$, and $g_{A}$ is such that $\I{g_{A}} \in \PhiI$.
-
-For example, these could be possible values for $g_{A}$:
-\begin{itemize}
-    \item 0
-    \item true
-    \item -1
-    \item $(\lambda x: \mathbb{Z} \to (\lambda y: \mathbb{Z} \to x + y))$
-    \item $(\lambda x: \mathbb{B} \to (\lambda y: \mathbb{B} \to x \land y) )$
-\end{itemize}
-
-A \textbf{class definition} is a formula of the form
-\[\sodaclass\ A (V_{A}) \ \sodaextends\ P S_{A}
-\]
-where $A$ is a fresh class name, $V_{A}$ is a sequence of typed function names, $P$ is a possibly empty sequence of class names, and $S_{A}$ is a set of function definitions.
-
-$P$ is said to be a conjunction of super classes, and this conjunction is notated:
-\[P_{1} \ P_{2} \ \ldots \ P_{n}\]
-
-In the following, $S_{P}, S_{P_{1}}, \ldots , S_{P_{n}}$ denotes the set of definitions of $P, P_{1}, \ldots, P_{n}$ respectively.
-
-Please observe that this definition does not consider defining classes inside other classes.
-
-For those acquainted with class-inside-class definition, this expression:
-\[
-\sodaclass\ A (V_{A}) \ \sodaextends\ P_{1}
-\sodaclass\ B (V_{B}) \ \sodaextends\ P_{2} S_{B} \sodaendclass\ \cup S_{A}
-\]
-can be rewritten as:
-\[\sodaclass\ A (V_{A}) \ \sodaextends\ P_{1}  S_{A} \sodaendclass\
-\]
-\[\sodaclass\ AB (V_{A}, V_{B}) \ \sodaextends\ P_{2} (S_{A} \cup S_{B}) \sodaendclass\
-\]
-
-where ``$V_{A}$, $V_{B}$'' contains the variables from $A$ and $B$.
-
-In addition, the variables can be included in the function definitions.
-This means that
-\[\sodaclass\ A (V_{A}) \ \sodaextends\ P
-f_{1} = g_{1},
-\ldots ,
-f_{n} = g_{n}
-\sodaendclass\
-\]
-
-can be rewritten as
-\[\sodaclass\ A() \ \sodaextends\ P
-f_{1}(V_{A}) = g_{1},
-\ldots ,
-f_{n}(V_{A}) = g_{n}
-\sodaendclass\
-\]
-
-In practice, all function calls should also include the parameters in $V_{A}$.
-
-Finally, the empty parameters can be also rewritten.
-This means that
-\[\sodaclass\ A() \ \sodaextends\ P
-f_{1} = g_{1},
-\ldots ,
-f_{n} = g_{n}
-\sodaendclass\
-\]
-can be rewritten as:
-\[\sodaclass\ A \ \sodaextends\ P
-f_{1}(self) = g_{1},
-\ldots ,
-f_{n}(self) = g_{n}
-\sodaendclass\
-\]
-where $self$ is an extra variable needed to invoke the functions, and it is given when a class instance is created.
-
-It is assumed that there exists a class \srccode{Top} such that all classes extend from it.
-Hence, if $A$ extends \srccode{Top}, ``$\sodaextends\ P$'' can be omitted.
-
-``$(V)$'' can be excluded to define a class that cannot be instantiated, which is call an \textbf{abstract class}.
-By contrast, a \textbf{concrete class} is a class that can be instantiated.
-If $V$ is an empty sequence, the class does not need parameters to be instantiated.
-
-If $S_{A}$ is empty, the equals sign can be omitted.
-
-We say that $A$ is a \textbf{trivial extension} of an abstract class $B$ when $A$ extends only $B$ and $A$ has no parameters.
-A \textbf{concrete trivial extension} is a trivial extension by using a concrete class.
-
-The \sodaabstract reserved word allows declaring a block of constants and functions in abstract classes.
-As a simple approach, each function or constant declared in this block can be thought as a parameter needed to instantiate a class.
-An abstract class without abstract constants or functions can be instantiated by a concrete trivial extension.
-
-There is a small divergence between \Soda as defined here and its implementation, because the implementation allows defining classes inside classes, and even inside functions.
-
-\textbf{Notation}: $e[f \coloneqq g]$ is a notation that means replacing every free occurrence of $f$ in $e$ by $g$, where bound variables in $e$ can be renamed to avoid that the insertion of free variables in $g$ are bound.
-
-For example,
-\begin{itemize}
-    \item $f = g$
-    \item $g = \lambd {x}{x + y}$
-    \item $e = \lambd {y}{2 f(y)}$
-    \item then $e[f \coloneqq g] = \lambd {y_{1}}{2 (y_{1} + y)}$
-\end{itemize}
-
-\subsection{Interpretation function}
-
-The interpretation function is defined as follows:
-\begin{itemize}
-    \item $\I{\srccode{Boolean}} = \mathbb{B}$
-    \item $\I{\srccode{Int}} = \mathbb{Z}$
-
-    \item $\I{(f : T)} = \I{f} \in \I{T}$
-
-    \item $\I{(\sodaif\ f_{B} \ \sodathen\ e_{1} \ \sodaelse\ e_{2})} =
-    \begin{cases}
-        \I{e_{1}}, & \text{if } \I{f_{B}} \text{ is true }\\
-        \I{e_{2}}, & \text{otherwise}
-    \end{cases}
-    $\\
-    provided that $f_{B}$ returns a Boolean value.
-
-    \item $\I{(\sodaclass\ A = S_{A})}$ = \\
-    $\{ (f_{d}, d) \mid d \in S_{A} \land f_{d} \text{ is the definiendum in } d \land A \in \ThetaI \}$, provided that the definienda are unique.
-
-    \item $\I{(\sodaclass\ A \ \sodaextends\ P = S_{A})}$ = \\
-    $\I{(\sodaclass\ A = S_{P} \cup S_{A})}$, provided that $S_{P}$ and $S_{A}$ do not share any definition of the same function name or class name.
-
-    \item $\I{(\sodaclass\ A \ \sodaextends\ P_{1} \ P_{2} = S_{A})}$ \\
-    $\I{(\sodaclass\ A \ \sodaextends\ P_{1} = S_{P_{2}} \cup S_{A})}$, provided that $S_{P_{2}}$ and $S_{A}$ do not share any definition of the same function name or class name.
-
-\end{itemize}
-
-\subsection{Recursive definitions}
-
-
-One problem to avoid is the definition of infinite recursions, like in the example below:
-
-\begin{lstlisting}[label={lst:exampleOfRecursion}]
-  f (x : Int) : Int = g(x)
-  g (x : Int) : Int = f(x)
-\end{lstlisting}
-
-Because of that, conventionally, every recursive function should be declared as such, by being named or starting with prefix \srccode{rec}.
-
-For example, instead of writing this function
-\begin{lstlisting}[label={lst:exampleOfFactorialBadNaming}]
-  f (n : Int) : Int =
-    if n <= 0
-    then 1
-    else n * f (n - 1)
-\end{lstlisting}
-
-writing this other function
-\begin{lstlisting}[label={lst:exampleOfFactorialGoodNaming}]
-  rec_f (n : Int) =
-    if n <= 0
-    then 1
-    else n * rec_f (n - 1)
-\end{lstlisting}
-
-The purpose is to highlight that it requires extra care to verify that its recursion finishes.
-
-Alternatively, it is possible to use \srccode{foldLeft} over an finite iterable structure.
-\begin{lstlisting}[label={lst:exampleOfFactorialFoldLeft}]
-  f (n: Int) : Int =
-    let
-      initial_value = 1
-      next_value (acc : Int, elem : Int) : Int = acc * elem
-    in Range (0, n).foldLeft (initial_value) (next_value)
-\end{lstlisting}
-
-More information about it can be found in \textbf{System-F}, \textbf{Martin-L\"{o}f type theory}, and in \textbf{dependent types}.
-
-
-\url{https://en.wikipedia.org/wiki/Operational_semantics}
-
-In addition, we can operate on a Monad with the following definitions
-
-$\I{bind(a, b)} = $ (to be defined)
-
-\subsection{Measuring similarity}
-
-Abstract classes can be encoded using an \textbf{integer encoding}.
-In this encoding, it is possible to determine whether two classes are subsumed with a simple operation.
-
-For this, we consider the \textbf{primitive} classes those who extend only from Top (or \srccode{Thing}).
-
-We assign a different prime number to each relation (or edge) between two classes.
-Each class (or vertex) is the multiplication of the edges in the path leading to Top.
-Please note that assigning the number to edges instead of the vertices ensures that the divisibility properties hold only in the same path.
-
-With this definition, class $A$ extends (or is subsumed by) class $B$ if and only if the encoding of $A$ is divisible by the encoding of $B$.
-
-This encoding can be used to measure \textbf{similarity} between two classes, by counting the number of common factors.
-This concept of similarity is completely structural and does not depend on the intended meaning modelling the classes.
-
-Similarity can be used to group similar concepts, either to detect coupling or lack of cohesion.
-
-
-\section{Type Theory}
-
-\Soda has purely functional notation.
-Correctness of functions can be proven using an external tool like Coq or Isabelle.
-In addition, functions can include some sort of \textit{assertion} that checks in runtime that the function has properly computed the input.
-For example, a \srccode{sort} function can be later called by a \srccode{is\_sorted} function, to verify that the sorting function correctly sort a sequence.
-The return of this check could be an \srccode{OptionSD}, so that this needs to be handled in case of an error.
-
-\Soda can be used to ``prove'' theorems by using its type system.
-
-There is some relation between Proof Theory in Philosophy, Category Theory in Mathematics, and Type Theory in Computer Science.
-
-It is possible to define type subsumption in \Soda, by using \sodaextends.
-
-Then, we can say that $A \ \sodaextends\ B$, is like saying $A \subseteq B$, or $A \to B$, or $A \sqsubseteq B$.
-Analogously, $A \ \sodaextends\ B \ C$, is like saying $A \subseteq B \cap C $, or $A \to B \land C$, or $A \sqsubseteq B \sqcap C$.
-
-We have that $\srccode{Any}$, is like saying $U$, or $True$, or $\top$.
-Likewise with $\srccode{Nothing}$, is like saying $\emptyset$, or $False$, or $\bot$.
-
-At the moment, it is part of future work to find how to express more complex constraints in \Soda.
-
-Some of the mappings are still open question for \Soda.
-These are some questions for the case of description logics.
-
-\begin{itemize}
-    \item How can we say $A \sqsubseteq \exists r. B $?
-    \item How to define a \textit{TBox}?
-    \item What does an \textit{ABox} mean?
-    \item Can we detect unsuitable types by checking its emptiness?
-    \item What is the meaning of $A \sqsubseteq \lnot B$?
-    \item What is the meaning of $A \sqsubseteq \exists r. A$?
-    \item Is it possible to relate the roles with the class methods?
-    \item How do abstract and concrete classes play?
-    \item How could a \textit{TBox} be translated into Scala code?
-\end{itemize}
-
-\begin{itemize}
-    \item Correct code generation in Scala:
-    \item \url{https://logika.sireum.org/}
-    \item \url{https://github.com/JBakouny/Scallina}
-\end{itemize}
-
diff --git a/documentation/src/site/tex/main.tex b/documentation/src/site/tex/main.tex
deleted file mode 100644
index c8ab3729..00000000
--- a/documentation/src/site/tex/main.tex
+++ /dev/null
@@ -1,51 +0,0 @@
-\documentclass[12pt,a4paper]{book}
-
-
-\usepackage[utf8]{inputenc}
-\usepackage{hyperref}
-\usepackage{amsmath}
-\usepackage{amssymb}
-\usepackage{xcolor}
-\usepackage{xspace}
-\usepackage{mathtools}
-
-\include{common/language}
-
-\begin{document}
-
-    \begin{center}
-
-        \phantom{H}
-
-        \vspace{80mm}
-
-        {\huge{Ethical Verification of Artificial Intelligence Systems}}
-
-        \vspace{80mm}
-        Julian Alfredo Mendez
-
-        \vspace{10mm}
-        0.15.0
-
-    \end{center}
-
-    \newpage
-
-    \tableofcontents
-
-    \include{discussion/chapter-01-introduction}
-    \include{discussion/chapter-02-description}
-
-    \include{manual/chapter-03-usage}
-    \include{manual/chapter-04-implementation}
-    \include{manual/chapter-05-tutorial}
-
-    \appendix
-    \include{manual/appendix-01-reservedwords}
-    \include{manual/appendix-02-libraries}
-
-    \bibliographystyle{plain}
-    \bibliography{bibliography}
-
-\end{document}
-
diff --git a/documentation/src/site/tex/manual/appendix-01-reservedwords.tex b/documentation/src/site/tex/manual/appendix-01-reservedwords.tex
deleted file mode 100644
index fbcac876..00000000
--- a/documentation/src/site/tex/manual/appendix-01-reservedwords.tex
+++ /dev/null
@@ -1,69 +0,0 @@
-\chapter{Reserved Words}
-
-\begin{table}[t]
-    \caption{Basic constructs}
-    \label{tab:basic_constructs}
-    \begin{center}
-        \begin{tabular}{|l|l|}
-            \hline
-            $f$ \sodadef $e$                                                    & function or constant definition of $f$ as $e$                         \\
-            $x$ \sodacolon $A$                                                  & declaration that $x$ is of type $A$                                   \\
-            \sodalambda ($x : A$) \sodalambdaarrow $e$                                & lambda definition for $\lambda (x : A) . e$, where $x$ is of type $A$ \\
-            $t$ \sodadefparam $e$                                               & assignment of parameter $t$ to have value $e$                         \\
-            \hline
-            \sodaif $b$ \sodathen $e_{0}$ \sodaelse $e_{1}$                     & expression if $b$ is true, then $e_{0}$, else $e_{1}$                 \\
-            \hline
-            \sodamatch $x$ \sodacase $p_{i}$ \sodaimplies $e_{i}$ & pattern matching from $p_{i}$ to $e_{i}$ for $1 \leq i \leq n$        \\
-            \hline
-            \sodaclass $B$ \sodaextends $A_{1} \ldots A_{n}$                    & class $B$ extends classes $A_{0}$ and $A_{1}$                         \\
-            \sodaclass $B$ [$A_{0}$ \sodasubtype $A_{1}$ ]                      & class $B$ requires a class $A_{0}$ which extends $A_{1}$              \\
-            \sodaclass $B$ [$A_{0}$ \sodasupertype $A_{1}$ ]                    & class $B$ requires a class $A_{0}$ which is extended by $A_{1}$       \\
-            \sodaabstract $f_{1} \ldots f_{n}$                                  & block of functions or constants $f_{i}$ to be defined                 \\
-            \sodathis                                                           & reference to itself as an instance                                    \\
-            \sodaendclass                                                       & end of class definition                                               \\
-            \hline
-            \sodapackage $p$                                                    & package declaration for this piece of code                            \\
-            \sodaimport $p$                                                     & block of import declarations                                          \\
-            \hline
-        \end{tabular}
-    \end{center}
-
-\end{table}
-
-\begin{table}[t]
-    \caption{Built-in functions}
-    \label{tab:built_in_functions}
-    \begin{center}
-        \begin{tabular}{|l|l|}
-            \hline
-            \sodafalse               & Boolean constant False                           \\
-            \sodatrue                & Boolean constant True                            \\
-            \sodanot $e$             & expression for $\lnot e$                         \\
-            $e_{0}$ \sodaand $e_{1}$ & lazy logic conjunction, $e_{0} \land _{L} e_{1}$ \\
-            $e_{1}$ \sodaor $e_{1}$  & lazy logic disjunction, $e_{0} \lor _{L} e_{1}$  \\
-            \hline
-            \sodaequalsSign          & comparison of equality                           \\
-            $x$ \srccode{+} $y$      & result of adding $x$ and $y$                     \\
-            $x$ \srccode{-} $y$      & result of subtracting $y$ from $x$               \\
-            $x$ \srccode{*} $y$      & result of multiplying $x$ by $y$                 \\
-            $x$ \srccode{/} $y$      & result of dividing $x$ by $y$                    \\
-            $x$ \srccode{\%} $y$     & remainder from dividing $x$ by $y$               \\
-            \hline
-        \end{tabular}
-    \end{center}
-\end{table}
-
-\begin{table}[t]
-    \caption{Annotations for the compiler}
-    \label{tab:annotations_for_the_compiler}
-    \begin{center}
-        \begin{tabular}{|l|l|}
-            \hline
-            \sodanew      & creation of an instance of a JVM class (for Scala 2) \\
-            \sodatailrec  & annotation to enforce a tail recursion               \\
-            \sodaoverride & annotation to allow overriding                       \\
-            \hline
-        \end{tabular}
-    \end{center}
-\end{table}
-
diff --git a/documentation/src/site/tex/manual/appendix-02-libraries.tex b/documentation/src/site/tex/manual/appendix-02-libraries.tex
deleted file mode 100644
index 91b90b2f..00000000
--- a/documentation/src/site/tex/manual/appendix-02-libraries.tex
+++ /dev/null
@@ -1,91 +0,0 @@
-\chapter{Libraries}
-
-\begin{lstlisting}[label={lst:fold}]
-
-  @tailrec
-  _tailrec_fold_while [A, B] (sequence : Seq [A] ) (current_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B =
-    if sequence.isEmpty
-    then current_value
-    else
-      if not condition (current_value) (sequence.head)
-      then current_value
-      else _tailrec_fold_while (sequence.tail) (next_value_function (current_value) (sequence.head) ) (next_value_function) (condition)
-
-  fold_while [A, B] (sequence : Seq [A] ) (initial_value : B) (next_value_function : B -> A -> B) (condition : B -> A -> Boolean) : B =
-    _tailrec_fold_while (sequence) (initial_value) (next_value_function) (condition)
-\end{lstlisting}
-
-\begin{lstlisting}[label={lst:range}]
-  @tailrec
-  _tailrec_range (n : Int) (sequence : Seq [Int] ) : Seq [Int] =
-    if n <= 0
-    then sequence
-    else _tailrec_range (n - 1) (sequence.+: (n - 1) )
-
-  range (length : Int) : Seq [Int] =
-    _tailrec_range (length) (Seq [Int] () )
-\end{lstlisting}
-
-
-\begin{lstlisting}[label={lst:option}]
-class OptionSD [A]
-
-  abstract
-    opt [B] (ifEmpty: B, ifNonEmpty: A -> B): B
-    isEmpty: Boolean
-    getOrElse (default: A): A
-    fold [B] (ifEmpty: B, f: A -> B): B
-    flatMap [B] (mapping: A -> OptionSD [B]): OptionSD [B]
-
-end
-
-class NoneSD [A]
-  extends
-    OptionSD [A]
-
-  opt [B] (ifEmpty: B, ifNonEmpty: A -> B): B = ifEmpty
-
-  isEmpty: Boolean = true
-
-  getOrElse (default: A): A = default
-
-  fold [B] (ifEmpty: B, f: A -> B): B = opt (ifEmpty, f)
-
-  flatMap [B] (mapping: A -> OptionSD [B]): OptionSD [B] = NoneSD_ [B] ()
-
-end
-
-class NoneSD_ [A] ()
-  extends
-    NoneSD [A]
-
-end
-
-class SomeSD [A]
-  extends
-    OptionSD [A]
-
-  abstract
-    element: A
-
-  value: A = element
-
-  opt [B] (ifEmpty: B, ifNonEmpty: A -> B): B = ifNonEmpty (element)
-
-  isEmpty: Boolean = false
-
-  getOrElse (default: A): A = element
-
-  fold [B] (ifEmpty: B, f: A -> B): B = opt (ifEmpty, f)
-
-  flatMap [B] (mapping: A -> OptionSD [B]): OptionSD [B] = mapping (element)
-
-end
-
-class SomeSD_ [A] (element: A)
-  extends
-    SomeSD [A]
-
-end
-\end{lstlisting}
-
diff --git a/documentation/src/site/tex/manual/chapter-03-usage.tex b/documentation/src/site/tex/manual/chapter-03-usage.tex
deleted file mode 100644
index ed0429f5..00000000
--- a/documentation/src/site/tex/manual/chapter-03-usage.tex
+++ /dev/null
@@ -1,329 +0,0 @@
-\chapter{Usage and Methodology}
-
-
-\section{Techniques}
-
-This section is intended to describe techniques to produce \Soda source code.
-This could be considered simple design patterns that use the features of \Soda.
-
-One of the techniques is to have a kind of \textit{weak scope}.
-
-\subsection{Common patterns when writing in \Soda}
-\begin{itemize}
-    \item use of flatMap / ... / flatMap / map
-    \item use abstract classes to contain constants
-\end{itemize}
-
-\subsection{How to translate Scala source code into \Soda}
-
-\begin{itemize}
-    \item remove any use of `null'
-    \item make the source code completely functional (no `var', no `for', no `while')
-    \item optimize source code and clean up imports
-    \item make all classes either `case class' or `trait', and make any class renaming if necessary
-    \item fix syntax for comments and Scaladoc
-    \item remove all braces possible
-    \item replace `enum' and create traits with constants
-    \item move imports into the classes that use them
-    \item take inner classes outside their parent classes, and add an underscore prefix if they are meant to be protected
-    \item take inner functions outside and make them protected adding an underscore prefix
-    \item rename private functions and add an underscore prefix
-    \item replace the `object' constructs, for example, by traits with constants and builder case classes
-    \item replace `try' and `catch' by Scala class Try
-    \item replace Scala Try by Option
-    \item replace `for' comprehension expressions by flatMap/map combinations
-    \item replace use of underscore `\_'
-    \item replace `case' and `match' reserved words, if it is a type casting, it could be done:
-    if (obj.isInstanceOf[SpecificType]) {
-        map = obj.asInstanceOf[SpecificType]
-    }
-    \item copy Scala files as Soda files
-    \item remove `def', remove `val' and `final val'
-    \item replace `case class' by `class', replace 'trait' by `class', replace `import' by `+', add '=' in class declarations,
-    replace `new' by `@new', replace `=>' by `->', replace `=' in parameters by `:=',
-    replace `\&\&' by `and', replace `||' by `or', replace `!' by `not'
-    \item adapt `if-then-else' structures
-    \item replace braces
-\end{itemize}
-
-\subsection{How to rewrite \Soda code}
-
-One the powerful things in \Soda is the capability of rewriting code.
-Remember that its purpose is to be a easy to understand to humans as possible.
-
-The goal can be summarized as:
-
-\begin{itemize}
-    \item use small functions and constants with descriptive and not too long names
-    (the more specific a publicly accessible function is, the longer its name)
-    \item use small classes with descriptive and not too long names
-    \item try to make every function do one thing
-    \item try to make every class model one thing
-    \item prefer abstract classes unless an instance is required
-    \item avoid code duplication
-    \item avoid parametric types, unless is significantly reduces code duplication
-    \item avoid complex structures, like many successive nested if-then-else structures
-\end{itemize}
-
-\subsubsection{Function extraction}
-
-If a function is not specific of another function, it can be extracted
-
-For example,
-
-\begin{lstlisting}[label={lst:rewritingFunctionExtractionBefore}]
-class SomeClass
-
-  relevant_function (x : Input) =
-    let
-      a = f (x)
-      b = some_constant
-      result = a + b
-    in result
-
-end
-\end{lstlisting}
-
-since function b does not depend on $x$ or $a$, it can be extracted
-
-\begin{lstlisting}[label={lst:rewritingFunctionExtractionAfter0}]
-class SomeClass
-
-  b = some_constant
-
-  relevant_function (x : Input) =
-    let
-      a = f (x)
-      result = a + b
-    in result
-
-end
-\end{lstlisting}
-
-and it can be renamed to be more descriptive
-
-\begin{lstlisting}[label={lst:rewritingFunctionExtractionAfter1}]
-class SomeClass
-
-  specific_constant_for_this_class = some_constant
-
-  relevant_function (x : Input) =
-    let
-      a = f(x)
-      result = a + specific_constant_for_this_class
-    in result
-
-end
-\end{lstlisting}
-
-\subsubsection{Function replacement}
-
-If a function is too complex, we can replace a piece by another function.
-
-For example,
-
-\begin{lstlisting}[label={lst:rewritingFunctionReplacementBefore}]
-class SomeClass
-
-  relevant_function (x : Input) =
-    let
-      a : TypeOfF = f(x)
-      b =
-        if some_condition(a)
-        then some_value(x)
-        else some_other_value(x)
-      result = a + b
-    in result
-
-end
-\end{lstlisting}
-
-since function $b$ depends on $x$ and $a$, it can be replaced by $new\_function$
-
-\begin{lstlisting}[label={lst:rewritingFunctionReplacementAfter}]
-class SomeClass
-
-  new_function (x : Input) (a : TypeOfF) =
-    if some_condition (a)
-    then some_value (x)
-    else some_other_value (x)
-
-  relevant_function (x : Input) =
-    let
-      a : TypeOfF = f (x)
-      b = new_function (x) (a)
-      result = a + b
-    in result
-
-end
-\end{lstlisting}
-
-\subsubsection{Class split}
-
-A class can be split to make two classes more specific
-
-Let us assume that there two groups of functions $f_{i}$ and $g_{i}$, where the $f_{i}$ functions do not depend on the $g_{i}$ and the $g_{i}$ functions do not depend on the $f_{i}$.
-Such a class could look like:
-
-\begin{lstlisting}[label={lst:rewritingClassSplitBefore}]
-class SomeClass
-
-  f_0 = ...
-  f_1 = ...
-  ...
-  f_n = ...
-
-  g_0 = ...
-  g_1 = ...
-  ...
-  g_m = ...
-
-end
-\end{lstlisting}
-
-We can then split the class as:
-
-\begin{lstlisting}[label={lst:rewritingClassSplitAfter}]
-class SomeClassWithF
-
-  f_0 = ...
-  f_1 = ...
-  ...
-  f_n = ...
-
-end
-
-class SomeClassWithG
-
-  g_0 = ...
-  g_1 = ...
-  ...
-  g_m = ...
-
-end
-
-class SomeClass
-  extends
-    SomeClassWithF
-    SomeClassWithG
-\end{lstlisting}
-
-\subsubsection{Class generalization}
-
-Every concrete class can be split between its abstract and its concrete part.
-
-\begin{lstlisting}[label={lst:rewritingClassGeneralizationBefore}]
-class SomeClass (v_0: Type_0, ..., v_n: Type_n)
-
-  f_0 = ...
-
-  ...
-
-  f_m = ...
-
-end
-\end{lstlisting}
-
-can be split as
-
-\begin{lstlisting}[label={lst:rewritingClassGeneralizationAfter}]
-class AbstractPartOfSomeClass
-
-    abstract
-      v_0: Type_0
-      ...
-      v_n: Type_n
-
-    f_0 = ...
-
-    f_1 = ...
-
-    ...
-
-    f_n = ...
-
-end
-\end{lstlisting}
-
-
-\section{Why and why not}
-
-\subsection{Mutability}
-Mutable structures are extremely error-prone, since a variable can change its value without any apparent change.
-
-Example:
-
-/* a = ?, b = ?, c = ? */
-a = C(5)
-
-/* a = C(5), b = ?, c = ? */
-b = compute(a)
-
-/* a = C(6), b = C(a), c = ? */
-c = compute(b)
-/* a = C(6), b = C(7), c = C(7) */
-
-
-compute(a)
-a.increment(1)
-return a
-
-
-expected
-/* a = ?, b = ?, c = ? */
-a = C(5)
-
-/* a = C(5), b = ?, c = ? */
-b = compute(a)
-
-/* a = C(5), b = C(6), c = ? */
-c = compute(b)
-/* a = C(5), b = C(6), c = C(7) */
-
-\subsection{Tuples}
-
-The use of tuple can sometimes hide an error in design.
-Unlike sequences, tuples may accept different types in their components.
-
-For example,
-
-\begin{lstlisting}[label={lst:exampleJonTuple}]
-  ("Jon", true, true, false)
-\end{lstlisting}
-
-is far less legible than
-
-\begin{lstlisting}[label={lst:exampleJonIndividual}]
-  Individual_ (name := "Jon", registered := true, evaluated := true, passed := true)
-\end{lstlisting}
-
-\subsection{Significant whitespace}
-
-In Python, horizontal tabulations can make a big difference.
-
-This is the intended snippet:
-
-\begin{lstlisting}[label={lst:snippetInPython1}]
-  if x > 0:
-    positive = True
-    y = x
-  else:
-    positive = False
-    y = 0
-\end{lstlisting}
-
-
-The following function has a bug, since it always assigns 0 to variable $y$.
-
-\begin{lstlisting}[label={lst:snippetInPython2}]
-  if x > 0:
-    positive = True
-    y = x
-  else:
-    positive = False
-  y = 0
-\end{lstlisting}
-
-This kind of bug is for a 6-line snippet.
-This can propagate when thousands of lines are written.
-
diff --git a/documentation/src/site/tex/manual/chapter-04-implementation.tex b/documentation/src/site/tex/manual/chapter-04-implementation.tex
deleted file mode 100644
index 48eb75d3..00000000
--- a/documentation/src/site/tex/manual/chapter-04-implementation.tex
+++ /dev/null
@@ -1,305 +0,0 @@
-\chapter{Implementation}
-
-\Soda (Symbolic Objective Descriptive Analysis) is a human-centered formalism to describe, formalize, and prototype ethical problems and constraints.
-It could be seen as a specification language or as a functional programming language.
-
-The reserved words in \Soda can be classified in the following categories:
-
-\begin{itemize}
-    \item Functional
-    \item Object Oriented
-    \item Boolean
-    \item Library
-    \item Annotations
-\end{itemize}
-
-
-%The reserved words considered in Scala are listed at this link:
-%\url{https://www.scala-lang.org/files/archive/spec/2.13/01-lexical-syntax.html}
-
-This is a tentative logo:
-
-\Sodalogo
-
-
-\section{Functional}
-
-\subsubsection{= (definition symbol)}
-
-The definition symbol, written as an equals symbol, is used to defined functions and constants.
-
-For example,
-\begin{lstlisting}[label={lst:exampleDef}]
-  a = 1
-\end{lstlisting}
-
-\subsubsection{: (type symbol)}
-
-The type symbol, written as a colon symbol, is used to assign a statically defined type to a function or constant.
-
-For example,
-\begin{lstlisting}[label={lst:exampleType01}]
-  b : Int = 2
-\end{lstlisting}
-
-Another example is the following:
-\begin{lstlisting}[label={lst:exampleType02}]
-  plus_one (x : Int) : Int = x + 1
-\end{lstlisting}
-
-\subsubsection{\sodaif, \sodathen, \sodaelse}
-
-The \sodaif-\sodathen-\sodaelse construct is used to define a conditional result in a function.
-
-For example,
-\begin{lstlisting}[label={lst:exampleIfThenElse}]
-  max (x : Int) (y : Int) : Int =
-    if x > y
-    then x
-    else y
-\end{lstlisting}
-
-\subsubsection{\sodaarrow (lambda symbol)}
-
-The lambda symbol, written as a right arrow, is used to bind a variable in a lambda expression.
-
-For example, this piece of code
-\begin{lstlisting}[label={lst:exampleLambda}]
-  plus_one (sequence : Seq [Int] ) : Seq [Int] =
-    sequence.map (element -> element + 1)
-\end{lstlisting}
-returns a sequence of integers where each element is computed as the next integer from the input
-
-
-\section{Object Oriented}
-
-\subsubsection{\sodaclass, \sodaabstract}
-
-As mentioned, there are two types of classes: the abstract and the concrete.
-
-Abstract classes compare to interfaces in Java, or traits in Scala, and cannot be directly instantiated.
-
-Both types are declared using the \sodaclass reserved words.
-
-For example,
-\begin{lstlisting}[label={lst:exampleAbstractClass}]
-class Agent
-
-  abstract
-    identifier : String
-
-end
-\end{lstlisting}
-defines an abstract agent that has some identifier.
-Agent is an abstract class and cannot be instantiated.
-
-By contrast, concrete classes compare to final classes in Java and case classes in Scala.
-
-The following example shows a class consisting only of a parameterized name.
-\begin{lstlisting}[label={lst:exampleConcreteClass}]
-class Person
-
-    abstract
-      name : String
-
-end
-\end{lstlisting}
-
-The difference between abstract classes and concrete classes is the parameters, possibly empty, that are required for concrete classes.
-
-\subsubsection{\sodaextends}
-
-It is possible to declare that a concrete class extends an abstract class using the \sodaextends reserved word.
-Concrete classes are final and cannot be extended.
-
-\begin{lstlisting}[label={lst:exampleExtends}]
-class AgentPerson
-  extends
-    Agent
-
-  abstract
-    name: String
-
-  identifier = name
-
-end
-\end{lstlisting}
-
-Concrete classes can also extend multiple abstract classes.
-For example,
-\begin{lstlisting}[label={lst:exampleWith}]
-class RankedIndividual
-
-  abstract
-    rank: Int
-
-end
-\end{lstlisting}
-
-\subsubsection{\sodathis}
-
-In some cases, it could be necessary that an object can refer to itself.
-For that, the \sodathis reserved word is used.
-
-For example,
-\begin{lstlisting}[label={lst:exampleExtendsElement}]
-class Element
-
-  abstract
-    accept (v : Visitor) : Boolean
-
-end
-
-class Visitor
-
-  abstract
-    visit (x : Element) : Boolean
-
-end
-
-class Item
-  extends
-    Element
-
-  abstract
-    identifier : Int
-
-  accept (v : Visitor) = v.visit (this)
-
-end
-\end{lstlisting}
-
-\subsubsection{\sodasubtype, \sodasupertype}
-
-The bounds of a parametric type can be determined with \sodasubtype, for the upper bound, and \sodasupertype, for the lower bound.
-
-
-\section{Boolean}
-
-\subsubsection{\sodafalse, \sodatrue}
-
-As in other programming languages, the \sodafalse and \sodatrue reserved words are used for the Boolean values.
-
-\begin{lstlisting}[label={lst:exampleFalseTrue}]
-  my_not (x : Boolean) : Boolean =
-    if x
-    then false
-    else true
-
-  my_and (x : Boolean) (y : Boolean) : Boolean =
-    if x
-    then y
-    else false
-
-  my_or (x : Boolean) (y : Boolean) : Boolean =
-    if x
-    then true
-    else y
-\end{lstlisting}
-
-\subsubsection{\sodanot, \sodaand, \sodaor}
-
-The reserved words \sodanot, \sodaand, \sodaor are introduced for the sake of readability.
-
-\begin{lstlisting}[label={lst:exampleNotAndOr}]
-
-  my_xor (x : Boolean) (y : Boolean) : Boolean =
-    (x or y) and not (x and y)
-
-\end{lstlisting}
-
-
-\section{Library}
-
-\subsubsection{\sodapackage}
-
-The reserved word \sodapackage declares the package where the content should be included.
-All classes then belong to that package.
-
-\begin{lstlisting}[label={lst:examplePackage}]
-package org.example.soda
-\end{lstlisting}
-
-\subsubsection{\sodaimport}
-
-The reserved word \sodaimport helps importing classes from other libraries and frameworks.
-It is recommended to put the \sodaimport inside the class that is using it.
-This differs from common practice in Java, where all the import statements are at the beginning of the file, outside the class.
-It is important to notice that the imports can always be moved outwards, i.e. from inside the class to outside.
-Including the imports in the class and not in more general place helps removing a class with its own imports.
-If these imports are in general place, e.g. visible from the whole package, it becomes harder to maintain when classes are added or removed.
-To have a view of the imports needed by a package, it would be necessary to use a tool, like an IDE.
-
-
-\begin{lstlisting}[label={lst:exampleImport}]
-  import
-    java.util.Date
-\end{lstlisting}
-
-
-\section{Annotations}
-
-Annotations are not part of the language itself, but they are necessary to translate it into Scala.
-
-\subsubsection{\sodanew}
-
-Although every concrete class can be instantiated directly using the parameters, some JVM libraries and frameworks may need a \sodanew reserved word.
-This is only necessary when the code is translated into Scala 2.
-For translations to Scala 3, the \sodanew annotation can be omitted.
-For example,
-
-\begin{lstlisting}[label={lst:exampleImportDate}]
-  import
-    java.util.Date
-
-  now = @new Date ()
-\end{lstlisting}
-
-\subsubsection{\sodaoverride}
-
-The \sodaoverride annotation may be necessary to override some JVM functions, like \srccode{toString()}.
-However, this could be misused to override functions and values of abstract classes.
-This could make that a concrete class does not behave as the abstract class that implements.
-For this reason, although \sodaoverride annotation could be used to ensure that a function is effectively overriding another function, it should only be used to override JVM functions, and not \Soda functions.
-
-\begin{lstlisting}[label={lst:exampleOverride}]
-class PersonName (name: String) =
-
-    @override
-    toString = name
-
-end
-\end{lstlisting}
-
-\subsubsection{\sodatailrec}
-
-The \sodatailrec annotation is used to ensure that a recursive function uses tail recursion.
-If a tail recursive function is not properly converted to a loop, it could produce a stack overflow after few iterations.
-
-\begin{lstlisting}[label={lst:exampleTailrecInside}]
-  @tailrec
-  _tailrec (n : Int) (accum : Int) : Int =
-    if n < 0
-    then accum
-    else _tailrec (n - 1) (n + accum)
-
-  sum (n : Int) : Int =
-    _tailrec (n, 0)
-\end{lstlisting}
-
-\subsubsection{Main}
-
-The Main class is used to indicate the entry point.
-This is kept to have functions that can be executed from the console.
-
-\begin{lstlisting}[label={lst:exampleMain}]
-class Main
-
-  main (args : Array[String] ) : Unit =
-    println ("Hello world!")
-
-end
-\end{lstlisting}
-
-This \srccode{main} method can be accessed by invoking a statically accessible \srccode{main} method in class \srccode{EntryPoint} located in the same package.
-
diff --git a/documentation/src/site/tex/manual/chapter-05-tutorial.tex b/documentation/src/site/tex/manual/chapter-05-tutorial.tex
deleted file mode 100644
index 94ea2217..00000000
--- a/documentation/src/site/tex/manual/chapter-05-tutorial.tex
+++ /dev/null
@@ -1,258 +0,0 @@
-\chapter{Tutorial}
-
-
-\section{In A Nutshell}
-
-The idea of \Soda is a language that can help human describe things in a way a computer can understand.
-In short, it is a specification with prototyping.
-
-Learning a programming language and implement something can be relatively easy.
-The challenge comes in writing code that is correct, and that humans can easily understand.
-
-The key feature of \Soda is that it has be clear for humans.
-
-Some of the most commonly used mathematical operations are addition, subtraction, multiplication, and division.
-For example, a formula like
-\begin{lstlisting}[label={lst:exampleAddition}]
-  1 + 2 + 4 + 8
-\end{lstlisting}
-is universally understood, without needing an explanation of what '+' means.
-
-It could be useful to give a name to a such quantity, defining a \emph{constant}.
-For example,
-\begin{lstlisting}[label={lst:exampleBindingToConstant}]
-  a = 1 + 2 + 4 + 8
-\end{lstlisting}
-
-And it is also good using other constants in the definition:
-\begin{lstlisting}[label={lst:exampleBindingToMultipleConstants}]
-  a = 1 + 2 + 4 + 8
-  b = a + 16
-\end{lstlisting}
-
-The order does not need to be relevant, as long as they are in the same \emph{block}.
-Thus, the previous piece is the same as:
-\begin{lstlisting}[label={lst:exampleBindingToMultipleConstantsDifferentOder}]
-  b = a + 16
-  a = 1 + 2 + 4 + 8
-\end{lstlisting}
-
-Another useful thing is defining functions.
-In principle, there are two direct ways of defining a function defined on the integers.
-Something like:
-\begin{center}
-    $f: Int \to Int$ \\
-    $f(x) = x + 16$
-\end{center}
-
-However, if we want to condense both the domain definition and the function itself, then we can write:
-\begin{lstlisting}[label={lst:exampleFunctionDefinition}]
-  f (x : Int) : Int = x + 16
-  b = f (a)
-  a = 1 + 2 + 4 + 8
-\end{lstlisting}
-
-In this way, $f$ is \textbf{defined completely and in exactly one place}.
-This is how it is defined in \Soda.
-
-Lambda functions can also be useful.
-For example, the definition
-$g = (\lambda x)(x + 32)$
-would be defined as:
-\begin{lstlisting}[label={lst:exampleFunctionDefinitionWithLambda}]
-  g : Int -> Int = x -> x + 32
-\end{lstlisting}
-
-The right arrow (\srccode(->)) is used to define a domain mapping and also to define a lambda expression.
-
-Standard arithmetic comparisons are also very useful.
-For example,
-\begin{lstlisting}[label={lst:exampleComparison}]
-  geater_than (a : Int) (b : Int) : Boolean =
-    a > b
-\end{lstlisting}
-
-This uses type \srccode{Boolean}, which can have values \sodafalse and \sodatrue.
-The functions \sodaand, \sodaor, and \sodanot have the standard definitions.
-
-Conditions can be also evaluated.
-\begin{lstlisting}[label={lst:exampleMax}]
-  max (a : Int) (b : Int) : Int =
-    if a > b
-    then a
-    else b
-\end{lstlisting}
-
-We can group the constant and functions in classes.
-
-\begin{lstlisting}[label={lst:exampleClassMax}]
-class MaxAndMin
-
-  max (a : Int) (b : Int) : Int =
-    if a > b
-    then a
-    else b
-
-  min (a : Int) (b : Int) : Int =
-    if a < b
-    then a
-    else b
-
-end
-\end{lstlisting}
-
-And we can have classes derived from \emph{abstract classes}.
-The \emph{concrete classes} can produce instances.
-
-\begin{lstlisting}[label={lst:exampleClassMaxWithIndex}]
-  class ConcreteMaxAndMin() extends MaxAndMin
-\end{lstlisting}
-
-To create an instance we can just give the parameters, if needed.
-
-\begin{lstlisting}[label={lst:exampleClassMaxAnInstance}]
-class MinMaxPair
-
-  abstract
-    min : Int
-    max : Int
-
-end
-
-class Example
-
-  abstract
-    index : Int
-
-  min_max (a : Int) (b : Int) : MinMaxPair =
-    MinMaxPair (
-      min := ConcreteMaxAndMin ().min (a) (b),
-      max := ConcreteMaxAndMin ().max (a) (b)
-    )
-
-end
-\end{lstlisting}
-
-Classes can be marked with \sodapackage reserved word and be put in \emph{packages}, which are collections of classes.
-Classes can contain functions and other classes.
-
-If a constant or function is to be implemented in another class, this can be denoted with \sodaabstract.
-
-\begin{lstlisting}[label={lst:exampleAbstractFunction}]
-class Comparable
-
-  abstract
-    is_greater_than (x : Comparable) : Boolean
-
-end
-\end{lstlisting}
-
-While the content in classes is public, the content in functions is private.
-Because of that, to put classes outside functions would help to test them.
-
-Basic Scala types are available (Int, Long, Boolean, Float, Double, String, \ldots).
-
-Class definition can be also parameterized:
-\begin{lstlisting}[label={lst:exampleParameterizedClass}]
-package example
-
-class Comparable
-
-  abstract
-    is_greater_than : Comparable -> Boolean
-
-end
-
-class ComparableMax [T subtype Comparable]
-
-  max (a : T) (b : T) : T =
-    if a.is_greater_than(b)
-    then a
-    else b
-
-end
-\end{lstlisting}
-
-Note that, considering packages, every constant, function, or class is defined in only one place, using the \sodadef symbol.
-It is not possible to add more information about the defined constant, function, or class in any other piece of code.
-We can say that every constant, function, or class, is \emph{completely defined} in exactly one place.
-
-In addition, every constant, function, or class is \emph{explicitly defined}.
-This means, that all the defining components are explicitly available.
-
-Let us see the following example:
-\begin{lstlisting}[label={lst:exampleExplicitDefinition}]
-class MyClass
-
-  abstract
-    instance_parameter : Int
-
-  class_constant : Int = 1
-
-  another_function (x : Int) : Int = 2 * x
-
-  class InnerClass
-
-    main_function (function_parameter : Int) : Int =
-      another_function (instance_parameter + class_constant + function_parameter)
-
-  end
-
-end
-\end{lstlisting}
-
-The function \srccode{main\_function} is defined in exactly one place, inside \srccode{example.MyClass.InnerClass}, and to be fully defined it requires:
-\begin{itemize}
-    \item \srccode{another\_function}, defined in the same class
-    \item \srccode{instance\_parameter}, a parameter given to create an instance
-    \item \srccode{function\_parameter}, a parameter given when the function is invoked
-\end{itemize}
-
-The reserved words \sodasubtype and \sodasupertype put constraints in the parameterized datatype.
-
-JDK classes can be imported, using the \sodaimport command, and can be instantiated with \sodanew.
-
-\begin{lstlisting}[label={lst:exampleJDKImport}]
-class TimeOfToday
-
-    import
-      java.util.Date
-
-    get_time () : Date = @new Date()
-
-end
-\end{lstlisting}
-
-Side effects are strongly discouraged, but they are possible through Java and Scala classes.
-
-For example, a ``Hello world!'' would be:
-\begin{lstlisting}[label={lst:exampleHelloWorld}]
-class Main
-
-  main (args : Array[String] ) =
-    println ("Hello world!")
-
-end
-\end{lstlisting}
-
-Another antipattern is overriding functionality.
-It is strongly discouraged, but it is the only way of overriding \srccode{toString}, which is available to all objects.
-
-This is:
-\begin{lstlisting}[label={lst:exampleToString}]
-class PersonName
-
-  abstract
-    name : String
-
-  @override
-  toString = name
-
-end
-\end{lstlisting}
-
-A tail recursion can be explicitly stated with a \sodatailrec annotation.
-
-This language is meant to be concise, but using a reduced number of symbols.
-However, there are a couple of useful synonyms to write a little less.
-

From f6f28345de4aede89af18302721cf93f189c1b4b Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Thu, 25 May 2023 17:05:10 +0200
Subject: [PATCH 39/56] Make minor changes

---
 examples/src/main/scala/soda/example/forcoq/lib/Nat.soda      | 4 ++--
 .../src/main/scala/soda/translator/parser/SodaConstant.soda   | 2 +-
 .../resources/soda/translator/example/forcoq/lib/Nat.soda     | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda b/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda
index 4d29b288..601fbe07 100644
--- a/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda
+++ b/examples/src/main/scala/soda/example/forcoq/lib/Nat.soda
@@ -38,13 +38,13 @@ class S
     lambda a --> add_for (a)
 
   add_for (a : nat) : nat =
-    t .from_non_negative( (t .to_Int (k) + 1) + t .to_Int (a) )
+    t .from_non_negative ( (t .to_Int (k) + 1) + t .to_Int (a) )
 
   mul : nat ->  nat =
     lambda a --> mul_for (a)
 
   mul_for (a : nat) : nat =
-    t .from_non_negative( (t .to_Int (k) + 1) * t .to_Int (a) )
+    t .from_non_negative ( (t .to_Int (k) + 1) * t .to_Int (a) )
 
 end
 
diff --git a/translator/src/main/scala/soda/translator/parser/SodaConstant.soda b/translator/src/main/scala/soda/translator/parser/SodaConstant.soda
index a0153153..3c40e804 100644
--- a/translator/src/main/scala/soda/translator/parser/SodaConstant.soda
+++ b/translator/src/main/scala/soda/translator/parser/SodaConstant.soda
@@ -209,7 +209,7 @@ class SodaConstant
   soda_reserved_words : Seq [String] =
     soda_reserved_words_words_only .++ (soda_reserved_words_symbols_only .++ (soda_reserved_words_annotations_only) )
 
-  soda_unicode_symbols : Seq [Tuple2 [String, String] ] =
+  soda_unicode_symbols : Seq [Tuple2 [String] [String] ] =
     Seq (
       Tuple2 (lambda_unicode_symbol , lambda_reserved_word) ,
       Tuple2 (lambda_arrow_unicode_symbol , lambda_arrow_symbol) ,
diff --git a/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda b/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda
index 4d29b288..601fbe07 100644
--- a/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda
+++ b/translator/src/test/resources/soda/translator/example/forcoq/lib/Nat.soda
@@ -38,13 +38,13 @@ class S
     lambda a --> add_for (a)
 
   add_for (a : nat) : nat =
-    t .from_non_negative( (t .to_Int (k) + 1) + t .to_Int (a) )
+    t .from_non_negative ( (t .to_Int (k) + 1) + t .to_Int (a) )
 
   mul : nat ->  nat =
     lambda a --> mul_for (a)
 
   mul_for (a : nat) : nat =
-    t .from_non_negative( (t .to_Int (k) + 1) * t .to_Int (a) )
+    t .from_non_negative ( (t .to_Int (k) + 1) * t .to_Int (a) )
 
 end
 

From 35a1f6bf05d19260bebd741a19e4ada6a8d839c3 Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Thu, 25 May 2023 21:42:00 +0200
Subject: [PATCH 40/56] Add intersection type and union type operators

---
 docs/RELEASE-NOTES.md                                |  3 ++-
 .../main/scala/soda/example/forcoq/lib/Package.scala |  4 ++--
 .../main/scala/soda/collection/example/Package.scala |  3 +++
 .../extension/toscala/MatchCaseBlockTranslator.soda  | 10 ++++++++--
 .../extension/toscala/MicroTranslatorToScala.soda    |  2 +-
 .../soda/translator/extension/toscala/Package.scala  | 12 +++++++++---
 .../main/scala/soda/translator/parser/Package.scala  |  8 +++++++-
 .../scala/soda/translator/parser/SodaConstant.soda   |  8 +++++++-
 8 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/docs/RELEASE-NOTES.md b/docs/RELEASE-NOTES.md
index 88e827b4..52c1197b 100644
--- a/docs/RELEASE-NOTES.md
+++ b/docs/RELEASE-NOTES.md
@@ -5,7 +5,8 @@
   - release: target/scala-3.2.2/soda-0.18.0.jar
   - new_features:
     - assumes translation to `Package.scala` files as default configuration for the Scala translator
-    - expects multiple type parameters to be between different square brackets, e.g. `MyPair [A] [B]` instead of `MyPair [A, B]` 
+    - expects multiple type parameters to be between different square brackets, e.g. `MyPair [A] [B]` instead of `MyPair [A, B]`
+    - accepts intersection types (built with `&`) and union types (built with `|`)
   - bug_fixes:
     - fixes translation of reserved words after opening parenthesis
 - - version: v0.17.0
diff --git a/examples/src/main/scala/soda/example/forcoq/lib/Package.scala b/examples/src/main/scala/soda/example/forcoq/lib/Package.scala
index 218d52b0..785c6688 100644
--- a/examples/src/main/scala/soda/example/forcoq/lib/Package.scala
+++ b/examples/src/main/scala/soda/example/forcoq/lib/Package.scala
@@ -119,13 +119,13 @@ trait S
      a => add_for (a)
 
   def add_for (a : nat) : nat =
-    t .from_non_negative( (t .to_Int (k) + 1) + t .to_Int (a) )
+    t .from_non_negative ( (t .to_Int (k) + 1) + t .to_Int (a) )
 
   lazy val mul : nat =>  nat =
      a => mul_for (a)
 
   def mul_for (a : nat) : nat =
-    t .from_non_negative( (t .to_Int (k) + 1) * t .to_Int (a) )
+    t .from_non_negative ( (t .to_Int (k) + 1) * t .to_Int (a) )
 
 }
 
diff --git a/library/src/main/scala/soda/collection/example/Package.scala b/library/src/main/scala/soda/collection/example/Package.scala
index d6b972cd..e25d099a 100644
--- a/library/src/main/scala/soda/collection/example/Package.scala
+++ b/library/src/main/scala/soda/collection/example/Package.scala
@@ -145,3 +145,6 @@ object EntryPoint {
 
 case class Main_ () extends Main
 
+
+
+
diff --git a/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda b/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda
index 58fef648..fb0384d4 100644
--- a/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda
+++ b/translator/src/main/scala/soda/translator/extension/toscala/MatchCaseBlockTranslator.soda
@@ -8,6 +8,8 @@ class MatchCaseBlockTranslator
     soda.translator.block.Block
     soda.translator.parser.BlockBuilder_
     soda.translator.parser.SodaConstant_
+    soda.translator.parser.annotation.ClassAliasAnnotation
+    soda.translator.parser.annotation.ClassAliasAnnotation_
     soda.translator.parser.annotation.FunctionDefinitionAnnotation
     soda.translator.parser.annotation.FunctionDefinitionAnnotation_
     soda.translator.parser.annotation.TestDeclarationAnnotation
@@ -25,13 +27,17 @@ class MatchCaseBlockTranslator
 
   translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock =
     match annotated_block
-      case FunctionDefinitionAnnotation_ (block) ==> _translate_function_block (FunctionDefinitionAnnotation_ (block) )
-      case TestDeclarationAnnotation_ (block) ==> _translate_test_block (TestDeclarationAnnotation_ (block) )
+      case FunctionDefinitionAnnotation_ (block) ==> _translate_function_block (annotated_block)
+      case ClassAliasAnnotation_ (block) ==> _translate_class_alias_block (annotated_block)
+      case TestDeclarationAnnotation_ (block) ==> _translate_test_block (annotated_block)
       case otherwise ==> annotated_block
 
   _translate_function_block (block : AnnotatedBlock) : FunctionDefinitionAnnotation =
     FunctionDefinitionAnnotation_ (_translate_block (block) )
 
+  _translate_class_alias_block (block : AnnotatedBlock) : ClassAliasAnnotation =
+    ClassAliasAnnotation_ (_translate_block (block) )
+
   _translate_test_block (block : AnnotatedBlock) : TestDeclarationAnnotation =
     TestDeclarationAnnotation_ (_translate_block (block) )
 
diff --git a/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda
index d954dfc4..3e58f226 100644
--- a/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda
+++ b/translator/src/main/scala/soda/translator/extension/toscala/MicroTranslatorToScala.soda
@@ -19,7 +19,7 @@ class MicroTranslatorToScala
   _ba = BlockAnnotationEnum_ ()
 
   _functions_and_tests =
-    Seq (_ba .function_definition , _ba .test_declaration)
+    Seq (_ba .function_definition , _ba .class_alias , _ba .test_declaration)
 
   _class_declarations =
     Seq (_ba .class_alias , _ba .class_beginning , _ba .abstract_declaration)
diff --git a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala
index a9d59d74..19bc3f3a 100644
--- a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala
+++ b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala
@@ -698,6 +698,8 @@ trait MatchCaseBlockTranslator
   import   soda.translator.block.Block
   import   soda.translator.parser.BlockBuilder_
   import   soda.translator.parser.SodaConstant_
+  import   soda.translator.parser.annotation.ClassAliasAnnotation
+  import   soda.translator.parser.annotation.ClassAliasAnnotation_
   import   soda.translator.parser.annotation.FunctionDefinitionAnnotation
   import   soda.translator.parser.annotation.FunctionDefinitionAnnotation_
   import   soda.translator.parser.annotation.TestDeclarationAnnotation
@@ -715,14 +717,18 @@ trait MatchCaseBlockTranslator
 
   def translate_for (annotated_block : AnnotatedBlock) : AnnotatedBlock =
     annotated_block match  {
-      case FunctionDefinitionAnnotation_ (block) => _translate_function_block (FunctionDefinitionAnnotation_ (block) )
-      case TestDeclarationAnnotation_ (block) => _translate_test_block (TestDeclarationAnnotation_ (block) )
+      case FunctionDefinitionAnnotation_ (block) => _translate_function_block (annotated_block)
+      case ClassAliasAnnotation_ (block) => _translate_class_alias_block (annotated_block)
+      case TestDeclarationAnnotation_ (block) => _translate_test_block (annotated_block)
       case otherwise => annotated_block
     }
 
   private def _translate_function_block (block : AnnotatedBlock) : FunctionDefinitionAnnotation =
     FunctionDefinitionAnnotation_ (_translate_block (block) )
 
+  private def _translate_class_alias_block (block : AnnotatedBlock) : ClassAliasAnnotation =
+    ClassAliasAnnotation_ (_translate_block (block) )
+
   private def _translate_test_block (block : AnnotatedBlock) : TestDeclarationAnnotation =
     TestDeclarationAnnotation_ (_translate_block (block) )
 
@@ -789,7 +795,7 @@ trait MicroTranslatorToScala
   private lazy val _ba = BlockAnnotationEnum_ ()
 
   private lazy val _functions_and_tests =
-    Seq (_ba .function_definition , _ba .test_declaration)
+    Seq (_ba .function_definition , _ba .class_alias , _ba .test_declaration)
 
   private lazy val _class_declarations =
     Seq (_ba .class_alias , _ba .class_beginning , _ba .abstract_declaration)
diff --git a/translator/src/main/scala/soda/translator/parser/Package.scala b/translator/src/main/scala/soda/translator/parser/Package.scala
index d6350963..ceeba5b5 100644
--- a/translator/src/main/scala/soda/translator/parser/Package.scala
+++ b/translator/src/main/scala/soda/translator/parser/Package.scala
@@ -418,6 +418,10 @@ trait SodaConstant
 
   lazy val private_function_prefix = "_"
 
+  lazy val intersection_type_symbol = "&"
+
+  lazy val union_type_symbol = "|"
+
   lazy val soda_reserved_words_words_only : Seq [String] =
     Seq (
       lambda_reserved_word,
@@ -463,7 +467,9 @@ trait SodaConstant
       greater_than_symbol,
       greater_than_or_equal_to_symbol,
       subtype_abbreviation,
-      supertype_abbreviation
+      supertype_abbreviation,
+      intersection_type_symbol,
+      union_type_symbol
     )
 
   lazy val soda_reserved_words_annotations_only : Seq [String] =
diff --git a/translator/src/main/scala/soda/translator/parser/SodaConstant.soda b/translator/src/main/scala/soda/translator/parser/SodaConstant.soda
index 3c40e804..fe79f1a9 100644
--- a/translator/src/main/scala/soda/translator/parser/SodaConstant.soda
+++ b/translator/src/main/scala/soda/translator/parser/SodaConstant.soda
@@ -151,6 +151,10 @@ class SodaConstant
 
   private_function_prefix = "_"
 
+  intersection_type_symbol = "&"
+
+  union_type_symbol = "|"
+
   soda_reserved_words_words_only : Seq [String] =
     Seq (
       lambda_reserved_word,
@@ -196,7 +200,9 @@ class SodaConstant
       greater_than_symbol,
       greater_than_or_equal_to_symbol,
       subtype_abbreviation,
-      supertype_abbreviation
+      supertype_abbreviation,
+      intersection_type_symbol,
+      union_type_symbol
     )
 
   soda_reserved_words_annotations_only : Seq [String] =

From 015dc5d46dee4679df2486fdcb04fab107e415bb Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Fri, 26 May 2023 00:56:03 +0200
Subject: [PATCH 41/56] Make minor change

---
 library/src/main/scala/soda/collection/example/Package.scala | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/library/src/main/scala/soda/collection/example/Package.scala b/library/src/main/scala/soda/collection/example/Package.scala
index e25d099a..d6b972cd 100644
--- a/library/src/main/scala/soda/collection/example/Package.scala
+++ b/library/src/main/scala/soda/collection/example/Package.scala
@@ -145,6 +145,3 @@ object EntryPoint {
 
 case class Main_ () extends Main
 
-
-
-

From c1c4d25c6fbffbd9d8426b3e2691c72d6ec9a802 Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Fri, 26 May 2023 21:54:07 +0200
Subject: [PATCH 42/56] Fix egde case of DirectoryScanner

---
 docs/RELEASE-NOTES.md                             |  1 +
 .../soda/translator/io/DirectoryScanner.soda      | 14 +++++++++++---
 .../main/scala/soda/translator/io/Package.scala   | 15 ++++++++++++---
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/docs/RELEASE-NOTES.md b/docs/RELEASE-NOTES.md
index 52c1197b..4ff11d19 100644
--- a/docs/RELEASE-NOTES.md
+++ b/docs/RELEASE-NOTES.md
@@ -9,6 +9,7 @@
     - accepts intersection types (built with `&`) and union types (built with `|`)
   - bug_fixes:
     - fixes translation of reserved words after opening parenthesis
+    - fixes edge case of directory scanner when translating multiple Soda files to Scala
 - - version: v0.17.0
   - date: '2023-03-01'
   - build: sbt '++ 3.2.2' clean compile test package assembly
diff --git a/translator/src/main/scala/soda/translator/io/DirectoryScanner.soda b/translator/src/main/scala/soda/translator/io/DirectoryScanner.soda
index afa1cd60..fa4e8ddb 100644
--- a/translator/src/main/scala/soda/translator/io/DirectoryScanner.soda
+++ b/translator/src/main/scala/soda/translator/io/DirectoryScanner.soda
@@ -1,12 +1,12 @@
 
 /**
- * This class is used to scan files in a given directory .
+ * This class is used to scan files in a given directory.
  */
 
 class DirectoryScanner
 
   import
-    java .io.File
+    java.io.File
 
   get_all_files (start : File) : Seq [File] =
     if start .isFile
@@ -29,8 +29,16 @@ class DirectoryScanner
 
   _get_files_to_scan_with (to_scan_head : File) (to_scan_tail : Seq [File] ) : Seq [File] =
     if to_scan_head .isDirectory
-    then to_scan_tail .++ (to_scan_head .listFiles () )
+    then to_scan_tail .++ (_list_files (to_scan_head) )
     else to_scan_tail
 
+  _list_files (to_scan_head : File) : Seq [File] =
+    _list_files_with (Option (to_scan_head .listFiles) )
+
+  _list_files_with (files : Option [Array [File] ] ) : Seq [File] =
+    match files
+      case Some (array) ==> array .toSeq
+      case otherwise ==> Seq ()
+
 end
 
diff --git a/translator/src/main/scala/soda/translator/io/Package.scala b/translator/src/main/scala/soda/translator/io/Package.scala
index 91df5beb..701de4cf 100644
--- a/translator/src/main/scala/soda/translator/io/Package.scala
+++ b/translator/src/main/scala/soda/translator/io/Package.scala
@@ -74,13 +74,13 @@ case class DirectoryProcessor_ (start : String, process_soda_file : java.io.File
 
 
 /**
- * This class is used to scan files in a given directory .
+ * This class is used to scan files in a given directory.
  */
 
 trait DirectoryScanner
 {
 
-  import   java .io.File
+  import   java.io.File
 
   def get_all_files (start : File) : Seq [File] =
     if ( start .isFile
@@ -104,9 +104,18 @@ trait DirectoryScanner
 
   private def _get_files_to_scan_with (to_scan_head : File) (to_scan_tail : Seq [File] ) : Seq [File] =
     if ( to_scan_head .isDirectory
-    ) to_scan_tail .++ (to_scan_head .listFiles () )
+    ) to_scan_tail .++ (_list_files (to_scan_head) )
     else to_scan_tail
 
+  private def _list_files (to_scan_head : File) : Seq [File] =
+    _list_files_with (Option (to_scan_head .listFiles) )
+
+  private def _list_files_with (files : Option [Array [File] ] ) : Seq [File] =
+    files match  {
+      case Some (array) => array .toSeq
+      case otherwise => Seq ()
+    }
+
 }
 
 case class DirectoryScanner_ () extends DirectoryScanner

From 01484fd578e6af8cef10a8668c08954b8c34637e Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Fri, 26 May 2023 21:54:07 +0200
Subject: [PATCH 43/56] Make minor change

---
 .../main/scala/soda/translator/extension/toscala/Package.scala  | 2 +-
 .../soda/translator/extension/toscala/TranslatorToScala.soda    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala
index 19bc3f3a..5a9c2643 100644
--- a/translator/src/main/scala/soda/translator/extension/toscala/Package.scala
+++ b/translator/src/main/scala/soda/translator/extension/toscala/Package.scala
@@ -1250,7 +1250,7 @@ trait PackageProcessor
   def get_input_output_file_names (input_name : String) (parent_name : String) : FileNamePair =
     if ( input_name .endsWith (tc .soda_extension)
     ) FileNamePair_ (input_name , parent_name + tc .file_separator + tc .package_scala_file_name )
-    else FileNamePair_ (input_name + tc .soda_extension, input_name + tc .scala_extension)
+    else FileNamePair_ (input_name + tc .soda_extension , input_name + tc .scala_extension)
 
   def translate_append (input_file_name : String) (output_file_name : String) : Boolean =
     _translate_append_with_input (reader .read_file (input_file_name) ) (output_file_name)
diff --git a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda
index fa29d656..73b8e35c 100644
--- a/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda
+++ b/translator/src/main/scala/soda/translator/extension/toscala/TranslatorToScala.soda
@@ -127,7 +127,7 @@ class PackageProcessor
   get_input_output_file_names (input_name : String) (parent_name : String) : FileNamePair =
     if input_name .endsWith (tc .soda_extension)
     then FileNamePair_ (input_name , parent_name + tc .file_separator + tc .package_scala_file_name )
-    else FileNamePair_ (input_name + tc .soda_extension, input_name + tc .scala_extension)
+    else FileNamePair_ (input_name + tc .soda_extension , input_name + tc .scala_extension)
 
   translate_append (input_file_name : String) (output_file_name : String) : Boolean =
     _translate_append_with_input (reader .read_file (input_file_name) ) (output_file_name)

From fec47e289d5618c3544c2284b8b1dec0ea9720ca Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Fri, 26 May 2023 22:59:22 +0200
Subject: [PATCH 44/56] Fix issue of missing Package.soda file

---
 .../translator/io/DirectoryProcessor.soda     | 31 ++++++++++++++++---
 .../scala/soda/translator/io/Package.scala    | 31 ++++++++++++++++---
 2 files changed, 54 insertions(+), 8 deletions(-)

diff --git a/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda b/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda
index bba8dd33..ae108990 100644
--- a/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda
+++ b/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda
@@ -23,12 +23,24 @@ class DirectoryProcessor
   package_file_name = "Package.soda"
 
   _all_files : Seq [File] =
-    DirectoryScanner_ () .get_all_files ( @new File (start))
+    DirectoryScanner_ () .get_all_files ( @new File (start) )
 
   _all_soda_files : Seq [File] =
     _all_files
       .filter (lambda x --> x .isFile)
-      .filter (lambda x --> x .getName .endsWith (soda_suffix))
+      .filter (lambda x --> x .getName .endsWith (soda_suffix) )
+
+  _sorted_soda_directories : Seq [File] =
+    _all_soda_files
+      .map (lambda x --> x .getParentFile)
+      .distinct
+      .sorted
+
+  _sorted_package_file_directories : Seq [File] =
+    _sorted_package_files
+      .map (lambda x --> x .getParentFile)
+      .distinct
+      .sorted
 
   _package_files : Seq [File] =
     _all_files
@@ -43,9 +55,17 @@ class DirectoryProcessor
 
   _sorted_soda_non_package_files : Seq [File] = _soda_non_package_files .sorted
 
-  _soda_files : Seq [File] =
+  _original_soda_files : Seq [File] =
     _sorted_package_files  .++ (_sorted_soda_non_package_files)
 
+  _missing_package_files : Seq [File] =
+    _sorted_soda_directories
+      .filter (lambda x --> not (_sorted_package_file_directories .contains (x) ) )
+      .map (lambda x --> @new File (x , package_file_name) )
+
+  _soda_files_and_missing_package_files : Seq [File] =
+    _missing_package_files .++ (_original_soda_files)
+
   _lib_files : Seq [File] =
     _all_files
       .filter (lambda x --> x .isFile)
@@ -53,7 +73,10 @@ class DirectoryProcessor
 
   process () : Boolean =
     LibraryDeployer_ () .expand_library (_lib_files) and
-      _soda_files
+      _missing_package_files
+        .map (lambda x --> x .createNewFile)
+        .forall (lambda x --> x) and
+      _soda_files_and_missing_package_files
         .map (process_soda_file)
         .forall (lambda x --> x)
 
diff --git a/translator/src/main/scala/soda/translator/io/Package.scala b/translator/src/main/scala/soda/translator/io/Package.scala
index 701de4cf..1152f3f5 100644
--- a/translator/src/main/scala/soda/translator/io/Package.scala
+++ b/translator/src/main/scala/soda/translator/io/Package.scala
@@ -34,12 +34,24 @@ trait DirectoryProcessor
   lazy val package_file_name = "Package.soda"
 
   private lazy val _all_files : Seq [File] =
-    DirectoryScanner_ () .get_all_files ( new File (start))
+    DirectoryScanner_ () .get_all_files ( new File (start) )
 
   private lazy val _all_soda_files : Seq [File] =
     _all_files
       .filter ( x => x .isFile)
-      .filter ( x => x .getName .endsWith (soda_suffix))
+      .filter ( x => x .getName .endsWith (soda_suffix) )
+
+  private lazy val _sorted_soda_directories : Seq [File] =
+    _all_soda_files
+      .map ( x => x .getParentFile)
+      .distinct
+      .sorted
+
+  private lazy val _sorted_package_file_directories : Seq [File] =
+    _sorted_package_files
+      .map ( x => x .getParentFile)
+      .distinct
+      .sorted
 
   private lazy val _package_files : Seq [File] =
     _all_files
@@ -54,9 +66,17 @@ trait DirectoryProcessor
 
   private lazy val _sorted_soda_non_package_files : Seq [File] = _soda_non_package_files .sorted
 
-  private lazy val _soda_files : Seq [File] =
+  private lazy val _original_soda_files : Seq [File] =
     _sorted_package_files  .++ (_sorted_soda_non_package_files)
 
+  private lazy val _missing_package_files : Seq [File] =
+    _sorted_soda_directories
+      .filter ( x => ! (_sorted_package_file_directories .contains (x) ) )
+      .map ( x => new File (x , package_file_name) )
+
+  private lazy val _soda_files_and_missing_package_files : Seq [File] =
+    _missing_package_files .++ (_original_soda_files)
+
   private lazy val _lib_files : Seq [File] =
     _all_files
       .filter ( x => x .isFile)
@@ -64,7 +84,10 @@ trait DirectoryProcessor
 
   def process () : Boolean =
     LibraryDeployer_ () .expand_library (_lib_files) &&
-      _soda_files
+      _missing_package_files
+        .map ( x => x .createNewFile)
+        .forall ( x => x) &&
+      _soda_files_and_missing_package_files
         .map (process_soda_file)
         .forall ( x => x)
 

From bbb209231d97d5d44d6a72ed4f18841ab605b06a Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Fri, 26 May 2023 23:48:01 +0200
Subject: [PATCH 45/56] Update release notes

---
 docs/RELEASE-NOTES.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/docs/RELEASE-NOTES.md b/docs/RELEASE-NOTES.md
index 4ff11d19..dd0922a2 100644
--- a/docs/RELEASE-NOTES.md
+++ b/docs/RELEASE-NOTES.md
@@ -10,6 +10,7 @@
   - bug_fixes:
     - fixes translation of reserved words after opening parenthesis
     - fixes edge case of directory scanner when translating multiple Soda files to Scala
+    - fixes processing of Soda files when Package.soda file is missing
 - - version: v0.17.0
   - date: '2023-03-01'
   - build: sbt '++ 3.2.2' clean compile test package assembly

From d22090c071c5f8fbf5a1ad4202b5a98216375712 Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Sun, 28 May 2023 15:28:15 +0200
Subject: [PATCH 46/56] Improve readability of DirectoryProcessor

---
 .../translator/io/DirectoryProcessor.soda     | 51 ++++++++++++-------
 .../scala/soda/translator/io/Package.scala    | 51 ++++++++++++-------
 2 files changed, 66 insertions(+), 36 deletions(-)

diff --git a/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda b/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda
index ae108990..da91301c 100644
--- a/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda
+++ b/translator/src/main/scala/soda/translator/io/DirectoryProcessor.soda
@@ -25,13 +25,22 @@ class DirectoryProcessor
   _all_files : Seq [File] =
     DirectoryScanner_ () .get_all_files ( @new File (start) )
 
-  _all_soda_files : Seq [File] =
+  _sorted_all_soda_files : Seq [File] =
     _all_files
       .filter (lambda x --> x .isFile)
       .filter (lambda x --> x .getName .endsWith (soda_suffix) )
+      .distinct
+      .sorted
+
+  _sorted_package_files : Seq [File] =
+    _all_files
+      .filter (lambda x --> x .isFile)
+      .filter (lambda x --> x .getName == package_file_name)
+      .distinct
+      .sorted
 
   _sorted_soda_directories : Seq [File] =
-    _all_soda_files
+    _sorted_all_soda_files
       .map (lambda x --> x .getParentFile)
       .distinct
       .sorted
@@ -42,19 +51,10 @@ class DirectoryProcessor
       .distinct
       .sorted
 
-  _package_files : Seq [File] =
-    _all_files
-      .filter (lambda x --> x .isFile)
-      .filter (lambda x --> x .getName == package_file_name)
-
-  _sorted_package_files : Seq [File] = _package_files .sorted
-
-  _soda_non_package_files : Seq [File] =
-    _all_soda_files
+  _sorted_soda_non_package_files : Seq [File] =
+    _sorted_all_soda_files
       .filter (lambda x --> not (x .getName == package_file_name) )
 
-  _sorted_soda_non_package_files : Seq [File] = _soda_non_package_files .sorted
-
   _original_soda_files : Seq [File] =
     _sorted_package_files  .++ (_sorted_soda_non_package_files)
 
@@ -66,19 +66,34 @@ class DirectoryProcessor
   _soda_files_and_missing_package_files : Seq [File] =
     _missing_package_files .++ (_original_soda_files)
 
-  _lib_files : Seq [File] =
+  _sorted_lib_files : Seq [File] =
     _all_files
       .filter (lambda x --> x .isFile)
       .filter (lambda file --> file .getName == LibraryDeployer_ () .library_marker_file)
+      .sorted
 
-  process () : Boolean =
-    LibraryDeployer_ () .expand_library (_lib_files) and
+  _expand_library_files (ready : Boolean) : Boolean =
+    ready and
+      LibraryDeployer_ () .expand_library (_sorted_lib_files)
+
+  _add_missing_package_files (ready : Boolean) : Boolean =
+    ready and
       _missing_package_files
-        .map (lambda x --> x .createNewFile)
-        .forall (lambda x --> x) and
+       .map (lambda x --> x .createNewFile)
+       .forall (lambda x --> x)
+
+  _process_all_soda_files (ready : Boolean) : Boolean =
+    ready and
       _soda_files_and_missing_package_files
         .map (process_soda_file)
         .forall (lambda x --> x)
 
+  process () : Boolean =
+    Some (true)
+      .map (_expand_library_files)
+      .map (_add_missing_package_files)
+      .map (_process_all_soda_files)
+      .getOrElse (false)
+
 end
 
diff --git a/translator/src/main/scala/soda/translator/io/Package.scala b/translator/src/main/scala/soda/translator/io/Package.scala
index 1152f3f5..486f9701 100644
--- a/translator/src/main/scala/soda/translator/io/Package.scala
+++ b/translator/src/main/scala/soda/translator/io/Package.scala
@@ -36,13 +36,22 @@ trait DirectoryProcessor
   private lazy val _all_files : Seq [File] =
     DirectoryScanner_ () .get_all_files ( new File (start) )
 
-  private lazy val _all_soda_files : Seq [File] =
+  private lazy val _sorted_all_soda_files : Seq [File] =
     _all_files
       .filter ( x => x .isFile)
       .filter ( x => x .getName .endsWith (soda_suffix) )
+      .distinct
+      .sorted
+
+  private lazy val _sorted_package_files : Seq [File] =
+    _all_files
+      .filter ( x => x .isFile)
+      .filter ( x => x .getName == package_file_name)
+      .distinct
+      .sorted
 
   private lazy val _sorted_soda_directories : Seq [File] =
-    _all_soda_files
+    _sorted_all_soda_files
       .map ( x => x .getParentFile)
       .distinct
       .sorted
@@ -53,19 +62,10 @@ trait DirectoryProcessor
       .distinct
       .sorted
 
-  private lazy val _package_files : Seq [File] =
-    _all_files
-      .filter ( x => x .isFile)
-      .filter ( x => x .getName == package_file_name)
-
-  private lazy val _sorted_package_files : Seq [File] = _package_files .sorted
-
-  private lazy val _soda_non_package_files : Seq [File] =
-    _all_soda_files
+  private lazy val _sorted_soda_non_package_files : Seq [File] =
+    _sorted_all_soda_files
       .filter ( x => ! (x .getName == package_file_name) )
 
-  private lazy val _sorted_soda_non_package_files : Seq [File] = _soda_non_package_files .sorted
-
   private lazy val _original_soda_files : Seq [File] =
     _sorted_package_files  .++ (_sorted_soda_non_package_files)
 
@@ -77,20 +77,35 @@ trait DirectoryProcessor
   private lazy val _soda_files_and_missing_package_files : Seq [File] =
     _missing_package_files .++ (_original_soda_files)
 
-  private lazy val _lib_files : Seq [File] =
+  private lazy val _sorted_lib_files : Seq [File] =
     _all_files
       .filter ( x => x .isFile)
       .filter ( file => file .getName == LibraryDeployer_ () .library_marker_file)
+      .sorted
 
-  def process () : Boolean =
-    LibraryDeployer_ () .expand_library (_lib_files) &&
+  private def _expand_library_files (ready : Boolean) : Boolean =
+    ready &&
+      LibraryDeployer_ () .expand_library (_sorted_lib_files)
+
+  private def _add_missing_package_files (ready : Boolean) : Boolean =
+    ready &&
       _missing_package_files
-        .map ( x => x .createNewFile)
-        .forall ( x => x) &&
+       .map ( x => x .createNewFile)
+       .forall ( x => x)
+
+  private def _process_all_soda_files (ready : Boolean) : Boolean =
+    ready &&
       _soda_files_and_missing_package_files
         .map (process_soda_file)
         .forall ( x => x)
 
+  def process () : Boolean =
+    Some (true)
+      .map (_expand_library_files)
+      .map (_add_missing_package_files)
+      .map (_process_all_soda_files)
+      .getOrElse (false)
+
 }
 
 case class DirectoryProcessor_ (start : String, process_soda_file : java.io.File => Boolean) extends DirectoryProcessor

From 398893185bb6a004f6d389e40bc388aa9c620471 Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Sun, 28 May 2023 17:54:57 +0200
Subject: [PATCH 47/56] Make minor change

---
 .../src/main/scala/soda/translator/io/SimpleIO.soda       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/translator/src/main/scala/soda/translator/io/SimpleIO.soda b/translator/src/main/scala/soda/translator/io/SimpleIO.soda
index 5d61fb04..404bff24 100644
--- a/translator/src/main/scala/soda/translator/io/SimpleIO.soda
+++ b/translator/src/main/scala/soda/translator/io/SimpleIO.soda
@@ -55,10 +55,10 @@ class SimpleFileWriter
 
   _write_content (writer : Writer) (content : String) : Boolean =
     SomeSD_ (true)
-      .map (lambda x --> writer.write (content) )
-      .map (lambda x --> writer.flush () )
-      .map (lambda x --> writer.close () )
-      .map (lambda x --> true )
+      .map (lambda x --> writer .write (content) )
+      .map (lambda x --> writer .flush () )
+      .map (lambda x --> writer .close () )
+      .map (lambda x --> true)
       .getOrElse (false)
 
   create_file (parent_directory : String) (file_name : String) : File =

From ee199745aa8d029d473413823a2a99d45ecd845b Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Sun, 28 May 2023 16:42:51 +0200
Subject: [PATCH 48/56] Add Soda class to handle exceptions

---
 .../main/resources/lib/soda/lib/Package.scala | 21 +++++++++++++++++++
 .../resources/lib/soda/lib/SodaException.soda | 18 ++++++++++++++++
 .../src/main/resources/lib/soda/lib/files.txt |  1 +
 .../src/main/scala/soda/lib/Package.scala     | 21 +++++++++++++++++++
 .../main/scala/soda/lib/SodaException.soda    | 17 +++++++++++++++
 5 files changed, 78 insertions(+)
 create mode 100644 translator/src/main/resources/lib/soda/lib/SodaException.soda
 create mode 100644 translator/src/main/scala/soda/lib/SodaException.soda

diff --git a/translator/src/main/resources/lib/soda/lib/Package.scala b/translator/src/main/resources/lib/soda/lib/Package.scala
index a93805d5..cc31c67f 100644
--- a/translator/src/main/resources/lib/soda/lib/Package.scala
+++ b/translator/src/main/resources/lib/soda/lib/Package.scala
@@ -384,3 +384,24 @@ trait SeqSDBuilder [A]
 
 case class SeqSDBuilder_ [A] () extends SeqSDBuilder [A]
 
+
+/*
+ * This file is automatically generated. Do not edit.
+ */
+
+/**
+ * This class models an exception in Soda.
+ */
+
+trait SodaException [A]
+  extends
+    java.lang.Throwable
+{
+
+   def   message : String
+   def   cause : A
+
+}
+
+case class SodaException_ [A] (message : String, cause : A) extends SodaException [A]
+
diff --git a/translator/src/main/resources/lib/soda/lib/SodaException.soda b/translator/src/main/resources/lib/soda/lib/SodaException.soda
new file mode 100644
index 00000000..0d13b5d7
--- /dev/null
+++ b/translator/src/main/resources/lib/soda/lib/SodaException.soda
@@ -0,0 +1,18 @@
+/*
+ * This file is automatically generated. Do not edit.
+ */
+
+/**
+ * This class models an exception in Soda.
+ */
+
+class SodaException [A]
+  extends
+    java.lang.Throwable
+
+   abstract
+     message : String
+     cause : A
+
+end
+
diff --git a/translator/src/main/resources/lib/soda/lib/files.txt b/translator/src/main/resources/lib/soda/lib/files.txt
index d2e94be2..bc629a60 100644
--- a/translator/src/main/resources/lib/soda/lib/files.txt
+++ b/translator/src/main/resources/lib/soda/lib/files.txt
@@ -5,3 +5,4 @@ OptionSD.soda
 Package.soda
 Recursion.soda
 SeqSD.soda
+SodaException.soda
diff --git a/translator/src/main/scala/soda/lib/Package.scala b/translator/src/main/scala/soda/lib/Package.scala
index fd02dd19..29b82ca6 100644
--- a/translator/src/main/scala/soda/lib/Package.scala
+++ b/translator/src/main/scala/soda/lib/Package.scala
@@ -383,5 +383,26 @@ trait SeqSDBuilder [A]
 case class SeqSDBuilder_ [A] () extends SeqSDBuilder [A]
 
 
+/*
+ * This file is automatically generated. Do not edit.
+ */
+
+/**
+ * This class models an exception in Soda.
+ */
+
+trait SodaException [A]
+  extends
+    java.lang.Throwable
+{
+
+   def   message : String
+   def   cause : A
+
+}
+
+case class SodaException_ [A] (message : String, cause : A) extends SodaException [A]
+
+
 /* Soda library */
 
diff --git a/translator/src/main/scala/soda/lib/SodaException.soda b/translator/src/main/scala/soda/lib/SodaException.soda
new file mode 100644
index 00000000..c6aa1575
--- /dev/null
+++ b/translator/src/main/scala/soda/lib/SodaException.soda
@@ -0,0 +1,17 @@
+/*
+ * This file is automatically generated. Do not edit.
+ */
+
+/**
+ * This class models an exception in Soda.
+ */
+
+class SodaException [A]
+  extends
+    java.lang.Throwable
+
+   abstract
+     message : String
+     cause : A
+
+end

From bed07dec1d4bc6051b3c2423ab1b940439347b79 Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Wed, 31 May 2023 17:17:18 +0200
Subject: [PATCH 49/56] Make minor change

---
 .../src/main/scala/soda/translator/io/Package.scala       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/translator/src/main/scala/soda/translator/io/Package.scala b/translator/src/main/scala/soda/translator/io/Package.scala
index 486f9701..c354d57a 100644
--- a/translator/src/main/scala/soda/translator/io/Package.scala
+++ b/translator/src/main/scala/soda/translator/io/Package.scala
@@ -252,10 +252,10 @@ trait SimpleFileWriter
 
   private def _write_content (writer : Writer) (content : String) : Boolean =
     SomeSD_ (true)
-      .map ( x => writer.write (content) )
-      .map ( x => writer.flush () )
-      .map ( x => writer.close () )
-      .map ( x => true )
+      .map ( x => writer .write (content) )
+      .map ( x => writer .flush () )
+      .map ( x => writer .close () )
+      .map ( x => true)
       .getOrElse (false)
 
   def create_file (parent_directory : String) (file_name : String) : File =

From acf7b24df5b79938afa2d1332c575a3adc2cd478 Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Wed, 31 May 2023 17:27:43 +0200
Subject: [PATCH 50/56] Update release notes

---
 docs/RELEASE-NOTES.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/RELEASE-NOTES.md b/docs/RELEASE-NOTES.md
index dd0922a2..310dd3ce 100644
--- a/docs/RELEASE-NOTES.md
+++ b/docs/RELEASE-NOTES.md
@@ -1,6 +1,6 @@
 ---
 - - version: v0.18.0
-  - date: unreleased
+  - date: '2023-06-01'
   - build: sbt '++ 3.2.2' clean compile test package assembly
   - release: target/scala-3.2.2/soda-0.18.0.jar
   - new_features:

From ba8adbc004320c4a2bfa4900edadaef7ca75cd7c Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Wed, 31 May 2023 18:34:37 +0200
Subject: [PATCH 51/56] Use sbt 1.8.3

---
 project/build.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/project/build.properties b/project/build.properties
index aeedd7eb..c91f8e2b 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -7,5 +7,5 @@
 # [https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/]
 # [https://repo.scala-sbt.org/scalasbt/maven-releases/org/scala-sbt/sbt-launch/]
 #
-sbt.version=1.8.2
+sbt.version=1.8.3
 

From 43bb940df229d838284bff170971234535fed396 Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Wed, 31 May 2023 18:39:03 +0200
Subject: [PATCH 52/56] Use Scala 3.3.0

---
 .github/workflows/ci.yml | 2 +-
 build.sbt                | 6 +++---
 docs/RELEASE-NOTES.md    | 4 ++--
 makeall.sh               | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a38517cb..74ab0e9a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,7 +20,7 @@ jobs:
         - 2.11.12
         - 2.12.17
         - 2.13.10
-        - 3.2.2
+        - 3.3.0
     steps:
     - name: Check out
       uses: actions/checkout@v3
diff --git a/build.sbt b/build.sbt
index 719da418..45dd4479 100644
--- a/build.sbt
+++ b/build.sbt
@@ -6,7 +6,7 @@ lazy val scala2_12 = "2.12.17"
 
 lazy val scala2_13 = "2.13.10"
 
-lazy val scala3_2 = "3.2.2"
+lazy val scala3_3 = "3.3.0"
 
 lazy val commonSettings =
   Seq(
@@ -28,8 +28,8 @@ lazy val commonSettings =
      * [[https://repo1.maven.org/maven2/org/scala-lang/scalap/]]
      * [[https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/]]
      */
-    crossScalaVersions := Seq(scala2_11, scala2_12, scala2_13, scala3_2),
-    scalaVersion := scala3_2,
+    crossScalaVersions := Seq(scala2_11, scala2_12, scala2_13, scala3_3),
+    scalaVersion := scala3_3,
     /**
      * ScalaTest
      * [[https://www.scalatest.org]]
diff --git a/docs/RELEASE-NOTES.md b/docs/RELEASE-NOTES.md
index 310dd3ce..83c6c8ee 100644
--- a/docs/RELEASE-NOTES.md
+++ b/docs/RELEASE-NOTES.md
@@ -1,8 +1,8 @@
 ---
 - - version: v0.18.0
   - date: '2023-06-01'
-  - build: sbt '++ 3.2.2' clean compile test package assembly
-  - release: target/scala-3.2.2/soda-0.18.0.jar
+  - build: sbt '++ 3.3.0' clean compile test package assembly
+  - release: target/scala-3.3.0/soda-0.18.0.jar
   - new_features:
     - assumes translation to `Package.scala` files as default configuration for the Scala translator
     - expects multiple type parameters to be between different square brackets, e.g. `MyPair [A] [B]` instead of `MyPair [A, B]`
diff --git a/makeall.sh b/makeall.sh
index 8c8459b9..0229590a 100644
--- a/makeall.sh
+++ b/makeall.sh
@@ -2,12 +2,12 @@
 
 #
 # This script builds the binary file.
-# It requires `sbt` installed.
+# It requires `sbt` [https://www.scala-sbt.org/].
 #
 
 sbt scalaVersion sbtVersion version clean compile test package assembly
 
-scalaVersion="3.2.2"
+scalaVersion="3.3.0"
 binaryFile="soda"
 executableStub="exec java -jar \$0 \"\$@\" ; exit"
 jarFile="target/scala-${scalaVersion}/${binaryFile}-*.jar"

From b37b2dfb3c8291e4675552fd8ee57d0109dcc9ae Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Wed, 31 May 2023 18:39:28 +0200
Subject: [PATCH 53/56] Use ScalaTest 3.2.16

---
 build.sbt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build.sbt b/build.sbt
index 45dd4479..94d50a4f 100644
--- a/build.sbt
+++ b/build.sbt
@@ -36,7 +36,7 @@ lazy val commonSettings =
      * [[https://github.com/scalatest/scalatest]]
      * [[https://repo1.maven.org/maven2/org/scalatest/]]
      */
-    libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.15" % "test",
+    libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.16" % "test",
     resolvers += Resolver.mavenLocal,
     publishTo := Some(Resolver.mavenLocal),
     publishMavenStyle := true,

From 0d8dd378d197f2656cecb4d8c10112cba127097b Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Wed, 31 May 2023 18:40:20 +0200
Subject: [PATCH 54/56] Update build.sbt

---
 build.sbt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build.sbt b/build.sbt
index 94d50a4f..82d28cea 100644
--- a/build.sbt
+++ b/build.sbt
@@ -12,8 +12,8 @@ lazy val commonSettings =
   Seq(
     organization := "se.umu.cs.rai.soda",
     version := "0.18.0-SNAPSHOT",
-    description := "Functional language to describe ethical problems",
-    homepage := Some(url("https://bitbucket.org/mendezjulian/soda")),
+    description := "Object-oriented functional language to describe, analyze, and model human-centered problems",
+    homepage := Some(url("https://julianmendez.github.io/soda/")),
     startYear := Some(2020),
     licenses := Seq("Apache License Version 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt")),
     organizationName := "Responsible Artificial Intelligence - Umea University",

From 7981f9d2cdd3514f1d761a5961c4ecb49e7f8513 Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Wed, 31 May 2023 18:40:35 +0200
Subject: [PATCH 55/56] Update README.md

---
 docs/README.md | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/docs/README.md b/docs/README.md
index 864c4a11..ddb8fa21 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,10 +1,10 @@
 # Soda
 
-*Soda* (Symbolic Objective Descriptive Analysis) is a functional language to describe ethical problems. Its main purpose
-is to be used to produce clear code. The source code should be easy to understand, somehow natural, although not
-necessarily easy to write.
+*Soda* (Symbolic Objective Descriptive Analysis) is an object-oriented functional language to describe, analyze, and
+model human-centered problems.
+Due to its readability, it can be applied to model ethical problems.
 
-This project includes a translator to Scala.
+This project includes a translator to [Scala](https://scala-lang.org).
 
 
 ## Reserved words
@@ -28,10 +28,12 @@ The reserved words are:
 ## Other Symbols
 
 In addition, the language has:
+
 - `(` and `)` (parentheses) for parameters and operator precedence
 - `[` and `]` (square brackets) for parametric types
 
 The main arithmetic operators are:
+
 - `+`, `-`, `*`, `/`, `%` (modulus)
 
 Comments are marked with `/*` and `*/`. Scaladoc / Javadoc markers are `/**` and `*/`.
@@ -51,9 +53,8 @@ Special names:
 
 ## Side Effects
 
-In this language, variables cannot change their value. Therefore, there is no equivalent to `var`.
-
-For example, it is not possible to write `x = x + 1`. Loops can be managed with `range` and `fold` functions, tail recursion, or directly using streams.
+In Soda, variables cannot change their value. Thus, it is not possible to write `x = x + 1`.
+Loops can be managed with `range` and `fold` functions and tail recursion.
 
 The language does not provide `throw`, `try`, and `catch`, because those commands do not follow the functional style.
 
@@ -61,15 +62,15 @@ The language does not provide `throw`, `try`, and `catch`, because those command
 ## Static Typing
 
 This language is statically typed. It is possible to define abstract and concrete classes.
-
-A *class* is like a *trait* in Scala. Each class should have a single class constructor. The class constructor is
-implemented with a *concrete class*, which is like a *case class* in Scala.
+Each *class* (like a *trait* in Scala) can be extended and has a single class constructor.
+This constructor is implemented with a *concrete class* (like a *case class* in Scala).
 
 
 ## Package Declaration and Imports
 
-This language is designed to be integrated via the Java Virtual Machine. It is possible to define the package and to
-declare the imports.
+Soda is designed to be integrated via the Java Virtual Machine.
+It is possible to define packages and to declare imports.
+This can be done in a separate file `Package.soda`, which is in the same directory as the source code.
 
 
 ## Syntax Highlighting
@@ -87,12 +88,10 @@ The following tools can be configured to have syntax highlighting:
 
 ## Build
 
-The project can be built with [sbt](https://www.scala-sbt.org/).
-
-The command is:
+The project can be built with [sbt](https://www.scala-sbt.org/) with
 `sbt clean compile test package assembly`
 
-It is also possible to compile it for different Scala versions.
+A Linux binary can be created with the script `makeall.sh`.
 
 
 ## Author

From 2261afd28fa55b782de070b3994ae777e1c538eb Mon Sep 17 00:00:00 2001
From: Julian Mendez 
Date: Wed, 31 May 2023 18:45:55 +0200
Subject: [PATCH 56/56] Update version to 0.18.0

---
 build.sbt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build.sbt b/build.sbt
index 82d28cea..d656066c 100644
--- a/build.sbt
+++ b/build.sbt
@@ -11,7 +11,7 @@ lazy val scala3_3 = "3.3.0"
 lazy val commonSettings =
   Seq(
     organization := "se.umu.cs.rai.soda",
-    version := "0.18.0-SNAPSHOT",
+    version := "0.18.0",
     description := "Object-oriented functional language to describe, analyze, and model human-centered problems",
     homepage := Some(url("https://julianmendez.github.io/soda/")),
     startYear := Some(2020),