Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison pygments_lexer_pseudocode2/fr_pseudocode.py @ 36:9004ff039497
Simplify op_replace in fr_pseudocode.py: use dict.get() more intelligently
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 22 Apr 2026 16:25:40 +0200 |
| parents | de1f67eff9d5 |
| children | c02d59f04133 |
comparison
equal
deleted
inserted
replaced
| 35:d9a3551a1038 | 36:9004ff039497 |
|---|---|
| 47 '^': '↑', | 47 '^': '↑', |
| 48 } | 48 } |
| 49 | 49 |
| 50 def op_replace(lexer, match): | 50 def op_replace(lexer, match): |
| 51 op = match.group(0) | 51 op = match.group(0) |
| 52 opr = lexer.REPLACEMENTS.get(op) | 52 opr = lexer.REPLACEMENTS.get(op, op) |
| 53 if opr is None: | 53 yield match.start(), Operator, opr |
| 54 yield match.start(), Operator, op | |
| 55 else: | |
| 56 yield match.start(), Operator, opr | |
| 57 | 54 |
| 58 def scomment(lexer, match): | 55 def scomment(lexer, match): |
| 59 s = match.group(1).lower().strip() | 56 s = match.group(1).lower().strip() |
| 60 c = Comment | 57 c = Comment |
| 61 | 58 |
