示例#1
0
文件: word_name.go 项目: mk2/yon
func NewNameWord(name string) kit.NameWord {

	return &nameWord{
		word: word{wordType: TNameWord, author: author.NewUserAuthor()},
		name: name,
	}
}
示例#2
0
文件: word_literal.go 项目: mk2/yon
func NewStringWord(val string) kit.StringWord {

	return &stringWord{
		str:  val,
		word: word{wordType: TStringWord, author: author.NewUserAuthor()},
	}
}
示例#3
0
文件: word_array.go 项目: mk2/yon
func NewArrayWordFromList(l *list.List) kit.ArrayWord {

	return &arrayWord{
		chainWord: chainWord{
			word: word{wordType: TArrayWord, author: author.NewUserAuthor()},
			List: *l,
		},
	}
}
示例#4
0
文件: word_dict.go 项目: mk2/yon
func NewDictWordFromList(l *list.List) kit.DictWord {

	return &dictWord{
		dict: make(map[kit.Word]kit.Word, 0),
		chainWord: chainWord{
			word: word{wordType: TArrayWord, author: author.NewUserAuthor()},
			List: *l,
		},
	}
}
示例#5
0
文件: parser.go 项目: mk2/yon
func parseAnonFuncBody(p *parser) kit.FuncWord {

	// skip the first square bracket
	p.next()

	if w, t := parseChainWordBody(p, word.TFuncWord); t == word.TFuncWord {
		return word.NewFuncWordFromChainWord("", author.NewUserAuthor(), w)
	}

	return nil
}
示例#6
0
文件: word_literal.go 项目: mk2/yon
func NewNumberWord(val string) kit.NumberWord {

	var (
		f   float64
		err error
	)
	if f, err = strconv.ParseFloat(val, 64); err != nil {
		f = 0.0
	}

	return &numberWord{
		word:   word{wordType: TNumberWord, author: author.NewUserAuthor()},
		number: f,
	}
}
示例#7
0
文件: word_chain.go 项目: mk2/yon
func NewChainWord() kit.ChainWord {

	return &chainWord{
		word: word{wordType: TChainWord, author: author.NewUserAuthor()},
	}
}