Пример #1
0
func paranTypeN(ns []parsec.ParsecNode) parsec.ParsecNode {
	if ns == nil || len(ns) == 0 {
		return nil
	}
	res := syntax.Type{NSIdent: ns[1].(syntax.NSIdent)}
	for _, t := range ns[2].([]parsec.ParsecNode) {
		res.Params = append(res.Params, t.(syntax.Type))
	}
	return res
}
Пример #2
0
func resultTypeN(ns []parsec.ParsecNode) parsec.ParsecNode {
	//	fmt.Println(basic.Dump(ns, 10))
	if ns == nil || len(ns) == 0 {
		return nil
	}
	res := syntax.Type{NSIdent: ns[0].(syntax.NSIdent)}
	for _, t := range ns[1].([]parsec.ParsecNode) {
		res.Params = append(res.Params, t.(syntax.Type))
	}
	return res
}
Пример #3
0
func sugarTypeN(ns []parsec.ParsecNode) parsec.ParsecNode {
	//	fmt.Println(basic.Dump(ns, 10))
	if ns == nil || len(ns) == 0 {
		return nil
	}
	res := syntax.Type{NSIdent: ns[0].(syntax.NSIdent)}
	for _, t := range ns[2].([]parsec.ParsecNode) {
		switch t.(type) {
		case *parsec.Terminal:
			continue
		default:
			res.Params = append(res.Params, t.(syntax.Type))
		}
	}
	return res
}