Added nat and bytes to ReasonLIGO and CameLIGO (expressions).

Use the correct ParserAPI for ReasonLIGO now.
This commit is contained in:
Christian Rinderknecht 2019-12-23 20:37:48 +01:00
parent 705b425589
commit 24f067b69e
7 changed files with 687 additions and 114 deletions

View File

@ -46,7 +46,7 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 33 -> | 33 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 459 -> | 460 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 27 -> | 27 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -68,9 +68,9 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 133 -> | 133 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 372 -> | 373 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 374 -> | 375 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 134 -> | 134 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -80,7 +80,7 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 153 -> | 153 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 373 -> | 374 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 63 -> | 63 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -144,85 +144,83 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 156 -> | 156 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 462 -> | 463 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 464 -> | 465 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 216 -> | 217 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 241 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 218 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 220 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 214 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 225 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 254 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 255 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 242 -> | 242 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 263 -> | 219 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 227 -> | 221 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 215 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 226 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 255 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 256 -> | 256 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 243 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 264 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 228 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 257 -> | 257 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 265 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 267 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 269 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 271 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 273 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 192 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 258 -> | 258 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 284 -> | 266 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 287 -> | 268 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 244 -> | 270 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 292 -> | 272 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 261 -> | 274 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 192 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 259 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 285 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 288 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 245 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 293 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 262 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 160 -> | 160 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 164 -> | 164 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 428 -> | 429 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 331 -> | 332 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 312 -> | 313 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 430 -> | 431 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 314 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 315 -> | 315 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 316 -> | 316 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 431 -> | 317 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 444 -> | 432 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 445 -> | 445 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 432 -> | 446 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 433 -> | 433 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -234,19 +232,19 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 437 -> | 437 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 439 -> | 438 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 327 -> | 440 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 329 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 333 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 330 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 328 -> | 328 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 339 -> | 330 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 334 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 331 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 329 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 340 -> | 340 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -258,23 +256,25 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 344 -> | 344 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 366 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 345 -> | 345 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 347 -> | 367 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 440 -> | 346 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 442 -> | 348 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 446 -> | 441 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 429 -> | 443 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 311 -> | 447 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 427 -> | 430 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 312 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 428 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 165 -> | 165 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -286,23 +286,23 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 163 -> | 163 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 447 -> | 448 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 449 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 450 -> | 450 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 166 -> | 451 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 234 -> | 166 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 235 -> | 235 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 238 -> | 236 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 239 -> | 239 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 424 -> | 240 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 425 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 170 -> | 170 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -310,31 +310,29 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 172 -> | 172 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 417 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 418 -> | 418 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 421 -> | 419 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 422 -> | 422 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 174 -> | 423 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 303 -> | 174 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 304 -> | 304 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 404 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 411 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 403 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 305 -> | 305 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 307 -> | 405 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 319 -> | 412 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 404 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 306 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 308 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 320 -> | 320 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -350,19 +348,19 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 326 -> | 326 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 377 -> | 327 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 378 -> | 378 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 380 -> | 379 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 334 -> | 381 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 309 -> | 335 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 306 -> | 310 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 394 -> | 307 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 395 -> | 395 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -374,11 +372,13 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 399 -> | 399 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 407 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 400 -> | 400 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 402 -> | 408 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 401 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 403 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 175 -> | 175 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -390,9 +390,9 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 183 -> | 183 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 301 -> | 302 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 299 -> | 300 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 185 -> | 185 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
@ -404,13 +404,13 @@ let message =
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 190 -> | 190 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 195 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 214 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 194 -> | 194 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 213 -> | 210 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 193 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 209 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n" "<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| _ -> | _ ->
raise Not_found raise Not_found

View File

@ -566,6 +566,7 @@ core_expr:
"<int>" { EArith (Int $1) } "<int>" { EArith (Int $1) }
| "<mutez>" { EArith (Mutez $1) } | "<mutez>" { EArith (Mutez $1) }
| "<nat>" { EArith (Nat $1) } | "<nat>" { EArith (Nat $1) }
| "<bytes>" { EBytes $1 }
| "<ident>" | module_field { EVar $1 } | "<ident>" | module_field { EVar $1 }
| projection { EProj $1 } | projection { EProj $1 }
| "<string>" { EString (String $1) } | "<string>" { EString (String $1) }

View File

@ -75,8 +75,6 @@ module Make (Lexer: Lexer.S)
(* The parser has suspended itself because of a syntax error. Stop. *) (* The parser has suspended itself because of a syntax error. Stop. *)
(* let fail _checkpoint = raise Parser.Error *)
let failure get_win checkpoint = let failure get_win checkpoint =
let message = ParErr.message (state checkpoint) in let message = ParErr.message (state checkpoint) in
match get_win () with match get_win () with

View File

@ -0,0 +1,510 @@
(* This file was auto-generated based on "Parser.msg". *)
(* Please note that the function [message] can raise [Not_found]. *)
let message =
fun s ->
match s with
| 0 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 1 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 2 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 3 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 4 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 5 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 55 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 6 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 52 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 54 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 7 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 38 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 8 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 9 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 32 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 36 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 35 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 10 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 31 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 11 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 509 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 503 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 48 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 12 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 19 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 20 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 43 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 46 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 49 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 13 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 14 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 60 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 65 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 505 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 145 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 146 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 144 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 329 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 331 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 330 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 61 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 64 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 59 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 143 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 338 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 340 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 339 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 151 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 152 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 78 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 325 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 327 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 326 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 92 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 155 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 118 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 125 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 87 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 105 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 107 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 108 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 106 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 88 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 93 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 80 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 81 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 82 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 132 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 334 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 336 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 335 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 133 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 136 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 137 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 157 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 159 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 158 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 512 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 218 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 514 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 216 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 250 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 248 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 249 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 230 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 235 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 252 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 254 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 255 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 258 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 219 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 226 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 227 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 260 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 262 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 264 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 266 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 194 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 195 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 206 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 215 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 199 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 207 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 208 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 196 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 197 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 198 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 256 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 257 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 277 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 233 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 279 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 67 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 463 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 464 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 387 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 121 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 122 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 120 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 466 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 467 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 483 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 492 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 469 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 470 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 468 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 471 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 472 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 473 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 475 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 476 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 477 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 478 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 487 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 488 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 474 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 499 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 497 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 465 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 321 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 315 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 316 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 318 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 317 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 314 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 71 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 410 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 298 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 304 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 305 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 308 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 309 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 300 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 178 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 73 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 75 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 419 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 420 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 77 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 160 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 412 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 413 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 415 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 416 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 193 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 229 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 74 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 447 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 448 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 456 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 457 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 459 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 460 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 449 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 450 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 76 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 440 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 441 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 425 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 422 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 428 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 429 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 434 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 438 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 437 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 433 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 423 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 427 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 162 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 163 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 290 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 295 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 296 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 357 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 400 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 401 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 402 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 403 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 404 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 405 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 399 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 297 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 311 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 312 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 322 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 323 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 377 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 384 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 342 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 343 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 324 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 344 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 345 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 346 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 370 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 371 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 372 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 373 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 379 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 380 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 369 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 393 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 391 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 313 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 348 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 349 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 347 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 350 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 351 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 352 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 359 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 360 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 361 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 362 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 364 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 363 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 358 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 292 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 293 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 164 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 165 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 166 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 167 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 168 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 169 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 174 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 175 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 176 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 188 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 237 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| _ ->
raise Not_found

View File

@ -320,6 +320,8 @@ core_pattern:
| "_" { PWild $1 } | "_" { PWild $1 }
| unit { PUnit $1 } | unit { PUnit $1 }
| "<int>" { PInt $1 } | "<int>" { PInt $1 }
| "<nat>" { PNat $1 }
| "<bytes>" { PBytes $1 }
| "true" { PTrue $1 } | "true" { PTrue $1 }
| "false" { PFalse $1 } | "false" { PFalse $1 }
| "<string>" { PString $1 } | "<string>" { PString $1 }
@ -424,7 +426,8 @@ fun_expr:
{p.value with inside = arg_to_pattern p.value.inside} {p.value with inside = arg_to_pattern p.value.inside}
in PPar {p with value} in PPar {p with value}
| EUnit u -> PUnit u | EUnit u -> PUnit u
| e -> raise (SyntaxError.Error (WrongFunctionArguments e)) | e -> let open! SyntaxError
in raise (Error (WrongFunctionArguments e))
in in
let fun_args_to_pattern = function let fun_args_to_pattern = function
EAnnot { EAnnot {
@ -453,7 +456,8 @@ fun_expr:
in arg_to_pattern (fst fun_args), bindings in arg_to_pattern (fst fun_args), bindings
| EUnit e -> | EUnit e ->
arg_to_pattern (EUnit e), [] arg_to_pattern (EUnit e), []
| e -> raise (SyntaxError.Error (WrongFunctionArguments e)) | e -> let open! SyntaxError
in raise (Error (WrongFunctionArguments e))
in in
let binders = fun_args_to_pattern $1 in let binders = fun_args_to_pattern $1 in
let f = {kwd_fun; let f = {kwd_fun;
@ -682,6 +686,7 @@ common_expr:
"<int>" { EArith (Int $1) } "<int>" { EArith (Int $1) }
| "<mutez>" { EArith (Mutez $1) } | "<mutez>" { EArith (Mutez $1) }
| "<nat>" { EArith (Nat $1) } | "<nat>" { EArith (Nat $1) }
| "<bytes>" { EBytes $1 }
| "<ident>" | module_field { EVar $1 } | "<ident>" | module_field { EVar $1 }
| projection { EProj $1 } | projection { EProj $1 }
| "<string>" { EString (String $1) } | "<string>" { EString (String $1) }

View File

@ -28,13 +28,46 @@ module type PARSER =
end end
end end
(* Errors *)
module type PAR_ERR =
sig
val message : int -> string (* From error states to messages *)
end
let format_error ?(offsets=true) mode Region.{region; value} ~file =
let reg = region#to_string ~file ~offsets mode in
Printf.sprintf "\027[31mParse error %s:\n%s\027[0m%!" reg value
(* Main functor *) (* Main functor *)
module Make (Lexer: Lexer.S) module Make (Lexer: Lexer.S)
(Parser: PARSER with type token = Lexer.Token.token) = (Parser: PARSER with type token = Lexer.Token.token)
(ParErr: PAR_ERR) =
struct struct
type message = string
type valid = Lexer.token
type invalid = Lexer.token
exception Point of message * valid option * invalid
module I = Parser.MenhirInterpreter module I = Parser.MenhirInterpreter
module S = MenhirLib.General (* Streams *)
(* The call [stack checkpoint] extracts the parser's stack out of
a checkpoint. *)
let stack = function
I.HandlingError env -> I.stack env
| _ -> assert false
(* The call [state checkpoint] extracts the number of the current
state out of a parser checkpoint. *)
let state checkpoint : int =
match Lazy.force (stack checkpoint) with
S.Nil -> 0 (* WARNING: Hack. The first state should be 0. *)
| S.Cons (I.Element (s,_,_,_),_) -> I.number s
(* The parser has successfully produced a semantic value. *) (* The parser has successfully produced a semantic value. *)
@ -42,14 +75,22 @@ module Make (Lexer: Lexer.S)
(* The parser has suspended itself because of a syntax error. Stop. *) (* The parser has suspended itself because of a syntax error. Stop. *)
let fail _checkpoint = raise Parser.Error let failure get_win checkpoint =
let message = ParErr.message (state checkpoint) in
match get_win () with
Lexer.Nil -> assert false
| Lexer.One invalid ->
raise (Point (message, None, invalid))
| Lexer.Two (invalid, valid) ->
raise (Point (message, Some valid, invalid))
(* The generic parsing function *) (* The generic parsing function *)
let incr_contract Lexer.{read; buffer; close; _} : AST.t = let incr_contract Lexer.{read; buffer; get_win; close; _} : AST.t =
let supplier = I.lexer_lexbuf_to_supplier read buffer in let supplier = I.lexer_lexbuf_to_supplier read buffer
and failure = failure get_win in
let parser = Parser.Incremental.contract buffer.Lexing.lex_curr_p in let parser = Parser.Incremental.contract buffer.Lexing.lex_curr_p in
let ast = I.loop_handle success fail supplier parser let ast = I.loop_handle success failure supplier parser
in close (); ast in close (); ast
let mono_contract = Parser.contract let mono_contract = Parser.contract

View File

@ -29,11 +29,29 @@ module type PARSER =
end end
(* Errors *)
module type PAR_ERR =
sig
val message : int -> string (* From error states to messages *)
end
val format_error :
?offsets:bool -> [`Byte | `Point] ->
string Region.reg -> file:bool -> string
(* Main functor *) (* Main functor *)
module Make (Lexer: Lexer.S) module Make (Lexer: Lexer.S)
(Parser: PARSER with type token = Lexer.Token.token) : (Parser: PARSER with type token = Lexer.Token.token)
(ParErr: PAR_ERR) :
sig sig
type message = string
type valid = Lexer.token
type invalid = Lexer.token
exception Point of message * valid option * invalid
val mono_contract : (Lexing.lexbuf -> Lexer.token) -> Lexing.lexbuf -> AST.t val mono_contract : (Lexing.lexbuf -> Lexer.token) -> Lexing.lexbuf -> AST.t
val incr_contract : Lexer.instance -> AST.t val incr_contract : Lexer.instance -> AST.t
end end