changeset 116:9bfd87544902

Use arrows from Supplemental Arrows-A Unicode block where appropriate: better readability
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 06 May 2026 10:05:57 +0200
parents e1663ac707b0
children d84f1fd10e64
files docs/algorithm-ford-fulkerson.pseudocode pygments_lexer_pseudocode2/algpseudocode.py tests/test_algpseudo.py
diffstat 3 files changed, 29 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/docs/algorithm-ford-fulkerson.pseudocode	Wed May 06 01:31:41 2026 +0200
+++ b/docs/algorithm-ford-fulkerson.pseudocode	Wed May 06 10:05:57 2026 +0200
@@ -3,7 +3,7 @@
   \INPUTS{Given a network \expr{G = (V, E)} with flow capacity \expr{c}, a source node \expr{s}, and a sink node \expr{t}}
   \OUTPUT{Compute a flow \expr{f} from \expr{s} to \expr{t} of maximum value}
 \IS
-  \TEXT{1. \expr{f(u, v) <- 0} for all edges \expr{(u, v)}
+  \TEXT{1. \expr{f(u, v) \gets 0} for all edges \expr{(u, v)}
 
   2. While there is a path \expr{p} from \expr{s} to \expr{t} in \expr{G_f},
      such that \expr{c_f(u, v) > 0} for all edges \expr{(u, v) ∈ p}:
@@ -12,8 +12,8 @@
 
      2. For each edge \expr{(u, v) ∈ p}
 
-        1. \expr{f(u, v) <- f(u, v) + c_f(p)}   \rem Send flow along the path
+        1. \expr{f(u, v) \gets f(u, v) + c_f(p)}   \rem Send flow along the path
 
-	2. \expr{f(v, u) <- f(v, u) - c_f(p)}   \rem The flow might be "returned" later
+	2. \expr{f(v, u) \gets f(v, u) - c_f(p)}   \rem The flow might be "returned" later
 }
 \END ALGORITHM {Ford–Fulkerson}
--- a/pygments_lexer_pseudocode2/algpseudocode.py	Wed May 06 01:31:41 2026 +0200
+++ b/pygments_lexer_pseudocode2/algpseudocode.py	Wed May 06 10:05:57 2026 +0200
@@ -131,18 +131,23 @@
         "TSTATE": SYMBOL_TEXTSTATEMENT,
         "TEXTBLOCK": SYMBOL_TEXTSTATEMENT,
         "TBLOCK": SYMBOL_TEXTSTATEMENT,
-        "<-": "←",
-        "->": "→",
-        "=>": "⇒",
-        "<=": "≤",
-        ">=": "≥",
-        "<>": "≠",
-        "!=": "≠",
-        ":=": "∶=",  # "≔"   not recognizable
-        "=:": "=∶",  # "≕",  not recognizable
-        "<=>": "⇔",
-        "<->": "↔",
-        "?=": "≟",
+        "<-": "⟵",          # U+27F5: Unicode 3.2 (Supplemental Arrows-A)
+        "->": "⟶",          # U+27F6: Unicode 3.2 (Supplemental Arrows-A)
+        "<->": "⟷",         # U+27F7: Unicode 3.2 (Supplemental Arrows-A)
+        # "=>": "⟹",       # U+27F9: Unicode 3.2 (Supplemental Arrows-A)
+        # "<=>": "⟺",      # U+27FA: Unicode 3.2 (Supplemental Arrows-A)
+        # "<-": "←",        # U+2190: Unicode 1.0 (Arrows)
+        # "->": "→",        # U+2192: Unicode 1.0 (Arrows)
+        # "<->": "↔",       # U+2194: Unicode 1.0 (Arrows)
+        "=>": "⇒",          # U+21D2: Unicode 1.0 (Arrows)
+        "<=>": "⇔",         # U+21D4: Unicode 1.0 (Arrows)
+        "<=": "≤",          # U+2264: Unicode 1.0 (Mathematical Operators)
+        ">=": "≥",          # U+2265: Unicode 1.0 (Mathematical Operators)
+        "<>": "≠",          # U+2260: Unicode 1.0 (Mathematical Operators)
+        "!=": "≠",          # U+2260: Unicode 1.0 (Mathematical Operators)
+        ":=": "∶=",    # "≔" U+2254  not recognizable in my (small) mono font
+        "=:": "=∶",    # "≕" U+2255  not recognizable in my (small) mono font
+        "?=": "≟",          # U+225F: Unicode 1.0 (Mathematical Operators)
     }
 
     def op_translate(toktype):
@@ -504,9 +509,11 @@
     }
 
     def __init__(self, **options):
-        val = pygments.util.get_bool_opt(options, "no_end", default=False)
-        self.no_end = val
-        self.symbol_gets = options.get("gets", "←")
+        self.no_end = pygments.util.get_bool_opt(
+            options, "no_end", default=False)
+        self.symbol_gets = options.get("gets", None)
+        if self.symbol_gets is None:
+            self.symbol_gets = self.SYMBOLS["<-"]   # Default: "⟵"  # U+27F5
         LexBase.__init__(self, **options)
 
 
--- a/tests/test_algpseudo.py	Wed May 06 01:31:41 2026 +0200
+++ b/tests/test_algpseudo.py	Wed May 06 10:05:57 2026 +0200
@@ -751,11 +751,11 @@
         self.assertTokenStreamEqualComplete(
             [("Operator", u"⇔"),
              ("Text", " "),
-             ("Operator", u"↔"),
+             ("Operator", u"⟷"),
              ("Text", " "),
-             ("Operator", u"←"),
+             ("Operator", u"⟵"),
              ("Text", " "),
-             ("Operator", u"→"),
+             ("Operator", u"⟶"),
              ("Text", " "),
              ("Operator", u"⇒"),
              ("Text", " "),
@@ -879,7 +879,7 @@
         self.assertTokenStreamEqualComplete(
             [("Name.Entity", "a"),
              ("Text", " "),
-             ("Operator", "←"),
+             ("Operator", "⟵"),     # U+27F5 (Supplemental Arrows-A)
              ("Text", " "),
              ("Number.Integer", "2"),
              ("Text.Whitespace", "\n"),