github.com/jingcheng-WU/gonum@v0.9.1-0.20210323123734-f1a2a11a8f7b/graph/formats/rdf/check.go (about)

     1  
     2  //line check.rl:1
     3  // Go code generated by go generate github.com/jingcheng-WU/gonum/graph/formats/rdf; DO NOT EDIT.
     4  
     5  // Copyright ©2020 The Gonum Authors. All rights reserved.
     6  // Use of this source code is governed by a BSD-style
     7  // license that can be found in the LICENSE file.
     8  
     9  package rdf
    10  
    11  import (
    12  	"fmt"
    13  	"unicode"
    14  )
    15  
    16  
    17  //line check.go:18
    18  const checkLabel_start int = 1
    19  const checkLabel_first_final int = 3
    20  const checkLabel_error int = 0
    21  
    22  const checkLabel_en_value int = 1
    23  
    24  
    25  //line check.rl:53
    26  
    27  
    28  func checkLabelText(data []rune) (err error) {
    29  	var (
    30  		cs, p int
    31  		pe    = len(data)
    32  		eof   = pe
    33  	)
    34  
    35  	
    36  //line check.go:37
    37  	{
    38  	cs = checkLabel_start
    39  	}
    40  
    41  //line check.rl:63
    42  
    43  	
    44  //line check.go:45
    45  	{
    46  	if p == pe {
    47  		goto _test_eof
    48  	}
    49  	switch cs {
    50  	case 1:
    51  		goto st_case_1
    52  	case 0:
    53  		goto st_case_0
    54  	case 3:
    55  		goto st_case_3
    56  	case 2:
    57  		goto st_case_2
    58  	}
    59  	goto st_out
    60  	st_case_1:
    61  		if data[p] == 95 {
    62  			goto st3
    63  		}
    64  		switch {
    65  		case data[p] < 895:
    66  			switch {
    67  			case data[p] < 192:
    68  				switch {
    69  				case data[p] < 65:
    70  					if 48 <= data[p] && data[p] <= 58 {
    71  						goto st3
    72  					}
    73  				case data[p] > 90:
    74  					if 97 <= data[p] && data[p] <= 122 {
    75  						goto st3
    76  					}
    77  				default:
    78  					goto st3
    79  				}
    80  			case data[p] > 214:
    81  				switch {
    82  				case data[p] < 248:
    83  					if 216 <= data[p] && data[p] <= 246 {
    84  						goto st3
    85  					}
    86  				case data[p] > 767:
    87  					if 880 <= data[p] && data[p] <= 893 {
    88  						goto st3
    89  					}
    90  				default:
    91  					goto st3
    92  				}
    93  			default:
    94  				goto st3
    95  			}
    96  		case data[p] > 8191:
    97  			switch {
    98  			case data[p] < 12289:
    99  				switch {
   100  				case data[p] < 8304:
   101  					if 8204 <= data[p] && data[p] <= 8205 {
   102  						goto st3
   103  					}
   104  				case data[p] > 8591:
   105  					if 11264 <= data[p] && data[p] <= 12271 {
   106  						goto st3
   107  					}
   108  				default:
   109  					goto st3
   110  				}
   111  			case data[p] > 55295:
   112  				switch {
   113  				case data[p] < 65008:
   114  					if 63744 <= data[p] && data[p] <= 64975 {
   115  						goto st3
   116  					}
   117  				case data[p] > 65533:
   118  					if 65536 <= data[p] && data[p] <= 983039 {
   119  						goto st3
   120  					}
   121  				default:
   122  					goto st3
   123  				}
   124  			default:
   125  				goto st3
   126  			}
   127  		default:
   128  			goto st3
   129  		}
   130  		goto tr0
   131  tr0:
   132  //line check_actions.rl:12
   133  
   134  		if p < len(data) {
   135  			if r := data[p]; r < unicode.MaxASCII {
   136  				return fmt.Errorf("%w: unexpected rune %q at %d", ErrInvalidTerm, data[p], p)
   137  			} else {
   138  				return fmt.Errorf("%w: unexpected rune %q (\\u%04[2]x) at %d", ErrInvalidTerm, data[p], p)
   139  			}
   140  		}
   141  		return ErrIncompleteTerm
   142  	
   143  	goto st0
   144  //line check.go:145
   145  st_case_0:
   146  	st0:
   147  		cs = 0
   148  		goto _out
   149  	st3:
   150  		if p++; p == pe {
   151  			goto _test_eof3
   152  		}
   153  	st_case_3:
   154  		switch data[p] {
   155  		case 45:
   156  			goto st3
   157  		case 46:
   158  			goto st2
   159  		case 95:
   160  			goto st3
   161  		case 183:
   162  			goto st3
   163  		}
   164  		switch {
   165  		case data[p] < 8204:
   166  			switch {
   167  			case data[p] < 192:
   168  				switch {
   169  				case data[p] < 65:
   170  					if 48 <= data[p] && data[p] <= 58 {
   171  						goto st3
   172  					}
   173  				case data[p] > 90:
   174  					if 97 <= data[p] && data[p] <= 122 {
   175  						goto st3
   176  					}
   177  				default:
   178  					goto st3
   179  				}
   180  			case data[p] > 214:
   181  				switch {
   182  				case data[p] < 248:
   183  					if 216 <= data[p] && data[p] <= 246 {
   184  						goto st3
   185  					}
   186  				case data[p] > 893:
   187  					if 895 <= data[p] && data[p] <= 8191 {
   188  						goto st3
   189  					}
   190  				default:
   191  					goto st3
   192  				}
   193  			default:
   194  				goto st3
   195  			}
   196  		case data[p] > 8205:
   197  			switch {
   198  			case data[p] < 12289:
   199  				switch {
   200  				case data[p] < 8304:
   201  					if 8255 <= data[p] && data[p] <= 8256 {
   202  						goto st3
   203  					}
   204  				case data[p] > 8591:
   205  					if 11264 <= data[p] && data[p] <= 12271 {
   206  						goto st3
   207  					}
   208  				default:
   209  					goto st3
   210  				}
   211  			case data[p] > 55295:
   212  				switch {
   213  				case data[p] < 65008:
   214  					if 63744 <= data[p] && data[p] <= 64975 {
   215  						goto st3
   216  					}
   217  				case data[p] > 65533:
   218  					if 65536 <= data[p] && data[p] <= 983039 {
   219  						goto st3
   220  					}
   221  				default:
   222  					goto st3
   223  				}
   224  			default:
   225  				goto st3
   226  			}
   227  		default:
   228  			goto st3
   229  		}
   230  		goto st0
   231  	st2:
   232  		if p++; p == pe {
   233  			goto _test_eof2
   234  		}
   235  	st_case_2:
   236  		switch data[p] {
   237  		case 45:
   238  			goto st3
   239  		case 46:
   240  			goto st2
   241  		case 95:
   242  			goto st3
   243  		case 183:
   244  			goto st3
   245  		}
   246  		switch {
   247  		case data[p] < 8204:
   248  			switch {
   249  			case data[p] < 192:
   250  				switch {
   251  				case data[p] < 65:
   252  					if 48 <= data[p] && data[p] <= 58 {
   253  						goto st3
   254  					}
   255  				case data[p] > 90:
   256  					if 97 <= data[p] && data[p] <= 122 {
   257  						goto st3
   258  					}
   259  				default:
   260  					goto st3
   261  				}
   262  			case data[p] > 214:
   263  				switch {
   264  				case data[p] < 248:
   265  					if 216 <= data[p] && data[p] <= 246 {
   266  						goto st3
   267  					}
   268  				case data[p] > 893:
   269  					if 895 <= data[p] && data[p] <= 8191 {
   270  						goto st3
   271  					}
   272  				default:
   273  					goto st3
   274  				}
   275  			default:
   276  				goto st3
   277  			}
   278  		case data[p] > 8205:
   279  			switch {
   280  			case data[p] < 12289:
   281  				switch {
   282  				case data[p] < 8304:
   283  					if 8255 <= data[p] && data[p] <= 8256 {
   284  						goto st3
   285  					}
   286  				case data[p] > 8591:
   287  					if 11264 <= data[p] && data[p] <= 12271 {
   288  						goto st3
   289  					}
   290  				default:
   291  					goto st3
   292  				}
   293  			case data[p] > 55295:
   294  				switch {
   295  				case data[p] < 65008:
   296  					if 63744 <= data[p] && data[p] <= 64975 {
   297  						goto st3
   298  					}
   299  				case data[p] > 65533:
   300  					if 65536 <= data[p] && data[p] <= 983039 {
   301  						goto st3
   302  					}
   303  				default:
   304  					goto st3
   305  				}
   306  			default:
   307  				goto st3
   308  			}
   309  		default:
   310  			goto st3
   311  		}
   312  		goto tr0
   313  	st_out:
   314  	_test_eof3: cs = 3; goto _test_eof
   315  	_test_eof2: cs = 2; goto _test_eof
   316  
   317  	_test_eof: {}
   318  	if p == eof {
   319  		switch cs {
   320  		case 3:
   321  //line check_actions.rl:8
   322  
   323  		return nil
   324  	
   325  		case 1, 2:
   326  //line check_actions.rl:12
   327  
   328  		if p < len(data) {
   329  			if r := data[p]; r < unicode.MaxASCII {
   330  				return fmt.Errorf("%w: unexpected rune %q at %d", ErrInvalidTerm, data[p], p)
   331  			} else {
   332  				return fmt.Errorf("%w: unexpected rune %q (\\u%04[2]x) at %d", ErrInvalidTerm, data[p], p)
   333  			}
   334  		}
   335  		return ErrIncompleteTerm
   336  	
   337  //line check.go:338
   338  		}
   339  	}
   340  
   341  	_out: {}
   342  	}
   343  
   344  //line check.rl:65
   345  
   346  	return ErrInvalidTerm
   347  }
   348  
   349  
   350  //line check.go:351
   351  const checkLang_start int = 1
   352  const checkLang_first_final int = 4
   353  const checkLang_error int = 0
   354  
   355  const checkLang_en_value int = 1
   356  
   357  
   358  //line check.rl:81
   359  
   360  
   361  func checkLangText(data []byte) (err error) {
   362  	var (
   363  		cs, p int
   364  		pe    = len(data)
   365  		eof   = pe
   366  	)
   367  
   368  	
   369  //line check.go:370
   370  	{
   371  	cs = checkLang_start
   372  	}
   373  
   374  //line check.rl:91
   375  
   376  	
   377  //line check.go:378
   378  	{
   379  	if p == pe {
   380  		goto _test_eof
   381  	}
   382  	switch cs {
   383  	case 1:
   384  		goto st_case_1
   385  	case 0:
   386  		goto st_case_0
   387  	case 2:
   388  		goto st_case_2
   389  	case 4:
   390  		goto st_case_4
   391  	case 3:
   392  		goto st_case_3
   393  	case 5:
   394  		goto st_case_5
   395  	}
   396  	goto st_out
   397  	st_case_1:
   398  		if data[p] == 64 {
   399  			goto st2
   400  		}
   401  		goto tr0
   402  tr0:
   403  //line check_actions.rl:12
   404  
   405  		if p < len(data) {
   406  			if r := data[p]; r < unicode.MaxASCII {
   407  				return fmt.Errorf("%w: unexpected rune %q at %d", ErrInvalidTerm, data[p], p)
   408  			} else {
   409  				return fmt.Errorf("%w: unexpected rune %q (\\u%04[2]x) at %d", ErrInvalidTerm, data[p], p)
   410  			}
   411  		}
   412  		return ErrIncompleteTerm
   413  	
   414  	goto st0
   415  //line check.go:416
   416  st_case_0:
   417  	st0:
   418  		cs = 0
   419  		goto _out
   420  	st2:
   421  		if p++; p == pe {
   422  			goto _test_eof2
   423  		}
   424  	st_case_2:
   425  		switch {
   426  		case data[p] > 90:
   427  			if 97 <= data[p] && data[p] <= 122 {
   428  				goto st4
   429  			}
   430  		case data[p] >= 65:
   431  			goto st4
   432  		}
   433  		goto tr0
   434  	st4:
   435  		if p++; p == pe {
   436  			goto _test_eof4
   437  		}
   438  	st_case_4:
   439  		if data[p] == 45 {
   440  			goto st3
   441  		}
   442  		switch {
   443  		case data[p] > 90:
   444  			if 97 <= data[p] && data[p] <= 122 {
   445  				goto st4
   446  			}
   447  		case data[p] >= 65:
   448  			goto st4
   449  		}
   450  		goto st0
   451  	st3:
   452  		if p++; p == pe {
   453  			goto _test_eof3
   454  		}
   455  	st_case_3:
   456  		switch {
   457  		case data[p] < 65:
   458  			if 48 <= data[p] && data[p] <= 57 {
   459  				goto st5
   460  			}
   461  		case data[p] > 90:
   462  			if 97 <= data[p] && data[p] <= 122 {
   463  				goto st5
   464  			}
   465  		default:
   466  			goto st5
   467  		}
   468  		goto tr0
   469  	st5:
   470  		if p++; p == pe {
   471  			goto _test_eof5
   472  		}
   473  	st_case_5:
   474  		if data[p] == 45 {
   475  			goto st3
   476  		}
   477  		switch {
   478  		case data[p] < 65:
   479  			if 48 <= data[p] && data[p] <= 57 {
   480  				goto st5
   481  			}
   482  		case data[p] > 90:
   483  			if 97 <= data[p] && data[p] <= 122 {
   484  				goto st5
   485  			}
   486  		default:
   487  			goto st5
   488  		}
   489  		goto st0
   490  	st_out:
   491  	_test_eof2: cs = 2; goto _test_eof
   492  	_test_eof4: cs = 4; goto _test_eof
   493  	_test_eof3: cs = 3; goto _test_eof
   494  	_test_eof5: cs = 5; goto _test_eof
   495  
   496  	_test_eof: {}
   497  	if p == eof {
   498  		switch cs {
   499  		case 4, 5:
   500  //line check_actions.rl:8
   501  
   502  		return nil
   503  	
   504  		case 1, 2, 3:
   505  //line check_actions.rl:12
   506  
   507  		if p < len(data) {
   508  			if r := data[p]; r < unicode.MaxASCII {
   509  				return fmt.Errorf("%w: unexpected rune %q at %d", ErrInvalidTerm, data[p], p)
   510  			} else {
   511  				return fmt.Errorf("%w: unexpected rune %q (\\u%04[2]x) at %d", ErrInvalidTerm, data[p], p)
   512  			}
   513  		}
   514  		return ErrIncompleteTerm
   515  	
   516  //line check.go:517
   517  		}
   518  	}
   519  
   520  	_out: {}
   521  	}
   522  
   523  //line check.rl:93
   524  
   525  	return ErrInvalidTerm
   526  }