config/lang/ast: use stringer to generate enums
This commit is contained in:
parent
1ff5a838a4
commit
fa7891d182
|
@ -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
|
||||
|
||||
|
|
|
@ -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]]
|
||||
}
|
|
@ -105,11 +105,3 @@ func TestLex(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* OTHERS:
|
||||
|
||||
foo ${var.foo}
|
||||
bar ${"hello"}
|
||||
foo ${concat("foo ${var.bar}", var.baz)}
|
||||
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue