github.com/gopherd/gonum@v0.0.4/graph/formats/rdf/extract.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 extract; 16 17 include extract "extract_actions.rl"; 18 19 include nquads "nquads.rl"; 20 21 value := ( 22 IRIREF 23 | '_:' BLANK_NODE_LABEL >StartBlank %EndBlank 24 | '"' STRING_LITERAL >StartLiteral %EndLiteral '"' ( '^^' IRIREF | LANGTAG >StartLang %EndLang )? 25 ) %Return @!Error ; 26 27 write data; 28 }%% 29 30 func extract(data []rune) (text, qual string, kind Kind, err error) { 31 var ( 32 cs, p int 33 pe = len(data) 34 eof = pe 35 36 iri = -1 37 blank = -1 38 literal = -1 39 lang = -1 40 41 iriText string 42 blankText string 43 literalText string 44 langText string 45 ) 46 47 %%write init; 48 49 %%write exec; 50 51 return "", "", 0, ErrInvalidTerm 52 }