Revision 6cac7daf64e95ed3f13738be65c48b982edc245f authored by Marge Bot on 06 March 2024, 15:01:25 UTC, committed by Marge Bot on 06 March 2024, 15:01:25 UTC
Co-authored-by: Nic Volanschi <nic.volanschi@nomadic-labs.com>

Approved-by: pietro <pietro.abate@nomadic-labs.com>
Approved-by: Raphaƫl Cauderlier <raphael.cauderlier@nomadic-labs.com>
Approved-by: Alain Mebsout <alain.mebsout@functori.com>

See merge request https://gitlab.com/tezos/tezos/-/merge_requests/12050
2 parent s 224ea75 + 8ab4347
Raw File
JSON_parser.mly
%{
%}

%token EOF
%token LBRACE RBRACE LBRACKET RBRACKET COMMA COLON
%token NULL
%token <bool> BOOL
%token <float> FLOAT
%token <string> STRING

%type <JSON_AST.t> json
%start json
%%

json:
| NULL { `Null }
| BOOL { `Bool $1 }
| FLOAT { `Float $1 }
| STRING { `String $1 }
| LBRACE fields RBRACE { `O $2 }
| LBRACE RBRACE { `O [] }
| LBRACKET items RBRACKET { `A $2 }
| LBRACKET RBRACKET { `A [] }

fields:
| STRING COLON json COMMA fields { ($1, $3) :: $5 }
| STRING COLON json { [ $1, $3 ] }

items:
| json COMMA items { $1 :: $3 }
| json { [ $1 ] }
back to top