xpath2

package
v0.0.0-...-3140c0a Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func XPathGrammar

func XPathGrammar() (g *kowhai.Grammar)

Types

type XPathLexer

type XPathLexer struct {
	Input string

	Tokens chan *XPathToken
	// contains filtered or unexported fields
}

func (*XPathLexer) Run

func (l *XPathLexer) Run()

type XPathToken

type XPathToken struct {
	Token_Type XPathTokenType
	Value      string
}

func (*XPathToken) AsValue

func (t *XPathToken) AsValue() string

func (*XPathToken) TokenType

func (t *XPathToken) TokenType() int

type XPathTokenType

type XPathTokenType int

lex terminal - default state

-- if quote, lex string
-- if (:, lex comment
-- recognize delimiting operators as token
-- skip whitespace

lex identifier

-- accept NCName characters
-- if next char is :, switch to lex QName
-- if token is keyword, emit keyword token else emit NCName
-- switch to lex terminal

lex QName

-- accept NCName characters
-- switch to lex terminal
const (
	TT_END      XPathTokenType = iota
	TT_INT                     //integer literal
	TT_DECIMAL                 //decimal literal
	TT_DOUBLE                  //double literal
	TT_STRING                  //string literal (may contain escaped quotes)
	TT_NCNAME                  // NCName (valid XML name) see http://www.w3.org/TR/REC-xml-names/#NT-NCName
	TT_QNAME                   // QName (namespace-qualified name) see http://www.w3.org/TR/REC-xml-names/#NT-QName
	TT_KEYWORD                 // as defined in http://www.w3.org/TR/xpath20/#id-terminal-delimitation
	TT_TERMINAL                // other terminal symbol (mostly punctuation)

)

Jump to

Keyboard shortcuts

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