grammar

package
Version: v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	SP = ' '
)

Variables

This section is empty.

Functions

func Alpha

func Alpha(p *parser.Parser) (*parser.Cursor, bool)

func AttrExp

func AttrExp(p *ast.Parser) (*ast.Node, error)

func AttrName

func AttrName(p *ast.Parser) (*ast.Node, error)

func AttrPath

func AttrPath(p *ast.Parser) (*ast.Node, error)

func Character

func Character(p *ast.Parser) (*ast.Node, error)

func CompareOp

func CompareOp(p *ast.Parser) (*ast.Node, error)

func CompareValue

func CompareValue(p *ast.Parser) (*ast.Node, error)

func Digit

func Digit(p *parser.Parser) (*parser.Cursor, bool)

func Digits

func Digits(p *ast.Parser) (*ast.Node, error)

func Escaped

func Escaped(p *ast.Parser) (*ast.Node, error)

func Exp

func Exp(p *ast.Parser) (*ast.Node, error)

func False

func False(p *ast.Parser) (*ast.Node, error)
Example
p, _ := ast.New([]byte("FaLSe"))
fmt.Println(False(p))
Output:

[013] FaLSe <nil>

func Filter

func Filter(p *ast.Parser) (*ast.Node, error)

func FilterAnd

func FilterAnd(p *ast.Parser) (*ast.Node, error)
Example
p := func(s string) {
	p, _ := ast.New([]byte(s))
	fmt.Println(Filter(p))
}
p("title pr and userType eq \"Employee\"")
p("userType eq \"Employee\" and emails[type eq \"work\" and value co \"@example.com\"]")
Output:

[001] [[002] [[005] [[006] [[007] title]], [005] [[006] [[007] userType], [008] eq, [023] "Employee"]]] <nil>
[001] [[002] [[005] [[006] [[007] userType], [008] eq, [023] "Employee"], [009] [[006] [[007] emails], [011] [[005] [[006] [[007] type], [008] eq, [023] "work"], [005] [[006] [[007] value], [008] co, [023] "@example.com"]]]]] <nil>

func FilterNot

func FilterNot(p *ast.Parser) (*ast.Node, error)
Example
p := func(s string) {
	p, _ := ast.New([]byte(s))
	fmt.Println(Filter(p))
}
p("userType ne \"Employee\" and not (emails co \"example.com\" or emails.value co \"example.org\")")
Output:

[001] [[002] [[005] [[006] [[007] userType], [008] ne, [023] "Employee"], [003] [[001] [[002] [[005] [[006] [[007] emails], [008] co, [023] "example.com"]], [002] [[005] [[006] [[007] emails, [007] value], [008] co, [023] "example.org"]]]]]] <nil>

func FilterOr

func FilterOr(p *ast.Parser) (*ast.Node, error)
Example
p := func(s string) {
	p, _ := ast.New([]byte(s))
	fmt.Println(Filter(p))
}
p("title pr or userType eq \"Intern\"")
p("emails[type eq \"work\" and value co \"@example.com\"] or ims[type eq \"xmpp\" and value co \"@foo.com\"]")
Output:

[001] [[002] [[005] [[006] [[007] title]]], [002] [[005] [[006] [[007] userType], [008] eq, [023] "Intern"]]] <nil>
[001] [[002] [[009] [[006] [[007] emails], [011] [[005] [[006] [[007] type], [008] eq, [023] "work"], [005] [[006] [[007] value], [008] co, [023] "@example.com"]]]], [002] [[009] [[006] [[007] ims], [011] [[005] [[006] [[007] type], [008] eq, [023] "xmpp"], [005] [[006] [[007] value], [008] co, [023] "@foo.com"]]]]] <nil>

func FilterParentheses

func FilterParentheses(p *ast.Parser) (*ast.Node, error)
Example
p := func(s string) {
	p, _ := ast.New([]byte(s))
	fmt.Println(Filter(p))
}
p("userType eq \"Employee\" and (emails.type eq \"work\")")
p("userType eq \"Employee\" and (emails co \"example.com\" or emails.value co \"example.org\")")
Output:

[001] [[002] [[005] [[006] [[007] userType], [008] eq, [023] "Employee"], [001] [[002] [[005] [[006] [[007] emails, [007] type], [008] eq, [023] "work"]]]]] <nil>
[001] [[002] [[005] [[006] [[007] userType], [008] eq, [023] "Employee"], [001] [[002] [[005] [[006] [[007] emails], [008] co, [023] "example.com"]], [002] [[005] [[006] [[007] emails, [007] value], [008] co, [023] "example.org"]]]]] <nil>

func FilterValue

func FilterValue(p *ast.Parser) (*ast.Node, error)

func Frac

func Frac(p *ast.Parser) (*ast.Node, error)

func Int

func Int(p *ast.Parser) (*ast.Node, error)

func Minus

func Minus(p *ast.Parser) (*ast.Node, error)

func NameChar

func NameChar(p *ast.Parser) (*ast.Node, error)

func Null

func Null(p *ast.Parser) (*ast.Node, error)

func Number

func Number(p *ast.Parser) (*ast.Node, error)
Example
p, _ := ast.New([]byte("-10.0e+01"))
fmt.Println(Number(p))
Output:

[016] [[017] -, [022] 10, [021] [[020] 0], [018] [[019] +, [020] 01]] <nil>

func Path

func Path(p *ast.Parser) (*ast.Node, error)
Example
p, _ := ast.New([]byte("members[value eq \"2819c223-7f76-453a-919d-413861904646\"].displayName"))
fmt.Println(Path(p))
Output:

[004] [[009] [[006] [[007] members], [005] [[006] [[007] value], [008] eq, [023] "2819c223-7f76-453a-919d-413861904646"]], [007] displayName] <nil>

func Sign

func Sign(p *ast.Parser) (*ast.Node, error)

func String

func String(p *ast.Parser) (*ast.Node, error)
Example
p, _ := ast.New([]byte("\"2819c223-7f76-453a-919d-413861904646\""))
fmt.Println(String(p))
Output:

[023] "2819c223-7f76-453a-919d-413861904646" <nil>
Example (Complex)
p, _ := ast.New([]byte("\"W/\\\"990-6468886345120203448\\\"\""))
fmt.Println(String(p))
Output:

[023] "W/\"990-6468886345120203448\"" <nil>

func SubAttr

func SubAttr(p *ast.Parser) (*ast.Node, error)

func True

func True(p *ast.Parser) (*ast.Node, error)
Example
p, _ := ast.New([]byte("TRue"))
fmt.Println(True(p))
Output:

[015] TRue <nil>

func URI

func URI(p *ast.Parser) (*ast.Node, error)
Example
p, _ := ast.New([]byte("urn:ietf:params:scim:schemas:core:2.0:User:userName"))
fmt.Println(URI(p))
Output:

[024] urn:ietf:params:scim:schemas:core:2.0:User: <nil>

func Unescaped

func Unescaped(p *ast.Parser) (*ast.Node, error)

func ValueFilter

func ValueFilter(p *ast.Parser) (*ast.Node, error)

func ValueFilterAll

func ValueFilterAll(p *ast.Parser) (*ast.Node, error)

func ValueFilterNot

func ValueFilterNot(p *ast.Parser) (*ast.Node, error)

func ValueLogExpAnd

func ValueLogExpAnd(p *ast.Parser) (*ast.Node, error)

func ValueLogExpOr

func ValueLogExpOr(p *ast.Parser) (*ast.Node, error)

func ValuePath

func ValuePath(p *ast.Parser) (*ast.Node, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL