parse

package
v0.0.0-...-07e11ac Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewParser

func NewParser() *participle.Parser[Message]

Types

type Case

type Case struct {
	Name    string   `(@Ident | @Case)`
	Message *Message `"{" @@ "}"`
}

type Expr

type Expr struct {
	Name   string  `"{" @Ident`
	Func   string  `("," @Ident)?`
	Offset int     `("," "offset" ":" @Int)?`
	Cases  []*Case `(@@*)? "}"`
}

type Fragment

type Fragment struct {
	Escaped    string    `(@Escaped | @SubEscaped)`
	Text       string    `| (@String | @SubMessageString | @Quote | @SubQuote)`
	PlainArg   *PlainArg `| @@`
	Func       *Func     `| @@`
	Expr       *Expr     `| @@`
	Octothorpe bool      `| @"#"`
}

type Func

type Func struct {
	ArgName string `"{" @Ident `
	Func    string `"," @Ident`
	Param   string `("," @Ident )? "}"`
}

type Message

type Message struct {
	Fragments []*Fragment `@@*`
}

type PlainArg

type PlainArg struct {
	Name string `"{" @Ident "}"`
}

Jump to

Keyboard shortcuts

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