diff options
author | Chloe Brown <chloe.brown.00@outlook.com> | 2025-03-25 16:52:43 +0000 |
---|---|---|
committer | Chloe Brown <chloe.brown.00@outlook.com> | 2025-03-25 16:52:43 +0000 |
commit | a2afd4b08dc2b7eada2f95ee95457457a3331344 (patch) | |
tree | 671b8530d7e8934efad4d91f7575ae01833c6bfe /lexer.py |
Before the big rewrite
Diffstat (limited to 'lexer.py')
-rw-r--r-- | lexer.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lexer.py b/lexer.py new file mode 100644 index 0000000..52080b0 --- /dev/null +++ b/lexer.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +from pygments.lexers.ml import OcamlLexer +from pygments.token import Name, Keyword +from pathlib import Path + +class SystemTLexer(OcamlLexer): + name = 'System T' + aliases = ['syst'] + filenames = ['*.syst'] # just to have one if you whant to use + + EXTRA_KEYWORDS = ['primrec', 'prl', 'prr', 'fold'] + + def get_tokens_unprocessed(self, text): + for index, token, value in OcamlLexer.get_tokens_unprocessed(self, text): + if token is Name and value in self.EXTRA_KEYWORDS: + yield index, Keyword, value + else: + yield index, token, value |