funny

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: Apache-2.0 Imports: 21 Imported by: 1

README

funny lang

A funny language interpreter written in golang.

It begins just for fun.

Target

To make creating dsl easily based on funny.

  • apitest dsl
  • api declare dsl

Installation

go install github.com/jerloo/funny/cmd/funny@latest

Usage


// funny.fun
// author: jerloo@gmail.com
// github: https://github.com/jerloo/funny

echoln('define a varible value 1')
a = 1

echoln('define b varible value 2')
b = 2

echoln('define c varible value a ')
c = a

echoln('a, b, c values: ')
echoln('a = ', a,', b = ',  b, ', c = ', c)

echoln('assert c equels 1')
assert(c == 1)

d = c + b

echoln('assert (d = c + b) === ', d)
assert(d == 3)

echoln('define a function ')
echoln('minus(a, b) {')
echoln('  return b - a')
echoln('}')

minus(a, b) {
  return b - a
}

e = minus(a, b)
echoln('minus(a, b) === ', e)
assert(e == 1)

if a > 0 {
  echoln('if a > 0')
}

fib(n) {
  if n < 2 {
    return n
  }
  return fib(n - 1) + fib(n - 2)
}

r = fib(1)
echoln(r)
r = fib(2)
echoln(r)
r = fib(3)
echoln(r)
r = fib(4)
echoln(r)
r = fib(5)
echoln(r)
r = fib(6)
echoln(r)
r = fib(7)
echoln(r)
r = fib(8)
echoln(r)

person = {
  name = 'jerloo'
  age = 10
}
assert(person.name == 'jerloo')
echoln(person.age)

Object() {
  return {
    name = 'jerloo'
    age = 10
    isAdult() {
      this.age = this.age + 5
      echoln('this.age ', this.age)
      return true
    }
  }
}

obj = Object()
assert(obj.name == 'jerloo')
obj.age = 20
assert(obj.age == 20)
assert(obj.isAdult())
echoln(obj.isAdult())
echoln(obj.age)

arrdemo = [1,2,3]
echoln(arrdemo[2])
assert(arrdemo[2]==3)

hashTest = 'i am string'
echoln(hashTest)
echoln('hash(i am string) => ', hash(hashTest))

echoln('max(10, 20) => ', max(10,20))

import 'funny.imported.fun'

echoln('uuid => ', uuid())

deepObj = {
  a = {
    b = {
      c = 1
    }
  }
}

echoln('deepObj.a =>', test.a)
echoln('deepObj.a.b =>', test.a.b)
echoln('deepObj.a.b.c =>', test.a.b.c)
$ funny --help

usage: funny [<flags>] [<script>]

funny lang

Flags:
  --help    Show context-sensitive help (also try --help-long and --help-man).
  --lexer   tokenizer script
  --parser  parser AST

Args:
  [<script>]  script file path

Todos

  • Fix many and many bugs
  • Fix scope
  • Fix echo
  • Add more builtin functions
  • Add tests
  • Fix import feature
  • Typings
  • module and package feature
  • module repo based on github
  • Add everything with(have) comment's feature
  • Chinese comments length

License

The MIT License (MIT)

Copyright (c) 2018 jerloo

Documentation

Index

Constants

View Source
const (
	STNewLine            = "NewLine"
	STVariable           = "Variable"
	STLiteral            = "Literal"
	STBinaryExpression   = "BinaryExpression"
	STAssign             = "Assign"
	STBlock              = "Block"
	STList               = "List"
	STListAccess         = "ListAccess"
	STFunction           = "Function"
	STFunctionCall       = "FunctionCall"
	STImportFunctionCall = "Import"
	STIfStatement        = "IfStatement"
	STForStatement       = "ForStatement"
	STIterableExpression = "IterableExpression"
	STBreak              = "Break"
	STContinue           = "Continue"
	STReturn             = "Return"
	STField              = "Field"
	STBoolean            = "Boolean"
	STStringExpression   = "StringExpression"
	STComment            = "Comment"
)
View Source
const (
	LBrace      = "{"
	RBrace      = "}"
	LBracket    = "["
	RBracket    = "]"
	LParenthese = "("
	RParenthese = ")"
	EQ          = "="
	DOUBLE_EQ   = "=="
	PLUS        = "+"
	MINUS       = "-"
	TIMES       = "*"
	DEVIDE      = "/"
	Quote       = "\""
	GT          = ">"
	LT          = "<"
	GTE         = ">="
	LTE         = "<="
	NOTEQ       = "!="
	COMMA       = ","
	DOT         = "."
	EOF         = "EOF"
	INT         = "INT"
	NAME        = "NAME"
	STRING      = "STRING"

	IF       = "if"
	ELSE     = "else"
	TRUE     = "true"
	FALSE    = "false"
	FOR      = "for"
	AND      = "and"
	IN       = "in"
	NIL      = "nil"
	NOT      = "not"
	OR       = "or"
	RETURN   = "return"
	BREAK    = "break"
	CONTINUE = "continue"

	NEW_LINE = "\\n"
	COMMENT  = "comment"
)
View Source
const (
	// VERSION of funny
	VERSION = "0.0.1"
)

Variables

View Source
var BuiltinsDotFunny string
View Source
var (
	// FUNCTIONS all builtin functions
	FUNCTIONS = map[string]BuiltinFunction{
		"echo":     Echo,
		"echoln":   Echoln,
		"now":      Now,
		"b64en":    Base64Encode,
		"b64de":    Base64Decode,
		"assert":   Assert,
		"len":      Len,
		"md5":      Md5,
		"max":      Max,
		"min":      Min,
		"typeof":   Typeof,
		"uuid":     UUID,
		"httpreq":  HttpRequest,
		"env":      Env,
		"strjoin":  StrJoin,
		"strsplit": StrSplit,
		"str":      Str,
		"int":      Int,
		"jwten":    JwtEncode,
		"jwtde":    JwtDecode,
		"sqlquery": SqlQuery,
		"sqlexec":  SqlExec,
	}
)
View Source
var Keywords = map[string]string{
	"and":      "and",
	"else":     "else",
	"false":    "false",
	"for":      "for",
	"if":       "if",
	"in":       "in",
	"nil":      "nil",
	"not":      "not",
	"or":       "or",
	"return":   "return",
	"true":     "true",
	"break":    "break",
	"continue": "continue",
}

Functions

func CombinedCode

func CombinedCode(basePath, filename string) (string, error)

CombinedCode get combined code that using import

func Format

func Format(data []byte, contentFile string) string

func P

func P(keyword string, posContent FunnyContent) error

P panic

func Typing

func Typing(data interface{}) string

Typing return the type name of one object

Types

type Assign

type Assign struct {
	Target Expression
	Value  Expression
	// contains filtered or unexported fields
}

Assign like a = 2

func (*Assign) Descriptor

func (n *Assign) Descriptor() *AstDescriptor

func (*Assign) Position

func (a *Assign) Position() Position

Position of Assign

func (*Assign) String

func (a *Assign) String() string

func (*Assign) Type

func (a *Assign) Type() string

type AstDescriptor

type AstDescriptor struct {
	Type     string
	Position Position
	Name     string
	Text     string
	Children []*AstDescriptor
}

type BinaryExpression

type BinaryExpression struct {
	Left     Expression
	Operator Token
	Right    Expression
	// contains filtered or unexported fields
}

BinaryExpression like a > 10

func (*BinaryExpression) Descriptor

func (n *BinaryExpression) Descriptor() *AstDescriptor

func (*BinaryExpression) Position

func (b *BinaryExpression) Position() Position

Position of BinaryExpression

func (*BinaryExpression) String

func (b *BinaryExpression) String() string

func (*BinaryExpression) Type

func (n *BinaryExpression) Type() string

type Block

type Block []Statement

Block contains many statments

func (*Block) Descriptor

func (b *Block) Descriptor() *AstDescriptor

func (*Block) Format

func (b *Block) Format(root bool) string

func (*Block) Position

func (b *Block) Position() Position

Position of Block

func (*Block) String

func (b *Block) String() string

func (*Block) Type

func (b *Block) Type() string

type Boolen

type Boolen struct {
	Value bool
	// contains filtered or unexported fields
}

Boolen like true, false

func (*Boolen) Descriptor

func (n *Boolen) Descriptor() *AstDescriptor

func (*Boolen) Position

func (b *Boolen) Position() Position

Position of Boolen

func (*Boolen) String

func (b *Boolen) String() string

func (*Boolen) Type

func (b *Boolen) Type() string

type Break

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

Break like break in for

func (*Break) Descriptor

func (n *Break) Descriptor() *AstDescriptor

func (*Break) Position

func (b *Break) Position() Position

Position of Break

func (*Break) String

func (b *Break) String() string

func (*Break) Type

func (i *Break) Type() string

type BuiltinFunction

type BuiltinFunction func(interpreter *Interpreter, args []Value) Value

BuiltinFunction function handler

type Comment

type Comment struct {
	Value string
	// contains filtered or unexported fields
}

Comment line for sth

func (*Comment) Descriptor

func (n *Comment) Descriptor() *AstDescriptor

func (*Comment) Position

func (c *Comment) Position() Position

Position of comment

func (*Comment) String

func (c *Comment) String() string

func (*Comment) Type

func (b *Comment) Type() string

type Continue

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

Continue like continue in for

func (*Continue) Descriptor

func (n *Continue) Descriptor() *AstDescriptor

func (*Continue) Position

func (b *Continue) Position() Position

Position of Continue

func (*Continue) String

func (b *Continue) String() string

func (*Continue) Type

func (i *Continue) Type() string

type Expression

type Expression interface {
	Position() Position
	String() string
	Type() string
	Descriptor() *AstDescriptor
}

Expression abstract

type FORStatement

type FORStatement struct {
	Iterable IterableExpression
	Block    Block

	CurrentIndex Variable
	CurrentItem  Expression
	// contains filtered or unexported fields
}

FORStatement like for

func (*FORStatement) Descriptor

func (n *FORStatement) Descriptor() *AstDescriptor

func (*FORStatement) Position

func (f *FORStatement) Position() Position

Position of FORStatement

func (*FORStatement) String

func (f *FORStatement) String() string

func (*FORStatement) Type

func (i *FORStatement) Type() string

type Field

type Field struct {
	Variable Variable
	Value    Expression
	// contains filtered or unexported fields
}

Field like obj.age

func (*Field) Descriptor

func (n *Field) Descriptor() *AstDescriptor

func (*Field) Position

func (f *Field) Position() Position

Position of Field

func (*Field) String

func (f *Field) String() string

func (*Field) Type

func (i *Field) Type() string

type Function

type Function struct {
	Name       string
	Parameters []Expression
	Body       Block
	// contains filtered or unexported fields
}

Function like test(a, b){}

func (*Function) Descriptor

func (n *Function) Descriptor() *AstDescriptor

func (*Function) Position

func (f *Function) Position() Position

Position of Function

func (*Function) SignatureString

func (f *Function) SignatureString() string

func (*Function) String

func (f *Function) String() string

func (*Function) Type

func (a *Function) Type() string

type FunctionCall

type FunctionCall struct {
	Name       string
	Parameters []Expression
	// contains filtered or unexported fields
}

FunctionCall like test(a, b)

func (*FunctionCall) Descriptor

func (c *FunctionCall) Descriptor() *AstDescriptor

func (*FunctionCall) Position

func (c *FunctionCall) Position() Position

Position of FunctionCall

func (*FunctionCall) String

func (c *FunctionCall) String() string

func (*FunctionCall) Type

func (c *FunctionCall) Type() string

type FunnyContent

type FunnyContent interface {
	String() string
}

type FunnyRuntimeError

type FunnyRuntimeError struct {
	FunnyContent FunnyContent
	Msg          string
}

func (*FunnyRuntimeError) Error

func (fre *FunnyRuntimeError) Error() string

type IFStatement

type IFStatement struct {
	Condition Expression
	Body      Block
	Else      Block
	// contains filtered or unexported fields
}

IFStatement like if

func (*IFStatement) Descriptor

func (i *IFStatement) Descriptor() *AstDescriptor

func (*IFStatement) Position

func (i *IFStatement) Position() Position

Position of IFStatement

func (*IFStatement) String

func (i *IFStatement) String() string

func (*IFStatement) Type

func (i *IFStatement) Type() string

type ImportFunctionCall

type ImportFunctionCall struct {
	ModulePath string
	Block      *Block
	// contains filtered or unexported fields
}

ImportFunctionCall like test(a, b)

func (*ImportFunctionCall) Descriptor

func (c *ImportFunctionCall) Descriptor() *AstDescriptor

func (*ImportFunctionCall) Position

func (c *ImportFunctionCall) Position() Position

Position of ImportFunctionCall

func (*ImportFunctionCall) String

func (c *ImportFunctionCall) String() string

func (*ImportFunctionCall) Type

func (c *ImportFunctionCall) Type() string

type Interpreter

type Interpreter struct {
	Vars      []Scope
	Functions map[string]BuiltinFunction
}

Interpreter the virtual machine of funny code

func NewInterpreterWithScope

func NewInterpreterWithScope(vars Scope) *Interpreter

NewInterpreterWithScope create a new interpreter

func (*Interpreter) Assign

func (i *Interpreter) Assign(name string, val Value)

Assign assign one variable

func (*Interpreter) AssignField

func (i *Interpreter) AssignField(field *Field, val Value)

AssignField assign one field value

func (*Interpreter) Debug

func (i *Interpreter) Debug() bool

Debug get debug value

func (*Interpreter) EvalBlock

func (i *Interpreter) EvalBlock(block Block) (Value, bool)

EvalBlock eval a block

func (*Interpreter) EvalDevide

func (i *Interpreter) EvalDevide(left, right Value) Value

EvalDevide /

func (*Interpreter) EvalDoubleEq

func (i *Interpreter) EvalDoubleEq(left, right Value) Value

EvalDoubleEq ==

func (*Interpreter) EvalEqual

func (i *Interpreter) EvalEqual(left, right Value) Value

EvalEqual ==

func (*Interpreter) EvalExpression

func (i *Interpreter) EvalExpression(expression Expression) Value

EvalExpression eval part that is expression

func (*Interpreter) EvalField

func (i *Interpreter) EvalField(item *Field) Value

EvalField person.age

func (*Interpreter) EvalForStatement

func (i *Interpreter) EvalForStatement(item *FORStatement) (Value, bool)

EvalForStatement eval for statement

func (*Interpreter) EvalFunction

func (i *Interpreter) EvalFunction(item Function, params []Value) (Value, bool)

EvalFunction eval function

func (*Interpreter) EvalFunctionCall

func (i *Interpreter) EvalFunctionCall(item *FunctionCall) (Value, bool)

EvalFunctionCall eval function call like test(a, b)

func (*Interpreter) EvalGt

func (i *Interpreter) EvalGt(left, right Value) Value

EvalGt >

func (*Interpreter) EvalGte

func (i *Interpreter) EvalGte(left, right Value) Value

EvalGte >=

func (*Interpreter) EvalIfStatement

func (i *Interpreter) EvalIfStatement(item *IFStatement) (Value, bool)

EvalIfStatement eval if statement

func (*Interpreter) EvalLt

func (i *Interpreter) EvalLt(left, right Value) Value

EvalLt <

func (*Interpreter) EvalLte

func (i *Interpreter) EvalLte(left, right Value) Value

EvalLte <=

func (*Interpreter) EvalMinus

func (i *Interpreter) EvalMinus(left, right Value) Value

EvalMinus -

func (*Interpreter) EvalPlus

func (i *Interpreter) EvalPlus(left, right Value) Value

EvalPlus +

func (*Interpreter) EvalStatement

func (i *Interpreter) EvalStatement(item Statement) (Value, bool)

EvalStatement eval statement

func (*Interpreter) EvalTimes

func (i *Interpreter) EvalTimes(left, right Value) Value

EvalTimes *

func (*Interpreter) Lookup

func (i *Interpreter) Lookup(name string) Value

Lookup find one variable named name and get value

func (*Interpreter) LookupDefault

func (i *Interpreter) LookupDefault(name string, defaultVal Value) Value

LookupDefault find one variable named name and get value, if not found, return default

func (*Interpreter) PopScope

func (i *Interpreter) PopScope()

PopScope pop current scope

func (*Interpreter) PushScope

func (i *Interpreter) PushScope(scope Scope)

PushScope push scope into current

func (*Interpreter) RegisterFunction

func (i *Interpreter) RegisterFunction(name string, fn BuiltinFunction) error

RegisterFunction register a builtin or customer function

func (*Interpreter) Run

func (i *Interpreter) Run(v interface{}) (Value, bool)

Run the part of the code

func (*Interpreter) RunFile

func (i *Interpreter) RunFile(filename string) (Value, bool)

type IterableExpression

type IterableExpression struct {
	Name  Variable
	Index int
	Items []Expression
	// contains filtered or unexported fields
}

IterableExpression like for in

func (*IterableExpression) Descriptor

func (n *IterableExpression) Descriptor() *AstDescriptor

func (*IterableExpression) Next

func (i *IterableExpression) Next() (int, Expression)

Next part of IterableExpression

func (*IterableExpression) Position

func (i *IterableExpression) Position() Position

Position of IterableExpression

func (*IterableExpression) String

func (i *IterableExpression) String() string

func (*IterableExpression) Type

func (i *IterableExpression) Type() string

type Lexer

type Lexer struct {
	Offset     int
	CurrentPos Position

	SaveOffset int
	SavePos    Position
	Data       []byte
	Elements   []Token
}

Lexer the lexer

func NewLexer

func NewLexer(data []byte) *Lexer

NewLexer create a new lexer

func (*Lexer) Consume

func (l *Lexer) Consume(n int) rune

Consume next char and move position

func (*Lexer) CreateToken

func (l *Lexer) CreateToken(kind string) Token

CreateToken create a new token and move position

func (*Lexer) LA

func (l *Lexer) LA(n int) rune

LA next char

func (*Lexer) NewLine

func (l *Lexer) NewLine() Token

NewLine move to next line

func (*Lexer) Next

func (l *Lexer) Next() Token

Next get next token

func (*Lexer) ReadComments

func (l *Lexer) ReadComments() Token

ReadComments read comments

func (*Lexer) ReadInt

func (l *Lexer) ReadInt() Token

ReadInt get a into from current position

func (*Lexer) ReadString

func (l *Lexer) ReadString() Token

ReadString read next string token

func (*Lexer) Reset

func (l *Lexer) Reset()

Reset reset the position

type List

type List struct {
	Values []Expression
	// contains filtered or unexported fields
}

List like [1, 2, 3]

func (*List) Descriptor

func (n *List) Descriptor() *AstDescriptor

func (*List) Position

func (l *List) Position() Position

Position of List

func (*List) String

func (l *List) String() string

func (*List) Type

func (a *List) Type() string

type ListAccess

type ListAccess struct {
	Index int
	List  Variable
	// contains filtered or unexported fields
}

ListAccess like a[0]

func (*ListAccess) Descriptor

func (n *ListAccess) Descriptor() *AstDescriptor

func (*ListAccess) Position

func (l *ListAccess) Position() Position

Position of ListAccess

func (*ListAccess) String

func (l *ListAccess) String() string

func (*ListAccess) Type

func (l *ListAccess) Type() string

type Literal

type Literal struct {
	Value interface{}
	// contains filtered or unexported fields
}

Literal like 1

func (*Literal) Descriptor

func (n *Literal) Descriptor() *AstDescriptor

func (*Literal) Position

func (l *Literal) Position() Position

Position of Literal

func (*Literal) String

func (l *Literal) String() string

func (*Literal) Type

func (n *Literal) Type() string

type NewLine

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

NewLine @impl Statement \n

func (*NewLine) Descriptor

func (n *NewLine) Descriptor() *AstDescriptor

func (*NewLine) Position

func (n *NewLine) Position() Position

Position of NewLine

func (*NewLine) String

func (n *NewLine) String() string

func (*NewLine) Type

func (n *NewLine) Type() string

type Parser

type Parser struct {
	Lexer   *Lexer
	Current Token

	Tokens []Token

	ContentFile string
}

Parser the parser

func NewParser

func NewParser(data []byte) *Parser

NewParser create a new parser

func (*Parser) Consume

func (p *Parser) Consume(kind string) Token

Consume get next token

func (*Parser) Parse

func (p *Parser) Parse() Block

Parse parse to statements

func (*Parser) ReadDict

func (p *Parser) ReadDict() Expression

ReadDict read dict expression

func (*Parser) ReadExpression

func (p *Parser) ReadExpression() Expression

ReadExpression read next expression

func (*Parser) ReadFOR

func (p *Parser) ReadFOR() Statement

ReadFOR read for statement

func (*Parser) ReadField

func (p *Parser) ReadField() Expression

ReadField read field expression

func (*Parser) ReadFunction

func (p *Parser) ReadFunction(name string) Statement

ReadFunction read function statement

func (*Parser) ReadIF

func (p *Parser) ReadIF() Statement

ReadIF get next if statement

func (*Parser) ReadList

func (p *Parser) ReadList() Expression

ReadList read list expression

func (*Parser) ReadStatement

func (p *Parser) ReadStatement() Statement

ReadStatement get next statement

type Position

type Position struct {
	Line int
	Col  int
}

Position of one token

func (*Position) String

func (p *Position) String() string

String of one token

type Program

type Program struct {
	Statements Block
}

Program means the whole application

func (*Program) String

func (p *Program) String() string

type Return

type Return struct {
	Value Expression
	// contains filtered or unexported fields
}

Return like return varA

func (*Return) Descriptor

func (n *Return) Descriptor() *AstDescriptor

func (*Return) Position

func (r *Return) Position() Position

Position of Return

func (*Return) String

func (r *Return) String() string

func (*Return) Type

func (i *Return) Type() string

type Scope

type Scope map[string]Value

Scope stores variables

type Statement

type Statement interface {
	Position() Position
	String() string
	Type() string
	Descriptor() *AstDescriptor
}

Statement abstract

type StringExpression

type StringExpression struct {
	Value string
	// contains filtered or unexported fields
}

StringExpression like 'hello world !'

func (*StringExpression) Descriptor

func (n *StringExpression) Descriptor() *AstDescriptor

func (*StringExpression) Position

func (s *StringExpression) Position() Position

Position of StringExpression

func (*StringExpression) String

func (s *StringExpression) String() string

func (*StringExpression) Type

func (b *StringExpression) Type() string

type Token

type Token struct {
	Position Position
	Kind     string
	Data     string
}

Token a part of code

func (Token) String

func (t Token) String() string

type Value

type Value interface {
}

Value one value of some like variable

func Assert

func Assert(interpreter *Interpreter, args []Value) Value

Assert return the value that has been given

func Base64Decode

func Base64Decode(interpreter *Interpreter, args []Value) Value

Base64Decode return base64 decoded string

func Base64Encode

func Base64Encode(interpreter *Interpreter, args []Value) Value

Base64Encode return base64 encoded string

func Echo

func Echo(interpreter *Interpreter, args []Value) Value

Echo builtin function echos one or every item in a array

func Echoln

func Echoln(interpreter *Interpreter, args []Value) Value

Echoln builtin function echos one or every item in a array

func Env

func Env(interpreter *Interpreter, args []Value) Value

Env return the value of env key

func HttpRequest

func HttpRequest(interpreter *Interpreter, args []Value) Value

HttpRequest builtin function for http request

func Int

func Int(interpreter *Interpreter, args []Value) Value

Int like int('1')

func JwtDecode

func JwtDecode(interpreter *Interpreter, args []Value) Value

JwtDecode jwtde(method, secret, token) string

func JwtEncode

func JwtEncode(interpreter *Interpreter, args []Value) Value

JwtEncode jwten(method, secret, claims) string

func Len

func Len(interpreter *Interpreter, args []Value) Value

Len return then length of the given list

func Max

func Max(interpreter *Interpreter, args []Value) Value

Max return then length of the given list

func Md5

func Md5(interpreter *Interpreter, args []Value) Value

Md5 return then length of the given list

func Min

func Min(interpreter *Interpreter, args []Value) Value

Min return then length of the given list

func Now

func Now(interpreter *Interpreter, args []Value) Value

Now builtin function return now time

func SqlExec

func SqlExec(interpreter *Interpreter, args []Value) Value

SqlExec sqlexec(connection, sqlRaw, args) string

func SqlQuery

func SqlQuery(interpreter *Interpreter, args []Value) Value

SqlQuery sqlquery(connection, sqlRaw, args) string

func Str

func Str(interpreter *Interpreter, args []Value) Value

Str like string(1)

func StrJoin

func StrJoin(interpreter *Interpreter, args []Value) Value

StrJoin equal strings.Join

func StrSplit

func StrSplit(interpreter *Interpreter, args []Value) Value

StrSplit equal strings.Split

func Typeof

func Typeof(interpreter *Interpreter, args []Value) Value

Typeof builtin function echos one or every item in a array

func UUID

func UUID(interpreter *Interpreter, args []Value) Value

UUID builtin function return a uuid string value

type Variable

type Variable struct {
	Name string
	// contains filtered or unexported fields
}

Variable means var

func (*Variable) Descriptor

func (n *Variable) Descriptor() *AstDescriptor

func (*Variable) Position

func (v *Variable) Position() Position

Position of Variable

func (*Variable) String

func (v *Variable) String() string

func (*Variable) Type

func (n *Variable) Type() string

Directories

Path Synopsis
cmd
funny command

Jump to

Keyboard shortcuts

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