config/lang/ast: use stringer to generate enums

This commit is contained in:
Mitchell Hashimoto 2015-01-11 14:35:14 -08:00
parent 1ff5a838a4
commit fa7891d182
3 changed files with 19 additions and 8 deletions

View File

@ -3,6 +3,8 @@ package ast
// Node is the interface that all AST nodes must implement.
type Node interface{}
//go:generate stringer -type=Type
// Type is the type of a literal.
type Type uint

View File

@ -0,0 +1,17 @@
// generated by stringer -type=Type; DO NOT EDIT
package ast
import "fmt"
const _Type_name = "TypeInvalidTypeString"
var _Type_index = [...]uint8{0, 11, 21}
func (i Type) String() string {
i -= 1
if i+1 >= Type(len(_Type_index)) {
return fmt.Sprintf("Type(%d)", i+1)
}
return _Type_name[_Type_index[i]:_Type_index[i+1]]
}

View File

@ -105,11 +105,3 @@ func TestLex(t *testing.T) {
}
}
}
/* OTHERS:
foo ${var.foo}
bar ${"hello"}
foo ${concat("foo ${var.bar}", var.baz)}
*/