Skip to content

Commit

Permalink
LESv3: Tweaked the precedence of -> and <-. Increase version to 2…
Browse files Browse the repository at this point in the history
….6.2.
  • Loading branch information
qwertie committed Oct 1, 2017
1 parent 8734346 commit 8739fd7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Core/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
// from linking together without an exact match - and now that I'm no longer using
// '.*' I am still having occasional problems with 'MissingMethodException' in the
// Visual Studio SFG, but I don't know why, maybe it's not about version numbers..)
[assembly: AssemblyVersion("2.6.1.0")]
[assembly: AssemblyFileVersion("2.6.1.0")]
[assembly: AssemblyVersion("2.6.2.0")]
[assembly: AssemblyFileVersion("2.6.2.0")]
2 changes: 1 addition & 1 deletion Core/Loyc.Syntax/LES/LesPrecedence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public static class LesPrecedence
public static readonly Precedence Compare = new Precedence(40); // == != > < >= <=
public static readonly Precedence AndBits = new Precedence(35, 35, 30, 40); // &
public static readonly Precedence OrBits = new Precedence(30, 30, 30, 40); // | ^
public static readonly Precedence Arrow = new Precedence(25, 25, 15, 40); // -> <-
public static readonly Precedence Arrow = new Precedence(26, 25); // -> <-
public static readonly Precedence And = new Precedence(20); // &&
public static readonly Precedence Or = new Precedence(15); // ||
public static readonly Precedence IfElse = new Precedence(10, 2, 2, 2); // ? : a 'is (b ? (c 'is d)), a ? (b 'is (c : d))
Expand Down
11 changes: 5 additions & 6 deletions Core/Tests/Syntax/Les3ParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ public void MiscibilityErrors()
Test(Mode.Expr, 0, "a & b | c;", F.Call(S.OrBits, F.Call(S.AndBits, a, b), c));
Test(Mode.Expr, 1, "x & Foo == 0;", F.Call(S.AndBits, x, F.Call(S.Eq, Foo, zero)));
Test(Mode.Expr, 1, "0 == x & Foo;", F.Call(S.AndBits, F.Call(S.Eq, zero, x), Foo));
Test(Mode.Expr, 1, "x >> a + 1;", F.Call(S.Add, F.Call(S.Shr, x, a), one));
Test(Mode.Expr, 1, "1 + x << a;", F.Call(S.Add, one, F.Call(S.Shl, x, a)));
Test(Mode.Expr, 1, "a MOD b * c", F.Call("'MOD", a, F.Call(S.Mul, b, c)));
Test(Mode.Expr, 1, "a MOD b - c", F.Call(S.Sub, F.Call("'MOD", a, b), c));
Test(Mode.Expr, 1, "a + b MOD c", F.Call(S.Add, a, F.Call("'MOD", b, c)));
Test(Mode.Expr, 1, "a -> b == c", F.Call(S._RightArrow, a, F.Call(S.Eq, b, c)));
Test(Mode.Expr, 1, "x >> a + 1;", F.Call(S.Add, F.Call(S.Shr, x, a), one));
Test(Mode.Expr, 1, "1 + x << a;", F.Call(S.Add, one, F.Call(S.Shl, x, a)));
Test(Mode.Expr, 1, "a MOD b * c", F.Call("'MOD", a, F.Call(S.Mul, b, c)));
Test(Mode.Expr, 1, "a MOD b - c", F.Call(S.Sub, F.Call("'MOD", a, b), c));
Test(Mode.Expr, 1, "a + b MOD c", F.Call(S.Add, a, F.Call("'MOD", b, c)));
}

[Test]
Expand Down
3 changes: 3 additions & 0 deletions Core/Tests/Syntax/Les3PrinterAndParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ public void BinaryOps()
Exact("a.b?.c(x)", F.Call(S.NullDot, F.Dot(a, b), F.Call(c, x)));
Exact(@"a!.b**2", F.Call(S.Exp, F.Call((Symbol)"'!.", a, b), two));
Exact("a.b::x.c", F.Dot(F.Call(S.ColonColon, F.Dot(a, b), x), c));
Exact("a <- b <- c", F.Call(S.LeftArrow, a, F.Call(S.LeftArrow, b, c)));
Exact("a -> a * b", F.Call(S._RightArrow, a, F.Call(S.Mul, a, b)));
Exact("c && a <- b > 1", F.Call(S.And, c, F.Call(S.LeftArrow, a, F.Call(S.GT, b, one))));

// Custom ops
Exact("a |-| b + c", F.Call("'|-|", a, F.Call(S.Add, b, c)));
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: 2.6.1.{build}
version: 2.6.2.{build}

before_build:
- nuget restore Loyc-Slim.sln

build_script:
# First, set some environment variables.
# SEMVER is set manually. Not sure how this can be automated.
- set SEMVER=26.1.0
- set SEMVER=26.2.0
- echo %APPVEYOR_REPO_TAG%
# Build packages as SEMVER-ci{build}
- ps: if ($env:APPVEYOR_REPO_TAG -eq $True) { $env:PKG_VERSION = $env:SEMVER; } else { $env:PKG_VERSION = "$($env:SEMVER)-ci$($env:APPVEYOR_BUILD_NUMBER)"; }
Expand Down

0 comments on commit 8739fd7

Please sign in to comment.