iris/_future/ipel/ast/param.go
Gerasimos (Makis) Maropoulos 251eeb6bd0 _future
Former-commit-id: c6f2c47cece55865b381df33950e6dfd8ccf882f
2017-03-27 14:38:10 +03:00

41 lines
738 B
Go

package ast
type ParamType uint8
const (
ParamTypeUnExpected ParamType = iota
// /42
ParamTypeInt
// /myparam1
ParamTypeString
// /myparam
ParamTypeAlphabetical
// /myparam1/myparam2
ParamTypePath
)
var paramTypes = map[string]ParamType{
"int": ParamTypeInt,
"string": ParamTypeString,
"alphabetical": ParamTypeAlphabetical,
"path": ParamTypePath,
// 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
}