Skip to content

Instantly share code, notes, and snippets.

@tj
Created January 16, 2016 03:32
Show Gist options
  • Save tj/8a0d8c525f9f01c4cb99 to your computer and use it in GitHub Desktop.
Save tj/8a0d8c525f9f01c4cb99 to your computer and use it in GitHub Desktop.
//line target.rl:1
package target
import (
"fmt"
)
//line target.rl:30
//line target_parser.go:15
const target_start int = 1
const target_first_final int = 13
const target_error int = 0
const target_en_main int = 1
//line target.rl:33
func Parse(data string) (*Target, error) {
cs, p, pe := 0, 0, len(data)
target := &Target{Source: data}
mark := 0
marked := func() string {
return data[mark:p]
}
//line target_parser.go:35
{
cs = target_start
}
//line target_parser.go:40
{
if p == pe {
goto _test_eof
}
switch cs {
case 1:
goto st_case_1
case 0:
goto st_case_0
case 13:
goto st_case_13
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
}
goto st_out
tr5:
//line target.rl:14
fmt.Println(marked())
goto st1
st1:
if p++; p == pe {
goto _test_eof1
}
st_case_1:
//line target_parser.go:87
switch data[p] {
case 32:
goto st1
case 59:
goto st13
}
switch {
case data[p] > 10:
if 97 <= data[p] && data[p] <= 122 {
goto tr3
}
case data[p] >= 9:
goto st1
}
goto st0
st_case_0:
st0:
cs = 0
goto _out
tr7:
//line target.rl:14
fmt.Println(marked())
goto st13
st13:
if p++; p == pe {
goto _test_eof13
}
st_case_13:
//line target_parser.go:118
goto st0
tr3:
//line target.rl:10
mark = p
goto st2
st2:
if p++; p == pe {
goto _test_eof2
}
st_case_2:
//line target_parser.go:131
switch data[p] {
case 9:
goto tr4
case 10:
goto tr5
case 32:
goto tr4
case 58:
goto tr6
case 59:
goto tr7
case 60:
goto tr8
case 62:
goto tr8
}
if 97 <= data[p] && data[p] <= 122 {
goto st2
}
goto st0
tr4:
//line target.rl:14
fmt.Println(marked())
goto st3
st3:
if p++; p == pe {
goto _test_eof3
}
st_case_3:
//line target_parser.go:163
switch data[p] {
case 9:
goto st3
case 10:
goto st1
case 32:
goto st3
case 58:
goto st4
case 59:
goto st13
case 60:
goto st12
case 62:
goto st12
}
if 97 <= data[p] && data[p] <= 122 {
goto tr3
}
goto st0
tr6:
//line target.rl:14
fmt.Println(marked())
goto st4
st4:
if p++; p == pe {
goto _test_eof4
}
st_case_4:
//line target_parser.go:195
switch data[p] {
case 9:
goto st4
case 32:
goto st4
case 91:
goto st6
}
switch {
case data[p] > 57:
if 97 <= data[p] && data[p] <= 122 {
goto tr15
}
case data[p] >= 48:
goto st5
}
goto st0
st5:
if p++; p == pe {
goto _test_eof5
}
st_case_5:
switch data[p] {
case 32:
goto st1
case 59:
goto st13
}
switch {
case data[p] > 10:
if 48 <= data[p] && data[p] <= 57 {
goto st5
}
case data[p] >= 9:
goto st1
}
goto st0
st6:
if p++; p == pe {
goto _test_eof6
}
st_case_6:
if data[p] == 32 {
goto st6
}
switch {
case data[p] < 48:
if 9 <= data[p] && data[p] <= 10 {
goto st6
}
case data[p] > 57:
if 97 <= data[p] && data[p] <= 122 {
goto tr17
}
default:
goto st7
}
goto st0
st7:
if p++; p == pe {
goto _test_eof7
}
st_case_7:
switch data[p] {
case 32:
goto st8
case 93:
goto st9
}
switch {
case data[p] > 10:
if 48 <= data[p] && data[p] <= 57 {
goto st7
}
case data[p] >= 9:
goto st8
}
goto st0
tr20:
//line target.rl:14
fmt.Println(marked())
goto st8
st8:
if p++; p == pe {
goto _test_eof8
}
st_case_8:
//line target_parser.go:285
switch data[p] {
case 32:
goto st8
case 93:
goto st9
}
switch {
case data[p] < 48:
if 9 <= data[p] && data[p] <= 10 {
goto st8
}
case data[p] > 57:
if 97 <= data[p] && data[p] <= 122 {
goto tr17
}
default:
goto st7
}
goto st0
tr21:
//line target.rl:14
fmt.Println(marked())
goto st9
st9:
if p++; p == pe {
goto _test_eof9
}
st_case_9:
//line target_parser.go:316
switch data[p] {
case 32:
goto st1
case 59:
goto st13
}
if 9 <= data[p] && data[p] <= 10 {
goto st1
}
goto st0
tr17:
//line target.rl:10
mark = p
goto st10
st10:
if p++; p == pe {
goto _test_eof10
}
st_case_10:
//line target_parser.go:338
switch data[p] {
case 32:
goto tr20
case 93:
goto tr21
}
switch {
case data[p] > 10:
if 97 <= data[p] && data[p] <= 122 {
goto st10
}
case data[p] >= 9:
goto tr20
}
goto st0
tr15:
//line target.rl:10
mark = p
goto st11
st11:
if p++; p == pe {
goto _test_eof11
}
st_case_11:
//line target_parser.go:365
switch data[p] {
case 32:
goto tr5
case 59:
goto tr7
}
switch {
case data[p] > 10:
if 97 <= data[p] && data[p] <= 122 {
goto st11
}
case data[p] >= 9:
goto tr5
}
goto st0
tr8:
//line target.rl:14
fmt.Println(marked())
goto st12
st12:
if p++; p == pe {
goto _test_eof12
}
st_case_12:
//line target_parser.go:392
switch data[p] {
case 9:
goto st4
case 32:
goto st4
case 61:
goto st4
case 91:
goto st6
}
switch {
case data[p] > 57:
if 97 <= data[p] && data[p] <= 122 {
goto tr15
}
case data[p] >= 48:
goto st5
}
goto st0
st_out:
_test_eof1: cs = 1; goto _test_eof
_test_eof13: cs = 13; goto _test_eof
_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_eof: {}
_out: {}
}
//line target.rl:46
return target, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment