Mercurial > yakumo_izuru > aya
comparison vendor/github.com/alecthomas/chroma/v2/lexers/cql.go @ 66:787b5ee0289d draft
Use vendored modules
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
author | yakumo.izuru |
---|---|
date | Sun, 23 Jul 2023 13:18:53 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
65:6d985efa0f7a | 66:787b5ee0289d |
---|---|
1 package lexers | |
2 | |
3 import ( | |
4 . "github.com/alecthomas/chroma/v2" // nolint | |
5 ) | |
6 | |
7 // CassandraCQL lexer. | |
8 var CassandraCQL = Register(MustNewLexer( | |
9 &Config{ | |
10 Name: "Cassandra CQL", | |
11 Aliases: []string{"cassandra", "cql"}, | |
12 Filenames: []string{"*.cql"}, | |
13 MimeTypes: []string{"text/x-cql"}, | |
14 NotMultiline: true, | |
15 CaseInsensitive: true, | |
16 }, | |
17 cassandraCQLRules, | |
18 )) | |
19 | |
20 func cassandraCQLRules() Rules { | |
21 return Rules{ | |
22 "root": { | |
23 {`\s+`, TextWhitespace, nil}, | |
24 {`(--|\/\/).*\n?`, CommentSingle, nil}, | |
25 {`/\*`, CommentMultiline, Push("multiline-comments")}, | |
26 {`(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}, | |
27 {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}, | |
28 {"[+*/<>=~!@#%^&|`?-]+", Operator, nil}, | |
29 { | |
30 `(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)`, | |
31 UsingByGroup(1, 6, | |
32 NameBuiltin, TextWhitespace, Keyword, TextWhitespace, | |
33 LiteralStringHeredoc, LiteralStringHeredoc, LiteralStringHeredoc), | |
34 nil, | |
35 }, | |
36 {`(true|false|null)\b`, KeywordConstant, nil}, | |
37 {`0x[0-9a-f]+`, LiteralNumberHex, nil}, | |
38 {`[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`, LiteralNumberHex, nil}, | |
39 {`\.[0-9]+(e[+-]?[0-9]+)?`, Error, nil}, | |
40 {`-?[0-9]+(\.[0-9])?(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil}, | |
41 {`[0-9]+`, LiteralNumberInteger, nil}, | |
42 {`'`, LiteralStringSingle, Push("string")}, | |
43 {`"`, LiteralStringName, Push("quoted-ident")}, | |
44 {`\$\$`, LiteralStringHeredoc, Push("dollar-string")}, | |
45 {`[a-z_]\w*`, Name, nil}, | |
46 {`:(['"]?)[a-z]\w*\b\1`, NameVariable, nil}, | |
47 {`[;:()\[\]\{\},.]`, Punctuation, nil}, | |
48 }, | |
49 "multiline-comments": { | |
50 {`/\*`, CommentMultiline, Push("multiline-comments")}, | |
51 {`\*/`, CommentMultiline, Pop(1)}, | |
52 {`[^/*]+`, CommentMultiline, nil}, | |
53 {`[/*]`, CommentMultiline, nil}, | |
54 }, | |
55 "string": { | |
56 {`[^']+`, LiteralStringSingle, nil}, | |
57 {`''`, LiteralStringSingle, nil}, | |
58 {`'`, LiteralStringSingle, Pop(1)}, | |
59 }, | |
60 "quoted-ident": { | |
61 {`[^"]+`, LiteralStringName, nil}, | |
62 {`""`, LiteralStringName, nil}, | |
63 {`"`, LiteralStringName, Pop(1)}, | |
64 }, | |
65 "dollar-string": { | |
66 {`[^\$]+`, LiteralStringHeredoc, nil}, | |
67 {`\$\$`, LiteralStringHeredoc, Pop(1)}, | |
68 }, | |
69 } | |
70 } |