diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-10-25 00:47:47 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-10-25 00:47:47 +0200 |
| commit | c6cc0108ca7738023b45e0eeac0fa2390532dd93 (patch) | |
| tree | 36890e6cd3091bbab8efbe686cc56f467f645bfd /vendor/github.com/alecthomas/chroma/v2/lexers/cql.go | |
| parent | 0130404a1dc663d4aa68d780c9bcb23a4243e68d (diff) | |
| download | jbmafp-c6cc0108ca7738023b45e0eeac0fa2390532dd93.tar.gz | |
Diffstat (limited to 'vendor/github.com/alecthomas/chroma/v2/lexers/cql.go')
| -rw-r--r-- | vendor/github.com/alecthomas/chroma/v2/lexers/cql.go | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/vendor/github.com/alecthomas/chroma/v2/lexers/cql.go b/vendor/github.com/alecthomas/chroma/v2/lexers/cql.go new file mode 100644 index 0000000..32f7a28 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/v2/lexers/cql.go | |||
| @@ -0,0 +1,70 @@ | |||
| 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 | } | ||
