iris/_future/ipel/ast/param.go
Gerasimos (Makis) Maropoulos a95a02a16a Nothing special here (yet)
Former-commit-id: 826d7c370481b78afd9ba92f4ae8bef1fb85a567
2017-03-27 04:09:44 +03:00

41 lines
730 B
Go

package ast
type ParamType uint8
const (
ParamTypeUnExpected ParamType = iota
// /42
ParamTypeInt
// /myparam1
ParamTypeString
// /myparam
ParamTypeAlphabetical
// /myparam1/myparam2
ParamPath
)
var paramTypes = map[string]ParamType{
"int": ParamTypeInt,
"string": ParamTypeString,
"alphabetical": ParamTypeAlphabetical,
"path": ParamPath,
// could be named also:
// "tail":
// "wild"
// "wildcard"
}
func LookupParamType(ident string) ParamType {
if typ, ok := paramTypes[ident]; ok {
return typ
}
return ParamTypeUnExpected
}
type ParamStatement struct {
Name string // id
Type ParamType // int
Funcs []ParamFunc // range
ErrorCode int // 404
}