Revision ae79a999e445690595d03fcdce3f4178aee8dbe9 authored by Marge Bot on 13 September 2022, 08:50:37 UTC, committed by Marge Bot on 13 September 2022, 08:50:37 UTC
Co-authored-by: Valentin Chaboche <valentin.chaboche@nomadic-labs.com>

Approved-by: François Thiré <francois.thire@nomadic-labs.com>
Approved-by: Yann Regis-Gianas <946787-yrg@users.noreply.gitlab.com>

See merge request https://gitlab.com/tezos/tezos/-/merge_requests/6305
2 parent s 4b11277 + 7d9bb57
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