File: go

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 (199 lines) | stat: -rw-r--r-- 3,592 bytes parent folder | download | duplicates (2)
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
syntax .go-esc

state special
    char 0-3 oct1
    # >255 byte value
    char 4-7 END error
    char x 2left
    char u 4left
    char U 8left
    noeat short

state oct1 special
    char 0-7 oct2
    noeat short

state oct2 special
    char 0-7 END special
    noeat short

state 8left special
    char 0-9a-fA-F 7left
    noeat short

state 7left special
    char 0-9a-fA-F 6left
    noeat short

state 6left special
    char 0-9a-fA-F 5left
    noeat short

state 5left special
    char 0-9a-fA-F 4left
    noeat short

state 4left special
    char 0-9a-fA-F 3left
    noeat short

state 3left special
    char 0-9a-fA-F 2left
    noeat short

state 2left special
    char 0-9a-fA-F 1left
    noeat short

state 1left special
    char 0-9a-fA-F END special
    noeat short

state short special
    char "\x80-\xff" not-ascii
    # Any ASCII character but \n
    char -n "\n" END error
    # Don't eat \n
    noeat END

# Eats (at least) one multibyte UTF-8 character
state not-ascii error
    char "\x80-\xff" this
    noeat END

syntax go

state go code
    char -b A-Z exported
    char -b a-z_ ident
    char 0 zero
    char 1-9 dec
    char . dot
    char "\"" string
    char "'" char
    char ` raw-string
    str "//" cpp-comment
    str "/*" c-comment
    eat this

state exported
    char -b a-zA-Z0-9_ this
    noeat go

state ident
    char -b a-zA-Z0-9_ this
    inlist keyword go
    inlist type go
    inlist constant go
    inlist builtin go
    noeat go

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

state oct numeric
    char 0-7 this
    noeat check-suffix

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

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

state check-suffix error
    char a-zA-Z0-9_ this
    noeat go

state check-imag code
    char i check-suffix numeric
    noeat check-suffix

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

state float numeric
    char 0-9 this
    char eE exp
    noeat check-imag

state exp numeric
    char +- exp-digit
    char 0-9 exp-digit
    noeat check-imag

state exp-digit numeric
    char 0-9 this
    noeat check-imag

state string
    char "\"" go string
    char "\n" go
    char "\\" string-esc
    eat this

state string-esc special
    # \' is illegal inside string literal
    char "abfnrtv\"\\" string special
    noeat .go-esc:string

state char
    char "'" go error
    char "\\" char-esc
    char "\n" go
    # Assume multiple non-ASCII bytes are one UTF-8 character
    char "\x80-\xff" not-ascii
    eat char-end

state char-esc special
    # \" is illegal inside character literal
    char "abfnrtv'\\" char-end special
    noeat .go-esc:char-end

state not-ascii char
    char "\x80-\xff" this
    noeat char-end

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

state raw-string string
    char ` go string
    eat this

state cpp-comment comment
    char "\n" go
    eat this

state c-comment comment
    str "*/" go comment
    eat this

list keyword \
    break case chan const continue default defer else fallthrough \
    for func go goto if import interface map package range return \
    select struct switch type var

list constant \
    false true iota nil

list builtin \
    append cap close complex delete copy imag len \
    make new panic print println real recover

list type \
    bool byte complex64 complex128 float32 float64 \
    int8 int16 int32 int64 string uint8 uint16 uint32 uint64 \
    int uint uintptr error rune

default ident exported