-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnyToString.sublime-syntax
More file actions
124 lines (102 loc) · 4.2 KB
/
AnyToString.sublime-syntax
File metadata and controls
124 lines (102 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
%YAML 1.2
---
name: AnyToString
first_line_match: (?i)^((JSON|HSON)(:))|(DumpValue from .*\(.*\))$
scope: source.anytostring
#ADDME: Some stuff within this context file is copied from HareScript.sublime-syntax. It would be cleaner if we can just
# include specific contexts of another syntax file, without having to support the other syntax completely.
# HareScript variables (copied from HareScript.sublime-syntax)
variables:
attributes: (CONSTANT|DEINITMACRO|DEPRECATED|EXECUTESHARESCRIPT|EXTERNAL|INTERNALPROTECTED|ISCOUNT|NOSTATEMODIFY|READONLY|SKIPTRACE|SPECIAL|TERMINATES|VARARG)
controls: (AWAIT|BREAK|CASE|CATCH|CONTINUE|ELSE|FINALLY|FOR|FOREVERY|IF|GOTO|RETURN|SWITCH|THROW|TRY|WHILE|YIELD)
keywords: (DELETE|FUNCTION|INSERT|MACRO|SELECT|ALL|AS|ASC|AT|BY|CELL|COLUMN|CLASSTYPE|CROSS|DEFAULTSTO|DESC|DISTINCT|END|EXCEPT|EXPORT|EXTEND|EXTENDSFROM|FALSE|FROM|FULL|GROUP|HAVING|INDEX|INNER|INTERSECT|INTO|JOIN|KEY|LIMIT|MEMBER|NEW|NULL|NVL|OFFSET|ONLY|ORDER|OUTER|PROPERTY|SET|TEMPORARY|TRUE|UNIQUE|USING|VALUES|VAR|VARTYPE|WHERE)
operators: (AND|BITAND|BITLSHIFT|BITNEG|BITOR|BITRSHIFT|BITXOR|CONCAT|IN|LIKE|NOT|OR|TYPEID|XOR)
types: (ARRAY|BLOB|BOOLEAN|DATETIME|FIXEDPOINT|FLOAT|FUNCTION PTR|INTEGER|INTEGER64|MACRO PTR|MONEY|OBJECT|OBJECTTYPE|RECORD|REF|SCHEMA|STRING|TABLE|VARIANT|WEAKOBJECT)
modifiers: (AGGREGATE|ASYNC|CONSTANT|DEFAULT|PRIVATE|PTR|PUBLIC|STATIC|UPDATE|__ATTRIBUTES__)
contexts:
main:
- match: (?i)^(JSON|HSON)(:)$
captures:
1: support.type.anytostring
2: punctuation.anytostring
push: anytostring
- match: (?i)^DumpValue from .*\(.*\)$
push: test_anytostring
# Check if this is a "boxed" value
test_anytostring:
- match: ^\+-.*
push: anytostring_boxed
- match: .
push: anytostring
anytostring_boxed:
- match: ^[^+].*
scope: identifier.cell.anytostring
- match: ^\+-.*
set: anytostring
anytostring:
# A DumpValue is followed by an empty line, so we're done
- match: ^$
pop: true
# Record (Array)
- match: (?i)^\s*(\+)(RECORD\b( ARRAY)?)(?!:)
captures:
1: punctuation.anytostring
2: storage.type.anytostring
scope: meta.type.anytostring
# Record Cell
- match: ^\s*(\+)([^:]+)(:)
captures:
1: punctuation.anytostring
2: identifier.cell.anytostring
3: punctuation.anytostring
scope: meta.cell.anytostring
# HareScript types
- match: (?i)\b{{types}}\b
scope: storage.type.harescript
# HareScript keywords
- match: (?i)\b{{keywords}}\b
scope: keyword.harescript
# HareScript storage modifier
- match: (?i)\b{{modifiers}}\b
scope: storage.modifier.harescript
# AnyToString storage modifier
- match: (?i)\b(EMPTY)\b
scope: storage.modifier.anytostring
# String constants (copied from HareScript.sublime-syntax)
- match: \"
captures:
0: punctuation.definition.string.begin
push: dqstring
- match: \'
captures:
0: punctuation.definition.string.begin
push: sqstring
# DATETIME constants
- match: \b(\d+-\d{2}-\d{2})\ (\(\d+\))\ (\d{2}:\d{2}:\d{2}\.\d{3})\b
scope: meta.datetime.anytostring
# BLOB lengths
- match: \ \(\d+\ bytes\)
scope: comment.blob.anytostring
# Decimal (integer, money and float), hexadecimal and binary numeric constants (copied from HareScript.sublime-syntax)
- match: \b(\d*\.)?\d+(i(64)?|m|f|e[+-]?[0-9]*)?\b|\b0x\h+\b|\b0b(0|1)+\b
scope: constant.numeric.harescript
# Double-quoted string constant (copied from HareScript.sublime-syntax)
dqstring:
- meta_content_scope: string.quoted.double.harescript
- include: escapes
- match: \"
captures:
0: punctuation.definition.string.end
pop: true
# Single-quoted string constant (copied from HareScript.sublime-syntax)
sqstring:
- meta_content_scope: string.quoted.single.harescript
- include: escapes
- match: \'
captures:
0: punctuation.definition.string.end
pop: true
# Escape characters within strings (copied from HareScript.sublime-syntax)
escapes:
- match: \\[abfnrt\'\"\\]|\\[0-7]{3}|\\x\h{2}|\\u\h{4}
scope: constant.character.escape.harescript