diff options
author | Zahary Karadjov <zahary@gmail.com> | 2014-03-11 00:59:35 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2014-03-11 00:59:35 +0200 |
commit | 9b5357da5aea54bf9036b98d48ef52da16f7e1a7 (patch) | |
tree | 5976a8ebad464d53d568af862091bfd93a973a00 /tests | |
parent | 71695ab791687302d4fdd7726616c348f1de7be8 (diff) | |
parent | 3270676e77676335446287fcff05aa6a6b9b4919 (diff) | |
download | Nim-9b5357da5aea54bf9036b98d48ef52da16f7e1a7.tar.gz |
Merge branch 'devel' of github.com:Araq/Nimrod into devel
Diffstat (limited to 'tests')
-rw-r--r-- | tests/parser/tstrongspaces.nim | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/parser/tstrongspaces.nim b/tests/parser/tstrongspaces.nim new file mode 100644 index 000000000..91506daf0 --- /dev/null +++ b/tests/parser/tstrongspaces.nim @@ -0,0 +1,52 @@ +#! strongSpaces + +discard """ + output: '''35 +77 +(Field0: 1, Field1: 2, Field2: 2) +ha +true +tester args +all +all args +''' +""" + +echo 2+5 * 5 + +let foo = 77 +echo $foo + +echo (1, 2, 2) + +template `&`(a, b: int): expr = a and b +template `|`(a, b: int): expr = a - b +template `++`(a, b: int): expr = a + b == 8009 + +when true: + let b = 66 + let c = 90 + let bar = 8000 + if foo+4 * 4 == 8 and b&c | 9 ++ + bar: + echo "ho" + else: + echo "ha" + + let booA = foo+4 * 4 - b&c | 9 + + bar + # is parsed as + let booB = ((foo+4)*4) - ((b&c) | 9) + bar + + echo booA == booB + + +template `|`(a, b): expr = (if a.len > 0: a else: b) + +const + tester = "tester" + args = "args" + +echo tester & " " & args|"all" +echo "all" | tester & " " & args +echo "all"|tester & " " & args |