github.com/gopherd/gonum@v0.0.4/graph/formats/rdf/check.rl (about) 1 // Go code generated by go generate gonum.org/v1/gonum/graph/formats/rdf; DO NOT EDIT. 2 3 // Copyright ©2020 The Gonum Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 package rdf 8 9 import ( 10 "fmt" 11 "unicode" 12 ) 13 14 %%{ 15 machine checkLabel; 16 17 alphtype rune; 18 19 include check "check_actions.rl"; 20 21 alphtype rune; 22 23 PN_CHARS_BASE = [A-Za-z] 24 | 0x00c0 .. 0x00d6 25 | 0x00d8 .. 0x00f6 26 | 0x00f8 .. 0x02ff 27 | 0x0370 .. 0x037d 28 | 0x037f .. 0x1fff 29 | 0x200c .. 0x200d 30 | 0x2070 .. 0x218f 31 | 0x2c00 .. 0x2fef 32 | 0x3001 .. 0xd7ff 33 | 0xf900 .. 0xfdcf 34 | 0xfdf0 .. 0xfffd 35 | 0x10000 .. 0xeffff 36 ; 37 38 PN_CHARS_U = PN_CHARS_BASE | '_' | ':' ; 39 40 PN_CHARS = PN_CHARS_U 41 | '-' 42 | [0-9] 43 | 0xb7 44 | 0x0300 .. 0x036f 45 | 0x203f .. 0x2040 46 ; 47 48 BLANK_NODE_LABEL = (PN_CHARS_U | [0-9]) ((PN_CHARS | '.')* PN_CHARS)? ; 49 50 value := BLANK_NODE_LABEL %Return @!Error ; 51 52 write data; 53 }%% 54 55 func checkLabelText(data []rune) (err error) { 56 var ( 57 cs, p int 58 pe = len(data) 59 eof = pe 60 ) 61 62 %%write init; 63 64 %%write exec; 65 66 return ErrInvalidTerm 67 } 68 69 %%{ 70 machine checkLang; 71 72 alphtype byte; 73 74 include check "check_actions.rl"; 75 76 LANGTAG = '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ; 77 78 value := LANGTAG %Return @!Error ; 79 80 write data; 81 }%% 82 83 func checkLangText(data []byte) (err error) { 84 var ( 85 cs, p int 86 pe = len(data) 87 eof = pe 88 ) 89 90 %%write init; 91 92 %%write exec; 93 94 return ErrInvalidTerm 95 }