grammar

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LuaComment

func LuaComment() Reader

func LuaNumeral

func LuaNumeral() Reader

func LuaString

func LuaString() Reader

Types

type JSONReader

type JSONReader struct {
	Value      Rule `name:"value"`
	Object     Rule `name:"object"`
	Members    Rule `name:"members"`
	Member     Rule `name:"member"`
	Key        Rule `name:"key"`
	Array      Rule `name:"array"`
	Elements   Rule `name:"elements"`
	Element    Rule `name:"element"`
	String     Rule `name:"string"`
	Characters Rule `name:"characters"`
	Character  Rule `name:"character"`
	Escape     Rule `name:"escape"`
	Hex        Rule `name:"hex"`
	Number     Rule `name:"number"`
	Integer    Rule `name:"integer"`
	Fraction   Rule `name:"fraction"`
	Exponent   Rule `name:"exponent"`
	OneNine    Rule `name:"onenine"`
	Digit      Rule `name:"digit"`
	Digits     Rule `name:"digits"`
	Sign       Rule `name:"sign"`
	Bool       Rule `name:"bool"`
	Null       Rule `name:"null"`
	WS         Rule `name:"ws"`
}

func JSON

func JSON() *JSONReader

JSON creates a Grammar to Read a JSON file. The implementation is based on https://www.crockford.com/mckeeman.html

func (*JSONReader) Grammar

func (r *JSONReader) Grammar() []*Rule

func (*JSONReader) Read

func (r *JSONReader) Read(s *Scanner) error

func (*JSONReader) What

func (r *JSONReader) What() string

type LuaReader

type LuaReader struct {
	SheBang       Rule `name:"SheBang"`
	Name          Rule `name:"Name"`
	Numeral       Rule `name:"Numeral"`
	LiteralString Rule `name:"LiteralString"`
	Comment       Rule `name:"Comment"`

	UnOp  Rule `name:"unop"`
	BinOp Rule `name:"binop"`

	FieldSep         Rule `name:"fieldsep"`
	Field            Rule `name:"field"`
	FieldList        Rule `name:"fieldlist"`
	TableConstructor Rule `name:"tableconstructor"`

	FuncParams Rule `name:"funcparams"`
	FuncBody   Rule `name:"funcbody"`
	FuncDef    Rule `name:"funcdef"`
	FuncArgs   Rule `name:"funcargs"`
	FuncCall   Rule `name:"funccall"`

	PrefixExp Rule `name:"prefixexp"`
	FinalExp  Rule `name:"finalexp"`
	Exp       Rule `name:"exp"`
	ExpList   Rule `name:"explist"`
	NameList  Rule `name:"namelist"`
	VarSuffix Rule `name:"varsuffix"`
	Var       Rule `name:"var"`
	VarList   Rule `name:"varlist"`

	FuncName    Rule `name:"funcname"`
	Label       Rule `name:"label"`
	RetStat     Rule `name:"retstat"`
	Attrib      Rule `name:"attrib"`
	AttNameList Rule `name:"attnamelist"`
	Break       Rule `name:"break"`
	GoTo        Rule `name:"goto"`
	Do          Rule `name:"do"`
	While       Rule `name:"while"`
	Repeat      Rule `name:"repeat"`
	IfElse      Rule `name:"ifelse"`
	For         Rule `name:"for"`
	ForEach     Rule `name:"foreach"`
	Func        Rule `name:"func"`
	LocalFunc   Rule `name:"localfunc"`
	LocalAtt    Rule `name:"localatt"`
	Stat        Rule `name:"stat"`

	Block  Rule `name:"block"`
	Chunk  Rule `name:"chunk"`
	Script Rule `name:"script"`
}

func Lua

func Lua() *LuaReader

Lua creates a Grammar to Read a Lua file. The implementation is based on https://www.lua.org/manual/5.4/manual.html#9

func (*LuaReader) Grammar

func (r *LuaReader) Grammar() []*Rule

func (*LuaReader) Read

func (r *LuaReader) Read(s *Scanner) error

func (*LuaReader) What

func (r *LuaReader) What() string

type MXTReader

type MXTReader struct {
	Chunks       Rule `name:"chunks"`
	Chunk        Rule `name:"chunk"`
	Header       Rule `name:"header"`
	Marker       Rule `name:"marker"`
	NextMarker   Rule `name:"next-marker"`
	Name         Rule `name:"name"`
	Comment      Rule `name:"comment"`
	Arrow        Rule `name:"arrow"`
	Salt         Rule `name:"salt"`
	EmptyContent Rule `name:"empty-content"`
	Content      Rule `name:"content"`
	Word         Rule `name:"word"`
	WordChar     Rule `name:"wordchar"`
	NL           Rule `name:"nl"`
}

func MXT

func MXT() *MXTReader

MXT creates a Grammar to Read a MXT file. The implementation is based on https://mxt.aiq.dk/

func (*MXTReader) Grammar

func (r *MXTReader) Grammar() []*Rule

func (*MXTReader) Read

func (r *MXTReader) Read(s *Scanner) error

func (*MXTReader) What

func (r *MXTReader) What() string

Jump to

Keyboard shortcuts

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