Remove colons from the normal lexer
This commit is contained in:
parent
e9b8055f58
commit
9fee7c831b
2
lex.go
2
lex.go
@ -55,8 +55,6 @@ func (x *hclLex) Lex(yylval *hclSymType) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch c {
|
switch c {
|
||||||
case ':':
|
|
||||||
return COLON
|
|
||||||
case ',':
|
case ',':
|
||||||
return COMMA
|
return COMMA
|
||||||
case '=':
|
case '=':
|
||||||
|
14
lex_test.go
14
lex_test.go
@ -24,20 +24,6 @@ func TestLex(t *testing.T) {
|
|||||||
lexEOF,
|
lexEOF,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"assign_colon.hcl",
|
|
||||||
[]int{
|
|
||||||
IDENTIFIER, EQUAL, LEFTBRACKET, LEFTBRACE,
|
|
||||||
STRING, COLON, LEFTBRACE,
|
|
||||||
STRING, COLON, LEFTBRACE, RIGHTBRACE, COMMA,
|
|
||||||
STRING, COLON, LEFTBRACKET,
|
|
||||||
NUMBER, COMMA, NUMBER, COMMA, STRING,
|
|
||||||
RIGHTBRACKET, COMMA,
|
|
||||||
RIGHTBRACE,
|
|
||||||
RIGHTBRACE, RIGHTBRACKET,
|
|
||||||
lexEOF,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"list.hcl",
|
"list.hcl",
|
||||||
[]int{
|
[]int{
|
||||||
|
2
parse.y
2
parse.y
@ -19,7 +19,7 @@ package hcl
|
|||||||
%type <str> blockId
|
%type <str> blockId
|
||||||
|
|
||||||
%token <num> NUMBER
|
%token <num> NUMBER
|
||||||
%token <str> COLON COMMA IDENTIFIER EQUAL NEWLINE STRING
|
%token <str> COMMA IDENTIFIER EQUAL NEWLINE STRING
|
||||||
%token <str> LEFTBRACE RIGHTBRACE LEFTBRACKET RIGHTBRACKET
|
%token <str> LEFTBRACE RIGHTBRACE LEFTBRACKET RIGHTBRACKET
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
Loading…
x
Reference in New Issue
Block a user