parser

package
v0.7.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2021 License: BSD-1-Clause, BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package parser implements a parser for N-Quads[0] source text.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GraphLabel

type GraphLabel struct {
	Pos
	Tag
	Value string
}

GraphLabel describes a parsed graphLabel[9].

func (*GraphLabel) String

func (g *GraphLabel) String() string

String implements fmt.Stringer()

type Object

type Object struct {
	Pos
	Tag
	Value  string
	Tag2   Tag // Tag2 is nonzero iff Tag == Literal and the literal has the optional IRIREF or LANGTAG value present.
	Value2 string
}

Object describes a parsed object[8].

func (*Object) String

func (o *Object) String() string

String implements fmt.Stringer()

type Pos

type Pos struct {
	Line int
	Col  int
}

Pos describes a position within the parsed source.

func (Pos) String

func (p Pos) String() string

type Predicate

type Predicate struct {
	Pos
	Value string
}

Predicate describes a parser predicate[7].

func (*Predicate) String

func (p *Predicate) String() string

String implements fmt.Stringer()

type Statement

type Statement struct {
	Pos
	*Subject
	*Predicate
	*Object
	*GraphLabel // GraphLabel might be nil.
}

Statement describes a parsed statement[1].

func Parse

func Parse(fname string, src []byte) (ast []*Statement, err error)

Parse parses src as a single N-Quads source file fname and returns the corresponding AST. If the source couldn't be parsed, the returned AST is nil and the error indicates all of the specific failures.

func (*Statement) String

func (s *Statement) String() string

String implements fmt.Stringer()

type Subject

type Subject struct {
	Pos
	Tag
	Value string
}

Subject describes a parsed subject[6].

func (*Subject) String

func (s *Subject) String() string

String implements fmt.Stringer()

type Tag

type Tag int

Tag is a kind of the Value field of Subject, Predicate, Object or GraphLabel.

const (
	IRIRef         Tag // [2]
	BlankNodeLabel     // [3]
	Literal            // [4]
	LangTag            // [5]
)

Values of type Tag.

func (Tag) String

func (t Tag) String() string

String implements fmt.Stringer()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL