hcl/scanner: allow hyphens in idents
This commit is contained in:
parent
22bdcc2db1
commit
798e1c6c05
@ -454,7 +454,7 @@ func (s *Scanner) scanDigits(ch rune, base, n int) rune {
|
||||
func (s *Scanner) scanIdentifier() string {
|
||||
offs := s.srcPos.Offset - s.lastCharLen
|
||||
ch := s.next()
|
||||
for isLetter(ch) || isDigit(ch) {
|
||||
for isLetter(ch) || isDigit(ch) || ch == '-' {
|
||||
ch = s.next()
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ var tokenLists = map[string][]tokenPair{
|
||||
{token.IDENT, "a"},
|
||||
{token.IDENT, "a0"},
|
||||
{token.IDENT, "foobar"},
|
||||
{token.IDENT, "foo-bar"},
|
||||
{token.IDENT, "abc123"},
|
||||
{token.IDENT, "LGTM"},
|
||||
{token.IDENT, "_"},
|
||||
|
Loading…
Reference in New Issue
Block a user