parser

package
v0.0.0-...-5c8e94d Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	// Type refer the type content (Verse, Text, Paragraph etc.)
	Type string

	// Value is the text (Empty for markers)
	Value string

	// Children point to the child contents (empty if no child)
	Children []*Content
}

Content represents a part of source It could be a marker or text

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser represents a parser.

func NewParser

func NewParser(r io.Reader) *Parser

NewParser returns a new instance of Parser.

func (*Parser) Parse

func (p *Parser) Parse() (*Content, error)

Parse parses a USFM formatted book content

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner represents a lexical scanner.

func NewScanner

func NewScanner(r io.Reader) *Scanner

NewScanner returns a new instance of Scanner.

func (*Scanner) Scan

func (s *Scanner) Scan() (tok Token, lit string)

Scan returns the next token and literal value.

type Token

type Token int

Token represents a lexical token.

const (
	// Illegal represents an illegal/invalid character
	Illegal Token = iota

	// Whitespace represents a white space (" ", \t, \r, \n) character
	Whitespace

	// EOF represents end of file
	EOF

	// MarkerID represents '\id' or '\id1' marker
	MarkerID

	// MarkerIde represents '\ide' marker
	MarkerIde

	// MarkerImte1 represents '\imte' or '\imte1' marker
	MarkerImte1

	// MarkerC represents '\c' marker
	MarkerC

	// MarkerV represents '\v' marker
	MarkerV

	// Number represents a number (verse, chapter)
	Number

	// Text represents actual text
	Text
)

Jump to

Keyboard shortcuts

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