Example #1
0
File: word_name.go Project: mk2/yon
func NewNameWord(name string) kit.NameWord {

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

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

	return &arrayWord{
		chainWord: chainWord{
			word: word{wordType: TArrayWord, author: author.NewUserAuthor()},
			List: *l,
		},
	}
}
Example #4
0
File: word_dict.go Project: 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,
		},
	}
}
Example #5
0
File: parser.go Project: 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
}
Example #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,
	}
}
Example #7
0
func NewChainWord() kit.ChainWord {

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