
//line check.rl:1
// Code generated by go generate gonum.org/v1/gonum/graph/formats/rdf; DO NOT EDIT.

// Copyright ©2020 The Gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package rdf

import (
	"fmt"
	"unicode"
)


//line check.go:16
const checkLabel_start int = 1
const checkLabel_first_final int = 3
const checkLabel_error int = 0

const checkLabel_en_value int = 1


//line check.rl:53


func checkLabelText(data []rune) (err error) {
	var (
		cs, p int
		pe    = len(data)
		eof   = pe
	)

	
//line check.go:33
	{
	cs = checkLabel_start
	}

//line check.rl:63

	
//line check.go:39
	{
	if p == pe {
		goto _test_eof
	}
	switch cs {
	case 1:
		goto st_case_1
	case 0:
		goto st_case_0
	case 3:
		goto st_case_3
	case 2:
		goto st_case_2
	}
	goto st_out
	st_case_1:
		if data[p] == 95 {
			goto st3
		}
		switch {
		case data[p] < 895:
			switch {
			case data[p] < 192:
				switch {
				case data[p] < 65:
					if 48 <= data[p] && data[p] <= 58 {
						goto st3
					}
				case data[p] > 90:
					if 97 <= data[p] && data[p] <= 122 {
						goto st3
					}
				default:
					goto st3
				}
			case data[p] > 214:
				switch {
				case data[p] < 248:
					if 216 <= data[p] && data[p] <= 246 {
						goto st3
					}
				case data[p] > 767:
					if 880 <= data[p] && data[p] <= 893 {
						goto st3
					}
				default:
					goto st3
				}
			default:
				goto st3
			}
		case data[p] > 8191:
			switch {
			case data[p] < 12289:
				switch {
				case data[p] < 8304:
					if 8204 <= data[p] && data[p] <= 8205 {
						goto st3
					}
				case data[p] > 8591:
					if 11264 <= data[p] && data[p] <= 12271 {
						goto st3
					}
				default:
					goto st3
				}
			case data[p] > 55295:
				switch {
				case data[p] < 65008:
					if 63744 <= data[p] && data[p] <= 64975 {
						goto st3
					}
				case data[p] > 65533:
					if 65536 <= data[p] && data[p] <= 983039 {
						goto st3
					}
				default:
					goto st3
				}
			default:
				goto st3
			}
		default:
			goto st3
		}
		goto tr0
tr0:
//line check_actions.rl:12

		if p < len(data) {
			if r := data[p]; r < unicode.MaxASCII {
				return fmt.Errorf("%w: unexpected rune %q at %d", ErrInvalidTerm, data[p], p)
			} else {
				return fmt.Errorf("%w: unexpected rune %q (\\u%04[2]x) at %d", ErrInvalidTerm, data[p], p)
			}
		}
		return ErrIncompleteTerm
	
	goto st0
//line check.go:139
st_case_0:
	st0:
		cs = 0
		goto _out
	st3:
		if p++; p == pe {
			goto _test_eof3
		}
	st_case_3:
		switch data[p] {
		case 45:
			goto st3
		case 46:
			goto st2
		case 95:
			goto st3
		case 183:
			goto st3
		}
		switch {
		case data[p] < 8204:
			switch {
			case data[p] < 192:
				switch {
				case data[p] < 65:
					if 48 <= data[p] && data[p] <= 58 {
						goto st3
					}
				case data[p] > 90:
					if 97 <= data[p] && data[p] <= 122 {
						goto st3
					}
				default:
					goto st3
				}
			case data[p] > 214:
				switch {
				case data[p] < 248:
					if 216 <= data[p] && data[p] <= 246 {
						goto st3
					}
				case data[p] > 893:
					if 895 <= data[p] && data[p] <= 8191 {
						goto st3
					}
				default:
					goto st3
				}
			default:
				goto st3
			}
		case data[p] > 8205:
			switch {
			case data[p] < 12289:
				switch {
				case data[p] < 8304:
					if 8255 <= data[p] && data[p] <= 8256 {
						goto st3
					}
				case data[p] > 8591:
					if 11264 <= data[p] && data[p] <= 12271 {
						goto st3
					}
				default:
					goto st3
				}
			case data[p] > 55295:
				switch {
				case data[p] < 65008:
					if 63744 <= data[p] && data[p] <= 64975 {
						goto st3
					}
				case data[p] > 65533:
					if 65536 <= data[p] && data[p] <= 983039 {
						goto st3
					}
				default:
					goto st3
				}
			default:
				goto st3
			}
		default:
			goto st3
		}
		goto st0
	st2:
		if p++; p == pe {
			goto _test_eof2
		}
	st_case_2:
		switch data[p] {
		case 45:
			goto st3
		case 46:
			goto st2
		case 95:
			goto st3
		case 183:
			goto st3
		}
		switch {
		case data[p] < 8204:
			switch {
			case data[p] < 192:
				switch {
				case data[p] < 65:
					if 48 <= data[p] && data[p] <= 58 {
						goto st3
					}
				case data[p] > 90:
					if 97 <= data[p] && data[p] <= 122 {
						goto st3
					}
				default:
					goto st3
				}
			case data[p] > 214:
				switch {
				case data[p] < 248:
					if 216 <= data[p] && data[p] <= 246 {
						goto st3
					}
				case data[p] > 893:
					if 895 <= data[p] && data[p] <= 8191 {
						goto st3
					}
				default:
					goto st3
				}
			default:
				goto st3
			}
		case data[p] > 8205:
			switch {
			case data[p] < 12289:
				switch {
				case data[p] < 8304:
					if 8255 <= data[p] && data[p] <= 8256 {
						goto st3
					}
				case data[p] > 8591:
					if 11264 <= data[p] && data[p] <= 12271 {
						goto st3
					}
				default:
					goto st3
				}
			case data[p] > 55295:
				switch {
				case data[p] < 65008:
					if 63744 <= data[p] && data[p] <= 64975 {
						goto st3
					}
				case data[p] > 65533:
					if 65536 <= data[p] && data[p] <= 983039 {
						goto st3
					}
				default:
					goto st3
				}
			default:
				goto st3
			}
		default:
			goto st3
		}
		goto tr0
	st_out:
	_test_eof3: cs = 3; goto _test_eof
	_test_eof2: cs = 2; goto _test_eof

	_test_eof: {}
	if p == eof {
		switch cs {
		case 3:
//line check_actions.rl:8

		return nil
	
		case 1, 2:
//line check_actions.rl:12

		if p < len(data) {
			if r := data[p]; r < unicode.MaxASCII {
				return fmt.Errorf("%w: unexpected rune %q at %d", ErrInvalidTerm, data[p], p)
			} else {
				return fmt.Errorf("%w: unexpected rune %q (\\u%04[2]x) at %d", ErrInvalidTerm, data[p], p)
			}
		}
		return ErrIncompleteTerm
	
//line check.go:332
		}
	}

	_out: {}
	}

//line check.rl:65

	return ErrInvalidTerm
}


//line check.go:343
const checkLang_start int = 1
const checkLang_first_final int = 4
const checkLang_error int = 0

const checkLang_en_value int = 1


//line check.rl:81


func checkLangText(data []byte) (err error) {
	var (
		cs, p int
		pe    = len(data)
		eof   = pe
	)

	
//line check.go:360
	{
	cs = checkLang_start
	}

//line check.rl:91

	
//line check.go:366
	{
	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 4:
		goto st_case_4
	case 3:
		goto st_case_3
	case 5:
		goto st_case_5
	}
	goto st_out
	st_case_1:
		if data[p] == 64 {
			goto st2
		}
		goto tr0
tr0:
//line check_actions.rl:12

		if p < len(data) {
			if r := data[p]; r < unicode.MaxASCII {
				return fmt.Errorf("%w: unexpected rune %q at %d", ErrInvalidTerm, data[p], p)
			} else {
				return fmt.Errorf("%w: unexpected rune %q (\\u%04[2]x) at %d", ErrInvalidTerm, data[p], p)
			}
		}
		return ErrIncompleteTerm
	
	goto st0
//line check.go:404
st_case_0:
	st0:
		cs = 0
		goto _out
	st2:
		if p++; p == pe {
			goto _test_eof2
		}
	st_case_2:
		switch {
		case data[p] > 90:
			if 97 <= data[p] && data[p] <= 122 {
				goto st4
			}
		case data[p] >= 65:
			goto st4
		}
		goto tr0
	st4:
		if p++; p == pe {
			goto _test_eof4
		}
	st_case_4:
		if data[p] == 45 {
			goto st3
		}
		switch {
		case data[p] > 90:
			if 97 <= data[p] && data[p] <= 122 {
				goto st4
			}
		case data[p] >= 65:
			goto st4
		}
		goto st0
	st3:
		if p++; p == pe {
			goto _test_eof3
		}
	st_case_3:
		switch {
		case data[p] < 65:
			if 48 <= data[p] && data[p] <= 57 {
				goto st5
			}
		case data[p] > 90:
			if 97 <= data[p] && data[p] <= 122 {
				goto st5
			}
		default:
			goto st5
		}
		goto tr0
	st5:
		if p++; p == pe {
			goto _test_eof5
		}
	st_case_5:
		if data[p] == 45 {
			goto st3
		}
		switch {
		case data[p] < 65:
			if 48 <= data[p] && data[p] <= 57 {
				goto st5
			}
		case data[p] > 90:
			if 97 <= data[p] && data[p] <= 122 {
				goto st5
			}
		default:
			goto st5
		}
		goto st0
	st_out:
	_test_eof2: cs = 2; goto _test_eof
	_test_eof4: cs = 4; goto _test_eof
	_test_eof3: cs = 3; goto _test_eof
	_test_eof5: cs = 5; goto _test_eof

	_test_eof: {}
	if p == eof {
		switch cs {
		case 4, 5:
//line check_actions.rl:8

		return nil
	
		case 1, 2, 3:
//line check_actions.rl:12

		if p < len(data) {
			if r := data[p]; r < unicode.MaxASCII {
				return fmt.Errorf("%w: unexpected rune %q at %d", ErrInvalidTerm, data[p], p)
			} else {
				return fmt.Errorf("%w: unexpected rune %q (\\u%04[2]x) at %d", ErrInvalidTerm, data[p], p)
			}
		}
		return ErrIncompleteTerm
	
//line check.go:505
		}
	}

	_out: {}
	}

//line check.rl:93

	return ErrInvalidTerm
}
