From ee8de8cf2fa46e47ee86b738ea7a071ed79bd432 Mon Sep 17 00:00:00 2001 From: Evan Hubinger Date: Fri, 16 Feb 2018 13:43:10 -0800 Subject: [PATCH] Swap unicode multiplication operators Resolves #393. --- DOCS.md | 6 +++--- coconut/compiler/grammar.py | 4 ++-- tests/src/cocotest/agnostic/main.coco | 2 +- tests/src/cocotest/agnostic/specific.coco | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DOCS.md b/DOCS.md index f8dea296b..71532c1bd 100644 --- a/DOCS.md +++ b/DOCS.md @@ -557,7 +557,7 @@ Coconut supports Unicode alternatives to many different operator symbols. The Un *↦ (*\u21a6) => "|*>" ↤ (\u21a4) => "<|" ↤* (\u21a4*) => "<*|" -⋅ (\u22c5) => "*" +× (\xd7) => "*" ↑ (\u2191) => "**" ÷ (\xf7) => "/" ÷/ (\xf7/) => "//" @@ -578,7 +578,7 @@ Coconut supports Unicode alternatives to many different operator symbols. The Un « (\xab) => "<<" » (\xbb) => ">>" … (\u2026) => "..." -× (\xd7) => "@" (only matrix multiplication) +⋅ (\u22c5) => "@" (only matrix multiplication) ``` ## Keywords @@ -974,7 +974,7 @@ def (arguments) -> statement; statement; ... ``` where `arguments` can be standard function arguments or [pattern-matching function definition](#pattern-matching-functions) arguments and `statement` can be an assignment statement or a keyword statement. If the last `statement` (not followed by a semicolon) is an `expression`, it will automatically be returned. -Statement lambdas also support implicit lambda syntax, where when the arguments are omitted, as in `def -> _`, `def (_=None) -> _` is assumed. +Statement lambdas also support implicit lambda syntax, where, as in `def -> _`, when the arguments are omitted, `def (_=None) -> _` is assumed. ##### Example diff --git a/coconut/compiler/grammar.py b/coconut/compiler/grammar.py index f7a2c07ae..aeadfb1b4 100644 --- a/coconut/compiler/grammar.py +++ b/coconut/compiler/grammar.py @@ -785,13 +785,13 @@ class Grammar(object): ge = Literal(">=") | fixto(Literal("\u2265"), ">=") ne = Literal("!=") | fixto(Literal("\xac=") | Literal("\u2260"), "!=") - mul_star = star | fixto(Literal("\u22c5"), "*") + mul_star = star | fixto(Literal("\xd7"), "*") exp_dubstar = dubstar | fixto(Literal("\u2191"), "**") neg_minus = minus | fixto(Literal("\u207b"), "-") sub_minus = minus | fixto(Literal("\u2212"), "-") div_slash = slash | fixto(Literal("\xf7") + ~slash, "/") div_dubslash = dubslash | fixto(Combine(Literal("\xf7") + slash), "//") - matrix_at_ref = at | fixto(Literal("\xd7"), "@") + matrix_at_ref = at | fixto(Literal("\u22c5"), "@") matrix_at = Forward() test = Forward() diff --git a/tests/src/cocotest/agnostic/main.coco b/tests/src/cocotest/agnostic/main.coco index c434f836b..3905164b6 100644 --- a/tests/src/cocotest/agnostic/main.coco +++ b/tests/src/cocotest/agnostic/main.coco @@ -501,6 +501,6 @@ def main(*args): assert target_sys_test() print(".", end="") # ........ - from . import tutorial + from . import tutorial # NOQA print("\n") diff --git a/tests/src/cocotest/agnostic/specific.coco b/tests/src/cocotest/agnostic/specific.coco index db8bb03c5..2f4199ceb 100644 --- a/tests/src/cocotest/agnostic/specific.coco +++ b/tests/src/cocotest/agnostic/specific.coco @@ -1,6 +1,6 @@ from io import StringIO # type: ignore -from .util import mod +from .util import mod # NOQA def non_py26_test(): """Tests for any non-py26 version."""