jinja

package
v0.0.0-...-459c047 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOWEST    int
	EQUALS    // ==
	LESSGREAT // > or <
	SUM       // +
	PRODUCT   // *
	PREFIX    // -x or +x
	FUNCTION  // myFunction(x)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Value    string
	Position int
}

type Expression

type Expression interface {
	Node
	// contains filtered or unexported methods
}

type ExpressionStatement

type ExpressionStatement struct {
	Value Expression
	Token Token
}

func (*ExpressionStatement) String

func (es *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLiteral

func (i *ExpressionStatement) TokenLiteral() string

type File

type File struct {
	Statements []Statement
}

Node

func (*File) String

func (f *File) String() string

func (*File) TokenLiteral

func (f *File) TokenLiteral() string

type Identifier

type Identifier struct {
	Value string
	Token Token
}

Expressions

func (*Identifier) String

func (i *Identifier) String() string

func (*Identifier) TokenLiteral

func (i *Identifier) TokenLiteral() string

type IntegerExpression

type IntegerExpression struct {
	Value int64
	Token Token
}

func (*IntegerExpression) String

func (i *IntegerExpression) String() string

func (*IntegerExpression) TokenLiteral

func (i *IntegerExpression) TokenLiteral() string

type Lexer

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

func NewJinjaLexer

func NewJinjaLexer(input string) *Lexer

func (*Lexer) NextToken

func (l *Lexer) NextToken() Token

type Node

type Node interface {
	TokenLiteral() string
	String() string
}

type Parser

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

func NewParser

func NewParser(l *Lexer) *Parser

func (*Parser) GetErrors

func (p *Parser) GetErrors() []Error

func (*Parser) Parse

func (p *Parser) Parse() *File

type SetStatment

type SetStatment struct {
	Value Expression
	Name  *Identifier
	Token Token
}

Statement

func (*SetStatment) String

func (ss *SetStatment) String() string

func (*SetStatment) TokenLiteral

func (ss *SetStatment) TokenLiteral() string

type Statement

type Statement interface {
	Node
	// contains filtered or unexported methods
}

type Token

type Token struct {
	Value string
	Token TokenType
}

type TokenType

type TokenType int
const (
	// general language things
	LEFT_BRACE TokenType = iota
	RIGHT_BRACE
	PERCENT
	IDENT
	INT
	PIPE
	TILDA
	LEFT_BRACKET
	RIGHT_BRACKET
	ASSIGN
	PLUS
	MINUS
	SLASH
	ASTERIKS
	COMMA
	BANG
	COLLECTION
	SEMI_COLON
	START_COLLECTION
	END_COLLECTION
	SINGLE_QUOTE
	QUOTE
	DOT
	LT
	GT
	EQ
	NOT_EQ

	// jinja opertations
	START_EXPRESSION
	START_STATEMENT
	START_COMMENT

	END_EXPRESSION
	END_STATEMENT
	END_COMMENT

	// keywords
	SET
	END_SET
	FOR
	END_FOR
	IN
	BLOCK
	END_BLOCK
	EXTENDS
	IS
	MACRO
	END_MACRO
	IF
	ELIF
	SCOPED
	CALL
	END_CALL
	FILTER
	END_FILTER
	NOT

	// other stuff
	ILLEGAL
	WS

	// special characters
	TEXT
	EOF
)

func LookupIdent

func LookupIdent(ident string) TokenType

Jump to

Keyboard shortcuts

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