comparison pygments_lexer_pseudocode2/algpseudocode.py @ 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
comparison
equal deleted inserted replaced
115:e1663ac707b0 116:9bfd87544902
129 "TEXTSTATE": SYMBOL_TEXTSTATEMENT, 129 "TEXTSTATE": SYMBOL_TEXTSTATEMENT,
130 "TSTATEMENT": SYMBOL_TEXTSTATEMENT, 130 "TSTATEMENT": SYMBOL_TEXTSTATEMENT,
131 "TSTATE": SYMBOL_TEXTSTATEMENT, 131 "TSTATE": SYMBOL_TEXTSTATEMENT,
132 "TEXTBLOCK": SYMBOL_TEXTSTATEMENT, 132 "TEXTBLOCK": SYMBOL_TEXTSTATEMENT,
133 "TBLOCK": SYMBOL_TEXTSTATEMENT, 133 "TBLOCK": SYMBOL_TEXTSTATEMENT,
134 "<-": "←", 134 "<-": "⟵", # U+27F5: Unicode 3.2 (Supplemental Arrows-A)
135 "->": "→", 135 "->": "⟶", # U+27F6: Unicode 3.2 (Supplemental Arrows-A)
136 "=>": "⇒", 136 "<->": "⟷", # U+27F7: Unicode 3.2 (Supplemental Arrows-A)
137 "<=": "≤", 137 # "=>": "⟹", # U+27F9: Unicode 3.2 (Supplemental Arrows-A)
138 ">=": "≥", 138 # "<=>": "⟺", # U+27FA: Unicode 3.2 (Supplemental Arrows-A)
139 "<>": "≠", 139 # "<-": "←", # U+2190: Unicode 1.0 (Arrows)
140 "!=": "≠", 140 # "->": "→", # U+2192: Unicode 1.0 (Arrows)
141 ":=": "∶=", # "≔" not recognizable 141 # "<->": "↔", # U+2194: Unicode 1.0 (Arrows)
142 "=:": "=∶", # "≕", not recognizable 142 "=>": "⇒", # U+21D2: Unicode 1.0 (Arrows)
143 "<=>": "⇔", 143 "<=>": "⇔", # U+21D4: Unicode 1.0 (Arrows)
144 "<->": "↔", 144 "<=": "≤", # U+2264: Unicode 1.0 (Mathematical Operators)
145 "?=": "≟", 145 ">=": "≥", # U+2265: Unicode 1.0 (Mathematical Operators)
146 "<>": "≠", # U+2260: Unicode 1.0 (Mathematical Operators)
147 "!=": "≠", # U+2260: Unicode 1.0 (Mathematical Operators)
148 ":=": "∶=", # "≔" U+2254 not recognizable in my (small) mono font
149 "=:": "=∶", # "≕" U+2255 not recognizable in my (small) mono font
150 "?=": "≟", # U+225F: Unicode 1.0 (Mathematical Operators)
146 } 151 }
147 152
148 def op_translate(toktype): 153 def op_translate(toktype):
149 154
150 def _op_translate(lexer, match, ctx=None): 155 def _op_translate(lexer, match, ctx=None):
502 op_explicit_tokentype), 507 op_explicit_tokentype),
503 ], 508 ],
504 } 509 }
505 510
506 def __init__(self, **options): 511 def __init__(self, **options):
507 val = pygments.util.get_bool_opt(options, "no_end", default=False) 512 self.no_end = pygments.util.get_bool_opt(
508 self.no_end = val 513 options, "no_end", default=False)
509 self.symbol_gets = options.get("gets", "←") 514 self.symbol_gets = options.get("gets", None)
515 if self.symbol_gets is None:
516 self.symbol_gets = self.SYMBOLS["<-"] # Default: "⟵" # U+27F5
510 LexBase.__init__(self, **options) 517 LexBase.__init__(self, **options)
511 518
512 519
513 class AlgPseudocodeLexer_DE(AlgPseudocodeLexer): 520 class AlgPseudocodeLexer_DE(AlgPseudocodeLexer):
514 521