Пример #1
0
func NewNameWord(name string) kit.NameWord {

	return &nameWord{
		word: word{wordType: TNameWord, author: author.NewUserAuthor()},
		name: name,
	}
}
Пример #2
0
func NewStringWord(val string) kit.StringWord {

	return &stringWord{
		str:  val,
		word: word{wordType: TStringWord, author: author.NewUserAuthor()},
	}
}
Пример #3
0
func NewArrayWordFromList(l *list.List) kit.ArrayWord {

	return &arrayWord{
		chainWord: chainWord{
			word: word{wordType: TArrayWord, author: author.NewUserAuthor()},
			List: *l,
		},
	}
}
Пример #4
0
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
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
func NewChainWord() kit.ChainWord {

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