File: d

package info (click to toggle)
dte 1.10-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,152 kB
  • sloc: ansic: 28,421; sh: 94; awk: 56; makefile: 13; sed: 1
file content (211 lines) | stat: -rw-r--r-- 4,278 bytes parent folder | download
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
require c-comment

syntax .d-esc

state start special
    char "abfnrtv'\\\"" END special
    char 0-3 oct1
    char 4-7 oct2
    char x hex0
    char -n "\n" END error
    noeat END

state oct1 special
    char 0-7 oct2
    noeat END

state oct2 special
    char 0-7 END special
    noeat END

state hex0 special
    char 0-9a-fA-F hex1
    noeat END

state hex1 special
    char 0-9a-fA-F hex2
    noeat END

# In strings "\xaff" is an error but "\xafg" is not.
# In chars both are errors.
state hex2 special
    char 0-9a-fA-F END error
    noeat END

syntax .d-string

state string
    char "\"" END string
    char "\n" END error
    char "\\" .d-esc:this
    eat this

syntax .d-char

state char
    char "'\n" END error
    char \\ .d-esc:char-end
    eat char-end

state char-end char
    char "'" END char
    eat END error

syntax .d-line-comment

state comment
    char "\n" END
    char \\ backslash
    eat this

state backslash comment
    # Multi-line comment?
    char "\n" comment
    noeat comment

syntax d

state start code
    char " \t" this
    char -b a-z_ ident-label
    char -b A-Z ident-upper-label
    noeat code

# TODO: Fix up to match the D syntax spec (originally copied from C)
state code code
    char -b a-z_ ident
    char -b A-Z ident-upper
    char 0 zero
    char 1-9 dec
    char . dot
    char \" .d-string:this
    char \' .d-char:this
    char "\n" start
    char ';' semicolon
    str "/*" .c-comment:this
    str "//" .d-line-comment:start
    eat this

state semicolon code
    char " \t" this
    char -b a-zA-Z_ ident-label
    noeat code

state ident-label ident
    char -b a-zA-Z0-9_ this
    char -b : label
    noeat -b ident

state label
    recolor label
    noeat code

state ident
    char -b a-zA-Z0-9_ this
    inlist keyword code
    inlist deprecated-keyword code error
    inlist constant code
    inlist type code
    inlist special-token code
    noeat code

state ident-upper ident
    char -b a-z class-name
    char -b A-Z0-9_ ident
    noeat code

state class-name
    recolor class-name
    char a-zA-Z0-9_ this
    noeat code

state ident-upper-label ident
    char -b a-z class-name-label
    char -b A-Z0-9_ ident-label
    char -b : label
    noeat code

state class-name-label class-name
    char -b a-zA-Z0-9_ this
    char -b : label
    noeat -b class-name

state zero numeric
    char xX hex
    char 0-7 oct
    char . float
    noeat code

state oct numeric
    char 0-7 this
    noeat code

state dec numeric
    char 0-9 this
    char eE exp
    char . float
    noeat code

state hex numeric
    char 0-9a-fA-F this
    noeat code

state dot numeric
    char 0-9 float
    recolor code 1
    noeat code

state float numeric
    char 0-9 this
    char eE exp
    char fFlL float-suffix
    char a-zA-Z0-9_ error-ident
    noeat code

state float-suffix numeric
    char a-zA-Z0-9_ error-ident
    noeat code

state exp numeric
    char +- exp-digit
    char 0-9 exp-digit
    char a-zA-Z0-9_ error-ident
    noeat code

state exp-digit numeric
    char 0-9 this
    char a-zA-Z0-9_ error-ident
    noeat code

state error-ident error
    char a-zA-Z0-9_ this
    noeat code

list keyword \
    abstract alias align asm assert auto body break case cast catch \
    class const continue debug default deprecated do else enum export \
    extern final finally for foreach foreach_reverse goto if immutable \
    import in inout interface invariant is lazy macro mixin module new \
    nothrow out override package pragma private protected public pure \
    ref return scope shared static struct super switch synchronized \
    template this throw try typeid typeof union unittest version while \
    with __FILE__ __FILE_FULL_PATH__ __MODULE__ __LINE__ __FUNCTION__ \
    __PRETTY_FUNCTION__ __gshared __traits __vector __parameters

list deprecated-keyword \
    delete typedef volatile

list constant \
    true false null

list type \
    bool byte ubyte short ushort int uint long ulong char wchar dchar \
    float double real ifloat idouble ireal cfloat cdouble creal void \
    cent ucent size_t ptrdiff_t function delegate
    # TODO: union/enum?

list special-token \
    __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__

default ident class-name
default macro special-token