parser

package
v0.0.0-...-f8b5ee7 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package parser is license expression parser.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidExpression = xerrors.New("invalid expression error")
)

Functions

This section is empty.

Types

type LicenseExpression

type LicenseExpression struct {
	Node     Node
	Operator string
	Next     *LicenseExpression
}

type Node

type Node struct {
	License           string
	LicenseExpression *LicenseExpression
}

type NormalizeFunc

type NormalizeFunc func(n string) string

type Pair

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

type Parser

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

func New

func New(lex *lexer.Lexer) *Parser

func (*Parser) Normalize

func (p *Parser) Normalize(l *LicenseExpression) string

func (*Parser) Parse

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

func (*Parser) RegisterNormalizeFunc

func (p *Parser) RegisterNormalizeFunc(fn ...NormalizeFunc) *Parser

type Stack

type Stack []Pair

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

func (*Stack) Pop

func (s *Stack) Pop() Pair

func (*Stack) Push

func (s *Stack) Push(x Pair)

Jump to

Keyboard shortcuts

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