forked from negbie/sipparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
machine.go
193 lines (154 loc) · 2.31 KB
/
machine.go
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
//line machine.rl:1
package sipparser
import (
"strings"
)
// ragel -G2 -Z machine.rl
//line machine.go:13
const metric_start int = 2
const metric_first_final int = 2
const metric_error int = 0
const metric_en_main int = 2
//line machine.rl:12
func extractParam(param, data string) (s string) {
if numPos := strings.Index(data, param); numPos >= 0 {
numPos += len(param)
data = data[numPos:]
} else {
return s
}
cs, p, pe, eof := 0, 0, len(data), len(data)
mark := 0
//line machine.go:36
{
cs = metric_start
}
//line machine.go:41
{
if p == pe {
goto _test_eof
}
switch cs {
case 2:
goto st_case_2
case 3:
goto st_case_3
case 4:
goto st_case_4
case 0:
goto st_case_0
case 1:
goto st_case_1
}
goto st_out
st_case_2:
switch data[p] {
case 13:
goto tr3
case 32:
goto tr3
case 34:
goto tr4
case 59:
goto tr3
}
if 9 <= data[p] && data[p] <= 10 {
goto tr3
}
goto tr2
tr2:
//line machine.rl:26
mark = p
goto st3
st3:
if p++; p == pe {
goto _test_eof3
}
st_case_3:
//line machine.go:85
switch data[p] {
case 13:
goto tr6
case 32:
goto tr6
case 34:
goto tr7
case 59:
goto tr6
}
if 9 <= data[p] && data[p] <= 10 {
goto tr6
}
goto st3
tr0:
//line machine.rl:37
return s
goto st4
tr3:
//line machine.rl:26
mark = p
//line machine.rl:30
s = data[mark:p]
//line machine.rl:37
return s
goto st4
tr6:
//line machine.rl:30
s = data[mark:p]
//line machine.rl:37
return s
goto st4
st4:
if p++; p == pe {
goto _test_eof4
}
st_case_4:
//line machine.go:129
goto st0
st_case_0:
st0:
cs = 0
goto _out
tr4:
//line machine.rl:26
mark = p
//line machine.rl:30
s = data[mark:p]
goto st1
tr7:
//line machine.rl:30
s = data[mark:p]
goto st1
st1:
if p++; p == pe {
goto _test_eof1
}
st_case_1:
//line machine.go:156
if data[p] == 44 {
goto tr0
}
goto st0
st_out:
_test_eof3: cs = 3; goto _test_eof
_test_eof4: cs = 4; goto _test_eof
_test_eof1: cs = 1; goto _test_eof
_test_eof: {}
if p == eof {
switch cs {
case 3:
//line machine.rl:30
s = data[mark:p]
case 2:
//line machine.rl:26
mark = p
//line machine.rl:30
s = data[mark:p]
//line machine.go:183
}
}
_out: {}
}
//line machine.rl:41
return s
}