hcl/parse.y

35 lines
390 B
Plaintext
Raw Normal View History

2014-07-31 20:56:51 +00:00
// This is the yacc input for creating the parser for HCL.
%{
package hcl
%}
%union {
num int
obj map[string]interface{}
str string
}
%type <obj> object
%token <num> NUMBER
%token <str> IDENTIFIER EQUAL SEMICOLON STRING
%token <str> LEFTBRACE RIGHTBRACE
%%
top:
object
{
2014-07-31 21:08:31 +00:00
hclResult = $1
2014-07-31 20:56:51 +00:00
}
object:
IDENTIFIER EQUAL STRING
{
$$ = map[string]interface{}{$1: $3}
}
%%