Added pygments lexer

main
Øyvind Skaaden 2022-03-18 19:47:18 +01:00
parent fab7d8916e
commit a92ee8c187
1 changed files with 20 additions and 0 deletions

20
exercises/vsl.py Normal file
View File

@ -0,0 +1,20 @@
from pygments.lexer import RegexLexer
from pygments.token import Whitespace, Comment, Keyword, Operator, Number, Name, String, Generic
class VSLLexer(RegexLexer):
name = "VSL"
aliases = ["vsl"]
filenames = ["*.vsl"]
tokens = {
"root": [
(r"[\ \t\v\r\n]+", Whitespace),
(r"\/\/[^\n]+", Comment),
(r"func|print|return|continue|if|then|else|while|do|begin|end|var", Keyword),
(r"\^|\||:|=|\+|-|\*|\/|<|>|&", Operator),
(r"[0-9]+", Number.Integer),
(r"[A-Za-z_][0-9A-Za-z_]*", Name),
(r"\"([^\"\n]|\\\")*\"", String),
(r".", Generic),
]
}