mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-04 08:17:24 -05:00
86e2789960
* update github.com/PuerkitoBio/goquery * update github.com/alecthomas/chroma * update github.com/blevesearch/bleve/v2 * update github.com/caddyserver/certmagic * update github.com/go-enry/go-enry/v2 * update github.com/go-git/go-billy/v5 * update github.com/go-git/go-git/v5 * update github.com/go-redis/redis/v8 * update github.com/go-testfixtures/testfixtures/v3 * update github.com/jaytaylor/html2text * update github.com/json-iterator/go * update github.com/klauspost/compress * update github.com/markbates/goth * update github.com/mattn/go-isatty * update github.com/mholt/archiver/v3 * update github.com/microcosm-cc/bluemonday * update github.com/minio/minio-go/v7 * update github.com/prometheus/client_golang * update github.com/unrolled/render * update github.com/xanzy/go-gitlab * update github.com/yuin/goldmark * update github.com/yuin/goldmark-highlighting Co-authored-by: techknowlogick <techknowlogick@gitea.io>
75 lines
3.4 KiB
Go
Vendored
75 lines
3.4 KiB
Go
Vendored
package c
|
|
|
|
import (
|
|
. "github.com/alecthomas/chroma" // nolint
|
|
"github.com/alecthomas/chroma/lexers/internal"
|
|
)
|
|
|
|
// CassandraCQL lexer.
|
|
var CassandraCQL = internal.Register(MustNewLazyLexer(
|
|
&Config{
|
|
Name: "Cassandra CQL",
|
|
Aliases: []string{"cassandra", "cql"},
|
|
Filenames: []string{"*.cql"},
|
|
MimeTypes: []string{"text/x-cql"},
|
|
NotMultiline: true,
|
|
CaseInsensitive: true,
|
|
},
|
|
cassandraCQLRules,
|
|
))
|
|
|
|
func cassandraCQLRules() Rules {
|
|
return Rules{
|
|
"root": {
|
|
{`\s+`, TextWhitespace, nil},
|
|
{`(--|\/\/).*\n?`, CommentSingle, nil},
|
|
{`/\*`, CommentMultiline, Push("multiline-comments")},
|
|
{`(ascii|bigint|blob|boolean|counter|date|decimal|double|float|frozen|inet|int|list|map|set|smallint|text|time|timestamp|timeuuid|tinyint|tuple|uuid|varchar|varint)\b`, NameBuiltin, nil},
|
|
{Words(``, `\b`, `ADD`, `AGGREGATE`, `ALL`, `ALLOW`, `ALTER`, `AND`, `ANY`, `APPLY`, `AS`, `ASC`, `AUTHORIZE`, `BATCH`, `BEGIN`, `BY`, `CLUSTERING`, `COLUMNFAMILY`, `COMPACT`, `CONSISTENCY`, `COUNT`, `CREATE`, `CUSTOM`, `DELETE`, `DESC`, `DISTINCT`, `DROP`, `EACH_QUORUM`, `ENTRIES`, `EXISTS`, `FILTERING`, `FROM`, `FULL`, `GRANT`, `IF`, `IN`, `INDEX`, `INFINITY`, `INSERT`, `INTO`, `KEY`, `KEYS`, `KEYSPACE`, `KEYSPACES`, `LEVEL`, `LIMIT`, `LOCAL_ONE`, `LOCAL_QUORUM`, `MATERIALIZED`, `MODIFY`, `NAN`, `NORECURSIVE`, `NOSUPERUSER`, `NOT`, `OF`, `ON`, `ONE`, `ORDER`, `PARTITION`, `PASSWORD`, `PER`, `PERMISSION`, `PERMISSIONS`, `PRIMARY`, `QUORUM`, `RENAME`, `REVOKE`, `SCHEMA`, `SELECT`, `STATIC`, `STORAGE`, `SUPERUSER`, `TABLE`, `THREE`, `TO`, `TOKEN`, `TRUNCATE`, `TTL`, `TWO`, `TYPE`, `UNLOGGED`, `UPDATE`, `USE`, `USER`, `USERS`, `USING`, `VALUES`, `VIEW`, `WHERE`, `WITH`, `WRITETIME`, `REPLICATION`, `OR`, `REPLACE`, `FUNCTION`, `CALLED`, `INPUT`, `RETURNS`, `LANGUAGE`, `ROLE`, `ROLES`, `TRIGGER`, `DURABLE_WRITES`, `LOGIN`, `OPTIONS`, `LOGGED`, `SFUNC`, `STYPE`, `FINALFUNC`, `INITCOND`, `IS`, `CONTAINS`, `JSON`, `PAGING`, `OFF`), Keyword, nil},
|
|
{"[+*/<>=~!@#%^&|`?-]+", Operator, nil},
|
|
{
|
|
`(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)`,
|
|
UsingByGroup(
|
|
internal.Get,
|
|
1, 6,
|
|
NameBuiltin, TextWhitespace, Keyword, TextWhitespace,
|
|
LiteralStringHeredoc, LiteralStringHeredoc, LiteralStringHeredoc,
|
|
),
|
|
nil,
|
|
},
|
|
{`(true|false|null)\b`, KeywordConstant, nil},
|
|
{`0x[0-9a-f]+`, LiteralNumberHex, nil},
|
|
{`[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`, LiteralNumberHex, nil},
|
|
{`\.[0-9]+(e[+-]?[0-9]+)?`, Error, nil},
|
|
{`-?[0-9]+(\.[0-9])?(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil},
|
|
{`[0-9]+`, LiteralNumberInteger, nil},
|
|
{`'`, LiteralStringSingle, Push("string")},
|
|
{`"`, LiteralStringName, Push("quoted-ident")},
|
|
{`\$\$`, LiteralStringHeredoc, Push("dollar-string")},
|
|
{`[a-z_]\w*`, Name, nil},
|
|
{`:(['"]?)[a-z]\w*\b\1`, NameVariable, nil},
|
|
{`[;:()\[\]\{\},.]`, Punctuation, nil},
|
|
},
|
|
"multiline-comments": {
|
|
{`/\*`, CommentMultiline, Push("multiline-comments")},
|
|
{`\*/`, CommentMultiline, Pop(1)},
|
|
{`[^/*]+`, CommentMultiline, nil},
|
|
{`[/*]`, CommentMultiline, nil},
|
|
},
|
|
"string": {
|
|
{`[^']+`, LiteralStringSingle, nil},
|
|
{`''`, LiteralStringSingle, nil},
|
|
{`'`, LiteralStringSingle, Pop(1)},
|
|
},
|
|
"quoted-ident": {
|
|
{`[^"]+`, LiteralStringName, nil},
|
|
{`""`, LiteralStringName, nil},
|
|
{`"`, LiteralStringName, Pop(1)},
|
|
},
|
|
"dollar-string": {
|
|
{`[^\$]+`, LiteralStringHeredoc, nil},
|
|
{`\$\$`, LiteralStringHeredoc, Pop(1)},
|
|
},
|
|
}
|
|
}
|