internal

package
v0.8.10 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ILLEGAL = "Illegal"
	EOF     = "Eof"
	EOL     = '\n'

	LITERAL         = "LITERAL"
	ARG             = "@arg"     // Literal will be the remainder of the line
	CONTEXT         = "@context" // Context variable expected
	ATDisplayBool   = "@bool="   // write integer
	ATDisplayInt    = "@int="    // write integer
	ATDisplayInt64  = "@int64="  // write integer
	ATDisplay       = "@="       // Literal will be up to the eol/eof or next @   @= name @
	ATDisplayUnsafe = "@=="      // Literal will be up to the eol/eof or next @   @= name @
	IMPORT          = "@import"  // Placed at the begging for go imports
	INCLUDE         = "@include" // includes another template but no embedded content
	EXTEND          = "@extend"  // includes another template
	CONTENT         = "@content" // The content to embed
	YIELD           = "@yield"   // provide content to the included template
	STARTBLOCK      = "@code"    // Start of a code block. embedded in the code
	FUNCTS          = "@func"    // functions. embedded in the code
	TEXT            = "@text"    // text block written to the output stream
	IF              = "@if"      // The if statement convert to if <content> {
	ELSE            = "@else"    // converts to } else {
	END             = "@end"     // converts to } and ends the block (returns from nesting)
	FOR             = "@for"     // convert for for range loop

)
View Source
const (
	NODE_ROOT = iota
	NODE_TOKEN
	NODE_INCLUDE_SIMPLE
	NODE_INCLUDE
	NODE_CONTENT
	NODE_FUNC
	NODE_CODEBLOCK
	NODE_TEXT
	NODE_DISPLAY
	NODE_DISPLAY_RAW
	NODE_DISPLAY_BOOL
	NODE_DISPLAY_INT
	NODE_DISPLAY_INT64
	NODE_TOKEN_RAW
	NODE_YIELD
	NODE_IF
	NODE_FOR
	NODE_ELSE
	NODE_ENDIF
	NODE_END
)

Variables

View Source
var Name = "Blip Template Compiler"
View Source
var Version = "0.8.10"

Functions

func GteProcess

func GteProcess(opt *BlipOptions)

Types

type BlipOptions

type BlipOptions struct {
	Sdir              string
	Rebuild           bool
	Watch             bool
	SupportBranch     string
	RenderLineNumbers bool
}

type Lexer

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

func NewLexer

func NewLexer(input string, fname string) *Lexer

func (*Lexer) NextToken

func (l *Lexer) NextToken() (tk *Token)

NextToken On input l.ch is the current character On output should be at next character after token required characters. peekChar will be looking at the next character

func (*Lexer) PriorToken

func (l *Lexer) PriorToken() *Token

type PError

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

type Parser

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

func New

func New(lex *Lexer) *Parser

func (*Parser) Dump

func (p *Parser) Dump()

func (*Parser) IsLiteralWhiteSpace

func (p *Parser) IsLiteralWhiteSpace(literal string) bool

func (*Parser) Parse

func (p *Parser) Parse()

Parse At a top level node

type Render

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

func NewRender

func NewRender(p *Parser) *Render

func (*Render) RenderOutput

func (r *Render) RenderOutput(o io.Writer, packageName string, templateName string, langType string, sourcefile string, opt *BlipOptions)

RenderOutput -- Writes the parse treee out as a golang file

func (*Render) WriteNodeForStatement

func (r *Render) WriteNodeForStatement(o io.Writer, base *astBase, depth int)

func (*Render) WriteNodeSimpleCall

func (r *Render) WriteNodeSimpleCall(o io.Writer, node ast, depth int, contextName string)

type Token

type Token struct {
	Type    TokenType
	Literal string
	Line    int
	Pos     int
}

type TokenType

type TokenType string

TokenType == May be better as an integer!

Jump to

Keyboard shortcuts

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