zeolite-lang 0.2.0.0 → 0.3.0.0
raw patch · 38 files changed
+357/−386 lines, 38 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +9/−0
- base/.zeolite-module +9/−10
- example/hello/hello-demo.0rx +3/−3
- example/regex/char-regex.0rx +21/−21
- example/regex/regex-demo.0rx +45/−45
- example/regex/regex-test.0rt +21/−21
- example/regex/regex.0rx +11/−11
- example/tree/tree-demo.0rx +9/−9
- example/tree/tree-test.0rt +4/−4
- example/tree/tree.0rx +34/−34
- example/tree/type-tree.0rx +2/−2
- lib/file/tests.0rt +1/−1
- lib/util/tests.0rt +9/−9
- lib/util/util.0rx +5/−5
- src/Compilation/CompileInfo.hs +1/−1
- src/CompilerCxx/Category.hs +3/−3
- src/Parser/Common.hs +1/−1
- src/Parser/Procedure.hs +5/−21
- src/Test/Procedure.hs +69/−69
- src/Test/testfiles/procedures.0rx +8/−8
- tests/builtin-types.0rt +6/−6
- tests/failure.0rt +1/−1
- tests/filters.0rt +1/−1
- tests/function-calls.0rt +15/−15
- tests/function-merging.0rt +2/−2
- tests/infix-operations.0rt +5/−5
- tests/internal-params.0rt +5/−5
- tests/member-init.0rt +4/−4
- tests/modifed-storage.0rt +9/−9
- tests/multiple-returns.0rt +7/−28
- tests/named-returns.0rt +8/−8
- tests/positional-returns.0rt +6/−6
- tests/reduce.0rt +1/−1
- tests/scoped.0rt +12/−12
- tests/simple.0rt +1/−1
- tests/typename.0rt +1/−1
- tests/unreachable.0rt +2/−2
- zeolite-lang.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,14 @@ # Revision history for zeolite-lang +## 0.3.0.0 -- 2020-05-03++* **[breaking]** Updates syntax for discarding all returns to use `\` instead of+ `~`. This will allow `~` to be used for bitwise-not later on. (Not to mention+ that `~` was kind of ugly in that context.)++* **[breaking]** Cleans up multiple-`return` syntax by removing `{}`. This+ applies to *both* the `return` and the assignment.+ ## 0.2.0.0 -- 2020-05-03 * **[breaking]** Requires that `concrete` categories defined in `.cpp` files be
base/.zeolite-module view
@@ -1,12 +1,11 @@ root: ".." path: "base" extra_files: [+ "base/argv.cpp" "base/builtin.cpp" "base/builtin.hpp" "base/category-header.hpp" "base/category-source.cpp"- "base/argv.cpp"- "base/builtin.cpp" "base/category-source.hpp" "base/cycle-check.hpp" "base/function.hpp"@@ -23,26 +22,26 @@ "capture-thread/include" ] always_include: [- Bool- Char- Int- Float- String AsBool AsChar- AsInt AsFloat+ AsInt AsString- Formatted+ Bool+ Char Equals+ Float+ Formatted+ Int LessThan ReadPosition+ String ] external: [ Bool Char- Int Float+ Int String ] mode: incremental
example/hello/hello-demo.0rx view
@@ -7,18 +7,18 @@ scoped { TextReader reader <- TextReader$fromBlockReader(SimpleInput$stdin()) } cleanup {- ~ LazyStream<Formatted>$new()+ \ LazyStream<Formatted>$new() .append("Goodbye.\n") .writeTo(SimpleOutput$stderr()) } in while (!reader.pastEnd()) {- ~ LazyStream<Formatted>$new()+ \ LazyStream<Formatted>$new() .append("What is your name? ") .writeTo(SimpleOutput$stderr()) String name <- reader.readNextLine() if (name.readSize() == 0) { break }- ~ LazyStream<Formatted>$new()+ \ LazyStream<Formatted>$new() .append("Hello \"") .append(name) .append("\", if that's your real name.\n")
example/regex/char-regex.0rx view
@@ -2,7 +2,7 @@ parse (pattern) (matcher) { ReadIterator<Char> p <- ReadIterator$$fromReadPosition<Char>(pattern) // TODO: Needs error handling.- { _, matcher } <- parseExpression(p)+ _, matcher <- parseExpression(p) } match (template,data) {@@ -25,22 +25,22 @@ (ReadIterator<Char>,optional ReadSequence<MatcherTemplate<Char>>) parseSequence (p) { if (p.pastForwardEnd()) {- return { p, empty }+ return p, empty }- { ReadIterator<Char> p2, optional MatcherTemplate<Char> matcher } <- parseNonSequence(p)+ ReadIterator<Char> p2, optional MatcherTemplate<Char> matcher <- parseNonSequence(p) if (!p2.pastForwardEnd() && (p2.readCurrent() == '|' || p2.readCurrent() == ')')) { // Requires choice matching or the end of a subexpression. if (present(matcher)) {- return { p2, LinkedNode<MatcherTemplate<Char>>$create(require(matcher),empty) }+ return p2, LinkedNode<MatcherTemplate<Char>>$create(require(matcher),empty) } else { // TODO: Disregards errors from parseNonSequence.- return { p2, LinkedNode<MatcherTemplate<Char>>$create(MatchEmpty$create(),empty) }+ return p2, LinkedNode<MatcherTemplate<Char>>$create(MatchEmpty$create(),empty) } } if (!present(matcher)) {- return { p2, empty }+ return p2, empty } else {- { p2, optional ReadSequence<MatcherTemplate<Char>> sequence } <- parseSequence(p2)- return { p2, LinkedNode<MatcherTemplate<Char>>$create(require(matcher),sequence) }+ p2, optional ReadSequence<MatcherTemplate<Char>> sequence <- parseSequence(p2)+ return p2, LinkedNode<MatcherTemplate<Char>>$create(require(matcher),sequence) } } @@ -56,38 +56,38 @@ return _ } elif (c == '*') { // TODO: Needs error handling.- return { p2.forward(),- MatchBranches<Char>$create(BranchRepeat<Char>$createZeroPlus(require(matcher))) }+ return p2.forward(),+ MatchBranches<Char>$create(BranchRepeat<Char>$createZeroPlus(require(matcher))) } elif (c == '+') { // TODO: Needs error handling.- return { p2.forward(),- MatchBranches<Char>$create(BranchRepeat<Char>$createOnePlus(require(matcher))) }+ return p2.forward(),+ MatchBranches<Char>$create(BranchRepeat<Char>$createOnePlus(require(matcher))) } elif (c == '{') {- { p2, Int min, Int max } <- parseRange(p2.forward())+ p2, Int min, Int max <- parseRange(p2.forward()) if (p2.pastForwardEnd() || p2.readCurrent() != '}') { // TODO: Needs error handling. fail("missing }") }- return { p2.forward(),- MatchBranches<Char>$create(BranchRepeat<Char>$createRange(min,max,require(matcher))) }+ return p2.forward(),+ MatchBranches<Char>$create(BranchRepeat<Char>$createRange(min,max,require(matcher))) } elif (present(matcher)) { return _ } elif (c == '[') {- { p2, matcher } <- parseCharChoices(p2.forward())+ p2, matcher <- parseCharChoices(p2.forward()) if (p2.pastForwardEnd() || p2.readCurrent() != ']') { // TODO: Needs error handling. fail("missing ]") } p2 <- p2.forward() } elif (c == '(') {- { p2, matcher } <- parseExpression(p2.forward())+ p2, matcher <- parseExpression(p2.forward()) if (p2.pastForwardEnd() || p2.readCurrent() != ')') { // TODO: Needs error handling. fail("missing )") } p2 <- p2.forward() } else {- { p2, matcher } <- parseSingleChar(p2)+ p2, matcher <- parseSingleChar(p2) } } }@@ -95,11 +95,11 @@ @type parseRange (ReadIterator<Char>) -> (ReadIterator<Char>,Int,Int) parseRange (p) (p2,min,max) { max <- 0- { p2, min } <- parseCount(p)+ p2, min <- parseCount(p) if (p2.pastForwardEnd() || p2.readCurrent() != ',') { max <- min } else {- { p2, max } <- parseCount(p2.forward())+ p2, max <- parseCount(p2.forward()) } } @@ -126,7 +126,7 @@ optional ReadSequence<MatcherTemplate<Char>> choices <- empty p2 <- p while (!p2.pastForwardEnd()) {- { p2, optional ReadSequence<MatcherTemplate<Char>> sequence } <- parseSequence(p2)+ p2, optional ReadSequence<MatcherTemplate<Char>> sequence <- parseSequence(p2) if (!present(sequence)) { break }
example/regex/regex-demo.0rx view
@@ -4,43 +4,43 @@ define RegexDemo { run () {- ~ testMatch("","",true)- ~ testMatch("","a",false)- ~ testMatch(".","a",true)- ~ testMatch(".","aa",false)- ~ testMatch("a",".",false)- ~ testMatch(".+","",false)- ~ testMatch(".+","a",true)- ~ testMatch(".+","ab",true)- ~ testMatch(".*.","a",true)- ~ testMatch(".*.","ab",true)- ~ testMatch("(ab)*","",true)- ~ testMatch("(ab)*","abab",true)- ~ testMatch("(ab)*","a",false)- ~ testMatch("(ab)*ac","abac",true)- ~ testMatch("(ab)*ac","ac",true)- ~ testMatch("(ab)*ac","aca",false)- ~ testMatch("(ab)*ac","acab",false)- ~ testMatch("(ab)*|ac","abab",true)- ~ testMatch("(ab)*|ac","ac",true)- ~ testMatch("(ab)*|ac","acac",false)- ~ testMatch("(ab)*|ac","abac",false)- ~ testMatch("a{2}","a",false)- ~ testMatch("a{2}","aa",true)- ~ testMatch("a{2}","aaa",false)- ~ testMatch("a{2,3}","a",false)- ~ testMatch("a{2,3}","aa",true)- ~ testMatch("a{2,3}","aaa",true)- ~ testMatch("a{2,3}","aaaa",false)- ~ testMatch("(a+){4}","aaa",false)- ~ testMatch("(a+){4}","aaaa",true)- ~ testMatch("(a+){4}","aaaaa",true)- ~ testMatch("(a+){4}","aaaaaa",true)- ~ testMatch("[a-z?]","q",true)- ~ testMatch("[a-z?]","-",false)- ~ testMatch("[a-z?]","?",true)- ~ testMatch("[a-z?]*","abcde?",true)- ~ testMatch("[a-z?]*","ab-cde",false)+ \ testMatch("","",true)+ \ testMatch("","a",false)+ \ testMatch(".","a",true)+ \ testMatch(".","aa",false)+ \ testMatch("a",".",false)+ \ testMatch(".+","",false)+ \ testMatch(".+","a",true)+ \ testMatch(".+","ab",true)+ \ testMatch(".*.","a",true)+ \ testMatch(".*.","ab",true)+ \ testMatch("(ab)*","",true)+ \ testMatch("(ab)*","abab",true)+ \ testMatch("(ab)*","a",false)+ \ testMatch("(ab)*ac","abac",true)+ \ testMatch("(ab)*ac","ac",true)+ \ testMatch("(ab)*ac","aca",false)+ \ testMatch("(ab)*ac","acab",false)+ \ testMatch("(ab)*|ac","abab",true)+ \ testMatch("(ab)*|ac","ac",true)+ \ testMatch("(ab)*|ac","acac",false)+ \ testMatch("(ab)*|ac","abac",false)+ \ testMatch("a{2}","a",false)+ \ testMatch("a{2}","aa",true)+ \ testMatch("a{2}","aaa",false)+ \ testMatch("a{2,3}","a",false)+ \ testMatch("a{2,3}","aa",true)+ \ testMatch("a{2,3}","aaa",true)+ \ testMatch("a{2,3}","aaaa",false)+ \ testMatch("(a+){4}","aaa",false)+ \ testMatch("(a+){4}","aaaa",true)+ \ testMatch("(a+){4}","aaaaa",true)+ \ testMatch("(a+){4}","aaaaaa",true)+ \ testMatch("[a-z?]","q",true)+ \ testMatch("[a-z?]","-",false)+ \ testMatch("[a-z?]","?",true)+ \ testMatch("[a-z?]*","abcde?",true)+ \ testMatch("[a-z?]*","ab-cde",false) // A few malicious regexes from https://en.wikipedia.org/wiki/ReDoS. //@@ -56,11 +56,11 @@ // a disclaimer about matching accuracy with repeated unbounded patterns // that overlap themselves. - // ~ testMatch("(a+)+","aaaaaaaaaaaaaaaaaaaaaaaa!",false)- // ~ testMatch("(a+)+","aaaaaaaaaaaaaaaaaaaaaaaa!",false)- // ~ testMatch("([a-zA-Z]+)*","aaaaaaaaaaaaaaaaaaaaaaaa!",false)- // ~ testMatch("(.*a){30}","aaaaaaaaaaaaaaaaaaaaaaaa!",false)- ~ testMatch("(a|aa)+","aaaaaaaaaaaaaaaaaaaaaaaa!",false)+ // \ testMatch("(a+)+","aaaaaaaaaaaaaaaaaaaaaaaa!",false)+ // \ testMatch("(a+)+","aaaaaaaaaaaaaaaaaaaaaaaa!",false)+ // \ testMatch("([a-zA-Z]+)*","aaaaaaaaaaaaaaaaaaaaaaaa!",false)+ // \ testMatch("(.*a){30}","aaaaaaaaaaaaaaaaaaaaaaaa!",false)+ \ testMatch("(a|aa)+","aaaaaaaaaaaaaaaaaaaaaaaa!",false) // This causes a ton of branching, but it actually finishes. Given m // unbounded groups in a sequence, the branching is O(n^m). Since n^m@@ -69,14 +69,14 @@ // the m groups will be in separate sequence branches from the beginning, // *adding* O(sqrt(2)^n) branches. This means the overall complexity is // O(n^m)+O(sqrt(2)^n): O(n^m) for smaller n, O(sqrt(2)^n) for larger n.- ~ testMatch("[ab]*[ac]*[ad]*[ae]*[af]*",- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaad",true)+ \ testMatch("[ab]*[ac]*[ad]*[ae]*[af]*",+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaad",true) } @type testMatch (String,String,Bool) -> () testMatch (pattern,data,expected) { MatcherTemplate<Char> template <- require(CharRegex$parse(pattern))- ~ LazyStream<Formatted>$new()+ \ LazyStream<Formatted>$new() .append("Trying: regex=\"") .append(pattern) .append("\" data=\"")
example/regex/regex-test.0rt view
@@ -641,7 +641,7 @@ optional ReadSequence<MatchBrancher<Char>> branches <- empty // First character.- { state, branches } <- brancher.tryBranches('x')+ state, branches <- brancher.tryBranches('x') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -659,7 +659,7 @@ } // Second character.- { state, branches } <- brancher.tryBranches('y')+ state, branches <- brancher.tryBranches('y') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -677,7 +677,7 @@ } // Third character.- { state, branches } <- brancher.tryBranches('x')+ state, branches <- brancher.tryBranches('x') if (!(state `MatchState$equals` MatchState$matchComplete())) { fail(state) }@@ -689,7 +689,7 @@ brancher <- template.newBrancher() // Fourth character.- { state, branches } <- brancher.tryBranches('w')+ state, branches <- brancher.tryBranches('w') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -728,7 +728,7 @@ optional ReadSequence<MatchBrancher<Char>> branches <- empty // First character.- { state, branches } <- brancher.tryBranches('x')+ state, branches <- brancher.tryBranches('x') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -746,7 +746,7 @@ } // Second character.- { state, branches } <- brancher.tryBranches('x')+ state, branches <- brancher.tryBranches('x') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -765,7 +765,7 @@ } // Third character, branch 1.- { state, _ } <- brancher.tryBranches('x')+ state, _ <- brancher.tryBranches('x') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -781,7 +781,7 @@ } // Third character, branch 2.- { state, _ } <- brancher.tryBranches('x')+ state, _ <- brancher.tryBranches('x') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -808,7 +808,7 @@ optional ReadSequence<MatchBrancher<Char>> branches <- empty // First character.- { state, branches } <- brancher.tryBranches('x')+ state, branches <- brancher.tryBranches('x') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -826,7 +826,7 @@ } // Second character.- { state, branches } <- brancher.tryBranches('q')+ state, branches <- brancher.tryBranches('q') if (!(state `MatchState$equals` MatchState$matchFail())) { fail(state) }@@ -865,7 +865,7 @@ optional ReadSequence<MatchBrancher<Char>> branches <- empty // First character.- { state, branches } <- brancher.tryBranches('x')+ state, branches <- brancher.tryBranches('x') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -880,7 +880,7 @@ } // Second character.- { state, branches } <- brancher.tryBranches('a')+ state, branches <- brancher.tryBranches('a') if (!(state `MatchState$equals` MatchState$matchComplete())) { fail(state) }@@ -892,7 +892,7 @@ if (!require(branches).value().matchSatisfied()) { fail("match not satisfied") }- { state, branches } <- require(branches).value().tryBranches('a')+ state, branches <- require(branches).value().tryBranches('a') if (!(state `MatchState$equals` MatchState$matchFail())) { fail(state) }@@ -901,7 +901,7 @@ brancher <- template.newBrancher() // Third character.- { state, branches } <- brancher.tryBranches('y')+ state, branches <- brancher.tryBranches('y') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -933,7 +933,7 @@ optional ReadSequence<MatchBrancher<Char>> branches <- empty // First character.- { state, branches } <- brancher.tryBranches('q')+ state, branches <- brancher.tryBranches('q') if (!(state `MatchState$equals` MatchState$matchFail())) { fail(state) }@@ -942,7 +942,7 @@ } // Should keep failing to match.- { state, branches } <- brancher.tryBranches('x')+ state, branches <- brancher.tryBranches('x') if (!(state `MatchState$equals` MatchState$matchFail())) { fail(state) }@@ -981,7 +981,7 @@ optional ReadSequence<MatchBrancher<Char>> branches <- empty // First character.- { state, branches } <- brancher.tryBranches('b')+ state, branches <- brancher.tryBranches('b') if (!(state `MatchState$equals` MatchState$matchComplete())) { fail(state) }@@ -1023,7 +1023,7 @@ optional ReadSequence<MatchBrancher<Char>> branches <- empty // First character.- { state, branches } <- brancher.tryBranches('b')+ state, branches <- brancher.tryBranches('b') if (!(state `MatchState$equals` MatchState$matchFail())) { fail(state) }@@ -1066,7 +1066,7 @@ optional ReadSequence<MatchBrancher<Char>> branches <- empty // First character.- { state, branches } <- brancher.tryBranches('a')+ state, branches <- brancher.tryBranches('a') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -1084,7 +1084,7 @@ // remaining sequence. // Second character, branch 1.- { state, _ } <- brancher.tryBranches('a')+ state, _ <- brancher.tryBranches('a') if (!(state `MatchState$equals` MatchState$matchContinue())) { fail(state) }@@ -1096,7 +1096,7 @@ } // Second character, branch 2.- { state, _ } <- brancher.tryBranches('a')+ state, _ <- brancher.tryBranches('a') if (!(state `MatchState$equals` MatchState$matchComplete())) { fail(state) }
example/regex/regex.0rx view
@@ -280,14 +280,14 @@ if (state `MatchState$equals` MatchState$matchFail() && lastState `MatchState$equals` MatchState$matchContinue() && canSkip) { // Handle the case where an optional end to the pattern can be skipped.- ~ incrementMatch()- ~ startRepeat()+ \ incrementMatch()+ \ startRepeat() state <- matcher.tryNextMatch(data) } lastState <- state if (state `MatchState$equals` MatchState$matchComplete()) {- ~ incrementMatch()- ~ startRepeat()+ \ incrementMatch()+ \ startRepeat() if (atMax()) { state <- MatchState$matchComplete() } else {@@ -443,7 +443,7 @@ complete <- false scoped { } in while(present(current)) {- { MatchState state2, optional ReadSequence<MatchBrancher<#c>> branches2 } <-+ MatchState state2, optional ReadSequence<MatchBrancher<#c>> branches2 <- require(current).value().tryBranches(data) if (state2 `MatchState$equals` MatchState$matchComplete()) { complete <- true@@ -514,8 +514,8 @@ MatchState$matchContinue() },empty) } // Continue, skipping over the optional suffix.- ~ incrementMatch()- ~ startRepeat()+ \ incrementMatch()+ \ startRepeat() if (atMax()) { // Skipping the branch puts us at the max. return _@@ -528,8 +528,8 @@ } lastState <- state if (state `MatchState$equals` MatchState$matchComplete()) {- ~ incrementMatch()- ~ startRepeat()+ \ incrementMatch()+ \ startRepeat() if (!atMax()) { branch <- LinkedNode<BranchRepeatMatcher<#c>>$create(self,branch) }@@ -619,7 +619,7 @@ tryBranches (data) { if (consumed) {- return { MatchState$matchFail(), empty }+ return MatchState$matchFail(), empty } consumed <- true return recursiveBranch(data,continued,sequence)@@ -640,7 +640,7 @@ sequence2 <- require(sequence2).next() } if (require(continued2).matchSatisfied()) {- { MatchState state2, branch } <- recursiveBranch(data,empty,sequence2)+ MatchState state2, branch <- recursiveBranch(data,empty,sequence2) if (state `MatchState$lessThan` state2) { state <- state2 }
example/tree/tree-demo.0rx view
@@ -11,15 +11,15 @@ TypeKey<Float> keyFloat <- TypeKey<Float>$new() TypeKey<Value> keyValue <- TypeKey<Value>$new() - ~ tree.set<Int>(keyInt,1)- ~ tree.set<String>(keyString,"a")+ \ tree.set<Int>(keyInt,1)+ \ tree.set<String>(keyString,"a") - ~ check<Int>(tree,keyInt)- ~ check<String>(tree,keyString)- ~ check<Float>(tree,keyFloat) // Not found, since we never added a value.+ \ check<Int>(tree,keyInt)+ \ check<String>(tree,keyString)+ \ check<Float>(tree,keyFloat) // Not found, since we never added a value. - ~ tree.set<Value>(keyValue,Value$new())- ~ check<Value>(tree,keyValue)+ \ tree.set<Value>(keyValue,Value$new())+ \ check<Value>(tree,keyValue) } @category check<#x>@@ -29,13 +29,13 @@ scoped { optional #x value <- tree.get<#x>(key) } in if (present(value)) {- ~ LazyStream<Formatted>$new()+ \ LazyStream<Formatted>$new() .append("Found '") .append(require(value)) .append("'\n") .writeTo(SimpleOutput$stderr()) } else {- ~ LazyStream<Formatted>$new()+ \ LazyStream<Formatted>$new() .append(typename<TypeKey<#x>>()) .append(" Not Found\n") .writeTo(SimpleOutput$stderr())
example/tree/tree-test.0rt view
@@ -27,7 +27,7 @@ Int i <- 0 } in while (i < count) { Int new <- ((i + 13) * 3547) % count- ~ tree.set(new,i)+ \ tree.set(new,i) } update { i <- i+1 }@@ -40,14 +40,14 @@ scoped { optional Int value <- tree.get(new) } in if (!present(value)) {- ~ LazyStream<Formatted>$new()+ \ LazyStream<Formatted>$new() .append("Not found ") .append(new) .append(" but should have been ") .append(i) .writeTo(SimpleOutput$error()) } elif (require(value) != i) {- ~ LazyStream<Formatted>$new()+ \ LazyStream<Formatted>$new() .append("Element ") .append(new) .append(" should have been ")@@ -56,7 +56,7 @@ .append(require(value)) .writeTo(SimpleOutput$error()) }- ~ tree.remove(new)+ \ tree.remove(new) } update { i <- i+1 }
example/tree/tree.0rx view
@@ -53,13 +53,13 @@ } Node<#k,#v> node2 <- require(node) if (k `#k$lessThan` node2.getKey()) {- ~ node2.setLower(insert(node2.getLower(),k,v))+ \ node2.setLower(insert(node2.getLower(),k,v)) return rebalance(node2) } elif (node2.getKey() `#k$lessThan` k) {- ~ node2.setHigher(insert(node2.getHigher(),k,v))+ \ node2.setHigher(insert(node2.getHigher(),k,v)) return rebalance(node2) } else {- ~ node2.setValue(v)+ \ node2.setValue(v) return node2 } }@@ -70,10 +70,10 @@ } Node<#k,#v> node2 <- require(node) if (k `#k$lessThan` node2.getKey()) {- ~ node2.setLower(delete(node2.getLower(),k))+ \ node2.setLower(delete(node2.getLower(),k)) return rebalance(node2) } elif (node2.getKey() `#k$lessThan` k) {- ~ node2.setHigher(delete(node2.getHigher(),k))+ \ node2.setHigher(delete(node2.getHigher(),k)) return rebalance(node2) } else { return rebalance(removeNode(node2))@@ -134,7 +134,7 @@ return empty } Node<#k,#v> node2 <- require(node)- ~ node2.updateHeight()+ \ node2.updateHeight() scoped { Int balance <- node2.getBalance() } in if (balance > 1) {@@ -149,55 +149,55 @@ @type pivotHigher (Node<#k,#v>) -> (Node<#k,#v>) pivotHigher (node) (newNode) { if (require(node.getLower()).getBalance() > 0) {- ~ node.setLower(pivotLower(require(node.getLower())))+ \ node.setLower(pivotLower(require(node.getLower()))) } newNode <- require(node.getLower())- ~ node.setLower(newNode.getHigher())- ~ node.updateHeight()- ~ newNode.setHigher(node)- ~ newNode.updateHeight()+ \ node.setLower(newNode.getHigher())+ \ node.updateHeight()+ \ newNode.setHigher(node)+ \ newNode.updateHeight() } @type pivotLower (Node<#k,#v>) -> (Node<#k,#v>) pivotLower (node) (newNode) { if (require(node.getHigher()).getBalance() < 0) {- ~ node.setHigher(pivotHigher(require(node.getHigher())))+ \ node.setHigher(pivotHigher(require(node.getHigher()))) } newNode <- require(node.getHigher())- ~ node.setHigher(newNode.getLower())- ~ node.updateHeight()- ~ newNode.setLower(node)- ~ newNode.updateHeight()+ \ node.setHigher(newNode.getLower())+ \ node.updateHeight()+ \ newNode.setLower(node)+ \ newNode.updateHeight() } @type removeNode (Node<#k,#v>) -> (optional Node<#k,#v>) removeNode (node) (newNode) { if (node.getBalance() < 0) {- { optional Node<#k,#v> temp, newNode } <- removeHighest(node.getLower())- ~ node.setLower(temp)+ optional Node<#k,#v> temp, newNode <- removeHighest(node.getLower())+ \ node.setLower(temp) } else {- { optional Node<#k,#v> temp, newNode } <- removeLowest(node.getHigher())- ~ node.setHigher(temp)+ optional Node<#k,#v> temp, newNode <- removeLowest(node.getHigher())+ \ node.setHigher(temp) } if (present(newNode)) {- ~ swapChildren(node,require(newNode))- ~ require(newNode).updateHeight()+ \ swapChildren(node,require(newNode))+ \ require(newNode).updateHeight() } } @type removeHighest (optional Node<#k,#v>) -> (optional Node<#k,#v>,optional Node<#k,#v>) removeHighest (node) (newNode,removed) { if (!present(node)) {- return { empty, empty }+ return empty, empty } Node<#k,#v> node2 <- require(node) if (present(node2.getHigher())) {- { optional Node<#k,#v> temp, removed } <- removeHighest(node2.getHigher())- ~ node2.setHigher(temp)+ optional Node<#k,#v> temp, removed <- removeHighest(node2.getHigher())+ \ node2.setHigher(temp) newNode <- rebalance(node2) } else { newNode <- node2.getLower()- ~ node2.setLower(empty)+ \ node2.setLower(empty) removed <- node } }@@ -205,16 +205,16 @@ @type removeLowest (optional Node<#k,#v>) -> (optional Node<#k,#v>,optional Node<#k,#v>) removeLowest (node) (newNode,removed) { if (!present(node)) {- return { empty, empty }+ return empty, empty } Node<#k,#v> node2 <- require(node) if (present(node2.getLower())) {- { optional Node<#k,#v> temp, removed } <- removeLowest(node2.getLower())- ~ node2.setLower(temp)+ optional Node<#k,#v> temp, removed <- removeLowest(node2.getLower())+ \ node2.setLower(temp) newNode <- rebalance(node2) } else { newNode <- node2.getHigher()- ~ node2.setHigher(empty)+ \ node2.setHigher(empty) removed <- node } }@@ -223,12 +223,12 @@ swapChildren (l,r) { scoped { optional Node<#k,#v> temp <- l.getLower()- ~ l.setLower(r.getLower())- } in ~ r.setLower(temp)+ \ l.setLower(r.getLower())+ } in \ r.setLower(temp) scoped { optional Node<#k,#v> temp <- l.getHigher()- ~ l.setHigher(r.getHigher())- } in ~ r.setHigher(temp)+ \ l.setHigher(r.getHigher())+ } in \ r.setHigher(temp) } @value getHeight () -> (Int)
example/tree/type-tree.0rx view
@@ -12,12 +12,12 @@ } set (k,v) {- ~ tree.set(k,LockedType$$create<#x>(k,v))+ \ tree.set(k,LockedType$$create<#x>(k,v)) return self } remove (k) {- ~ tree.remove(k)+ \ tree.remove(k) return self }
lib/file/tests.0rt view
@@ -72,7 +72,7 @@ define Test { run () {- ~ RawFileWriter$open("testfile").freeResource()+ \ RawFileWriter$open("testfile").freeResource() RawFileReader reader <- RawFileReader$open("testfile") String data <- reader.readBlock(10)
lib/util/tests.0rt view
@@ -24,7 +24,7 @@ define Test { run () {- ~ LazyStream<Formatted>$new().append("message").writeTo(SimpleOutput$stdout())+ \ LazyStream<Formatted>$new().append("message").writeTo(SimpleOutput$stdout()) } } @@ -41,7 +41,7 @@ define Test { run () {- ~ LazyStream<Formatted>$new().append("message").writeTo(SimpleOutput$stderr())+ \ LazyStream<Formatted>$new().append("message").writeTo(SimpleOutput$stderr()) } } @@ -57,7 +57,7 @@ define Test { run () {- ~ LazyStream<Formatted>$new().append("message").writeTo(SimpleOutput$error())+ \ LazyStream<Formatted>$new().append("message").writeTo(SimpleOutput$error()) } } @@ -136,7 +136,7 @@ fail(count) } String name <- Argv$global().readPosition(0)- ~ LazyStream<Formatted>$new()+ \ LazyStream<Formatted>$new() .append(name) .append("\n") .writeTo(SimpleOutput$stdout())@@ -189,11 +189,11 @@ define Test { run () { TextReader reader <- TextReader$fromBlockReader(FakeFile$create())- ~ checkNext(reader,"this is a partial line")- ~ checkNext(reader,"with some more data")- ~ checkNext(reader,"and")- ~ checkNext(reader,"more lines")- ~ checkNext(reader,"unfinished")+ \ checkNext(reader,"this is a partial line")+ \ checkNext(reader,"with some more data")+ \ checkNext(reader,"and")+ \ checkNext(reader,"more lines")+ \ checkNext(reader,"unfinished") if (!reader.pastEnd()) { fail("not past end") }
lib/util/util.0rx view
@@ -37,7 +37,7 @@ readCurrent () { if (pastForwardEnd() || pastReverseEnd()) {- ~ LazyStream<Formatted>$new()+ \ LazyStream<Formatted>$new() .append("Position ") .append(position) .append(" is out of bounds")@@ -78,16 +78,16 @@ @value recursive (Writer<#x>) -> () recursive (writer) { if (present(next)) {- ~ require(next).recursive(writer)+ \ require(next).recursive(writer) } if (present(value)) {- ~ writer.write(require(value))+ \ writer.write(require(value)) } } writeTo (writer) {- ~ recursive(writer)- ~ writer.flush()+ \ recursive(writer)+ \ writer.flush() } }
src/Compilation/CompileInfo.hs view
@@ -97,7 +97,7 @@ instance Monad CompileInfo where (CompileFail w e) >>= _ = CompileFail w e -- Not the same a. (CompileSuccess w d) >>= f = prependWarning w $ f d- return = CompileSuccess []+ return = pure prependWarning :: [String] -> CompileInfo a -> CompileInfo a prependWarning w (CompileSuccess w2 d) = CompileSuccess (w ++ w2) d
src/CompilerCxx/Category.hs view
@@ -116,15 +116,15 @@ (False,Just [_]) -> return () (True,Nothing) -> return () (True,Just [d]) ->- compileError ("Public category " ++ show (getCategoryName t) +++ compileError ("Category " ++ show (getCategoryName t) ++ formatFullContextBrace (getCategoryContext t) ++ " was declared external but is also defined at " ++ formatFullContext (dcContext d)) (False,Nothing) ->- compileError ("Public category " ++ show (getCategoryName t) +++ compileError ("Category " ++ show (getCategoryName t) ++ formatFullContextBrace (getCategoryContext t) ++ " has not been defined or declared external") (_,Just ds) ->- flip reviseError ("Public category " ++ show (getCategoryName t) +++ flip reviseError ("Category " ++ show (getCategoryName t) ++ formatFullContextBrace (getCategoryContext t) ++ " is defined " ++ show (length ds) ++ " times") $ mergeAllM $ map (\d -> compileError $ "Defined at " ++ formatFullContext (dcContext d)) ds
src/Parser/Common.hs view
@@ -122,7 +122,7 @@ escapeStart = sepAfter (string_ "\\") statementStart :: Parser ()-statementStart = sepAfter (string_ "~")+statementStart = sepAfter (string_ "\\") statementEnd :: Parser () statementEnd = sepAfter (string_ "")
src/Parser/Procedure.hs view
@@ -109,7 +109,8 @@ parseIgnore where parseAssign = labeled "statement" $ do c <- getPosition- as <- multiDest <|> singleDest+ as <- sepBy sourceParser (sepAfter $ string_ ",")+ assignOperator e <- sourceParser statementEnd return $ Assignment [c] (Positional as) e@@ -126,16 +127,6 @@ try kwFail e <- between (sepAfter $ string_ "(") (sepAfter $ string_ ")") sourceParser return $ FailCall [c] e- multiDest = do- as <- try $ between (sepAfter $ string_ "{")- (sepAfter $ string_ "}")- (sepBy sourceParser (sepAfter $ string_ ","))- assignOperator- return as- singleDest = do- a <- try sourceParser- assignOperator- return [a] parseIgnore = do c <- getPosition statementStart@@ -145,19 +136,12 @@ parseReturn = labeled "return" $ do c <- getPosition try kwReturn- multiReturn c <|> singleReturn c <|> emptyReturn c+ emptyReturn c <|> multiReturn c multiReturn :: SourcePos -> Parser (Statement SourcePos) multiReturn c = do- rs <- between (sepAfter $ string_ "{")- (sepAfter $ string_ "}")- (sepBy sourceParser (sepAfter $ string_ ","))+ rs <- sepBy sourceParser (sepAfter $ string_ ",") statementEnd return $ ExplicitReturn [c] (Positional rs)- singleReturn :: SourcePos -> Parser (Statement SourcePos)- singleReturn c = do- r <- sourceParser- statementEnd- return $ ExplicitReturn [c] (Positional [r]) emptyReturn :: SourcePos -> Parser (Statement SourcePos) emptyReturn c = do kwIgnore@@ -238,7 +222,7 @@ kwIn -- TODO: If there's a parse error in an otherwise-valid {} then the actual -- error might look like a multi-assignment issue.- s <- try unconditional <|> sourceParser+ s <- unconditional <|> sourceParser return $ ScopedBlock [c] p cl s justCleanup = do c <- getPosition
src/Test/Procedure.hs view
@@ -44,36 +44,36 @@ checkShortParseFail "return _ var", checkShortParseSuccess "return call()", checkShortParseSuccess "return var.T<#x>$func()",- checkShortParseSuccess "return { var, var.T<#x>$func() }",- checkShortParseFail "return { var var.T<#x>$func() }",- checkShortParseFail "return { var, _ }",+ checkShortParseSuccess "return var, var.T<#x>$func()",+ checkShortParseFail "return var var.T<#x>$func()",+ checkShortParseFail "return var, _", checkShortParseFail "return T<#x> var", checkShortParseSuccess "return T<#x>{ val }",- checkShortParseSuccess "~ T$$func()",- checkShortParseFail "~ T<#x>$$func()",- checkShortParseFail "~ var.T$$func()",- checkShortParseFail "~ T$ $func()",+ checkShortParseSuccess "\\ T$$func()",+ checkShortParseFail "\\ T<#x>$$func()",+ checkShortParseFail "\\ var.T$$func()",+ checkShortParseFail "\\ T$ $func()", checkShortParseSuccess "break", checkShortParseFail "break var", checkShortParseFail "break _", checkShortParseFail "break { }", - checkShortParseSuccess "~ var",- checkShortParseFail "~ var var",- checkShortParseSuccess "~ var.T<#x>$func().func2().func3()",- checkShortParseSuccess "~ T<#x>$func().func2().func3()",- checkShortParseSuccess "~ #x$func().func2().func3()",- checkShortParseFail "~ var.T<#x>.T<#x>$func()",- checkShortParseFail "~ var.T<#x>$T<#x>$func()",- checkShortParseFail "~ T<#x>$func()$func2()",- checkShortParseFail "~ var$func2()",- checkShortParseFail "~ var.T<#x>",- checkShortParseFail "~ T<#x> var",- checkShortParseSuccess "~ T<#x>{ val, var.T<#x>$func() }",- checkShortParseFail "~ T<#x>{ val var.T<#x>$func() }",- checkShortParseFail "~ T<#x>{}.call()",- checkShortParseSuccess "~ (T<#x>{}).call()",+ checkShortParseSuccess "\\ var",+ checkShortParseFail "\\ var var",+ checkShortParseSuccess "\\ var.T<#x>$func().func2().func3()",+ checkShortParseSuccess "\\ T<#x>$func().func2().func3()",+ checkShortParseSuccess "\\ #x$func().func2().func3()",+ checkShortParseFail "\\ var.T<#x>.T<#x>$func()",+ checkShortParseFail "\\ var.T<#x>$T<#x>$func()",+ checkShortParseFail "\\ T<#x>$func()$func2()",+ checkShortParseFail "\\ var$func2()",+ checkShortParseFail "\\ var.T<#x>",+ checkShortParseFail "\\ T<#x> var",+ checkShortParseSuccess "\\ T<#x>{ val, var.T<#x>$func() }",+ checkShortParseFail "\\ T<#x>{ val var.T<#x>$func() }",+ checkShortParseFail "\\ T<#x>{}.call()",+ checkShortParseSuccess "\\ (T<#x>{}).call()", checkShortParseSuccess "x <- var.func()", checkShortParseFail "x <- var.func() var.func()",@@ -99,83 +99,83 @@ checkShortParseFail "T<#x> self <- x", checkShortParseSuccess "T<#x> x <- var.func()", checkShortParseSuccess "weak T<#x> x <- var.func()",- checkShortParseFail "~ T<#x> x <- var.func()",- checkShortParseSuccess "{ _, weak T<#x> x } <- var.func()",- checkShortParseFail "{ _, weak T<#x> x } <- T<#x> x",+ checkShortParseFail "\\ T<#x> x <- var.func()",+ checkShortParseSuccess "_, weak T<#x> x <- var.func()",+ checkShortParseFail "_, weak T<#x> x <- T<#x> x", - checkShortParseSuccess "if (var.func()) { ~ val.call() }",- checkShortParseSuccess "if (present(var)) { ~ val.call() }",- checkShortParseFail "if (T<#x> x) { ~ val.call() }",- checkShortParseSuccess "if (var) { ~ val.call() } else { ~ val.call() }",- checkShortParseFail "if (var) { ~ val.call() } elif { ~ val.call() }",- checkShortParseSuccess "if (v) { ~ c() } elif (v) { ~ c() }",- checkShortParseSuccess "if (v) { ~ c() } elif (v) { ~ c() } else { ~ c() }",- checkShortParseSuccess "if (v) { ~ c() } elif (v) { ~ c() } elif (v) { ~ c() }",+ checkShortParseSuccess "if (var.func()) { \\ val.call() }",+ checkShortParseSuccess "if (present(var)) { \\ val.call() }",+ checkShortParseFail "if (T<#x> x) { \\ val.call() }",+ checkShortParseSuccess "if (var) { \\ val.call() } else { \\ val.call() }",+ checkShortParseFail "if (var) { \\ val.call() } elif { \\ val.call() }",+ checkShortParseSuccess "if (v) { \\ c() } elif (v) { \\ c() }",+ checkShortParseSuccess "if (v) { \\ c() } elif (v) { \\ c() } else { \\ c() }",+ checkShortParseSuccess "if (v) { \\ c() } elif (v) { \\ c() } elif (v) { \\ c() }", - checkShortParseSuccess "while (var.func()) { ~ val.call() }",- checkShortParseSuccess "while (var.func()) { ~ val.call() } update { ~ call() }",+ checkShortParseSuccess "while (var.func()) { \\ val.call() }",+ checkShortParseSuccess "while (var.func()) { \\ val.call() } update { \\ call() }", checkShortParseSuccess "scoped { T<#x> x <- y } in return _",- checkShortParseSuccess "scoped { T<#x> x <- y } in return { var, var.T<#x>$func() }",- checkShortParseSuccess "scoped { T<#x> x <- y } in ~ var.T<#x>$func()",- checkShortParseSuccess "scoped { T<#x> x <- y } in { _, weak T<#x> x } <- var.func()",+ checkShortParseSuccess "scoped { T<#x> x <- y } in return var, var.T<#x>$func()",+ checkShortParseSuccess "scoped { T<#x> x <- y } in \\ var.T<#x>$func()",+ checkShortParseSuccess "scoped { T<#x> x <- y } in _, weak T<#x> x <- var.func()", - checkShortParseSuccess "scoped { T<#x> x <- y } in if (var.func()) { ~ val.call() }",- checkShortParseSuccess "scoped { T<#x> x <- y } in while (var.func()) { ~ val.call() }",+ checkShortParseSuccess "scoped { T<#x> x <- y } in if (var.func()) { \\ val.call() }",+ checkShortParseSuccess "scoped { T<#x> x <- y } in while (var.func()) { \\ val.call() }", checkShortParseSuccess "x <- (((var.func())).T$call())",- checkShortParseSuccess "~ (x <- var).func()",+ checkShortParseSuccess "\\ (x <- var).func()", checkShortParseFail "x <- (((var.func()))", checkShortParseFail "(((x <- var.func())))", checkShortParseFail "(x) <- y", checkShortParseFail "T (x) <- y",- checkShortParseFail "~ (T x <- var).func()",- checkShortParseSuccess "~ call(((var.func())).T$call())",+ checkShortParseFail "\\ (T x <- var).func()",+ checkShortParseSuccess "\\ call(((var.func())).T$call())", checkShortParseSuccess "if (((var.func()).T$call())) { }", checkShortParseSuccess "fail(\"reason\")",- checkShortParseFail "~ fail(\"reason\")",+ checkShortParseFail "\\ fail(\"reason\")", checkShortParseSuccess "failed <- 10", - checkShortParseSuccess "~var.T<#x>$func().func2().func3()",- checkShortParseSuccess "~T<#x>{val,var.T<#x>$func()}",+ checkShortParseSuccess "\\var.T<#x>$func().func2().func3()",+ checkShortParseSuccess "\\T<#x>{val,var.T<#x>$func()}", checkShortParseSuccess "x<-var.func()", checkShortParseSuccess "T<#x>x<-var.func()",- checkShortParseSuccess "{_,weak T<#x>x}<-var.func()",- checkShortParseSuccess "if(v){~c()}elif(v){~c()}",- checkShortParseSuccess "if(v){~c()}elif(v){~c()}else{~c()}",- checkShortParseSuccess "if(v){~c()}elif(v){~c()}elif(v){~c()}",- checkShortParseSuccess "while(var.func()){~val.call()}",- checkShortParseSuccess "scoped{T<#x>x<-y}in~var.T<#x>$func()",+ checkShortParseSuccess "_,weak T<#x>x<-var.func()",+ checkShortParseSuccess "if(v){\\c()}elif(v){\\c()}",+ checkShortParseSuccess "if(v){\\c()}elif(v){\\c()}else{\\c()}",+ checkShortParseSuccess "if(v){\\c()}elif(v){\\c()}elif(v){\\c()}",+ checkShortParseSuccess "while(var.func()){\\val.call()}",+ checkShortParseSuccess "scoped{T<#x>x<-y}in\\var.T<#x>$func()", checkShortParseSuccess "scoped{T<#x>x<-y}in{x<-1}",- checkShortParseSuccess "scoped{T<#x>x<-y}in{x}<-1",+ checkShortParseSuccess "scoped{T<#x>x<-y}in x<-1", checkShortParseFail "scoped{T<#x>x<-y}in{x}", checkShortParseSuccess "x <- !y", checkShortParseSuccess "x <- !y", checkShortParseFail "x <- !!=y", checkShortParseSuccess "x <- (!y).func()",- checkShortParseSuccess "~ !y",+ checkShortParseSuccess "\\ !y", checkShortParseSuccess "if (!y) { }", - checkShortParseSuccess "~ !x + !y",- checkShortParseSuccess "~ !x - !y",- checkShortParseSuccess "~ !x * !y",- checkShortParseSuccess "~ !x / !y",- checkShortParseSuccess "~ !x % !y",- checkShortParseSuccess "~ !x == !y",- checkShortParseSuccess "~ !x != !y",- checkShortParseSuccess "~ !x < !y",- checkShortParseSuccess "~ !x <= !y",- checkShortParseSuccess "~ !x > !y",- checkShortParseSuccess "~ !x >= !y",- checkShortParseSuccess "~ !x && !y",- checkShortParseSuccess "~ !x || !y",+ checkShortParseSuccess "\\ !x + !y",+ checkShortParseSuccess "\\ !x - !y",+ checkShortParseSuccess "\\ !x * !y",+ checkShortParseSuccess "\\ !x / !y",+ checkShortParseSuccess "\\ !x % !y",+ checkShortParseSuccess "\\ !x == !y",+ checkShortParseSuccess "\\ !x != !y",+ checkShortParseSuccess "\\ !x < !y",+ checkShortParseSuccess "\\ !x <= !y",+ checkShortParseSuccess "\\ !x > !y",+ checkShortParseSuccess "\\ !x >= !y",+ checkShortParseSuccess "\\ !x && !y",+ checkShortParseSuccess "\\ !x || !y", checkShortParseSuccess "x <- y + z", checkShortParseSuccess "x <- !y == !z", checkShortParseSuccess "x <- (x + y) / z",- checkShortParseSuccess "~ x <= y",- checkShortParseFail "~ x < <- y",+ checkShortParseSuccess "\\ x <= y",+ checkShortParseFail "\\ x < <- y", checkShortParseSuccess "x <- 123 + 123", checkShortParseSuccess "x <- 123.0 - 123.0",
src/Test/testfiles/procedures.0rx view
@@ -2,7 +2,7 @@ if (T$f()) { // do nothing } elif (#q$r().f()) {- ~ require(v).g()+ \ require(v).g() } elif (zzz) { // sleep }@@ -14,30 +14,30 @@ scoped { optional T myvar <- reduce<#x,#y>(q) } in if (present(myvar)) {- ~ unqualified()+ \ unqualified() } else { // something } scoped { optional T myvar <- reduce<#x,#y>(q)- } in { v, _ } <- x.process(myvar)+ } in v, _ <- x.process(myvar) scoped { // ... } cleanup { x <- y- } in ~ x.process()+ } in \ x.process() - ~ z.call().call()- { x, weak [#k|Type] y, _ } <- z.call()+ \ z.call().call()+ x, weak [#k|Type] y, _ <- z.call() x <- z.T<#z>$call().call() return _ return a- return { a, z.call().call(), c }+ return a, z.call().call(), c while (true) {- ~ failure.to().execute()+ \ failure.to().execute() return x } update { x <- y
tests/builtin-types.0rt view
@@ -651,7 +651,7 @@ define Test { run () {- ~ ("abc").readPosition(-10)+ \ ("abc").readPosition(-10) } } @@ -668,7 +668,7 @@ define Test { run () {- ~ ("abc").readPosition(100)+ \ ("abc").readPosition(100) } } @@ -723,7 +723,7 @@ define Test { run () {- ~ ("abc").subSequence(1,100)+ \ ("abc").subSequence(1,100) } } @@ -793,7 +793,7 @@ define Test { run () {- ~ 9223372036854775808+ \ 9223372036854775808 } } @@ -810,7 +810,7 @@ define Test { run () {- ~ \x10000000000000000+ \ \x10000000000000000 } } @@ -827,7 +827,7 @@ define Test { run () {- ~ -9223372036854775807+ \ -9223372036854775807 } }
tests/failure.0rt view
@@ -72,7 +72,7 @@ define Test { run () {- ~ require(empty)+ \ require(empty) } }
tests/filters.0rt view
@@ -32,7 +32,7 @@ define Test { run () {- ~ Value$$something<Bool>()+ \ Value$$something<Bool>() } }
tests/function-calls.0rt view
@@ -41,7 +41,7 @@ define Test { run () { Value value <- Value$create()- ~ value.Base$call()+ \ value.Base$call() } } @@ -75,7 +75,7 @@ define Test { run () { Value value <- Value$create()- ~ value.Base$call()+ \ value.Base$call() } } @@ -110,7 +110,7 @@ define Test { run () { [Base|Value] value <- Value$create()- ~ value.call()+ \ value.call() } } @@ -144,7 +144,7 @@ define Test { run () { [Base|Value] value <- Value$create()- ~ value.Base$call()+ \ value.Base$call() } } @@ -181,7 +181,7 @@ define Test { run () { [Base1&Base2] value <- Value$create()- ~ value.call()+ \ value.call() } } @@ -218,7 +218,7 @@ define Test { run () { [Base1&Base2] value <- Value$create()- ~ value.Base1$call()+ \ value.Base1$call() } } @@ -255,7 +255,7 @@ define Test { run () { [Base1&Base2] value <- Value$create()- ~ value.Base1$call()+ \ value.Base1$call() } } @@ -285,11 +285,11 @@ #x defines Base () -> () check () {- ~ #x$call()+ \ #x$call() } run () {- ~ check<Value>()+ \ check<Value>() } } @@ -311,7 +311,7 @@ @type check<#x> () -> () check () {- ~ #x$call()+ \ #x$call() } run () {}@@ -349,12 +349,12 @@ #x requires Base (#x) -> () check (value) {- ~ value.call()+ \ value.call() } run () { Value value <- Value$create()- ~ check<Value>(value)+ \ check<Value>(value) } } @@ -376,7 +376,7 @@ @type check<#x> (#x) -> () check (value) {- ~ value.call()+ \ value.call() } run () {}@@ -416,7 +416,7 @@ } run () {- ~ convert(Value$create()).call()+ \ convert(Value$create()).call() } } @@ -471,7 +471,7 @@ define Test { run () {- ~ Call$call<Value<Test>>()+ \ Call$call<Value<Test>>() } }
tests/function-merging.0rt view
@@ -42,7 +42,7 @@ define Test { run () {- ~ Value$create().call().call()+ \ Value$create().call().call() } } @@ -114,7 +114,7 @@ define Test { run () {- ~ Value$create().call().call()+ \ Value$create().call().call() } }
tests/infix-operations.0rt view
@@ -61,7 +61,7 @@ define Test { run () {- ~ \x10 + false+ \ \x10 + false } } @@ -77,7 +77,7 @@ define Test { run () {- ~ \x10 + ""+ \ \x10 + "" } } @@ -247,7 +247,7 @@ define Test { run () {- ~ "x" - "x"+ \ "x" - "x" } } @@ -263,7 +263,7 @@ define Test { run () {- ~ true - false+ \ true - false } } @@ -347,7 +347,7 @@ define Test { run () {- ~ 1 < 2 < 3+ \ 1 < 2 < 3 } }
tests/internal-params.0rt view
@@ -59,7 +59,7 @@ define Test { run () {- ~ Value$something<Bool>()+ \ Value$something<Bool>() } } @@ -86,7 +86,7 @@ define Test { run () {- ~ Value$$something<Bool>()+ \ Value$$something<Bool>() } } @@ -117,7 +117,7 @@ define Test { run () {- ~ Value$create<Type1,Type2>()+ \ Value$create<Type1,Type2>() } } @@ -262,7 +262,7 @@ define Test { run () {- ~ Value$create<Bool>(Type<Bool>$create())+ \ Value$create<Bool>(Type<Bool>$create()) } } @@ -305,7 +305,7 @@ define Test { run () {- ~ Value$create<String>(Type<Bool>$create())+ \ Value$create<String>(Type<Bool>$create()) } }
tests/member-init.0rt view
@@ -41,7 +41,7 @@ @type call () -> () call () {- ~ value+ \ value } run () {}@@ -61,7 +61,7 @@ @value call () -> () call () {- ~ value+ \ value } run () {}@@ -193,7 +193,7 @@ @category Bool value <- Util$doNotUse() run () {- ~ value+ \ value } } @@ -257,7 +257,7 @@ define Test { run () {- ~ Value1$get()+ \ Value1$get() } }
tests/modifed-storage.0rt view
@@ -37,13 +37,13 @@ @value check () -> () check () {- ~ require(self2)+ \ require(self2) } run () { Test value <- create()- ~ value.set()- ~ value.check()+ \ value.set()+ \ value.check() } } @@ -82,8 +82,8 @@ run () { Test value <- create()- ~ value.set()- ~ value.check()+ \ value.set()+ \ value.check() } } @@ -112,7 +112,7 @@ run () { Test value <- create()- ~ value.check()+ \ value.check() } } @@ -175,12 +175,12 @@ @type get () -> (Value,Value) get () { Value value <- Value$create()- return { value, value }+ return value, value } run () { // value1 ensures value2 is present.- { Value value1, weak Value value2 } <- get()+ Value value1, weak Value value2 <- get() if (!present(strong(value2))) { fail("Failed") }@@ -259,7 +259,7 @@ run () { Test value <- create()- ~ require(value).call()+ \ require(value).call() } }
tests/multiple-returns.0rt view
@@ -29,7 +29,7 @@ define Test { @value process (Value) -> () process (value) {- ~ value.get().call()+ \ value.get().call() } run () {}@@ -53,7 +53,7 @@ define Test { @value process (Value) -> () process (value) {- ~ value.get().call()+ \ value.get().call() } run () {}@@ -76,13 +76,13 @@ @value double () -> (Test,Test) double () {- return { self, self }+ return self, self } run () { Test value <- create()- { _, Test value2 } <- value.double()- { value, _ } <- value2.double()+ _, Test value2 <- value.double()+ value, _ <- value2.double() } } @@ -98,7 +98,7 @@ define Test { @type get () -> (Int,Int) get () {- return { 1, 2 }+ return 1, 2 } @type call (Int,Int) -> ()@@ -112,29 +112,8 @@ } run () {- ~ call(get())- }-}--concrete Test {- @type run () -> ()-}---testcase "empty return is not return with assignments" {- error- require "count.+mismatch"-}--define Test {- @type process () -> (Int,Int)- process () (x,y) {- x <- 1- y <- 2- return { }+ \ call(get()) }-- run () {} } concrete Test {
tests/named-returns.0rt view
@@ -42,7 +42,7 @@ define Test { @value process () -> (Bool) process () (value) {- ~ (value <- true) || false+ \ (value <- true) || false } run () {}@@ -61,7 +61,7 @@ define Test { @value process () -> (Bool) process () (value) {- ~ false || (value <- true)+ \ false || (value <- true) } run () {}@@ -79,7 +79,7 @@ define Test { @value process () -> (Int) process () (value) {- ~ (value <- 1) + 2+ \ (value <- 1) + 2 } run () {}@@ -97,7 +97,7 @@ define Test { @value process () -> (Int) process () (value) {- ~ 2 + (value <- 1)+ \ 2 + (value <- 1) } run () {}@@ -158,12 +158,12 @@ define Test { @type get () -> (Int,Int) get () {- return { 1, 2 }+ return 1, 2 } run () { scoped {- { Int x, Int y } <- get()+ Int x, Int y <- get() } in if (x != 1) { fail("Failed") } elif (y != 2) {@@ -202,7 +202,7 @@ run () { scoped {- { _, Int x, Int y } <- get()+ _, Int x, Int y <- get() } in if (x != 1) { fail("Failed") } elif (y != 2) {@@ -230,7 +230,7 @@ run () { scoped {- { Int x, Int y } <- get()+ Int x, Int y <- get() } in if (x != 1) { fail("Failed") } elif (y != 2) {
tests/positional-returns.0rt view
@@ -45,14 +45,14 @@ if (false) { x <- 1 } else {- return { 3, 4 }+ return 3, 4 } y <- 2 } run () { scoped {- { Int x, Int y } <- get()+ Int x, Int y <- get() } in if (x != 3) { fail("Failed") } elif (y != 4) {@@ -73,12 +73,12 @@ define Test { @type get () -> (Int,Int) get () (x,y) {- return { 1, 2 }+ return 1, 2 } run () { scoped {- { Int x, Int y } <- get()+ Int x, Int y <- get() } in if (x != 1) { fail("Failed") } elif (y != 2) {@@ -103,13 +103,13 @@ if (false) { x <- 1 } else {- return { 3, 4 }+ return 3, 4 } } run () { scoped {- { Int x, Int y } <- get()+ Int x, Int y <- get() } in if (x != 3) { fail("Failed") } elif (y != 4) {
tests/reduce.0rt view
@@ -819,7 +819,7 @@ define Test { run () {- ~ reduce<Value<Test>,Formatted>(empty)+ \ reduce<Value<Test>,Formatted>(empty) } }
tests/scoped.0rt view
@@ -71,7 +71,7 @@ process () { scoped { return empty- } in ~ empty+ } in \ empty } run () {}@@ -135,7 +135,7 @@ process () (value) { scoped { value <- empty- } in ~ empty+ } in \ empty } run () {}@@ -201,7 +201,7 @@ Int value <- 1 } cleanup { Int value <- 2- } in ~ empty+ } in \ empty } } @@ -328,7 +328,7 @@ } run () {- ~ get()+ \ get() } } @@ -412,7 +412,7 @@ } cleanup { value2 <- 2 value3 <- 2- } in ~ empty+ } in \ empty if (value1 != 1) { fail(value1) }@@ -461,18 +461,18 @@ } cleanup { value2 <- 3 value3 <- 3- } in return { value1, value2, value3 }+ } in return value1, value2, value3 } get () {- return { value1, value2, value3 }+ return value1, value2, value3 } } define Test { run () { Value value <- Value$create()- { Int value1, Int value2, Int value3 } <- value.call()+ Int value1, Int value2, Int value3 <- value.call() if (value1 != 1) { fail(value1) }@@ -482,7 +482,7 @@ if (value3 != 1) { fail(value3) }- { value1, value2, value3 } <- value.get()+ value1, value2, value3 <- value.get() if (value1 != 2) { fail(value1) }@@ -532,7 +532,7 @@ } in scoped { } cleanup { value <- 1- } in ~ empty+ } in \ empty } } @@ -594,7 +594,7 @@ if (value != 0) { fail(value) }- } in ~ empty+ } in \ empty value <- 1 return _@@ -617,7 +617,7 @@ scoped { Int x <- 1 } in {- ~ x+ \ x } } }
tests/simple.0rt view
@@ -30,7 +30,7 @@ define Test { execute () {- ~ undefined()+ \ undefined() } }
tests/typename.0rt view
@@ -262,7 +262,7 @@ define Test { run () {- ~ typename<Value<Test>>()+ \ typename<Value<Test>>() } }
tests/unreachable.0rt view
@@ -108,7 +108,7 @@ scoped { } cleanup { return 1- } in ~ empty+ } in \ empty return 2 } run () {}@@ -131,7 +131,7 @@ return 1 } cleanup { return 2- } in ~ empty+ } in \ empty } run () {} }
zeolite-lang.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: zeolite-lang-version: 0.2.0.0+version: 0.3.0.0 synopsis: Zeolite is a statically-typed, general-purpose programming language. description: