TDT4205/exercises/vsl.py

21 lines
682 B
Python

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),
]
}