in libbeat/reader/syslog/rfc5424_gen.go [40:670]
func parseRFC5424(data string) (message, error) {
var errs error
var p, cs, tok int
pe := len(data)
eof := len(data)
m := message{
priority: -1,
}
{
cs = rfc5424_start
}
{
if p == pe {
goto _test_eof
}
switch cs {
case 1:
goto st_case_1
case 0:
goto st_case_0
case 2:
goto st_case_2
case 3:
goto st_case_3
case 4:
goto st_case_4
case 5:
goto st_case_5
case 6:
goto st_case_6
case 7:
goto st_case_7
case 8:
goto st_case_8
case 9:
goto st_case_9
case 10:
goto st_case_10
case 11:
goto st_case_11
case 12:
goto st_case_12
case 13:
goto st_case_13
case 14:
goto st_case_14
case 15:
goto st_case_15
case 16:
goto st_case_16
case 24:
goto st_case_24
case 25:
goto st_case_25
case 26:
goto st_case_26
case 17:
goto st_case_17
case 18:
goto st_case_18
case 19:
goto st_case_19
case 27:
goto st_case_27
case 20:
goto st_case_20
case 21:
goto st_case_21
case 22:
goto st_case_22
case 23:
goto st_case_23
}
goto st_out
st_case_1:
if data[p] == 60 {
goto st2
}
goto tr0
tr0:
errs = multierr.Append(errs, &ParseError{Err: io.ErrUnexpectedEOF, Pos: p + 1})
p--
goto st0
st_case_0:
st0:
cs = 0
goto _out
st2:
if p++; p == pe {
goto _test_eof2
}
st_case_2:
if 33 <= data[p] && data[p] <= 126 {
goto tr2
}
goto tr0
tr2:
tok = p
goto st3
st3:
if p++; p == pe {
goto _test_eof3
}
st_case_3:
if data[p] == 62 {
goto tr4
}
if 33 <= data[p] && data[p] <= 126 {
goto st3
}
goto tr0
tr4:
if err := m.setPriority(data[tok:p]); err != nil {
errs = multierr.Append(errs, &ValidationError{Err: err, Pos: tok + 1})
}
goto st4
st4:
if p++; p == pe {
goto _test_eof4
}
st_case_4:
if data[p] == 62 {
goto tr6
}
if 33 <= data[p] && data[p] <= 126 {
goto tr5
}
goto tr0
tr5:
tok = p
goto st5
st5:
if p++; p == pe {
goto _test_eof5
}
st_case_5:
switch data[p] {
case 32:
goto tr7
case 62:
goto tr9
}
if 33 <= data[p] && data[p] <= 126 {
goto st5
}
goto tr0
tr7:
if err := m.setVersion(data[tok:p]); err != nil {
errs = multierr.Append(errs, &ValidationError{Err: err, Pos: tok + 1})
}
goto st6
st6:
if p++; p == pe {
goto _test_eof6
}
st_case_6:
if data[p] == 45 {
goto st7
}
if 48 <= data[p] && data[p] <= 57 {
goto tr11
}
goto tr0
st7:
if p++; p == pe {
goto _test_eof7
}
st_case_7:
if data[p] == 32 {
goto st8
}
goto tr0
tr32:
if err := m.setTimestampRFC3339(data[tok:p]); err != nil {
errs = multierr.Append(errs, &ValidationError{Err: err, Pos: tok + 1})
}
goto st8
st8:
if p++; p == pe {
goto _test_eof8
}
st_case_8:
if 33 <= data[p] && data[p] <= 126 {
goto tr13
}
goto tr0
tr13:
tok = p
goto st9
st9:
if p++; p == pe {
goto _test_eof9
}
st_case_9:
if data[p] == 32 {
goto tr14
}
if 33 <= data[p] && data[p] <= 126 {
goto st9
}
goto tr0
tr14:
m.setHostname(data[tok:p])
goto st10
st10:
if p++; p == pe {
goto _test_eof10
}
st_case_10:
if 33 <= data[p] && data[p] <= 126 {
goto tr16
}
goto tr0
tr16:
tok = p
goto st11
st11:
if p++; p == pe {
goto _test_eof11
}
st_case_11:
if data[p] == 32 {
goto tr17
}
if 33 <= data[p] && data[p] <= 126 {
goto st11
}
goto tr0
tr17:
m.setAppName(data[tok:p])
goto st12
st12:
if p++; p == pe {
goto _test_eof12
}
st_case_12:
if 33 <= data[p] && data[p] <= 126 {
goto tr19
}
goto tr0
tr19:
tok = p
goto st13
st13:
if p++; p == pe {
goto _test_eof13
}
st_case_13:
if data[p] == 32 {
goto tr20
}
if 33 <= data[p] && data[p] <= 126 {
goto st13
}
goto tr0
tr20:
m.setProcID(data[tok:p])
goto st14
st14:
if p++; p == pe {
goto _test_eof14
}
st_case_14:
if 33 <= data[p] && data[p] <= 126 {
goto tr22
}
goto tr0
tr22:
tok = p
goto st15
st15:
if p++; p == pe {
goto _test_eof15
}
st_case_15:
if data[p] == 32 {
goto tr23
}
if 33 <= data[p] && data[p] <= 126 {
goto st15
}
goto tr0
tr23:
m.setMsgID(data[tok:p])
goto st16
st16:
if p++; p == pe {
goto _test_eof16
}
st_case_16:
switch data[p] {
case 45:
goto st24
case 91:
goto tr26
}
goto tr0
st24:
if p++; p == pe {
goto _test_eof24
}
st_case_24:
if data[p] == 32 {
goto st25
}
goto tr0
tr37:
m.setRawSDValue(data[tok:p])
goto st25
st25:
if p++; p == pe {
goto _test_eof25
}
st_case_25:
goto tr35
tr35:
tok = p
goto st26
st26:
if p++; p == pe {
goto _test_eof26
}
st_case_26:
goto st26
tr26:
tok = p
goto st17
st17:
if p++; p == pe {
goto _test_eof17
}
st_case_17:
switch data[p] {
case 92:
goto st19
case 93:
goto tr0
}
goto st18
st18:
if p++; p == pe {
goto _test_eof18
}
st_case_18:
switch data[p] {
case 92:
goto st19
case 93:
goto st27
}
goto st18
st19:
if p++; p == pe {
goto _test_eof19
}
st_case_19:
if data[p] == 93 {
goto st18
}
goto tr0
st27:
if p++; p == pe {
goto _test_eof27
}
st_case_27:
switch data[p] {
case 32:
goto tr37
case 91:
goto st17
}
goto tr0
tr11:
tok = p
goto st20
st20:
if p++; p == pe {
goto _test_eof20
}
st_case_20:
switch data[p] {
case 43:
goto st21
case 58:
goto st21
}
switch {
case data[p] < 48:
if 45 <= data[p] && data[p] <= 46 {
goto st21
}
case data[p] > 57:
switch {
case data[p] > 90:
if 97 <= data[p] && data[p] <= 122 {
goto st21
}
case data[p] >= 65:
goto st21
}
default:
goto st22
}
goto tr0
st21:
if p++; p == pe {
goto _test_eof21
}
st_case_21:
if data[p] == 32 {
goto tr32
}
if 48 <= data[p] && data[p] <= 57 {
goto st20
}
goto tr0
st22:
if p++; p == pe {
goto _test_eof22
}
st_case_22:
switch data[p] {
case 32:
goto tr32
case 43:
goto st21
case 58:
goto st21
}
switch {
case data[p] < 48:
if 45 <= data[p] && data[p] <= 46 {
goto st21
}
case data[p] > 57:
switch {
case data[p] > 90:
if 97 <= data[p] && data[p] <= 122 {
goto st21
}
case data[p] >= 65:
goto st21
}
default:
goto st22
}
goto tr0
tr9:
if err := m.setPriority(data[tok:p]); err != nil {
errs = multierr.Append(errs, &ValidationError{Err: err, Pos: tok + 1})
}
goto st23
tr6:
if err := m.setPriority(data[tok:p]); err != nil {
errs = multierr.Append(errs, &ValidationError{Err: err, Pos: tok + 1})
}
tok = p
goto st23
st23:
if p++; p == pe {
goto _test_eof23
}
st_case_23:
switch data[p] {
case 32:
goto tr7
case 62:
goto tr6
}
if 33 <= data[p] && data[p] <= 126 {
goto tr5
}
goto tr0
st_out:
_test_eof2:
cs = 2
goto _test_eof
_test_eof3:
cs = 3
goto _test_eof
_test_eof4:
cs = 4
goto _test_eof
_test_eof5:
cs = 5
goto _test_eof
_test_eof6:
cs = 6
goto _test_eof
_test_eof7:
cs = 7
goto _test_eof
_test_eof8:
cs = 8
goto _test_eof
_test_eof9:
cs = 9
goto _test_eof
_test_eof10:
cs = 10
goto _test_eof
_test_eof11:
cs = 11
goto _test_eof
_test_eof12:
cs = 12
goto _test_eof
_test_eof13:
cs = 13
goto _test_eof
_test_eof14:
cs = 14
goto _test_eof
_test_eof15:
cs = 15
goto _test_eof
_test_eof16:
cs = 16
goto _test_eof
_test_eof24:
cs = 24
goto _test_eof
_test_eof25:
cs = 25
goto _test_eof
_test_eof26:
cs = 26
goto _test_eof
_test_eof17:
cs = 17
goto _test_eof
_test_eof18:
cs = 18
goto _test_eof
_test_eof19:
cs = 19
goto _test_eof
_test_eof27:
cs = 27
goto _test_eof
_test_eof20:
cs = 20
goto _test_eof
_test_eof21:
cs = 21
goto _test_eof
_test_eof22:
cs = 22
goto _test_eof
_test_eof23:
cs = 23
goto _test_eof
_test_eof:
{
}
if p == eof {
switch cs {
case 26:
m.setMsg(data[tok:p])
case 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23:
errs = multierr.Append(errs, &ParseError{Err: io.ErrUnexpectedEOF, Pos: p + 1})
p--
case 27:
m.setRawSDValue(data[tok:p])
case 25:
tok = p
m.setMsg(data[tok:p])
}
}
_out:
{
}
}
return m, errs
}