Added syntax highlighter
parent
c857bb68e8
commit
8dfa078c0f
|
@ -1,5 +1,5 @@
|
||||||
from pygments.lexer import RegexLexer
|
from pygments.lexer import RegexLexer, bygroups
|
||||||
from pygments.token import Whitespace, Comment, Keyword, Operator, Number, Name, String, Generic
|
from pygments.token import *
|
||||||
|
|
||||||
class VSLLexer(RegexLexer):
|
class VSLLexer(RegexLexer):
|
||||||
name = "VSL"
|
name = "VSL"
|
||||||
|
@ -9,12 +9,15 @@ class VSLLexer(RegexLexer):
|
||||||
tokens = {
|
tokens = {
|
||||||
"root": [
|
"root": [
|
||||||
(r"[\ \t\v\r\n]+", Whitespace),
|
(r"[\ \t\v\r\n]+", Whitespace),
|
||||||
(r"\/\/[^\n]+", Comment),
|
(r"\/\/[^\n]+", Comment.Single),
|
||||||
(r"func|print|return|continue|if|then|else|while|do|begin|end|var", Keyword),
|
(r"var", Keyword.Declaration),
|
||||||
|
(r"func|print|return|continue|if|then|else|while|do|begin|end", Keyword),
|
||||||
(r"\^|\||:|=|\+|-|\*|\/|<|>|&", Operator),
|
(r"\^|\||:|=|\+|-|\*|\/|<|>|&", Operator),
|
||||||
(r"[0-9]+", Number.Integer),
|
(r"[0-9]+", Number.Integer),
|
||||||
(r"[A-Za-z_][0-9A-Za-z_]*", Name),
|
(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"\"([^\"\n]|\\\")*\"", String),
|
||||||
(r".", Generic),
|
(r".", Text),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue