2019-10-27 17:04:31 +01:00
|
|
|
package w
|
|
|
|
|
|
|
|
import (
|
|
|
|
. "github.com/alecthomas/chroma" // nolint
|
|
|
|
"github.com/alecthomas/chroma/lexers/internal"
|
|
|
|
)
|
|
|
|
|
|
|
|
// WDTE lexer.
|
2021-04-28 18:23:24 +02:00
|
|
|
var WDTE = internal.Register(MustNewLazyLexer(
|
2019-10-27 17:04:31 +01:00
|
|
|
&Config{
|
|
|
|
Name: "WDTE",
|
|
|
|
Filenames: []string{"*.wdte"},
|
|
|
|
},
|
2021-04-28 18:23:24 +02:00
|
|
|
wdteRules,
|
|
|
|
))
|
|
|
|
|
|
|
|
func wdteRules() Rules {
|
|
|
|
return Rules{
|
2019-10-27 17:04:31 +01:00
|
|
|
"root": {
|
|
|
|
{`\n`, Text, nil},
|
|
|
|
{`\s+`, Text, nil},
|
|
|
|
{`\\\n`, Text, nil},
|
|
|
|
{`#(.*?)\n`, CommentSingle, nil},
|
|
|
|
{`-?[0-9]+`, LiteralNumberInteger, nil},
|
|
|
|
{`-?[0-9]*\.[0-9]+`, LiteralNumberFloat, nil},
|
|
|
|
{`"[^"]*"`, LiteralString, nil},
|
|
|
|
{`'[^']*'`, LiteralString, nil},
|
|
|
|
{Words(``, `\b`, `switch`, `default`, `memo`), KeywordReserved, nil},
|
|
|
|
{`{|}|;|->|=>|\(|\)|\[|\]|\.`, Operator, nil},
|
|
|
|
{`[^{};()[\].\s]+`, NameVariable, nil},
|
|
|
|
},
|
2021-04-28 18:23:24 +02:00
|
|
|
}
|
|
|
|
}
|