github.com/gopherd/gonum@v0.0.4/graph/formats/rdf/parse.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 "net/url" 12 "unicode" 13 ) 14 15 %%{ 16 machine nquads; 17 18 include "parse_actions.rl"; 19 20 include "nquads.rl"; 21 22 statement := ( 23 whitespace* subject >StartSubject %SetSubject 24 whitespace* predicate >StartPredicate %SetPredicate 25 whitespace* object >StartObject %SetObject 26 (whitespace* graphLabel >StartLabel %SetLabel)? 27 whitespace* '.' whitespace* ('#' any*)? >Comment 28 ) %Return @!Error ; 29 30 write data; 31 }%% 32 33 func parse(data []rune) (Statement, error) { 34 var ( 35 cs, p int 36 pe = len(data) 37 eof = pe 38 39 subject = -1 40 predicate = -1 41 object = -1 42 label = -1 43 iri = -1 44 45 s Statement 46 ) 47 48 %%write init; 49 50 %%write exec; 51 52 return Statement{}, ErrInvalid 53 }