changeset 8:5812e7f3bc13

Rename the project the implementing class to "pygments-lexer-pseudocode2". This is to not to clash with the original package.
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 19 Apr 2026 18:15:56 +0200
parents 4189849f2715
children 74b95ceeda5f
files README.md pygments_lexer_pseudocode/__init__.py pygments_lexer_pseudocode2/__init__.py pyproject.toml
diffstat 4 files changed, 98 insertions(+), 98 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Sun Apr 19 18:04:38 2026 +0200
+++ b/README.md	Sun Apr 19 18:15:56 2026 +0200
@@ -6,11 +6,11 @@
 
 The lexer is available as a Pip package:
 
-    pip install pygments-lexer-pseudocode
+    pip install pygments-lexer-pseudocode2
 
 Alternatively, to install from the git repository: (you may need to sudo depending on your Python environment)
 
-    python setup.py install
+    python -m build
 
 ## Usage
 
--- a/pygments_lexer_pseudocode/__init__.py	Sun Apr 19 18:04:38 2026 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-import re
-
-from pygments.lexer import RegexLexer, include, bygroups, using, this
-from pygments.token import Error, Punctuation, Text, Comment, Operator, Keyword, Name, String, Number
-
-
-class PseudocodeLexer(RegexLexer):
-    '''
-    A Pseudo code (fr) lexer
-    '''
-    name = 'Pseudocode'
-    aliases = ['pseudocode', 'pseudo', 'algorithm', 'algo']
-    filenames = ['*.algo', '*.pseudocode']
-    mimetypes = []
-    flags = re.IGNORECASE
-
-    def op_replace(lexer, match):
-        op = match.group(0)
-        
-        S = ('<=', '>=', '<>', '<-', '^')
-        R = ('≤',  '≥',  '≠',  '←',  '↑')
-
-        if op in S:
-            op = R[S.index(op)]
-
-        yield match.start(), Operator, op
-
-    def scomment(lexer, match):
-        s = match.group(1).lower().strip()
-        c = Comment
-
-        directives = ['passage par copie', 'passage par valeur', 'passage par référence', 'passage par reference', 'passage par adresse', 've', 'vs', 've/s']
-
-        if s in directives:
-            c = Comment.Special
-        
-        yield match.start(), c, match.group(0)
-     
-    tokens = {
-        'root': [
-                 (r'\/\*.*\*\/', Comment),
-                 (r'(\/\/|#).*\n', Comment),
-                 (r'\|', Comment),
-                 (r'\{(.*)\}', scomment),
-                 include('strings'),
-                 include('core'),
-                 (r'[a-zéàùçèÉÀÙÇÈ][a-z0-9éàùçèÉÀÙÇÈ_]*', Name.Variable),
-                 include('nums'),
-                 (r'[\s]+', Text)
-        ],
-        'core':[ # Statements
-                 (r'\b(debut|début|fin|si|alors|sinon|fin[_ ]si|tant[ _]que|tantque|fin[ _]tantque|faire|répéter'
-                  r'repeter|type|structure|fin[ _]structure|fonction|procédure|procedure|retourner|renvoyer|'
-                  r'pour|fin[ _]pour|à|déclarations?|juqsque|spécialise|specialise|comporte|super|public|privé|protégé|'
-                  r'classe'
-                  r')\s*\b', Keyword),
-
-                 # Data Types
-                 (r'\b(entiers?|chaines?|chaînes?|réels?|reels?|caractères?|caracteres?|booléens?|'
-                  r'booleens?|tableaux?|rien)\s*\b', 
-                  Keyword.Type),
-
-                  (r'\b(vrai|faux|nil)\s*\b',
-                   Name.Constant),
-                  
-                 # Operators
-                 (r'(<=|>=|<>|<-|\^|\*|\+|-|\/|<|>|=|\\\\|mod|←|↑|≤|≥|≠|÷|×|\.\.|\[|\]|\.|non|xou|et|ou)',
-                  op_replace),
-                  
-                 (r'(\(|\)|\,|\;|:)',
-                  Punctuation),
-                  
-                 #(r'\b(\[(VE|VS|VE/S)\])\s*\b',
-                 # Keyword.Declaration),
-
-                  # Intrinsics
-                 (r'\b(sqrt|pow|cos|sin|tan|arccos|arcsin|arctan|arctan2|lire|ecrire|écrire|'
-                  r'exp|ln|log|détruire|detruire'
-                  r')\s*\b', Name.Builtin)
-                ],
-
-        'strings': [
-                 (r'"([^"])*"', String.Double),
-                 (r"'([^'])*'", String.Single),
-                ],
-
-        'nums': [
-                 (r'\d+(?![.Ee])', Number.Integer),
-                 (r'[+-]?\d*\.\d+([eE][-+]?\d+)?', Number.Float),
-                 (r'[+-]?\d+\.\d*([eE][-+]?\d+)?', Number.Float)
-                ],
-        }
-        
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pygments_lexer_pseudocode2/__init__.py	Sun Apr 19 18:15:56 2026 +0200
@@ -0,0 +1,93 @@
+import re
+
+from pygments.lexer import RegexLexer, include, bygroups, using, this
+from pygments.token import Error, Punctuation, Text, Comment, Operator, Keyword, Name, String, Number
+
+
+class PseudocodeLexer2(RegexLexer):
+    '''
+    A Pseudo code (fr) lexer
+    '''
+    name = 'Pseudocode'
+    aliases = ['pseudocode', 'pseudo', 'algorithm', 'algo']
+    filenames = ['*.algo', '*.pseudocode']
+    mimetypes = []
+    flags = re.IGNORECASE
+
+    def op_replace(lexer, match):
+        op = match.group(0)
+        
+        S = ('<=', '>=', '<>', '<-', '^')
+        R = ('≤',  '≥',  '≠',  '←',  '↑')
+
+        if op in S:
+            op = R[S.index(op)]
+
+        yield match.start(), Operator, op
+
+    def scomment(lexer, match):
+        s = match.group(1).lower().strip()
+        c = Comment
+
+        directives = ['passage par copie', 'passage par valeur', 'passage par référence', 'passage par reference', 'passage par adresse', 've', 'vs', 've/s']
+
+        if s in directives:
+            c = Comment.Special
+        
+        yield match.start(), c, match.group(0)
+     
+    tokens = {
+        'root': [
+                 (r'\/\*.*\*\/', Comment),
+                 (r'(\/\/|#).*\n', Comment),
+                 (r'\|', Comment),
+                 (r'\{(.*)\}', scomment),
+                 include('strings'),
+                 include('core'),
+                 (r'[a-zéàùçèÉÀÙÇÈ][a-z0-9éàùçèÉÀÙÇÈ_]*', Name.Variable),
+                 include('nums'),
+                 (r'[\s]+', Text)
+        ],
+        'core':[ # Statements
+                 (r'\b(debut|début|fin|si|alors|sinon|fin[_ ]si|tant[ _]que|tantque|fin[ _]tantque|faire|répéter'
+                  r'repeter|type|structure|fin[ _]structure|fonction|procédure|procedure|retourner|renvoyer|'
+                  r'pour|fin[ _]pour|à|déclarations?|juqsque|spécialise|specialise|comporte|super|public|privé|protégé|'
+                  r'classe'
+                  r')\s*\b', Keyword),
+
+                 # Data Types
+                 (r'\b(entiers?|chaines?|chaînes?|réels?|reels?|caractères?|caracteres?|booléens?|'
+                  r'booleens?|tableaux?|rien)\s*\b', 
+                  Keyword.Type),
+
+                  (r'\b(vrai|faux|nil)\s*\b',
+                   Name.Constant),
+                  
+                 # Operators
+                 (r'(<=|>=|<>|<-|\^|\*|\+|-|\/|<|>|=|\\\\|mod|←|↑|≤|≥|≠|÷|×|\.\.|\[|\]|\.|non|xou|et|ou)',
+                  op_replace),
+                  
+                 (r'(\(|\)|\,|\;|:)',
+                  Punctuation),
+                  
+                 #(r'\b(\[(VE|VS|VE/S)\])\s*\b',
+                 # Keyword.Declaration),
+
+                  # Intrinsics
+                 (r'\b(sqrt|pow|cos|sin|tan|arccos|arcsin|arctan|arctan2|lire|ecrire|écrire|'
+                  r'exp|ln|log|détruire|detruire'
+                  r')\s*\b', Name.Builtin)
+                ],
+
+        'strings': [
+                 (r'"([^"])*"', String.Double),
+                 (r"'([^'])*'", String.Single),
+                ],
+
+        'nums': [
+                 (r'\d+(?![.Ee])', Number.Integer),
+                 (r'[+-]?\d*\.\d+([eE][-+]?\d+)?', Number.Float),
+                 (r'[+-]?\d+\.\d*([eE][-+]?\d+)?', Number.Float)
+                ],
+        }
+        
--- a/pyproject.toml	Sun Apr 19 18:04:38 2026 +0200
+++ b/pyproject.toml	Sun Apr 19 18:15:56 2026 +0200
@@ -3,7 +3,7 @@
 build-backend = "setuptools.build_meta"
 
 [project]
-name = "pygments-lexer-pseudocode"
+name = "pygments-lexer-pseudocode2"
 version = "2.0.1"
 description = "Pygments Lexer for a french pseudocode"
 license = { file = "LICENSES/MIT.txt" }
@@ -28,11 +28,11 @@
 homepage = "https://github.com/svvac/pseudocode-pygments-lexer"
 
 [project.entry-points.'pygments.lexers']
-pseudocodelexer = "pygments_lexer_pseudocode:PseudocodeLexer"
+pseudocodelexer2 = "pygments_lexer_pseudocode2:PseudocodeLexer2"
 
 [tool.setuptools]
 packages = [
-    "pygments_lexer_pseudocode",
+    "pygments_lexer_pseudocode2",
 ]
 platforms = ["any"]
 zip-safe = true