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