From 8739fd7ca4e716cc7f9f39496c6a053aeedf4dc8 Mon Sep 17 00:00:00 2001 From: David Piepgrass Date: Sun, 1 Oct 2017 12:55:25 +0800 Subject: [PATCH] LESv3: Tweaked the precedence of `->` and `<-`. Increase version to 2.6.2. --- Core/AssemblyVersion.cs | 4 ++-- Core/Loyc.Syntax/LES/LesPrecedence.cs | 2 +- Core/Tests/Syntax/Les3ParserTests.cs | 11 +++++------ Core/Tests/Syntax/Les3PrinterAndParserTests.cs | 3 +++ appveyor.yml | 4 ++-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Core/AssemblyVersion.cs b/Core/AssemblyVersion.cs index c61ff5b02..c58b5c75f 100644 --- a/Core/AssemblyVersion.cs +++ b/Core/AssemblyVersion.cs @@ -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")] diff --git a/Core/Loyc.Syntax/LES/LesPrecedence.cs b/Core/Loyc.Syntax/LES/LesPrecedence.cs index 48c86d934..f033a2a2a 100644 --- a/Core/Loyc.Syntax/LES/LesPrecedence.cs +++ b/Core/Loyc.Syntax/LES/LesPrecedence.cs @@ -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)) diff --git a/Core/Tests/Syntax/Les3ParserTests.cs b/Core/Tests/Syntax/Les3ParserTests.cs index 98bb495f9..d92d6b73a 100644 --- a/Core/Tests/Syntax/Les3ParserTests.cs +++ b/Core/Tests/Syntax/Les3ParserTests.cs @@ -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] diff --git a/Core/Tests/Syntax/Les3PrinterAndParserTests.cs b/Core/Tests/Syntax/Les3PrinterAndParserTests.cs index 59691919f..04734d96c 100644 --- a/Core/Tests/Syntax/Les3PrinterAndParserTests.cs +++ b/Core/Tests/Syntax/Les3PrinterAndParserTests.cs @@ -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))); diff --git a/appveyor.yml b/appveyor.yml index 9414d4968..fe8c78fc4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.6.1.{build} +version: 2.6.2.{build} before_build: - nuget restore Loyc-Slim.sln @@ -6,7 +6,7 @@ before_build: 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)"; }