parser

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

The `parser` package provides primitives that help with writing recursive descent parsers. This version is a golang port of the original Python implementation from https://tinyurl.com/rdescent

The `Parser` struct is supposed to be extended to support parsing a new language. Take a look at `lama2parser.go` for an example. Essentially the actual parsing begins from the `Start()` method.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomPairMerge

func CustomPairMerge(destination, source interface{}) interface{}

Types

type Lama2Parser

type Lama2Parser struct {
	*Parser
	Context map[string]bool
}

func NewLama2Parser

func NewLama2Parser() *Lama2Parser

func (*Lama2Parser) AnyType

func (p *Lama2Parser) AnyType() (*gabs.Container, error)

func (*Lama2Parser) Boolean

func (p *Lama2Parser) Boolean() (*gabs.Container, error)

func (*Lama2Parser) ComplexType

func (p *Lama2Parser) ComplexType() (*gabs.Container, error)

func (*Lama2Parser) DataHeader

func (p *Lama2Parser) DataHeader() (*gabs.Container, error)

func (*Lama2Parser) DataInput

func (p *Lama2Parser) DataInput() (*gabs.Container, error)

func (*Lama2Parser) Details

func (p *Lama2Parser) Details() (*gabs.Container, error)

func (*Lama2Parser) Digit

func (p *Lama2Parser) Digit() (*gabs.Container, error)

func (*Lama2Parser) Digits

func (p *Lama2Parser) Digits() (*gabs.Container, error)

func (*Lama2Parser) Exponent

func (p *Lama2Parser) Exponent() (*gabs.Container, error)

func (*Lama2Parser) FilesPair

func (p *Lama2Parser) FilesPair() (*gabs.Container, error)

func (*Lama2Parser) FilesUnquoted

func (p *Lama2Parser) FilesUnquoted() (*gabs.Container, error)

func (*Lama2Parser) Fraction

func (p *Lama2Parser) Fraction() (*gabs.Container, error)

func (*Lama2Parser) FractionRule1

func (p *Lama2Parser) FractionRule1() (*gabs.Container, error)

func (*Lama2Parser) HTTPFile

func (p *Lama2Parser) HTTPFile() (*gabs.Container, error)

func (*Lama2Parser) HTTPVerb

func (p *Lama2Parser) HTTPVerb() (*gabs.Container, error)

func (*Lama2Parser) HeaderData

func (p *Lama2Parser) HeaderData() (*gabs.Container, error)

func (*Lama2Parser) HeaderPair

func (p *Lama2Parser) HeaderPair() (*gabs.Container, error)

func (*Lama2Parser) Headers

func (p *Lama2Parser) Headers() (*gabs.Container, error)

func (*Lama2Parser) Integer

func (p *Lama2Parser) Integer() (*gabs.Container, error)

func (*Lama2Parser) IntegerRule1

func (p *Lama2Parser) IntegerRule1() (*gabs.Container, error)

func (*Lama2Parser) IntegerRule2

func (p *Lama2Parser) IntegerRule2() (*gabs.Container, error)

func (*Lama2Parser) IntegerRule3

func (p *Lama2Parser) IntegerRule3() (*gabs.Container, error)

func (*Lama2Parser) IntegerRule4

func (p *Lama2Parser) IntegerRule4() (*gabs.Container, error)

func (*Lama2Parser) List

func (p *Lama2Parser) List() (*gabs.Container, error)

func (*Lama2Parser) Map

func (p *Lama2Parser) Map() (*gabs.Container, error)

func (*Lama2Parser) Multipart

func (p *Lama2Parser) Multipart() (*gabs.Container, error)

func (*Lama2Parser) Null

func (p *Lama2Parser) Null() (*gabs.Container, error)

func (*Lama2Parser) Number

func (p *Lama2Parser) Number() (*gabs.Container, error)

func (*Lama2Parser) OneNine

func (p *Lama2Parser) OneNine() (*gabs.Container, error)

func (*Lama2Parser) Pair

func (p *Lama2Parser) Pair() (*gabs.Container, error)

func (*Lama2Parser) PrimitiveType

func (p *Lama2Parser) PrimitiveType() (*gabs.Container, error)

func (*Lama2Parser) QuotedString

func (p *Lama2Parser) QuotedString() (*gabs.Container, error)

func (*Lama2Parser) Sign

func (p *Lama2Parser) Sign() (*gabs.Container, error)

func (*Lama2Parser) Start

func (p *Lama2Parser) Start() (*gabs.Container, error)

func (*Lama2Parser) TheURL

func (p *Lama2Parser) TheURL() (*gabs.Container, error)

func (*Lama2Parser) Unquoted

func (p *Lama2Parser) Unquoted() (*gabs.Container, error)

func (*Lama2Parser) VarJSON

func (p *Lama2Parser) VarJSON() (*gabs.Container, error)

func (*Lama2Parser) VarJSONPair

func (p *Lama2Parser) VarJSONPair() (*gabs.Container, error)

func (*Lama2Parser) VarJSONUnquoted

func (p *Lama2Parser) VarJSONUnquoted() (*gabs.Container, error)

type MinimalParser

type MinimalParser interface {
	Start() (*gabs.Container, error)
}

type Parser

type Parser struct {
	Text     []rune
	Pos      int
	TotalLen int

	Pm MinimalParser

	LineNum int
	// contains filtered or unexported fields
}

func (*Parser) Char

func (p *Parser) Char() (rune, error)

func (*Parser) CharClass

func (p *Parser) CharClass(charClass string) (rune, error)

func (*Parser) Init

func (p *Parser) Init()

func (*Parser) Keyword

func (p *Parser) Keyword(kw string, eatWsStart bool, eatWsEnd bool, caseInsensitive bool) ([]rune, error)

func (*Parser) Match

func (p *Parser) Match(rules []string) (*gabs.Container, error)

func (*Parser) Parse

func (p *Parser) Parse(text string) (*gabs.Container, error)

func (*Parser) SetText

func (p *Parser) SetText(text string)

func (*Parser) SplitCharRanges

func (p *Parser) SplitCharRanges(charClass string) ([]string, error)

func (*Parser) Start

func (p *Parser) Start() *gabs.Container

Jump to

Keyboard shortcuts

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