ast

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: BSD-3-Clause, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileToString

func CompileToString(forms *Forms) string

Types

type BinaryExpr

type BinaryExpr struct {
	X  Node
	Op Token // and, or, ==, !=
	Y  Node
}

func (BinaryExpr) Type

func (e BinaryExpr) Type() Token

type Forms

type Forms struct {
	NPlurals int
	Root     Node
}

func MustParse

func MustParse(rule string) *Forms

func Parse

func Parse(rule string) (*Forms, error)

type Node

type Node interface {
	Type() Token
}

type OperandExpr

type OperandExpr struct{}

func (OperandExpr) Type

func (OperandExpr) Type() Token

type QuestionMarkExpr

type QuestionMarkExpr struct {
	Cond Node
	T    Node
	F    Node
}

func (QuestionMarkExpr) Type

func (QuestionMarkExpr) Type() Token

type Token

type Token string
const (
	Value   Token = "Value" // 1, 2, 100, etc.
	Operand Token = "n"

	Equal Token = "=="

	Greater        Token = ">"
	GreaterOrEqual Token = ">="
	Less           Token = "<"
	LessOrEqual    Token = "<="
	Reminder       Token = "%"
	NotEqual       Token = "!="
	LogicalAnd     Token = "&&"
	LogicalOr      Token = "||"
	Question       Token = "?"
)

type ValueExpr

type ValueExpr struct {
	Value int64
}

func (ValueExpr) Type

func (ValueExpr) Type() Token

Jump to

Keyboard shortcuts

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