Guest User

Untitled

a guest
Feb 18th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 151.81 KB | None | 0 0
  1. exception Error = Parsing.Parse_error
  2.  
  3. type token =
  4. | UID of (string Positions.located)
  5. | TYPE
  6. | TOKEN
  7. | START
  8. | STAR
  9. | RPAREN
  10. | RIGHT
  11. | QUESTION
  12. | PUBLIC
  13. | PREC
  14. | PLUS
  15. | PERCENTPERCENT of (string Lazy.t)
  16. | PARAMETER
  17. | OCAMLTYPE of (Stretch.ocamltype)
  18. | NONASSOC
  19. | LPAREN
  20. | LID of (string Positions.located)
  21. | LEFT
  22. | INLINE
  23. | HEADER of (Stretch.t)
  24. | EQUAL
  25. | EOF
  26. | COMMA
  27. | COLON
  28. | BAR
  29. | ACTION of (Action.t)
  30.  
  31. and _menhir_env = {
  32. _menhir_lexer: Lexing.lexbuf -> token;
  33. _menhir_lexbuf: Lexing.lexbuf;
  34. _menhir_token: token;
  35. mutable _menhir_error: bool
  36. }
  37.  
  38. and _menhir_state =
  39. | MenhirState127
  40. | MenhirState119
  41. | MenhirState118
  42. | MenhirState115
  43. | MenhirState113
  44. | MenhirState110
  45. | MenhirState107
  46. | MenhirState103
  47. | MenhirState99
  48. | MenhirState98
  49. | MenhirState95
  50. | MenhirState88
  51. | MenhirState86
  52. | MenhirState84
  53. | MenhirState82
  54. | MenhirState76
  55. | MenhirState71
  56. | MenhirState70
  57. | MenhirState68
  58. | MenhirState52
  59. | MenhirState51
  60. | MenhirState49
  61. | MenhirState48
  62. | MenhirState44
  63. | MenhirState43
  64. | MenhirState41
  65. | MenhirState39
  66. | MenhirState37
  67. | MenhirState35
  68. | MenhirState27
  69. | MenhirState19
  70. | MenhirState17
  71. | MenhirState13
  72. | MenhirState12
  73. | MenhirState9
  74. | MenhirState8
  75. | MenhirState4
  76. | MenhirState0
  77.  
  78.  
  79.  
  80. open Keyword
  81. open ConcreteSyntax
  82. open Syntax
  83. open Positions
  84.  
  85. let _eRR =
  86. Error
  87.  
  88. let rec _menhir_reduce44 : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.symbol Positions.located) -> 'ttv_return =
  89. fun _menhir_env _menhir_stack _menhir_s x ->
  90. (* Reducing production option(modifier) -> modifier *)
  91. let _v : (Syntax.symbol Positions.located option) = ( Some x ) in
  92. _menhir_goto_option_modifier_ _menhir_env _menhir_stack _menhir_s _v
  93.  
  94. and _menhir_reduce33 : _menhir_env -> ('ttv_tail * _menhir_state) * _menhir_state * (Syntax.parameters) -> 'ttv_return =
  95. fun _menhir_env _menhir_stack ->
  96. (* Reducing production loption(delimited(LPAREN,separated_nonempty_list(COMMA,actual_parameter),RPAREN)) -> LPAREN separated_nonempty_list(COMMA,actual_parameter) RPAREN *)
  97. let ((_menhir_stack, _menhir_s), _, x0) = _menhir_stack in
  98. let _v : (Syntax.parameters) = let x =
  99. let x = x0 in
  100. ( x )
  101. in
  102. ( x ) in
  103. _menhir_goto_loption_delimited_LPAREN_separated_nonempty_list_COMMA_actual_parameter__RPAREN__ _menhir_env _menhir_stack _menhir_s _v
  104.  
  105. and _menhir_reduce47 : _menhir_env -> 'ttv_tail -> 'ttv_return =
  106. fun _menhir_env _menhir_stack ->
  107. (* Reducing production optional_bar -> *)
  108. let _v : (unit) = ( () ) in
  109. _menhir_goto_optional_bar _menhir_env _menhir_stack _v
  110.  
  111. and _menhir_goto_optional_bar : _menhir_env -> 'ttv_tail -> (unit) -> 'ttv_return =
  112. fun _menhir_env _menhir_stack _v ->
  113. let _menhir_stack = (_menhir_stack, _v) in
  114. (* State should be MenhirState93 *)
  115. let _menhir_stack = Obj.magic _menhir_stack in
  116. (* _menhir_run95 *)
  117. (* State 95: *)
  118. if _menhir_env._menhir_error then
  119. (* Resuming error handling *)
  120. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState95
  121. else
  122. let _tok = _menhir_env._menhir_token in
  123. match _tok with
  124. | LID _v ->
  125. (* Shifting (LID) to state 102 *)
  126. _menhir_run102 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  127. | UID _v ->
  128. (* Shifting (UID) to state 10 *)
  129. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  130. | ACTION _ | BAR | PREC ->
  131. _menhir_reduce28 _menhir_env (Obj.magic _menhir_stack) MenhirState95
  132. | _ ->
  133. (assert (not _menhir_env._menhir_error);
  134. (* Initiating error handling *)
  135. _menhir_env._menhir_error <- true;
  136. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState95)
  137.  
  138. and _menhir_goto_option_COMMA_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (unit option) -> 'ttv_return =
  139. fun _menhir_env _menhir_stack _menhir_s _v ->
  140. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  141. match _menhir_s with
  142. | MenhirState35 ->
  143. let _menhir_stack = Obj.magic _menhir_stack in
  144. (* _menhir_run37 *)
  145. (* State 37: *)
  146. assert (not _menhir_env._menhir_error);
  147. let _tok = _menhir_env._menhir_token in
  148. (match _tok with
  149. | LID _v ->
  150. (* Shifting (LID) to state 7 *)
  151. _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState37 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  152. | UID _v ->
  153. (* Shifting (UID) to state 6 *)
  154. _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState37 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  155. | _ ->
  156. assert (not _menhir_env._menhir_error);
  157. (* Initiating error handling *)
  158. _menhir_env._menhir_error <- true;
  159. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState37)
  160. | MenhirState43 ->
  161. let _menhir_stack = Obj.magic _menhir_stack in
  162. (* _menhir_run44 *)
  163. (* State 44: *)
  164. assert (not _menhir_env._menhir_error);
  165. let _tok = _menhir_env._menhir_token in
  166. (match _tok with
  167. | UID _v ->
  168. (* Shifting (UID) to state 43 *)
  169. _menhir_run43 _menhir_env (Obj.magic _menhir_stack) MenhirState44 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  170. | _ ->
  171. assert (not _menhir_env._menhir_error);
  172. (* Initiating error handling *)
  173. _menhir_env._menhir_error <- true;
  174. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState44)
  175. | MenhirState51 ->
  176. let _menhir_stack = Obj.magic _menhir_stack in
  177. (* _menhir_run52 *)
  178. (* State 52: *)
  179. assert (not _menhir_env._menhir_error);
  180. let _tok = _menhir_env._menhir_token in
  181. (match _tok with
  182. | LID _v ->
  183. (* Shifting (LID) to state 51 *)
  184. _menhir_run51 _menhir_env (Obj.magic _menhir_stack) MenhirState52 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  185. | _ ->
  186. assert (not _menhir_env._menhir_error);
  187. (* Initiating error handling *)
  188. _menhir_env._menhir_error <- true;
  189. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState52)
  190. | MenhirState70 ->
  191. let _menhir_stack = Obj.magic _menhir_stack in
  192. (* _menhir_run71 *)
  193. (* State 71: *)
  194. assert (not _menhir_env._menhir_error);
  195. let _tok = _menhir_env._menhir_token in
  196. (match _tok with
  197. | LID _v ->
  198. (* Shifting (LID) to state 7 *)
  199. _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState71 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  200. | UID _v ->
  201. (* Shifting (UID) to state 6 *)
  202. _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState71 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  203. | _ ->
  204. assert (not _menhir_env._menhir_error);
  205. (* Initiating error handling *)
  206. _menhir_env._menhir_error <- true;
  207. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState71)
  208. | _ ->
  209. _menhir_fail ()
  210.  
  211. and _menhir_goto_modifier : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.symbol Positions.located) -> 'ttv_return =
  212. fun _menhir_env _menhir_stack _menhir_s _v ->
  213. match _menhir_s with
  214. | MenhirState19 ->
  215. let _menhir_stack = Obj.magic _menhir_stack in
  216. (* _menhir_run24 *)
  217. (* State 24: *)
  218. (* Not allocating top stack cell *)
  219. (* Reducing without looking ahead at ACTION _ | BAR | COMMA | LID _ | PREC | RPAREN | UID _ *)
  220. _menhir_reduce44 _menhir_env (Obj.magic _menhir_stack) _menhir_s _v
  221. | MenhirState27 ->
  222. let _menhir_stack = Obj.magic _menhir_stack in
  223. (* _menhir_run32 *)
  224. (* State 32: *)
  225. (* Not allocating top stack cell *)
  226. (* Reducing without looking ahead at COLON | COMMA | EOF | HEADER _ | INLINE | LEFT | LID _ | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | UID _ | error *)
  227. _menhir_reduce44 _menhir_env (Obj.magic _menhir_stack) _menhir_s _v
  228. | _ ->
  229. _menhir_fail ()
  230.  
  231. and _menhir_goto_producer : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.producer) -> Lexing.position -> 'ttv_return =
  232. fun _menhir_env _menhir_stack _menhir_s _v _startpos ->
  233. let _menhir_stack = (_menhir_stack, _menhir_s, _v, _startpos) in
  234. (* State should be MenhirState95 | MenhirState110 | MenhirState115 | MenhirState113 *)
  235. let _menhir_stack = Obj.magic _menhir_stack in
  236. (* _menhir_run115 *)
  237. (* State 115: *)
  238. assert (not _menhir_env._menhir_error);
  239. let _tok = _menhir_env._menhir_token in
  240. match _tok with
  241. | LID _v ->
  242. (* Shifting (LID) to state 102 *)
  243. _menhir_run102 _menhir_env (Obj.magic _menhir_stack) MenhirState115 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  244. | UID _v ->
  245. (* Shifting (UID) to state 10 *)
  246. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState115 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  247. | ACTION _ | BAR | PREC ->
  248. _menhir_reduce28 _menhir_env (Obj.magic _menhir_stack) MenhirState115
  249. | _ ->
  250. assert (not _menhir_env._menhir_error);
  251. (* Initiating error handling *)
  252. _menhir_env._menhir_error <- true;
  253. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState115
  254.  
  255. and _menhir_goto_separated_nonempty_list_COMMA_actual_parameter_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.parameters) -> 'ttv_return =
  256. fun _menhir_env _menhir_stack _menhir_s _v ->
  257. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  258. match _menhir_s with
  259. | MenhirState13 ->
  260. let _menhir_stack = Obj.magic _menhir_stack in
  261. (* _menhir_run14 *)
  262. (* State 14: *)
  263. assert (not _menhir_env._menhir_error);
  264. let _tok = _menhir_env._menhir_token in
  265. (match _tok with
  266. | RPAREN ->
  267. (* Shifting (RPAREN) to state 15 *)
  268. let _menhir_stack = Obj.magic _menhir_stack in
  269. (* _menhir_run15 *)
  270. (* State 15: *)
  271. (* Not allocating top stack cell *)
  272. let _menhir_env = _menhir_discard _menhir_env in
  273. (* Reducing without looking ahead at ACTION _ | BAR | COMMA | LID _ | PLUS | PREC | QUESTION | RPAREN | STAR | UID _ *)
  274. _menhir_reduce33 _menhir_env (Obj.magic _menhir_stack)
  275. | _ ->
  276. assert (not _menhir_env._menhir_error);
  277. (* Initiating error handling *)
  278. _menhir_env._menhir_error <- true;
  279. let _menhir_stack = Obj.magic _menhir_stack in
  280. (* _menhir_error14 *)
  281. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  282. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s)
  283. | MenhirState17 ->
  284. let _menhir_stack = Obj.magic _menhir_stack in
  285. (* _menhir_run18 *)
  286. (* State 18: *)
  287. (* Reducing without looking ahead at RPAREN *)
  288. let _menhir_stack = Obj.magic _menhir_stack in
  289. (* _menhir_reduce69 *)
  290. (* Reducing production separated_nonempty_list(COMMA,actual_parameter) -> actual_parameter COMMA separated_nonempty_list(COMMA,actual_parameter) *)
  291. let ((_menhir_stack, _menhir_s, x, _startpos_x_), _, xs) = _menhir_stack in
  292. let _v : (Syntax.parameters) = ( x :: xs ) in
  293. _menhir_goto_separated_nonempty_list_COMMA_actual_parameter_ _menhir_env _menhir_stack _menhir_s _v
  294. | MenhirState9 ->
  295. let _menhir_stack = Obj.magic _menhir_stack in
  296. (* _menhir_run25 *)
  297. (* State 25: *)
  298. assert (not _menhir_env._menhir_error);
  299. let _tok = _menhir_env._menhir_token in
  300. (match _tok with
  301. | RPAREN ->
  302. (* Shifting (RPAREN) to state 26 *)
  303. let _menhir_stack = Obj.magic _menhir_stack in
  304. (* _menhir_run26 *)
  305. (* State 26: *)
  306. (* Not allocating top stack cell *)
  307. let _menhir_env = _menhir_discard _menhir_env in
  308. (* Reducing without looking ahead at COLON | COMMA | EOF | HEADER _ | INLINE | LEFT | LID _ | NONASSOC | PARAMETER | PERCENTPERCENT _ | PLUS | PUBLIC | QUESTION | RIGHT | STAR | START | TOKEN | TYPE | UID _ | error *)
  309. _menhir_reduce33 _menhir_env (Obj.magic _menhir_stack)
  310. | _ ->
  311. assert (not _menhir_env._menhir_error);
  312. (* Initiating error handling *)
  313. _menhir_env._menhir_error <- true;
  314. let _menhir_stack = Obj.magic _menhir_stack in
  315. (* _menhir_error25 *)
  316. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  317. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s)
  318. | _ ->
  319. _menhir_fail ()
  320.  
  321. and _menhir_error16 : _menhir_env -> 'ttv_tail * _menhir_state * (Syntax.parameter) * Lexing.position -> 'ttv_return =
  322. fun _menhir_env _menhir_stack ->
  323. let (_menhir_stack, _menhir_s, _, _) = _menhir_stack in
  324. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  325.  
  326. and _menhir_goto_separated_nonempty_list_BAR_production_group_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.parameterized_branch list list) -> 'ttv_return =
  327. fun _menhir_env _menhir_stack _menhir_s _v ->
  328. match _menhir_s with
  329. | MenhirState95 ->
  330. let _menhir_stack = Obj.magic _menhir_stack in
  331. (* _menhir_run105 *)
  332. (* State 105: *)
  333. (* Not allocating top stack cell *)
  334. (* Reducing without looking ahead at EOF | INLINE | LID _ | PERCENTPERCENT _ | PUBLIC | UID _ | error *)
  335. let _menhir_stack = Obj.magic _menhir_stack in
  336. let prods = _v in
  337. (* _menhir_reduce58 *)
  338. (* Reducing production rule -> flags symbol loption(delimited(LPAREN,separated_nonempty_list(COMMA,symbol),RPAREN)) COLON optional_bar separated_nonempty_list(BAR,production_group) *)
  339. let (((((_menhir_stack, _menhir_s, flags), _, symbol, _startpos_symbol_, _endpos_symbol_), params0), _startpos__4_, _endpos__4_), _) = _menhir_stack in
  340. let _v : (Syntax.parameterized_rule list) = let params =
  341. let params = params0 in
  342. ( params )
  343. in
  344. (
  345. let public, inline = flags in
  346. [
  347. {
  348. pr_public_flag = public;
  349. pr_inline_flag = inline;
  350. pr_nt = Positions.value symbol;
  351. pr_positions = [ Positions.position symbol ];
  352. pr_parameters = List.map Positions.value params;
  353. pr_branches = List.flatten prods
  354. }
  355. ]
  356. ) in
  357. _menhir_goto_rule _menhir_env _menhir_stack _menhir_s _v
  358. | MenhirState110 ->
  359. let _menhir_stack = Obj.magic _menhir_stack in
  360. (* _menhir_run111 *)
  361. (* State 111: *)
  362. (* Not allocating top stack cell *)
  363. (* Reducing without looking ahead at EOF | INLINE | LID _ | PERCENTPERCENT _ | PUBLIC | UID _ | error *)
  364. let _menhir_stack = Obj.magic _menhir_stack in
  365. let xs = _v in
  366. (* _menhir_reduce67 *)
  367. (* Reducing production separated_nonempty_list(BAR,production_group) -> production_group BAR separated_nonempty_list(BAR,production_group) *)
  368. let (_menhir_stack, _menhir_s, x) = _menhir_stack in
  369. let _v : (Syntax.parameterized_branch list list) = ( x :: xs ) in
  370. _menhir_goto_separated_nonempty_list_BAR_production_group_ _menhir_env _menhir_stack _menhir_s _v
  371. | _ ->
  372. _menhir_fail ()
  373.  
  374. and _menhir_goto_list_producer_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.producer list) -> Lexing.position -> 'ttv_return =
  375. fun _menhir_env _menhir_stack _menhir_s _v _startpos ->
  376. let _menhir_stack = (_menhir_stack, _menhir_s, _v, _startpos) in
  377. match _menhir_s with
  378. | MenhirState115 ->
  379. let _menhir_stack = Obj.magic _menhir_stack in
  380. (* _menhir_run116 *)
  381. (* State 116: *)
  382. (* Reducing without looking ahead at ACTION _ | BAR | PREC *)
  383. let _menhir_stack = Obj.magic _menhir_stack in
  384. (* _menhir_reduce29 *)
  385. (* Reducing production list(producer) -> producer list(producer) *)
  386. let ((_menhir_stack, _menhir_s, x, _startpos_x_), _, xs, _startpos_xs_) = _menhir_stack in
  387. let _startpos = _startpos_x_ in
  388. let _v : (Syntax.producer list) = ( x :: xs ) in
  389. _menhir_goto_list_producer_ _menhir_env _menhir_stack _menhir_s _v _startpos
  390. | MenhirState95 | MenhirState110 | MenhirState113 ->
  391. let _menhir_stack = Obj.magic _menhir_stack in
  392. (* _menhir_run118 *)
  393. (* State 118: *)
  394. assert (not _menhir_env._menhir_error);
  395. let _tok = _menhir_env._menhir_token in
  396. (match _tok with
  397. | PREC ->
  398. (* Shifting (PREC) to state 119 *)
  399. let _menhir_stack = Obj.magic _menhir_stack in
  400. let _menhir_s = MenhirState118 in
  401. (* _menhir_run119 *)
  402. (* State 119: *)
  403. let _menhir_stack = (_menhir_stack, _menhir_s) in
  404. let _menhir_env = _menhir_discard _menhir_env in
  405. let _tok = _menhir_env._menhir_token in
  406. (match _tok with
  407. | LID _v ->
  408. (* Shifting (LID) to state 11 *)
  409. _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState119 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  410. | UID _v ->
  411. (* Shifting (UID) to state 10 *)
  412. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState119 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  413. | _ ->
  414. assert (not _menhir_env._menhir_error);
  415. (* Initiating error handling *)
  416. _menhir_env._menhir_error <- true;
  417. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState119)
  418. | ACTION _ | BAR ->
  419. _menhir_reduce45 _menhir_env (Obj.magic _menhir_stack) MenhirState118
  420. | _ ->
  421. assert (not _menhir_env._menhir_error);
  422. (* Initiating error handling *)
  423. _menhir_env._menhir_error <- true;
  424. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState118)
  425. | _ ->
  426. _menhir_fail ()
  427.  
  428. and _menhir_goto_trailer : _menhir_env -> 'ttv_tail -> (Syntax.trailer option) -> 'ttv_return =
  429. fun _menhir_env _menhir_stack _v ->
  430. (* State should be MenhirState122 *)
  431. let _menhir_stack = Obj.magic _menhir_stack in
  432. (* _menhir_run125 *)
  433. (* State 125: *)
  434. (* Not allocating top stack cell *)
  435. (* Reducing without looking ahead at # *)
  436. let _menhir_stack = Obj.magic _menhir_stack in
  437. let t = _v in
  438. (* _menhir_reduce25 *)
  439. (* Reducing production grammar -> list(declaration) PERCENTPERCENT list(rule) trailer *)
  440. let (((_menhir_stack, _menhir_s, ds), _), _, rs) = _menhir_stack in
  441. let _v : (ConcreteSyntax.grammar) = (
  442. {
  443. pg_filename = ""; (* filled in by the caller *)
  444. pg_declarations = List.flatten ds;
  445. pg_rules = List.flatten rs;
  446. pg_trailer = t
  447. }
  448. ) in
  449. (* _menhir_goto_grammar *)
  450. (* State should be MenhirState0 *)
  451. let _menhir_stack = Obj.magic _menhir_stack in
  452. (* _menhir_run126 *)
  453. (* State 126: *)
  454. (* Not allocating top stack cell *)
  455. (* Reducing without looking ahead at # *)
  456. let _menhir_stack = Obj.magic _menhir_stack in
  457. let _1 = _v in
  458. (* _menhir_reduce0 *)
  459. (* Accepting *)
  460. Obj.magic _1
  461.  
  462. and _menhir_reduce46 : _menhir_env -> ('ttv_tail * _menhir_state) * _menhir_state * (Syntax.symbol Positions.located) * Lexing.position * Lexing.position -> 'ttv_return =
  463. fun _menhir_env _menhir_stack ->
  464. (* Reducing production option(precedence) -> PREC symbol *)
  465. let ((_menhir_stack, _menhir_s), _, symbol0, _startpos_symbol0_, _endpos_symbol0_) = _menhir_stack in
  466. let _endpos = _endpos_symbol0_ in
  467. let _v : (Syntax.symbol Positions.located option) = let x =
  468. let symbol = symbol0 in
  469. ( symbol )
  470. in
  471. ( Some x ) in
  472. _menhir_goto_option_precedence_ _menhir_env _menhir_stack _menhir_s _v _endpos
  473.  
  474. and _menhir_goto_separated_nonempty_list_COMMA_symbol_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.symbol Positions.located list) -> 'ttv_return =
  475. fun _menhir_env _menhir_stack _menhir_s _v ->
  476. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  477. match _menhir_s with
  478. | MenhirState88 ->
  479. let _menhir_stack = Obj.magic _menhir_stack in
  480. (* _menhir_run89 *)
  481. (* State 89: *)
  482. (* Reducing without looking ahead at RPAREN *)
  483. let _menhir_stack = Obj.magic _menhir_stack in
  484. (* _menhir_reduce71 *)
  485. (* Reducing production separated_nonempty_list(COMMA,symbol) -> symbol COMMA separated_nonempty_list(COMMA,symbol) *)
  486. let ((_menhir_stack, _menhir_s, x, _startpos_x_, _endpos_x_), _, xs) = _menhir_stack in
  487. let _v : (Syntax.symbol Positions.located list) = ( x :: xs ) in
  488. _menhir_goto_separated_nonempty_list_COMMA_symbol_ _menhir_env _menhir_stack _menhir_s _v
  489. | MenhirState86 ->
  490. let _menhir_stack = Obj.magic _menhir_stack in
  491. (* _menhir_run90 *)
  492. (* State 90: *)
  493. assert (not _menhir_env._menhir_error);
  494. let _tok = _menhir_env._menhir_token in
  495. (match _tok with
  496. | RPAREN ->
  497. (* Shifting (RPAREN) to state 91 *)
  498. let _menhir_stack = Obj.magic _menhir_stack in
  499. (* _menhir_run91 *)
  500. (* State 91: *)
  501. (* Not allocating top stack cell *)
  502. let _menhir_env = _menhir_discard _menhir_env in
  503. (* Reducing without looking ahead at COLON *)
  504. let _menhir_stack = Obj.magic _menhir_stack in
  505. (* _menhir_reduce35 *)
  506. (* Reducing production loption(delimited(LPAREN,separated_nonempty_list(COMMA,symbol),RPAREN)) -> LPAREN separated_nonempty_list(COMMA,symbol) RPAREN *)
  507. let (_menhir_stack, _, x0) = _menhir_stack in
  508. let _v : (Syntax.symbol Positions.located list) = let x =
  509. let x = x0 in
  510. ( x )
  511. in
  512. ( x ) in
  513. _menhir_goto_loption_delimited_LPAREN_separated_nonempty_list_COMMA_symbol__RPAREN__ _menhir_env _menhir_stack _v
  514. | _ ->
  515. assert (not _menhir_env._menhir_error);
  516. (* Initiating error handling *)
  517. _menhir_env._menhir_error <- true;
  518. let _menhir_stack = Obj.magic _menhir_stack in
  519. (* _menhir_error90 *)
  520. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  521. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s)
  522. | _ ->
  523. _menhir_fail ()
  524.  
  525. and _menhir_error87 : _menhir_env -> 'ttv_tail * _menhir_state * (Syntax.symbol Positions.located) * Lexing.position * Lexing.position -> 'ttv_return =
  526. fun _menhir_env _menhir_stack ->
  527. let (_menhir_stack, _menhir_s, _, _, _) = _menhir_stack in
  528. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  529.  
  530. and _menhir_goto_loption_delimited_LPAREN_separated_nonempty_list_COMMA_symbol__RPAREN__ : _menhir_env -> 'ttv_tail -> (Syntax.symbol Positions.located list) -> 'ttv_return =
  531. fun _menhir_env _menhir_stack _v ->
  532. let _menhir_stack = (_menhir_stack, _v) in
  533. (* State should be MenhirState85 *)
  534. let _menhir_stack = Obj.magic _menhir_stack in
  535. (* _menhir_run92 *)
  536. (* State 92: *)
  537. assert (not _menhir_env._menhir_error);
  538. let _tok = _menhir_env._menhir_token in
  539. match _tok with
  540. | COLON ->
  541. (* Shifting (COLON) to state 93 *)
  542. let _menhir_stack = Obj.magic _menhir_stack in
  543. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  544. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  545. (* _menhir_run93 *)
  546. (* State 93: *)
  547. let _menhir_stack = (_menhir_stack, _startpos, _endpos) in
  548. let _menhir_env = _menhir_discard _menhir_env in
  549. let _tok = _menhir_env._menhir_token in
  550. (match _tok with
  551. | BAR ->
  552. (* Shifting (BAR) to state 94 *)
  553. let _menhir_stack = Obj.magic _menhir_stack in
  554. (* _menhir_run94 *)
  555. (* State 94: *)
  556. (* Not allocating top stack cell *)
  557. let _menhir_env = _menhir_discard _menhir_env in
  558. (* Reducing without looking ahead at ACTION _ | BAR | LID _ | PREC | UID _ | error *)
  559. let _menhir_stack = Obj.magic _menhir_stack in
  560. (* _menhir_reduce48 *)
  561. (* Reducing production optional_bar -> BAR *)
  562. let _v : (unit) = ( () ) in
  563. _menhir_goto_optional_bar _menhir_env _menhir_stack _v
  564. | ACTION _ | LID _ | PREC | UID _ ->
  565. _menhir_reduce47 _menhir_env (Obj.magic _menhir_stack)
  566. | _ ->
  567. assert (not _menhir_env._menhir_error);
  568. (* Initiating error handling *)
  569. _menhir_env._menhir_error <- true;
  570. let _menhir_stack = Obj.magic _menhir_stack in
  571. (* _menhir_error93 *)
  572. (* Handling error in state 93 *)
  573. _menhir_reduce47 _menhir_env (Obj.magic _menhir_stack))
  574. | _ ->
  575. assert (not _menhir_env._menhir_error);
  576. (* Initiating error handling *)
  577. _menhir_env._menhir_error <- true;
  578. let _menhir_stack = Obj.magic _menhir_stack in
  579. (* _menhir_error92 *)
  580. let ((_menhir_stack, _menhir_s, _, _, _), _) = _menhir_stack in
  581. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  582.  
  583. and _menhir_error85 : _menhir_env -> ('ttv_tail * _menhir_state * (bool * bool)) * _menhir_state * (Syntax.symbol Positions.located) * Lexing.position * Lexing.position -> 'ttv_return =
  584. fun _menhir_env _menhir_stack ->
  585. let (_menhir_stack, _menhir_s, _, _, _) = _menhir_stack in
  586. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  587.  
  588. and _menhir_run11 : _menhir_env -> 'ttv_tail -> _menhir_state -> (string Positions.located) -> Lexing.position -> Lexing.position -> 'ttv_return =
  589. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  590. (* State 11: *)
  591. let _menhir_stack = (_menhir_stack, _menhir_s, _v, _startpos, _endpos) in
  592. let _menhir_env = _menhir_discard _menhir_env in
  593. (* Reducing without looking ahead at ACTION _ | BAR | COLON | COMMA | LID _ | LPAREN | PLUS | PREC | QUESTION | RPAREN | STAR | UID _ *)
  594. _menhir_reduce80 _menhir_env (Obj.magic _menhir_stack)
  595.  
  596. and _menhir_reduce39 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  597. fun _menhir_env _menhir_stack _menhir_s ->
  598. (* Reducing production option(COMMA) -> *)
  599. let _v : (unit option) = ( None ) in
  600. _menhir_goto_option_COMMA_ _menhir_env _menhir_stack _menhir_s _v
  601.  
  602. and _menhir_run36 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  603. fun _menhir_env _menhir_stack _menhir_s ->
  604. (* State 36: *)
  605. (* Not allocating top stack cell *)
  606. let _menhir_env = _menhir_discard _menhir_env in
  607. (* Reducing without looking ahead at LID _ | UID _ *)
  608. let _menhir_stack = Obj.magic _menhir_stack in
  609. (* _menhir_reduce40 *)
  610. (* Reducing production option(COMMA) -> COMMA *)
  611. let x = () in
  612. let _v : (unit option) = ( Some x ) in
  613. _menhir_goto_option_COMMA_ _menhir_env _menhir_stack _menhir_s _v
  614.  
  615. and _menhir_reduce38 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  616. fun _menhir_env _menhir_stack _menhir_s _startpos__1_ _endpos__1_ ->
  617. (* Reducing production modifier -> STAR *)
  618. let _startpos = _startpos__1_ in
  619. let _endpos = _endpos__1_ in
  620. let _v : (Syntax.symbol Positions.located) = ( with_poss _startpos _endpos "list" ) in
  621. _menhir_goto_modifier _menhir_env _menhir_stack _menhir_s _v
  622.  
  623. and _menhir_reduce36 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  624. fun _menhir_env _menhir_stack _menhir_s _startpos__1_ _endpos__1_ ->
  625. (* Reducing production modifier -> QUESTION *)
  626. let _startpos = _startpos__1_ in
  627. let _endpos = _endpos__1_ in
  628. let _v : (Syntax.symbol Positions.located) = ( with_poss _startpos _endpos "option" ) in
  629. _menhir_goto_modifier _menhir_env _menhir_stack _menhir_s _v
  630.  
  631. and _menhir_reduce37 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  632. fun _menhir_env _menhir_stack _menhir_s _startpos__1_ _endpos__1_ ->
  633. (* Reducing production modifier -> PLUS *)
  634. let _startpos = _startpos__1_ in
  635. let _endpos = _endpos__1_ in
  636. let _v : (Syntax.symbol Positions.located) = ( with_poss _startpos _endpos "nonempty_list" ) in
  637. _menhir_goto_modifier _menhir_env _menhir_stack _menhir_s _v
  638.  
  639. and _menhir_reduce1 : _menhir_env -> ('ttv_tail * _menhir_state * (Syntax.symbol Positions.located) * Lexing.position * Lexing.position) * _menhir_state * (Syntax.parameters) -> _menhir_state -> (Syntax.symbol Positions.located option) -> 'ttv_return =
  640. fun _menhir_env _menhir_stack _ modifier ->
  641. (* Reducing production actual_parameter -> symbol loption(delimited(LPAREN,separated_nonempty_list(COMMA,actual_parameter),RPAREN)) option(modifier) *)
  642. let ((_menhir_stack, _menhir_s, symbol, _startpos_symbol_, _endpos_symbol_), _, params0) = _menhir_stack in
  643. let _startpos = _startpos_symbol_ in
  644. let _v : (Syntax.parameter) = let actuals =
  645. let params = params0 in
  646. ( params )
  647. in
  648. ( Parameters.oapp1 modifier (Parameters.app symbol actuals) ) in
  649. (* _menhir_goto_actual_parameter *)
  650. let _menhir_stack = (_menhir_stack, _menhir_s, _v, _startpos) in
  651. match _menhir_s with
  652. | MenhirState9 | MenhirState17 | MenhirState13 ->
  653. let _menhir_stack = Obj.magic _menhir_stack in
  654. (* _menhir_run16 *)
  655. (* State 16: *)
  656. if _menhir_env._menhir_error then
  657. (* Resuming error handling *)
  658. _menhir_error16 _menhir_env (Obj.magic _menhir_stack)
  659. else
  660. let _tok = _menhir_env._menhir_token in
  661. (match _tok with
  662. | COMMA ->
  663. (* Shifting (COMMA) to state 17 *)
  664. let _menhir_stack = Obj.magic _menhir_stack in
  665. (* _menhir_run17 *)
  666. (* State 17: *)
  667. let _menhir_env = _menhir_discard _menhir_env in
  668. let _tok = _menhir_env._menhir_token in
  669. (match _tok with
  670. | LID _v ->
  671. (* Shifting (LID) to state 11 *)
  672. _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState17 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  673. | UID _v ->
  674. (* Shifting (UID) to state 10 *)
  675. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState17 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  676. | _ ->
  677. assert (not _menhir_env._menhir_error);
  678. (* Initiating error handling *)
  679. _menhir_env._menhir_error <- true;
  680. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState17)
  681. | RPAREN ->
  682. let _menhir_stack = Obj.magic _menhir_stack in
  683. (* _menhir_reduce68 *)
  684. (* Reducing production separated_nonempty_list(COMMA,actual_parameter) -> actual_parameter *)
  685. let (_menhir_stack, _menhir_s, x, _startpos_x_) = _menhir_stack in
  686. let _v : (Syntax.parameters) = ( [ x ] ) in
  687. _menhir_goto_separated_nonempty_list_COMMA_actual_parameter_ _menhir_env _menhir_stack _menhir_s _v
  688. | _ ->
  689. assert (not _menhir_env._menhir_error);
  690. (* Initiating error handling *)
  691. _menhir_env._menhir_error <- true;
  692. _menhir_error16 _menhir_env (Obj.magic _menhir_stack))
  693. | MenhirState37 | MenhirState4 ->
  694. let _menhir_stack = Obj.magic _menhir_stack in
  695. (* _menhir_run35 *)
  696. (* State 35: *)
  697. if _menhir_env._menhir_error then
  698. (* Resuming error handling *)
  699. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState35
  700. else
  701. let _tok = _menhir_env._menhir_token in
  702. (match _tok with
  703. | COMMA ->
  704. (* Shifting (COMMA) to state 36 *)
  705. _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState35
  706. | COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE ->
  707. _menhir_reduce72 _menhir_env (Obj.magic _menhir_stack)
  708. | LID _ | UID _ ->
  709. _menhir_reduce39 _menhir_env (Obj.magic _menhir_stack) MenhirState35
  710. | _ ->
  711. assert (not _menhir_env._menhir_error);
  712. (* Initiating error handling *)
  713. _menhir_env._menhir_error <- true;
  714. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState35)
  715. | MenhirState103 ->
  716. let _menhir_stack = Obj.magic _menhir_stack in
  717. (* _menhir_run104 *)
  718. (* State 104: *)
  719. (* Reducing without looking ahead at ACTION _ | BAR | LID _ | PREC | UID _ *)
  720. let _menhir_stack = Obj.magic _menhir_stack in
  721. (* _menhir_reduce53 *)
  722. (* Reducing production producer -> LID EQUAL actual_parameter *)
  723. let ((_menhir_stack, _menhir_s, x00, _startpos_x00_, _endpos_x00_), _, p, _startpos_p_) = _menhir_stack in
  724. let _startpos = _startpos_x00_ in
  725. let _v : (Syntax.producer) = let id =
  726. let x0 = x00 in
  727. let x =
  728. let x = x0 in
  729. ( x )
  730. in
  731. ( Some x )
  732. in
  733. ( id, p ) in
  734. _menhir_goto_producer _menhir_env _menhir_stack _menhir_s _v _startpos
  735. | MenhirState95 | MenhirState110 | MenhirState113 | MenhirState115 ->
  736. let _menhir_stack = Obj.magic _menhir_stack in
  737. (* _menhir_run117 *)
  738. (* State 117: *)
  739. (* Reducing without looking ahead at ACTION _ | BAR | LID _ | PREC | UID _ *)
  740. let _menhir_stack = Obj.magic _menhir_stack in
  741. (* _menhir_reduce52 *)
  742. (* Reducing production producer -> actual_parameter *)
  743. let (_menhir_stack, _menhir_s, p, _startpos_p_) = _menhir_stack in
  744. let _startpos = _startpos_p_ in
  745. let _v : (Syntax.producer) = let id =
  746. ( None )
  747. in
  748. ( id, p ) in
  749. _menhir_goto_producer _menhir_env _menhir_stack _menhir_s _v _startpos
  750. | _ ->
  751. _menhir_fail ()
  752.  
  753. and _menhir_error33 : _menhir_env -> (('ttv_tail * _menhir_state * Lexing.position) * (Stretch.ocamltype) * Lexing.position) * _menhir_state * (Syntax.parameter list) -> 'ttv_return =
  754. fun _menhir_env _menhir_stack ->
  755. (* Handling error in state 33 *)
  756. (* Shifting (error) to state 34 *)
  757. let _menhir_stack = Obj.magic _menhir_stack in
  758. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  759. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  760. (* _menhir_run34 *)
  761. (* State 34: *)
  762. (* Not allocating top stack cell *)
  763. let _menhir_env = _menhir_discard _menhir_env in
  764. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  765. let _menhir_stack = Obj.magic _menhir_stack in
  766. let _startpos__4_ = _startpos in
  767. let _endpos__4_ = _endpos in
  768. (* _menhir_reduce10 *)
  769. (* Reducing production declaration -> TYPE OCAMLTYPE separated_nonempty_list(option(COMMA),actual_parameter) error *)
  770. let (((_menhir_stack, _menhir_s, _startpos__1_), _, _endpos__2_), _, xs0) = _menhir_stack in
  771. let _startpos = _startpos__1_ in
  772. let _endpos = _endpos__4_ in
  773. let _v : (Syntax.declaration Positions.located list) = let _3 =
  774. let xs = xs0 in
  775. ( xs )
  776. in
  777. ( Error.error (Positions.two _startpos _endpos) (String.concat "\n" [
  778. "syntax error in a %type declaration.";
  779. "Here are sample valid declarations:";
  780. " %type <Syntax.expression> expression";
  781. " %type <int> date time";
  782. ])
  783. ) in
  784. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  785.  
  786. and _menhir_error46 : _menhir_env -> (('ttv_tail * _menhir_state * Lexing.position) * _menhir_state * (Stretch.ocamltype option)) * _menhir_state * (Syntax.terminal Positions.located list) -> 'ttv_return =
  787. fun _menhir_env _menhir_stack ->
  788. (* Handling error in state 46 *)
  789. (* Shifting (error) to state 47 *)
  790. let _menhir_stack = Obj.magic _menhir_stack in
  791. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  792. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  793. (* _menhir_run47 *)
  794. (* State 47: *)
  795. (* Not allocating top stack cell *)
  796. let _menhir_env = _menhir_discard _menhir_env in
  797. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  798. let _menhir_stack = Obj.magic _menhir_stack in
  799. let _startpos__4_ = _startpos in
  800. let _endpos__4_ = _endpos in
  801. (* _menhir_reduce4 *)
  802. (* Reducing production declaration -> TOKEN option(OCAMLTYPE) separated_nonempty_list(option(COMMA),terminal) error *)
  803. let (((_menhir_stack, _menhir_s, _startpos__1_), _, _), _, xs0) = _menhir_stack in
  804. let _startpos = _startpos__1_ in
  805. let _endpos = _endpos__4_ in
  806. let _v : (Syntax.declaration Positions.located list) = let _3 =
  807. let xs = xs0 in
  808. ( xs )
  809. in
  810. ( Error.error (Positions.two _startpos _endpos) (String.concat "\n" [
  811. "syntax error in a %token declaration.";
  812. "Here are sample valid declarations:";
  813. " %token DOT SEMICOLON";
  814. " %token <string> LID UID";
  815. ])
  816. ) in
  817. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  818.  
  819. and _menhir_error54 : _menhir_env -> (('ttv_tail * _menhir_state * Lexing.position) * _menhir_state * (Stretch.ocamltype option)) * _menhir_state * (Syntax.nonterminal Positions.located list) -> 'ttv_return =
  820. fun _menhir_env _menhir_stack ->
  821. (* Handling error in state 54 *)
  822. (* Shifting (error) to state 55 *)
  823. let _menhir_stack = Obj.magic _menhir_stack in
  824. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  825. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  826. (* _menhir_run55 *)
  827. (* State 55: *)
  828. (* Not allocating top stack cell *)
  829. let _menhir_env = _menhir_discard _menhir_env in
  830. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  831. let _menhir_stack = Obj.magic _menhir_stack in
  832. let _startpos__4_ = _startpos in
  833. let _endpos__4_ = _endpos in
  834. (* _menhir_reduce7 *)
  835. (* Reducing production declaration -> START option(OCAMLTYPE) separated_nonempty_list(option(COMMA),nonterminal) error *)
  836. let (((_menhir_stack, _menhir_s, _startpos__1_), _, _), _, xs0) = _menhir_stack in
  837. let _startpos = _startpos__1_ in
  838. let _endpos = _endpos__4_ in
  839. let _v : (Syntax.declaration Positions.located list) = let _3 =
  840. let xs = xs0 in
  841. ( xs )
  842. in
  843. ( Error.error (Positions.two _startpos _endpos) (String.concat "\n" [
  844. "syntax error in a %start declaration.";
  845. "Here are sample valid declarations:";
  846. " %start expression phrase";
  847. " %start <int> date time";
  848. ])
  849. ) in
  850. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  851.  
  852. and _menhir_error73 : _menhir_env -> ('ttv_tail * _menhir_state * (Syntax.token_associativity) * Lexing.position * Lexing.position) * _menhir_state * (Syntax.symbol Positions.located list) -> 'ttv_return =
  853. fun _menhir_env _menhir_stack ->
  854. (* Handling error in state 73 *)
  855. (* Shifting (error) to state 74 *)
  856. let _menhir_stack = Obj.magic _menhir_stack in
  857. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  858. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  859. (* _menhir_run74 *)
  860. (* State 74: *)
  861. (* Not allocating top stack cell *)
  862. let _menhir_env = _menhir_discard _menhir_env in
  863. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  864. let _menhir_stack = Obj.magic _menhir_stack in
  865. let _startpos__3_ = _startpos in
  866. let _endpos__3_ = _endpos in
  867. (* _menhir_reduce14 *)
  868. (* Reducing production declaration -> priority_keyword separated_nonempty_list(option(COMMA),symbol) error *)
  869. let ((_menhir_stack, _menhir_s, _, _startpos__1_, _endpos__1_), _, xs0) = _menhir_stack in
  870. let _startpos = _startpos__1_ in
  871. let _endpos = _endpos__3_ in
  872. let _v : (Syntax.declaration Positions.located list) = let _2 =
  873. let xs = xs0 in
  874. ( xs )
  875. in
  876. ( Error.error (Positions.two _startpos _endpos) (String.concat "\n" [
  877. "syntax error in a precedence declaration.";
  878. "Here are sample valid declarations:";
  879. " %left PLUS TIMES";
  880. " %nonassoc unary_minus";
  881. " %right CONCAT";
  882. ])
  883. ) in
  884. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  885.  
  886. and _menhir_goto_separated_nonempty_list_BAR_production_ : _menhir_env -> 'ttv_tail -> _menhir_state -> ((Syntax.producer list * Syntax.symbol Positions.located option *
  887. Syntax.branch_reduce_precedence * Positions.t)
  888. list) -> 'ttv_return =
  889. fun _menhir_env _menhir_stack _menhir_s _v ->
  890. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  891. match _menhir_s with
  892. | MenhirState110 | MenhirState95 ->
  893. let _menhir_stack = Obj.magic _menhir_stack in
  894. (* _menhir_run106 *)
  895. (* State 106: *)
  896. assert (not _menhir_env._menhir_error);
  897. let _tok = _menhir_env._menhir_token in
  898. (match _tok with
  899. | ACTION _v ->
  900. (* Shifting (ACTION) to state 107 *)
  901. let _menhir_stack = Obj.magic _menhir_stack in
  902. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  903. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  904. (* _menhir_run107 *)
  905. (* State 107: *)
  906. let _menhir_stack = (_menhir_stack, _v, _startpos, _endpos) in
  907. let _menhir_env = _menhir_discard _menhir_env in
  908. let _tok = _menhir_env._menhir_token in
  909. (match _tok with
  910. | PREC ->
  911. (* Shifting (PREC) to state 99 *)
  912. _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState107
  913. | BAR | EOF | INLINE | LID _ | PERCENTPERCENT _ | PUBLIC | UID _ ->
  914. _menhir_reduce45 _menhir_env (Obj.magic _menhir_stack) MenhirState107
  915. | _ ->
  916. assert (not _menhir_env._menhir_error);
  917. (* Initiating error handling *)
  918. _menhir_env._menhir_error <- true;
  919. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState107)
  920. | _ ->
  921. assert (not _menhir_env._menhir_error);
  922. (* Initiating error handling *)
  923. _menhir_env._menhir_error <- true;
  924. let _menhir_stack = Obj.magic _menhir_stack in
  925. (* _menhir_error106 *)
  926. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  927. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s)
  928. | MenhirState113 ->
  929. let _menhir_stack = Obj.magic _menhir_stack in
  930. (* _menhir_run114 *)
  931. (* State 114: *)
  932. (* Reducing without looking ahead at ACTION _ *)
  933. let _menhir_stack = Obj.magic _menhir_stack in
  934. (* _menhir_reduce65 *)
  935. (* Reducing production separated_nonempty_list(BAR,production) -> production BAR separated_nonempty_list(BAR,production) *)
  936. let ((_menhir_stack, _menhir_s, x), _, xs) = _menhir_stack in
  937. let _v : ((Syntax.producer list * Syntax.symbol Positions.located option *
  938. Syntax.branch_reduce_precedence * Positions.t)
  939. list) = ( x :: xs ) in
  940. _menhir_goto_separated_nonempty_list_BAR_production_ _menhir_env _menhir_stack _menhir_s _v
  941. | _ ->
  942. _menhir_fail ()
  943.  
  944. and _menhir_reduce66 : _menhir_env -> 'ttv_tail * _menhir_state * (Syntax.parameterized_branch list) -> 'ttv_return =
  945. fun _menhir_env _menhir_stack ->
  946. (* Reducing production separated_nonempty_list(BAR,production_group) -> production_group *)
  947. let (_menhir_stack, _menhir_s, x) = _menhir_stack in
  948. let _v : (Syntax.parameterized_branch list list) = ( [ x ] ) in
  949. _menhir_goto_separated_nonempty_list_BAR_production_group_ _menhir_env _menhir_stack _menhir_s _v
  950.  
  951. and _menhir_reduce28 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  952. fun _menhir_env _menhir_stack _menhir_s ->
  953. (* Reducing production list(producer) -> *)
  954. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  955. let _v : (Syntax.producer list) = ( [] ) in
  956. _menhir_goto_list_producer_ _menhir_env _menhir_stack _menhir_s _v _startpos
  957.  
  958. and _menhir_run10 : _menhir_env -> 'ttv_tail -> _menhir_state -> (string Positions.located) -> Lexing.position -> Lexing.position -> 'ttv_return =
  959. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  960. (* State 10: *)
  961. (* Not allocating top stack cell *)
  962. let _menhir_env = _menhir_discard _menhir_env in
  963. (* Reducing without looking ahead at ACTION _ | BAR | COLON | COMMA | LID _ | LPAREN | PLUS | PREC | QUESTION | RPAREN | STAR | UID _ *)
  964. _menhir_reduce81 _menhir_env (Obj.magic _menhir_stack) _menhir_s _v _startpos _endpos
  965.  
  966. and _menhir_run102 : _menhir_env -> 'ttv_tail -> _menhir_state -> (string Positions.located) -> Lexing.position -> Lexing.position -> 'ttv_return =
  967. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  968. (* State 102: *)
  969. let _menhir_stack = (_menhir_stack, _menhir_s, _v, _startpos, _endpos) in
  970. let _menhir_env = _menhir_discard _menhir_env in
  971. let _tok = _menhir_env._menhir_token in
  972. match _tok with
  973. | EQUAL ->
  974. (* Shifting (EQUAL) to state 103 *)
  975. let _menhir_stack = Obj.magic _menhir_stack in
  976. (* _menhir_run103 *)
  977. (* State 103: *)
  978. let _menhir_env = _menhir_discard _menhir_env in
  979. let _tok = _menhir_env._menhir_token in
  980. (match _tok with
  981. | LID _v ->
  982. (* Shifting (LID) to state 11 *)
  983. _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState103 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  984. | UID _v ->
  985. (* Shifting (UID) to state 10 *)
  986. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState103 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  987. | _ ->
  988. assert (not _menhir_env._menhir_error);
  989. (* Initiating error handling *)
  990. _menhir_env._menhir_error <- true;
  991. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState103)
  992. | ACTION _ | BAR | LID _ | LPAREN | PLUS | PREC | QUESTION | STAR | UID _ ->
  993. _menhir_reduce80 _menhir_env (Obj.magic _menhir_stack)
  994. | _ ->
  995. assert (not _menhir_env._menhir_error);
  996. (* Initiating error handling *)
  997. _menhir_env._menhir_error <- true;
  998. let _menhir_stack = Obj.magic _menhir_stack in
  999. (* _menhir_error102 *)
  1000. let (_menhir_stack, _menhir_s, _, _, _) = _menhir_stack in
  1001. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  1002.  
  1003. and _menhir_error109 : _menhir_env -> 'ttv_tail * _menhir_state * (Syntax.parameterized_branch list) -> 'ttv_return =
  1004. fun _menhir_env _menhir_stack ->
  1005. (* Handling error in state 109 *)
  1006. _menhir_reduce66 _menhir_env (Obj.magic _menhir_stack)
  1007.  
  1008. and _menhir_goto_list_rule_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.parameterized_rule list list) -> 'ttv_return =
  1009. fun _menhir_env _menhir_stack _menhir_s _v ->
  1010. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1011. match _menhir_s with
  1012. | MenhirState82 ->
  1013. let _menhir_stack = Obj.magic _menhir_stack in
  1014. (* _menhir_run83 *)
  1015. (* State 83: *)
  1016. (* Reducing without looking ahead at EOF | PERCENTPERCENT _ *)
  1017. let _menhir_stack = Obj.magic _menhir_stack in
  1018. (* _menhir_reduce31 *)
  1019. (* Reducing production list(rule) -> rule list(rule) *)
  1020. let ((_menhir_stack, _menhir_s, x), _, xs) = _menhir_stack in
  1021. let _v : (Syntax.parameterized_rule list list) = ( x :: xs ) in
  1022. _menhir_goto_list_rule_ _menhir_env _menhir_stack _menhir_s _v
  1023. | MenhirState76 ->
  1024. let _menhir_stack = Obj.magic _menhir_stack in
  1025. (* _menhir_run122 *)
  1026. (* State 122: *)
  1027. assert (not _menhir_env._menhir_error);
  1028. let _tok = _menhir_env._menhir_token in
  1029. (match _tok with
  1030. | EOF ->
  1031. (* Shifting (EOF) to state 124 *)
  1032. let _menhir_stack = Obj.magic _menhir_stack in
  1033. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  1034. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  1035. (* _menhir_run124 *)
  1036. (* State 124: *)
  1037. (* Not allocating top stack cell *)
  1038. (* Reducing without looking ahead at # *)
  1039. let _menhir_stack = Obj.magic _menhir_stack in
  1040. let _startpos__1_ = _startpos in
  1041. let _endpos__1_ = _endpos in
  1042. (* _menhir_reduce82 *)
  1043. (* Reducing production trailer -> EOF *)
  1044. let _v : (Syntax.trailer option) = ( None ) in
  1045. _menhir_goto_trailer _menhir_env _menhir_stack _v
  1046. | PERCENTPERCENT _v ->
  1047. (* Shifting (PERCENTPERCENT) to state 123 *)
  1048. let _menhir_stack = Obj.magic _menhir_stack in
  1049. (* _menhir_run123 *)
  1050. (* State 123: *)
  1051. (* Not allocating top stack cell *)
  1052. (* Reducing without looking ahead at # *)
  1053. let _menhir_stack = Obj.magic _menhir_stack in
  1054. let p = _v in
  1055. (* _menhir_reduce83 *)
  1056. (* Reducing production trailer -> PERCENTPERCENT *)
  1057. let _v : (Syntax.trailer option) = ( Some (Lazy.force p) ) in
  1058. _menhir_goto_trailer _menhir_env _menhir_stack _v
  1059. | _ ->
  1060. assert (not _menhir_env._menhir_error);
  1061. (* Initiating error handling *)
  1062. _menhir_env._menhir_error <- true;
  1063. let _menhir_stack = Obj.magic _menhir_stack in
  1064. (* _menhir_error122 *)
  1065. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  1066. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s)
  1067. | _ ->
  1068. _menhir_fail ()
  1069.  
  1070. and _menhir_goto_flags : _menhir_env -> 'ttv_tail -> _menhir_state -> (bool * bool) -> 'ttv_return =
  1071. fun _menhir_env _menhir_stack _menhir_s _v ->
  1072. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1073. (* State should be MenhirState76 | MenhirState82 *)
  1074. let _menhir_stack = Obj.magic _menhir_stack in
  1075. (* _menhir_run84 *)
  1076. (* State 84: *)
  1077. assert (not _menhir_env._menhir_error);
  1078. let _tok = _menhir_env._menhir_token in
  1079. match _tok with
  1080. | LID _v ->
  1081. (* Shifting (LID) to state 11 *)
  1082. _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState84 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1083. | UID _v ->
  1084. (* Shifting (UID) to state 10 *)
  1085. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState84 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1086. | _ ->
  1087. assert (not _menhir_env._menhir_error);
  1088. (* Initiating error handling *)
  1089. _menhir_env._menhir_error <- true;
  1090. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState84
  1091.  
  1092. and _menhir_goto_symbol : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.symbol Positions.located) -> Lexing.position -> Lexing.position -> 'ttv_return =
  1093. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  1094. let _menhir_stack = (_menhir_stack, _menhir_s, _v, _startpos, _endpos) in
  1095. match _menhir_s with
  1096. | MenhirState37 | MenhirState4 ->
  1097. let _menhir_stack = Obj.magic _menhir_stack in
  1098. (* _menhir_run8 *)
  1099. (* State 8: *)
  1100. if _menhir_env._menhir_error then
  1101. (* Resuming error handling *)
  1102. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState8
  1103. else
  1104. let _tok = _menhir_env._menhir_token in
  1105. (match _tok with
  1106. | LPAREN ->
  1107. (* Shifting (LPAREN) to state 9 *)
  1108. let _menhir_stack = Obj.magic _menhir_stack in
  1109. let _menhir_s = MenhirState8 in
  1110. (* _menhir_run9 *)
  1111. (* State 9: *)
  1112. let _menhir_stack = (_menhir_stack, _menhir_s) in
  1113. let _menhir_env = _menhir_discard _menhir_env in
  1114. let _tok = _menhir_env._menhir_token in
  1115. (match _tok with
  1116. | LID _v ->
  1117. (* Shifting (LID) to state 11 *)
  1118. _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1119. | UID _v ->
  1120. (* Shifting (UID) to state 10 *)
  1121. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState9 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1122. | _ ->
  1123. assert (not _menhir_env._menhir_error);
  1124. (* Initiating error handling *)
  1125. _menhir_env._menhir_error <- true;
  1126. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState9)
  1127. | COLON | COMMA | EOF | HEADER _ | INLINE | LEFT | LID _ | NONASSOC | PARAMETER | PERCENTPERCENT _ | PLUS | PUBLIC | QUESTION | RIGHT | STAR | START | TOKEN | TYPE | UID _ ->
  1128. _menhir_reduce32 _menhir_env (Obj.magic _menhir_stack) MenhirState8
  1129. | _ ->
  1130. assert (not _menhir_env._menhir_error);
  1131. (* Initiating error handling *)
  1132. _menhir_env._menhir_error <- true;
  1133. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState8)
  1134. | MenhirState115 | MenhirState113 | MenhirState110 | MenhirState95 | MenhirState103 | MenhirState17 | MenhirState13 | MenhirState9 ->
  1135. let _menhir_stack = Obj.magic _menhir_stack in
  1136. (* _menhir_run12 *)
  1137. (* State 12: *)
  1138. if _menhir_env._menhir_error then
  1139. (* Resuming error handling *)
  1140. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState12
  1141. else
  1142. let _tok = _menhir_env._menhir_token in
  1143. (match _tok with
  1144. | LPAREN ->
  1145. (* Shifting (LPAREN) to state 13 *)
  1146. let _menhir_stack = Obj.magic _menhir_stack in
  1147. let _menhir_s = MenhirState12 in
  1148. (* _menhir_run13 *)
  1149. (* State 13: *)
  1150. let _menhir_stack = (_menhir_stack, _menhir_s) in
  1151. let _menhir_env = _menhir_discard _menhir_env in
  1152. let _tok = _menhir_env._menhir_token in
  1153. (match _tok with
  1154. | LID _v ->
  1155. (* Shifting (LID) to state 11 *)
  1156. _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1157. | UID _v ->
  1158. (* Shifting (UID) to state 10 *)
  1159. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState13 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1160. | _ ->
  1161. assert (not _menhir_env._menhir_error);
  1162. (* Initiating error handling *)
  1163. _menhir_env._menhir_error <- true;
  1164. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState13)
  1165. | ACTION _ | BAR | COMMA | LID _ | PLUS | PREC | QUESTION | RPAREN | STAR | UID _ ->
  1166. _menhir_reduce32 _menhir_env (Obj.magic _menhir_stack) MenhirState12
  1167. | _ ->
  1168. assert (not _menhir_env._menhir_error);
  1169. (* Initiating error handling *)
  1170. _menhir_env._menhir_error <- true;
  1171. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState12)
  1172. | MenhirState71 | MenhirState68 ->
  1173. let _menhir_stack = Obj.magic _menhir_stack in
  1174. (* _menhir_run70 *)
  1175. (* State 70: *)
  1176. if _menhir_env._menhir_error then
  1177. (* Resuming error handling *)
  1178. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState70
  1179. else
  1180. let _tok = _menhir_env._menhir_token in
  1181. (match _tok with
  1182. | COMMA ->
  1183. (* Shifting (COMMA) to state 36 *)
  1184. _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState70
  1185. | COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE ->
  1186. _menhir_reduce76 _menhir_env (Obj.magic _menhir_stack)
  1187. | LID _ | UID _ ->
  1188. _menhir_reduce39 _menhir_env (Obj.magic _menhir_stack) MenhirState70
  1189. | _ ->
  1190. assert (not _menhir_env._menhir_error);
  1191. (* Initiating error handling *)
  1192. _menhir_env._menhir_error <- true;
  1193. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState70)
  1194. | MenhirState84 ->
  1195. let _menhir_stack = Obj.magic _menhir_stack in
  1196. (* _menhir_run85 *)
  1197. (* State 85: *)
  1198. if _menhir_env._menhir_error then
  1199. (* Resuming error handling *)
  1200. _menhir_error85 _menhir_env (Obj.magic _menhir_stack)
  1201. else
  1202. let _tok = _menhir_env._menhir_token in
  1203. (match _tok with
  1204. | LPAREN ->
  1205. (* Shifting (LPAREN) to state 86 *)
  1206. let _menhir_stack = Obj.magic _menhir_stack in
  1207. (* _menhir_run86 *)
  1208. (* State 86: *)
  1209. let _menhir_env = _menhir_discard _menhir_env in
  1210. let _tok = _menhir_env._menhir_token in
  1211. (match _tok with
  1212. | LID _v ->
  1213. (* Shifting (LID) to state 11 *)
  1214. _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState86 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1215. | UID _v ->
  1216. (* Shifting (UID) to state 10 *)
  1217. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState86 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1218. | _ ->
  1219. assert (not _menhir_env._menhir_error);
  1220. (* Initiating error handling *)
  1221. _menhir_env._menhir_error <- true;
  1222. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState86)
  1223. | COLON ->
  1224. let _menhir_stack = Obj.magic _menhir_stack in
  1225. (* _menhir_reduce34 *)
  1226. (* Reducing production loption(delimited(LPAREN,separated_nonempty_list(COMMA,symbol),RPAREN)) -> *)
  1227. let _v : (Syntax.symbol Positions.located list) = ( [] ) in
  1228. _menhir_goto_loption_delimited_LPAREN_separated_nonempty_list_COMMA_symbol__RPAREN__ _menhir_env _menhir_stack _v
  1229. | _ ->
  1230. assert (not _menhir_env._menhir_error);
  1231. (* Initiating error handling *)
  1232. _menhir_env._menhir_error <- true;
  1233. _menhir_error85 _menhir_env (Obj.magic _menhir_stack))
  1234. | MenhirState88 | MenhirState86 ->
  1235. let _menhir_stack = Obj.magic _menhir_stack in
  1236. (* _menhir_run87 *)
  1237. (* State 87: *)
  1238. if _menhir_env._menhir_error then
  1239. (* Resuming error handling *)
  1240. _menhir_error87 _menhir_env (Obj.magic _menhir_stack)
  1241. else
  1242. let _tok = _menhir_env._menhir_token in
  1243. (match _tok with
  1244. | COMMA ->
  1245. (* Shifting (COMMA) to state 88 *)
  1246. let _menhir_stack = Obj.magic _menhir_stack in
  1247. (* _menhir_run88 *)
  1248. (* State 88: *)
  1249. let _menhir_env = _menhir_discard _menhir_env in
  1250. let _tok = _menhir_env._menhir_token in
  1251. (match _tok with
  1252. | LID _v ->
  1253. (* Shifting (LID) to state 11 *)
  1254. _menhir_run11 _menhir_env (Obj.magic _menhir_stack) MenhirState88 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1255. | UID _v ->
  1256. (* Shifting (UID) to state 10 *)
  1257. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState88 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1258. | _ ->
  1259. assert (not _menhir_env._menhir_error);
  1260. (* Initiating error handling *)
  1261. _menhir_env._menhir_error <- true;
  1262. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState88)
  1263. | RPAREN ->
  1264. let _menhir_stack = Obj.magic _menhir_stack in
  1265. (* _menhir_reduce70 *)
  1266. (* Reducing production separated_nonempty_list(COMMA,symbol) -> symbol *)
  1267. let (_menhir_stack, _menhir_s, x, _startpos_x_, _endpos_x_) = _menhir_stack in
  1268. let _v : (Syntax.symbol Positions.located list) = ( [ x ] ) in
  1269. _menhir_goto_separated_nonempty_list_COMMA_symbol_ _menhir_env _menhir_stack _menhir_s _v
  1270. | _ ->
  1271. assert (not _menhir_env._menhir_error);
  1272. (* Initiating error handling *)
  1273. _menhir_env._menhir_error <- true;
  1274. _menhir_error87 _menhir_env (Obj.magic _menhir_stack))
  1275. | MenhirState99 ->
  1276. let _menhir_stack = Obj.magic _menhir_stack in
  1277. (* _menhir_run100 *)
  1278. (* State 100: *)
  1279. (* Reducing without looking ahead at BAR | EOF | INLINE | LID _ | PERCENTPERCENT _ | PUBLIC | UID _ | error *)
  1280. _menhir_reduce46 _menhir_env (Obj.magic _menhir_stack)
  1281. | MenhirState119 ->
  1282. let _menhir_stack = Obj.magic _menhir_stack in
  1283. (* _menhir_run120 *)
  1284. (* State 120: *)
  1285. (* Reducing without looking ahead at ACTION _ | BAR *)
  1286. _menhir_reduce46 _menhir_env (Obj.magic _menhir_stack)
  1287. | _ ->
  1288. _menhir_fail ()
  1289.  
  1290. and _menhir_run51 : _menhir_env -> 'ttv_tail -> _menhir_state -> (string Positions.located) -> Lexing.position -> Lexing.position -> 'ttv_return =
  1291. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  1292. (* State 51: *)
  1293. let _menhir_stack = (_menhir_stack, _menhir_s, _v, _startpos, _endpos) in
  1294. let _menhir_env = _menhir_discard _menhir_env in
  1295. let _tok = _menhir_env._menhir_token in
  1296. match _tok with
  1297. | COMMA ->
  1298. (* Shifting (COMMA) to state 36 *)
  1299. _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState51
  1300. | COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE ->
  1301. _menhir_reduce74 _menhir_env (Obj.magic _menhir_stack)
  1302. | LID _ ->
  1303. _menhir_reduce39 _menhir_env (Obj.magic _menhir_stack) MenhirState51
  1304. | _ ->
  1305. assert (not _menhir_env._menhir_error);
  1306. (* Initiating error handling *)
  1307. _menhir_env._menhir_error <- true;
  1308. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState51
  1309.  
  1310. and _menhir_run43 : _menhir_env -> 'ttv_tail -> _menhir_state -> (string Positions.located) -> Lexing.position -> Lexing.position -> 'ttv_return =
  1311. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  1312. (* State 43: *)
  1313. let _menhir_stack = (_menhir_stack, _menhir_s, _v, _startpos, _endpos) in
  1314. let _menhir_env = _menhir_discard _menhir_env in
  1315. let _tok = _menhir_env._menhir_token in
  1316. match _tok with
  1317. | COMMA ->
  1318. (* Shifting (COMMA) to state 36 *)
  1319. _menhir_run36 _menhir_env (Obj.magic _menhir_stack) MenhirState43
  1320. | COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE ->
  1321. _menhir_reduce78 _menhir_env (Obj.magic _menhir_stack)
  1322. | UID _ ->
  1323. _menhir_reduce39 _menhir_env (Obj.magic _menhir_stack) MenhirState43
  1324. | _ ->
  1325. assert (not _menhir_env._menhir_error);
  1326. (* Initiating error handling *)
  1327. _menhir_env._menhir_error <- true;
  1328. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState43
  1329.  
  1330. and _menhir_goto_loption_delimited_LPAREN_separated_nonempty_list_COMMA_actual_parameter__RPAREN__ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.parameters) -> 'ttv_return =
  1331. fun _menhir_env _menhir_stack _menhir_s _v ->
  1332. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1333. match _menhir_s with
  1334. | MenhirState12 ->
  1335. let _menhir_stack = Obj.magic _menhir_stack in
  1336. (* _menhir_run19 *)
  1337. (* State 19: *)
  1338. if _menhir_env._menhir_error then
  1339. (* Resuming error handling *)
  1340. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState19
  1341. else
  1342. let _tok = _menhir_env._menhir_token in
  1343. (match _tok with
  1344. | PLUS ->
  1345. (* Shifting (PLUS) to state 22 *)
  1346. let _menhir_stack = Obj.magic _menhir_stack in
  1347. let _menhir_s = MenhirState19 in
  1348. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  1349. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  1350. (* _menhir_run22 *)
  1351. (* State 22: *)
  1352. (* Not allocating top stack cell *)
  1353. let _menhir_env = _menhir_discard _menhir_env in
  1354. (* Reducing without looking ahead at ACTION _ | BAR | COMMA | LID _ | PREC | RPAREN | UID _ *)
  1355. _menhir_reduce37 _menhir_env (Obj.magic _menhir_stack) _menhir_s _startpos _endpos
  1356. | QUESTION ->
  1357. (* Shifting (QUESTION) to state 21 *)
  1358. let _menhir_stack = Obj.magic _menhir_stack in
  1359. let _menhir_s = MenhirState19 in
  1360. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  1361. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  1362. (* _menhir_run21 *)
  1363. (* State 21: *)
  1364. (* Not allocating top stack cell *)
  1365. let _menhir_env = _menhir_discard _menhir_env in
  1366. (* Reducing without looking ahead at ACTION _ | BAR | COMMA | LID _ | PREC | RPAREN | UID _ *)
  1367. _menhir_reduce36 _menhir_env (Obj.magic _menhir_stack) _menhir_s _startpos _endpos
  1368. | STAR ->
  1369. (* Shifting (STAR) to state 20 *)
  1370. let _menhir_stack = Obj.magic _menhir_stack in
  1371. let _menhir_s = MenhirState19 in
  1372. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  1373. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  1374. (* _menhir_run20 *)
  1375. (* State 20: *)
  1376. (* Not allocating top stack cell *)
  1377. let _menhir_env = _menhir_discard _menhir_env in
  1378. (* Reducing without looking ahead at ACTION _ | BAR | COMMA | LID _ | PREC | RPAREN | UID _ *)
  1379. _menhir_reduce38 _menhir_env (Obj.magic _menhir_stack) _menhir_s _startpos _endpos
  1380. | ACTION _ | BAR | COMMA | LID _ | PREC | RPAREN | UID _ ->
  1381. _menhir_reduce43 _menhir_env (Obj.magic _menhir_stack) MenhirState19
  1382. | _ ->
  1383. assert (not _menhir_env._menhir_error);
  1384. (* Initiating error handling *)
  1385. _menhir_env._menhir_error <- true;
  1386. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState19)
  1387. | MenhirState8 ->
  1388. let _menhir_stack = Obj.magic _menhir_stack in
  1389. (* _menhir_run27 *)
  1390. (* State 27: *)
  1391. if _menhir_env._menhir_error then
  1392. (* Resuming error handling *)
  1393. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState27
  1394. else
  1395. let _tok = _menhir_env._menhir_token in
  1396. (match _tok with
  1397. | PLUS ->
  1398. (* Shifting (PLUS) to state 30 *)
  1399. let _menhir_stack = Obj.magic _menhir_stack in
  1400. let _menhir_s = MenhirState27 in
  1401. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  1402. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  1403. (* _menhir_run30 *)
  1404. (* State 30: *)
  1405. (* Not allocating top stack cell *)
  1406. let _menhir_env = _menhir_discard _menhir_env in
  1407. (* Reducing without looking ahead at COLON | COMMA | EOF | HEADER _ | INLINE | LEFT | LID _ | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | UID _ | error *)
  1408. _menhir_reduce37 _menhir_env (Obj.magic _menhir_stack) _menhir_s _startpos _endpos
  1409. | QUESTION ->
  1410. (* Shifting (QUESTION) to state 29 *)
  1411. let _menhir_stack = Obj.magic _menhir_stack in
  1412. let _menhir_s = MenhirState27 in
  1413. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  1414. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  1415. (* _menhir_run29 *)
  1416. (* State 29: *)
  1417. (* Not allocating top stack cell *)
  1418. let _menhir_env = _menhir_discard _menhir_env in
  1419. (* Reducing without looking ahead at COLON | COMMA | EOF | HEADER _ | INLINE | LEFT | LID _ | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | UID _ | error *)
  1420. _menhir_reduce36 _menhir_env (Obj.magic _menhir_stack) _menhir_s _startpos _endpos
  1421. | STAR ->
  1422. (* Shifting (STAR) to state 28 *)
  1423. let _menhir_stack = Obj.magic _menhir_stack in
  1424. let _menhir_s = MenhirState27 in
  1425. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  1426. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  1427. (* _menhir_run28 *)
  1428. (* State 28: *)
  1429. (* Not allocating top stack cell *)
  1430. let _menhir_env = _menhir_discard _menhir_env in
  1431. (* Reducing without looking ahead at COLON | COMMA | EOF | HEADER _ | INLINE | LEFT | LID _ | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | UID _ | error *)
  1432. _menhir_reduce38 _menhir_env (Obj.magic _menhir_stack) _menhir_s _startpos _endpos
  1433. | COLON | COMMA | EOF | HEADER _ | INLINE | LEFT | LID _ | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | UID _ ->
  1434. _menhir_reduce43 _menhir_env (Obj.magic _menhir_stack) MenhirState27
  1435. | _ ->
  1436. assert (not _menhir_env._menhir_error);
  1437. (* Initiating error handling *)
  1438. _menhir_env._menhir_error <- true;
  1439. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState27)
  1440. | _ ->
  1441. _menhir_fail ()
  1442.  
  1443. and _menhir_goto_option_modifier_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.symbol Positions.located option) -> 'ttv_return =
  1444. fun _menhir_env _menhir_stack _menhir_s _v ->
  1445. match _menhir_s with
  1446. | MenhirState19 ->
  1447. let _menhir_stack = Obj.magic _menhir_stack in
  1448. (* _menhir_run23 *)
  1449. (* State 23: *)
  1450. (* Not allocating top stack cell *)
  1451. (* Reducing without looking ahead at ACTION _ | BAR | COMMA | LID _ | PREC | RPAREN | UID _ *)
  1452. _menhir_reduce1 _menhir_env (Obj.magic _menhir_stack) _menhir_s _v
  1453. | MenhirState27 ->
  1454. let _menhir_stack = Obj.magic _menhir_stack in
  1455. (* _menhir_run31 *)
  1456. (* State 31: *)
  1457. (* Not allocating top stack cell *)
  1458. (* Reducing without looking ahead at COLON | COMMA | EOF | HEADER _ | INLINE | LEFT | LID _ | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | UID _ | error *)
  1459. _menhir_reduce1 _menhir_env (Obj.magic _menhir_stack) _menhir_s _v
  1460. | _ ->
  1461. _menhir_fail ()
  1462.  
  1463. and _menhir_goto_separated_nonempty_list_option_COMMA__actual_parameter_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.parameter list) -> 'ttv_return =
  1464. fun _menhir_env _menhir_stack _menhir_s _v ->
  1465. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1466. match _menhir_s with
  1467. | MenhirState4 ->
  1468. let _menhir_stack = Obj.magic _menhir_stack in
  1469. (* _menhir_run33 *)
  1470. (* State 33: *)
  1471. if _menhir_env._menhir_error then
  1472. (* Resuming error handling *)
  1473. _menhir_error33 _menhir_env (Obj.magic _menhir_stack)
  1474. else
  1475. let _tok = _menhir_env._menhir_token in
  1476. (match _tok with
  1477. | COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE ->
  1478. let _menhir_stack = Obj.magic _menhir_stack in
  1479. (* _menhir_reduce9 *)
  1480. (* Reducing production declaration -> TYPE OCAMLTYPE separated_nonempty_list(option(COMMA),actual_parameter) *)
  1481. let (((_menhir_stack, _menhir_s, _startpos__1_), t, _endpos_t_), _, xs0) = _menhir_stack in
  1482. let _v : (Syntax.declaration Positions.located list) = let ss =
  1483. let xs = xs0 in
  1484. ( xs )
  1485. in
  1486. ( List.map (Positions.map (fun nt -> DType (t, nt)))
  1487. (List.map Parameters.with_pos ss) ) in
  1488. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  1489. | _ ->
  1490. assert (not _menhir_env._menhir_error);
  1491. (* Initiating error handling *)
  1492. _menhir_env._menhir_error <- true;
  1493. _menhir_error33 _menhir_env (Obj.magic _menhir_stack))
  1494. | MenhirState37 ->
  1495. let _menhir_stack = Obj.magic _menhir_stack in
  1496. (* _menhir_run38 *)
  1497. (* State 38: *)
  1498. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  1499. let _menhir_stack = Obj.magic _menhir_stack in
  1500. (* _menhir_reduce73 *)
  1501. (* Reducing production separated_nonempty_list(option(COMMA),actual_parameter) -> actual_parameter option(COMMA) separated_nonempty_list(option(COMMA),actual_parameter) *)
  1502. let (((_menhir_stack, _menhir_s, x, _startpos_x_), _, _), _, xs) = _menhir_stack in
  1503. let _v : (Syntax.parameter list) = ( x :: xs ) in
  1504. _menhir_goto_separated_nonempty_list_option_COMMA__actual_parameter_ _menhir_env _menhir_stack _menhir_s _v
  1505. | _ ->
  1506. _menhir_fail ()
  1507.  
  1508. and _menhir_goto_separated_nonempty_list_option_COMMA__terminal_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.terminal Positions.located list) -> 'ttv_return =
  1509. fun _menhir_env _menhir_stack _menhir_s _v ->
  1510. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1511. match _menhir_s with
  1512. | MenhirState44 ->
  1513. let _menhir_stack = Obj.magic _menhir_stack in
  1514. (* _menhir_run45 *)
  1515. (* State 45: *)
  1516. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  1517. let _menhir_stack = Obj.magic _menhir_stack in
  1518. (* _menhir_reduce79 *)
  1519. (* Reducing production separated_nonempty_list(option(COMMA),terminal) -> UID option(COMMA) separated_nonempty_list(option(COMMA),terminal) *)
  1520. let (((_menhir_stack, _menhir_s, id0, _startpos_id0_, _endpos_id0_), _, _), _, xs) = _menhir_stack in
  1521. let _v : (Syntax.terminal Positions.located list) = let x =
  1522. let id = id0 in
  1523. ( id )
  1524. in
  1525. ( x :: xs ) in
  1526. _menhir_goto_separated_nonempty_list_option_COMMA__terminal_ _menhir_env _menhir_stack _menhir_s _v
  1527. | MenhirState41 ->
  1528. let _menhir_stack = Obj.magic _menhir_stack in
  1529. (* _menhir_run46 *)
  1530. (* State 46: *)
  1531. if _menhir_env._menhir_error then
  1532. (* Resuming error handling *)
  1533. _menhir_error46 _menhir_env (Obj.magic _menhir_stack)
  1534. else
  1535. let _tok = _menhir_env._menhir_token in
  1536. (match _tok with
  1537. | COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE ->
  1538. let _menhir_stack = Obj.magic _menhir_stack in
  1539. (* _menhir_reduce3 *)
  1540. (* Reducing production declaration -> TOKEN option(OCAMLTYPE) separated_nonempty_list(option(COMMA),terminal) *)
  1541. let (((_menhir_stack, _menhir_s, _startpos__1_), _, t), _, xs0) = _menhir_stack in
  1542. let _v : (Syntax.declaration Positions.located list) = let ts =
  1543. let xs = xs0 in
  1544. ( xs )
  1545. in
  1546. ( List.map (Positions.map (fun terminal -> DToken (t, terminal))) ts ) in
  1547. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  1548. | _ ->
  1549. assert (not _menhir_env._menhir_error);
  1550. (* Initiating error handling *)
  1551. _menhir_env._menhir_error <- true;
  1552. _menhir_error46 _menhir_env (Obj.magic _menhir_stack))
  1553. | _ ->
  1554. _menhir_fail ()
  1555.  
  1556. and _menhir_goto_separated_nonempty_list_option_COMMA__nonterminal_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.nonterminal Positions.located list) -> 'ttv_return =
  1557. fun _menhir_env _menhir_stack _menhir_s _v ->
  1558. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1559. match _menhir_s with
  1560. | MenhirState52 ->
  1561. let _menhir_stack = Obj.magic _menhir_stack in
  1562. (* _menhir_run53 *)
  1563. (* State 53: *)
  1564. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  1565. let _menhir_stack = Obj.magic _menhir_stack in
  1566. (* _menhir_reduce75 *)
  1567. (* Reducing production separated_nonempty_list(option(COMMA),nonterminal) -> LID option(COMMA) separated_nonempty_list(option(COMMA),nonterminal) *)
  1568. let (((_menhir_stack, _menhir_s, id0, _startpos_id0_, _endpos_id0_), _, _), _, xs) = _menhir_stack in
  1569. let _v : (Syntax.nonterminal Positions.located list) = let x =
  1570. let id = id0 in
  1571. ( id )
  1572. in
  1573. ( x :: xs ) in
  1574. _menhir_goto_separated_nonempty_list_option_COMMA__nonterminal_ _menhir_env _menhir_stack _menhir_s _v
  1575. | MenhirState49 ->
  1576. let _menhir_stack = Obj.magic _menhir_stack in
  1577. (* _menhir_run54 *)
  1578. (* State 54: *)
  1579. if _menhir_env._menhir_error then
  1580. (* Resuming error handling *)
  1581. _menhir_error54 _menhir_env (Obj.magic _menhir_stack)
  1582. else
  1583. let _tok = _menhir_env._menhir_token in
  1584. (match _tok with
  1585. | COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE ->
  1586. let _menhir_stack = Obj.magic _menhir_stack in
  1587. (* _menhir_reduce6 *)
  1588. (* Reducing production declaration -> START option(OCAMLTYPE) separated_nonempty_list(option(COMMA),nonterminal) *)
  1589. let (((_menhir_stack, _menhir_s, _startpos__1_), _, t), _, xs0) = _menhir_stack in
  1590. let _v : (Syntax.declaration Positions.located list) = let nts =
  1591. let xs = xs0 in
  1592. ( xs )
  1593. in
  1594. (
  1595. match t with
  1596. | None ->
  1597. List.map (Positions.map (fun nonterminal -> DStart nonterminal)) nts
  1598. | Some t ->
  1599. Misc.mapd (fun ntloc ->
  1600. Positions.mapd (fun nt -> DStart nt, DType (t, ParameterVar ntloc)) ntloc) nts
  1601. ) in
  1602. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  1603. | _ ->
  1604. assert (not _menhir_env._menhir_error);
  1605. (* Initiating error handling *)
  1606. _menhir_env._menhir_error <- true;
  1607. _menhir_error54 _menhir_env (Obj.magic _menhir_stack))
  1608. | _ ->
  1609. _menhir_fail ()
  1610.  
  1611. and _menhir_goto_separated_nonempty_list_option_COMMA__symbol_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.symbol Positions.located list) -> 'ttv_return =
  1612. fun _menhir_env _menhir_stack _menhir_s _v ->
  1613. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1614. match _menhir_s with
  1615. | MenhirState71 ->
  1616. let _menhir_stack = Obj.magic _menhir_stack in
  1617. (* _menhir_run72 *)
  1618. (* State 72: *)
  1619. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  1620. let _menhir_stack = Obj.magic _menhir_stack in
  1621. (* _menhir_reduce77 *)
  1622. (* Reducing production separated_nonempty_list(option(COMMA),symbol) -> symbol option(COMMA) separated_nonempty_list(option(COMMA),symbol) *)
  1623. let (((_menhir_stack, _menhir_s, x, _startpos_x_, _endpos_x_), _, _), _, xs) = _menhir_stack in
  1624. let _v : (Syntax.symbol Positions.located list) = ( x :: xs ) in
  1625. _menhir_goto_separated_nonempty_list_option_COMMA__symbol_ _menhir_env _menhir_stack _menhir_s _v
  1626. | MenhirState68 ->
  1627. let _menhir_stack = Obj.magic _menhir_stack in
  1628. (* _menhir_run73 *)
  1629. (* State 73: *)
  1630. if _menhir_env._menhir_error then
  1631. (* Resuming error handling *)
  1632. _menhir_error73 _menhir_env (Obj.magic _menhir_stack)
  1633. else
  1634. let _tok = _menhir_env._menhir_token in
  1635. (match _tok with
  1636. | COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE ->
  1637. let _menhir_stack = Obj.magic _menhir_stack in
  1638. (* _menhir_reduce13 *)
  1639. (* Reducing production declaration -> priority_keyword separated_nonempty_list(option(COMMA),symbol) *)
  1640. let ((_menhir_stack, _menhir_s, k, _startpos_k_, _endpos_k_), _, xs0) = _menhir_stack in
  1641. let _v : (Syntax.declaration Positions.located list) = let ss =
  1642. let xs = xs0 in
  1643. ( xs )
  1644. in
  1645. ( let prec = ParserAux.current_token_precedence _startpos_k_ _endpos_k_ in
  1646. List.map (Positions.map (fun symbol -> DTokenProperties (symbol, k, prec))) ss ) in
  1647. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  1648. | _ ->
  1649. assert (not _menhir_env._menhir_error);
  1650. (* Initiating error handling *)
  1651. _menhir_env._menhir_error <- true;
  1652. _menhir_error73 _menhir_env (Obj.magic _menhir_stack))
  1653. | _ ->
  1654. _menhir_fail ()
  1655.  
  1656. and _menhir_goto_rule : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.parameterized_rule list) -> 'ttv_return =
  1657. fun _menhir_env _menhir_stack _menhir_s _v ->
  1658. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1659. (* State should be MenhirState82 | MenhirState76 *)
  1660. let _menhir_stack = Obj.magic _menhir_stack in
  1661. (* _menhir_run82 *)
  1662. (* State 82: *)
  1663. if _menhir_env._menhir_error then
  1664. (* Resuming error handling *)
  1665. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState82
  1666. else
  1667. let _tok = _menhir_env._menhir_token in
  1668. match _tok with
  1669. | INLINE ->
  1670. (* Shifting (INLINE) to state 80 *)
  1671. _menhir_run80 _menhir_env (Obj.magic _menhir_stack) MenhirState82 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1672. | PUBLIC ->
  1673. (* Shifting (PUBLIC) to state 78 *)
  1674. _menhir_run78 _menhir_env (Obj.magic _menhir_stack) MenhirState82 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1675. | EOF | PERCENTPERCENT _ ->
  1676. _menhir_reduce30 _menhir_env (Obj.magic _menhir_stack) MenhirState82
  1677. | LID _ | UID _ ->
  1678. _menhir_reduce20 _menhir_env (Obj.magic _menhir_stack) MenhirState82
  1679. | _ ->
  1680. (assert (not _menhir_env._menhir_error);
  1681. (* Initiating error handling *)
  1682. _menhir_env._menhir_error <- true;
  1683. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState82)
  1684.  
  1685. and _menhir_goto_option_precedence_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.symbol Positions.located option) -> Lexing.position -> 'ttv_return =
  1686. fun _menhir_env _menhir_stack _menhir_s _v _endpos ->
  1687. match _menhir_s with
  1688. | MenhirState98 ->
  1689. let _menhir_stack = Obj.magic _menhir_stack in
  1690. (* _menhir_run101 *)
  1691. (* State 101: *)
  1692. (* Not allocating top stack cell *)
  1693. (* Reducing without looking ahead at BAR | EOF | INLINE | LID _ | PERCENTPERCENT _ | PUBLIC | UID _ | error *)
  1694. let _menhir_stack = Obj.magic _menhir_stack in
  1695. let _endpos__3_ = _endpos in
  1696. (* _menhir_reduce56 *)
  1697. (* Reducing production production_group -> error ACTION option(precedence) *)
  1698. let ((_menhir_stack, _menhir_s, _startpos__1_, _endpos__1_), _, _startpos__2_, _endpos__2_) = _menhir_stack in
  1699. let _v : (Syntax.parameterized_branch list) = ( Error.error (Positions.two _startpos__1_ _endpos__1_) "syntax error inside a production." ) in
  1700. _menhir_goto_production_group _menhir_env _menhir_stack _menhir_s _v
  1701. | MenhirState107 ->
  1702. let _menhir_stack = Obj.magic _menhir_stack in
  1703. (* _menhir_run108 *)
  1704. (* State 108: *)
  1705. (* Not allocating top stack cell *)
  1706. (* Reducing without looking ahead at BAR | EOF | INLINE | LID _ | PERCENTPERCENT _ | PUBLIC | UID _ | error *)
  1707. let _menhir_stack = Obj.magic _menhir_stack in
  1708. let oprec2 = _v in
  1709. let _endpos_oprec2_ = _endpos in
  1710. (* _menhir_reduce55 *)
  1711. (* Reducing production production_group -> separated_nonempty_list(BAR,production) ACTION option(precedence) *)
  1712. let ((_menhir_stack, _menhir_s, productions), action, _startpos_action_, _endpos_action_) = _menhir_stack in
  1713. let _v : (Syntax.parameterized_branch list) = (
  1714. ParserAux.check_production_group
  1715. productions
  1716. _startpos_action_ _endpos_action_ action;
  1717.  
  1718. List.map (fun (producers, oprec1, rprec, pos) -> {
  1719. pr_producers = producers;
  1720. pr_action = action;
  1721. pr_branch_shift_precedence = ParserAux.override pos oprec1 oprec2;
  1722. pr_branch_reduce_precedence = rprec;
  1723. pr_branch_position = pos
  1724. }) productions
  1725. ) in
  1726. _menhir_goto_production_group _menhir_env _menhir_stack _menhir_s _v
  1727. | MenhirState118 ->
  1728. let _menhir_stack = Obj.magic _menhir_stack in
  1729. (* _menhir_run121 *)
  1730. (* State 121: *)
  1731. (* Not allocating top stack cell *)
  1732. (* Reducing without looking ahead at ACTION _ | BAR *)
  1733. let _menhir_stack = Obj.magic _menhir_stack in
  1734. let oprec = _v in
  1735. let _endpos_oprec_ = _endpos in
  1736. (* _menhir_reduce54 *)
  1737. (* Reducing production production -> list(producer) option(precedence) *)
  1738. let (_menhir_stack, _menhir_s, producers, _startpos_producers_) = _menhir_stack in
  1739. let _startpos = _startpos_producers_ in
  1740. let _endpos = _endpos_oprec_ in
  1741. let _v : (Syntax.producer list * Syntax.symbol Positions.located option *
  1742. Syntax.branch_reduce_precedence * Positions.t) = ( producers,
  1743. oprec,
  1744. ParserAux.current_reduce_precedence(),
  1745. Positions.lex_join _startpos _endpos
  1746. ) in
  1747. (* _menhir_goto_production *)
  1748. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1749. (* State should be MenhirState95 | MenhirState113 | MenhirState110 *)
  1750. let _menhir_stack = Obj.magic _menhir_stack in
  1751. (* _menhir_run112 *)
  1752. (* State 112: *)
  1753. assert (not _menhir_env._menhir_error);
  1754. let _tok = _menhir_env._menhir_token in
  1755. (match _tok with
  1756. | BAR ->
  1757. (* Shifting (BAR) to state 113 *)
  1758. let _menhir_stack = Obj.magic _menhir_stack in
  1759. (* _menhir_run113 *)
  1760. (* State 113: *)
  1761. let _menhir_env = _menhir_discard _menhir_env in
  1762. let _tok = _menhir_env._menhir_token in
  1763. (match _tok with
  1764. | LID _v ->
  1765. (* Shifting (LID) to state 102 *)
  1766. _menhir_run102 _menhir_env (Obj.magic _menhir_stack) MenhirState113 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1767. | UID _v ->
  1768. (* Shifting (UID) to state 10 *)
  1769. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState113 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1770. | ACTION _ | BAR | PREC ->
  1771. _menhir_reduce28 _menhir_env (Obj.magic _menhir_stack) MenhirState113
  1772. | _ ->
  1773. assert (not _menhir_env._menhir_error);
  1774. (* Initiating error handling *)
  1775. _menhir_env._menhir_error <- true;
  1776. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState113)
  1777. | ACTION _ ->
  1778. let _menhir_stack = Obj.magic _menhir_stack in
  1779. (* _menhir_reduce64 *)
  1780. (* Reducing production separated_nonempty_list(BAR,production) -> production *)
  1781. let (_menhir_stack, _menhir_s, x) = _menhir_stack in
  1782. let _v : ((Syntax.producer list * Syntax.symbol Positions.located option *
  1783. Syntax.branch_reduce_precedence * Positions.t)
  1784. list) = ( [ x ] ) in
  1785. _menhir_goto_separated_nonempty_list_BAR_production_ _menhir_env _menhir_stack _menhir_s _v
  1786. | _ ->
  1787. assert (not _menhir_env._menhir_error);
  1788. (* Initiating error handling *)
  1789. _menhir_env._menhir_error <- true;
  1790. let _menhir_stack = Obj.magic _menhir_stack in
  1791. (* _menhir_error112 *)
  1792. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  1793. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s)
  1794. | _ ->
  1795. _menhir_fail ()
  1796.  
  1797. and _menhir_goto_production_group : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.parameterized_branch list) -> 'ttv_return =
  1798. fun _menhir_env _menhir_stack _menhir_s _v ->
  1799. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1800. (* State should be MenhirState110 | MenhirState95 *)
  1801. let _menhir_stack = Obj.magic _menhir_stack in
  1802. (* _menhir_run109 *)
  1803. (* State 109: *)
  1804. if _menhir_env._menhir_error then
  1805. (* Resuming error handling *)
  1806. _menhir_error109 _menhir_env (Obj.magic _menhir_stack)
  1807. else
  1808. let _tok = _menhir_env._menhir_token in
  1809. match _tok with
  1810. | BAR ->
  1811. (* Shifting (BAR) to state 110 *)
  1812. let _menhir_stack = Obj.magic _menhir_stack in
  1813. (* _menhir_run110 *)
  1814. (* State 110: *)
  1815. let _menhir_env = _menhir_discard _menhir_env in
  1816. let _tok = _menhir_env._menhir_token in
  1817. (match _tok with
  1818. | LID _v ->
  1819. (* Shifting (LID) to state 102 *)
  1820. _menhir_run102 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1821. | UID _v ->
  1822. (* Shifting (UID) to state 10 *)
  1823. _menhir_run10 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1824. | ACTION _ | BAR | PREC ->
  1825. _menhir_reduce28 _menhir_env (Obj.magic _menhir_stack) MenhirState110
  1826. | _ ->
  1827. assert (not _menhir_env._menhir_error);
  1828. (* Initiating error handling *)
  1829. _menhir_env._menhir_error <- true;
  1830. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState110)
  1831. | EOF | INLINE | LID _ | PERCENTPERCENT _ | PUBLIC | UID _ ->
  1832. _menhir_reduce66 _menhir_env (Obj.magic _menhir_stack)
  1833. | _ ->
  1834. (assert (not _menhir_env._menhir_error);
  1835. (* Initiating error handling *)
  1836. _menhir_env._menhir_error <- true;
  1837. _menhir_error109 _menhir_env (Obj.magic _menhir_stack))
  1838.  
  1839. and _menhir_run99 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  1840. fun _menhir_env _menhir_stack _menhir_s ->
  1841. (* State 99: *)
  1842. let _menhir_stack = (_menhir_stack, _menhir_s) in
  1843. let _menhir_env = _menhir_discard _menhir_env in
  1844. let _tok = _menhir_env._menhir_token in
  1845. match _tok with
  1846. | LID _v ->
  1847. (* Shifting (LID) to state 7 *)
  1848. _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1849. | UID _v ->
  1850. (* Shifting (UID) to state 6 *)
  1851. _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState99 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1852. | _ ->
  1853. assert (not _menhir_env._menhir_error);
  1854. (* Initiating error handling *)
  1855. _menhir_env._menhir_error <- true;
  1856. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState99
  1857.  
  1858. and _menhir_fail : unit -> 'a =
  1859. fun () ->
  1860. Printf.fprintf Pervasives.stderr "Internal failure -- please contact the parser generator's developers.\n%!";
  1861. assert false
  1862.  
  1863. and _menhir_reduce20 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  1864. fun _menhir_env _menhir_stack _menhir_s ->
  1865. (* Reducing production flags -> *)
  1866. let _v : (bool * bool) = ( false, false ) in
  1867. _menhir_goto_flags _menhir_env _menhir_stack _menhir_s _v
  1868.  
  1869. and _menhir_reduce30 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  1870. fun _menhir_env _menhir_stack _menhir_s ->
  1871. (* Reducing production list(rule) -> *)
  1872. let _v : (Syntax.parameterized_rule list list) = ( [] ) in
  1873. _menhir_goto_list_rule_ _menhir_env _menhir_stack _menhir_s _v
  1874.  
  1875. and _menhir_run78 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  1876. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  1877. (* State 78: *)
  1878. let _menhir_stack = (_menhir_stack, _menhir_s, _startpos, _endpos) in
  1879. let _menhir_env = _menhir_discard _menhir_env in
  1880. let _tok = _menhir_env._menhir_token in
  1881. match _tok with
  1882. | INLINE ->
  1883. (* Shifting (INLINE) to state 79 *)
  1884. let _menhir_stack = Obj.magic _menhir_stack in
  1885. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  1886. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  1887. (* _menhir_run79 *)
  1888. (* State 79: *)
  1889. (* Not allocating top stack cell *)
  1890. let _menhir_env = _menhir_discard _menhir_env in
  1891. (* Reducing without looking ahead at LID _ | UID _ *)
  1892. let _menhir_stack = Obj.magic _menhir_stack in
  1893. let _startpos__2_ = _startpos in
  1894. let _endpos__2_ = _endpos in
  1895. (* _menhir_reduce23 *)
  1896. (* Reducing production flags -> PUBLIC INLINE *)
  1897. let (_menhir_stack, _menhir_s, _startpos__1_, _endpos__1_) = _menhir_stack in
  1898. let _v : (bool * bool) = ( true, true ) in
  1899. _menhir_goto_flags _menhir_env _menhir_stack _menhir_s _v
  1900. | LID _ | UID _ ->
  1901. let _menhir_stack = Obj.magic _menhir_stack in
  1902. (* _menhir_reduce21 *)
  1903. (* Reducing production flags -> PUBLIC *)
  1904. let (_menhir_stack, _menhir_s, _startpos__1_, _endpos__1_) = _menhir_stack in
  1905. let _v : (bool * bool) = ( true, false ) in
  1906. _menhir_goto_flags _menhir_env _menhir_stack _menhir_s _v
  1907. | _ ->
  1908. assert (not _menhir_env._menhir_error);
  1909. (* Initiating error handling *)
  1910. _menhir_env._menhir_error <- true;
  1911. let _menhir_stack = Obj.magic _menhir_stack in
  1912. (* _menhir_error78 *)
  1913. let (_menhir_stack, _menhir_s, _, _) = _menhir_stack in
  1914. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  1915.  
  1916. and _menhir_run80 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  1917. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  1918. (* State 80: *)
  1919. let _menhir_stack = (_menhir_stack, _menhir_s, _startpos, _endpos) in
  1920. let _menhir_env = _menhir_discard _menhir_env in
  1921. let _tok = _menhir_env._menhir_token in
  1922. match _tok with
  1923. | PUBLIC ->
  1924. (* Shifting (PUBLIC) to state 81 *)
  1925. let _menhir_stack = Obj.magic _menhir_stack in
  1926. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  1927. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  1928. (* _menhir_run81 *)
  1929. (* State 81: *)
  1930. (* Not allocating top stack cell *)
  1931. let _menhir_env = _menhir_discard _menhir_env in
  1932. (* Reducing without looking ahead at LID _ | UID _ *)
  1933. let _menhir_stack = Obj.magic _menhir_stack in
  1934. let _startpos__2_ = _startpos in
  1935. let _endpos__2_ = _endpos in
  1936. (* _menhir_reduce24 *)
  1937. (* Reducing production flags -> INLINE PUBLIC *)
  1938. let (_menhir_stack, _menhir_s, _startpos__1_, _endpos__1_) = _menhir_stack in
  1939. let _v : (bool * bool) = ( true, true ) in
  1940. _menhir_goto_flags _menhir_env _menhir_stack _menhir_s _v
  1941. | LID _ | UID _ ->
  1942. let _menhir_stack = Obj.magic _menhir_stack in
  1943. (* _menhir_reduce22 *)
  1944. (* Reducing production flags -> INLINE *)
  1945. let (_menhir_stack, _menhir_s, _startpos__1_, _endpos__1_) = _menhir_stack in
  1946. let _v : (bool * bool) = ( false, true ) in
  1947. _menhir_goto_flags _menhir_env _menhir_stack _menhir_s _v
  1948. | _ ->
  1949. assert (not _menhir_env._menhir_error);
  1950. (* Initiating error handling *)
  1951. _menhir_env._menhir_error <- true;
  1952. let _menhir_stack = Obj.magic _menhir_stack in
  1953. (* _menhir_error80 *)
  1954. let (_menhir_stack, _menhir_s, _, _) = _menhir_stack in
  1955. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  1956.  
  1957. and _menhir_reduce81 : _menhir_env -> 'ttv_tail -> _menhir_state -> (string Positions.located) -> Lexing.position -> Lexing.position -> 'ttv_return =
  1958. fun _menhir_env _menhir_stack _menhir_s id _startpos_id_ _endpos_id_ ->
  1959. (* Reducing production symbol -> UID *)
  1960. let _startpos = _startpos_id_ in
  1961. let _endpos = _endpos_id_ in
  1962. let _v : (Syntax.symbol Positions.located) = ( id ) in
  1963. _menhir_goto_symbol _menhir_env _menhir_stack _menhir_s _v _startpos _endpos
  1964.  
  1965. and _menhir_reduce80 : _menhir_env -> 'ttv_tail * _menhir_state * (string Positions.located) * Lexing.position * Lexing.position -> 'ttv_return =
  1966. fun _menhir_env _menhir_stack ->
  1967. (* Reducing production symbol -> LID *)
  1968. let (_menhir_stack, _menhir_s, id, _startpos_id_, _endpos_id_) = _menhir_stack in
  1969. let _startpos = _startpos_id_ in
  1970. let _endpos = _endpos_id_ in
  1971. let _v : (Syntax.symbol Positions.located) = ( id ) in
  1972. _menhir_goto_symbol _menhir_env _menhir_stack _menhir_s _v _startpos _endpos
  1973.  
  1974. and _menhir_goto_option_OCAMLTYPE_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Stretch.ocamltype option) -> 'ttv_return =
  1975. fun _menhir_env _menhir_stack _menhir_s _v ->
  1976. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  1977. match _menhir_s with
  1978. | MenhirState39 ->
  1979. let _menhir_stack = Obj.magic _menhir_stack in
  1980. (* _menhir_run41 *)
  1981. (* State 41: *)
  1982. if _menhir_env._menhir_error then
  1983. (* Resuming error handling *)
  1984. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState41
  1985. else
  1986. let _tok = _menhir_env._menhir_token in
  1987. (match _tok with
  1988. | UID _v ->
  1989. (* Shifting (UID) to state 43 *)
  1990. _menhir_run43 _menhir_env (Obj.magic _menhir_stack) MenhirState41 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  1991. | _ ->
  1992. assert (not _menhir_env._menhir_error);
  1993. (* Initiating error handling *)
  1994. _menhir_env._menhir_error <- true;
  1995. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState41)
  1996. | MenhirState48 ->
  1997. let _menhir_stack = Obj.magic _menhir_stack in
  1998. (* _menhir_run49 *)
  1999. (* State 49: *)
  2000. if _menhir_env._menhir_error then
  2001. (* Resuming error handling *)
  2002. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState49
  2003. else
  2004. let _tok = _menhir_env._menhir_token in
  2005. (match _tok with
  2006. | LID _v ->
  2007. (* Shifting (LID) to state 51 *)
  2008. _menhir_run51 _menhir_env (Obj.magic _menhir_stack) MenhirState49 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2009. | _ ->
  2010. assert (not _menhir_env._menhir_error);
  2011. (* Initiating error handling *)
  2012. _menhir_env._menhir_error <- true;
  2013. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState49)
  2014. | _ ->
  2015. _menhir_fail ()
  2016.  
  2017. and _menhir_reduce32 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  2018. fun _menhir_env _menhir_stack _menhir_s ->
  2019. (* Reducing production loption(delimited(LPAREN,separated_nonempty_list(COMMA,actual_parameter),RPAREN)) -> *)
  2020. let _v : (Syntax.parameters) = ( [] ) in
  2021. _menhir_goto_loption_delimited_LPAREN_separated_nonempty_list_COMMA_actual_parameter__RPAREN__ _menhir_env _menhir_stack _menhir_s _v
  2022.  
  2023. and _menhir_reduce43 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  2024. fun _menhir_env _menhir_stack _menhir_s ->
  2025. (* Reducing production option(modifier) -> *)
  2026. let _v : (Syntax.symbol Positions.located option) = ( None ) in
  2027. _menhir_goto_option_modifier_ _menhir_env _menhir_stack _menhir_s _v
  2028.  
  2029. and _menhir_reduce72 : _menhir_env -> 'ttv_tail * _menhir_state * (Syntax.parameter) * Lexing.position -> 'ttv_return =
  2030. fun _menhir_env _menhir_stack ->
  2031. (* Reducing production separated_nonempty_list(option(COMMA),actual_parameter) -> actual_parameter *)
  2032. let (_menhir_stack, _menhir_s, x, _startpos_x_) = _menhir_stack in
  2033. let _v : (Syntax.parameter list) = ( [ x ] ) in
  2034. _menhir_goto_separated_nonempty_list_option_COMMA__actual_parameter_ _menhir_env _menhir_stack _menhir_s _v
  2035.  
  2036. and _menhir_reduce78 : _menhir_env -> 'ttv_tail * _menhir_state * (string Positions.located) * Lexing.position * Lexing.position -> 'ttv_return =
  2037. fun _menhir_env _menhir_stack ->
  2038. (* Reducing production separated_nonempty_list(option(COMMA),terminal) -> UID *)
  2039. let (_menhir_stack, _menhir_s, id0, _startpos_id0_, _endpos_id0_) = _menhir_stack in
  2040. let _v : (Syntax.terminal Positions.located list) = let x =
  2041. let id = id0 in
  2042. ( id )
  2043. in
  2044. ( [ x ] ) in
  2045. _menhir_goto_separated_nonempty_list_option_COMMA__terminal_ _menhir_env _menhir_stack _menhir_s _v
  2046.  
  2047. and _menhir_reduce74 : _menhir_env -> 'ttv_tail * _menhir_state * (string Positions.located) * Lexing.position * Lexing.position -> 'ttv_return =
  2048. fun _menhir_env _menhir_stack ->
  2049. (* Reducing production separated_nonempty_list(option(COMMA),nonterminal) -> LID *)
  2050. let (_menhir_stack, _menhir_s, id0, _startpos_id0_, _endpos_id0_) = _menhir_stack in
  2051. let _v : (Syntax.nonterminal Positions.located list) = let x =
  2052. let id = id0 in
  2053. ( id )
  2054. in
  2055. ( [ x ] ) in
  2056. _menhir_goto_separated_nonempty_list_option_COMMA__nonterminal_ _menhir_env _menhir_stack _menhir_s _v
  2057.  
  2058. and _menhir_reduce76 : _menhir_env -> 'ttv_tail * _menhir_state * (Syntax.symbol Positions.located) * Lexing.position * Lexing.position -> 'ttv_return =
  2059. fun _menhir_env _menhir_stack ->
  2060. (* Reducing production separated_nonempty_list(option(COMMA),symbol) -> symbol *)
  2061. let (_menhir_stack, _menhir_s, x, _startpos_x_, _endpos_x_) = _menhir_stack in
  2062. let _v : (Syntax.symbol Positions.located list) = ( [ x ] ) in
  2063. _menhir_goto_separated_nonempty_list_option_COMMA__symbol_ _menhir_env _menhir_stack _menhir_s _v
  2064.  
  2065. and _menhir_run77 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  2066. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  2067. (* State 77: *)
  2068. (* Not allocating top stack cell *)
  2069. let _menhir_env = _menhir_discard _menhir_env in
  2070. (* Reducing without looking ahead at EOF | INLINE | LID _ | PERCENTPERCENT _ | PUBLIC | UID _ | error *)
  2071. let _menhir_stack = Obj.magic _menhir_stack in
  2072. let _startpos__1_ = _startpos in
  2073. let _endpos__1_ = _endpos in
  2074. (* _menhir_reduce59 *)
  2075. (* Reducing production rule -> error *)
  2076. let _startpos = _startpos__1_ in
  2077. let _endpos = _endpos__1_ in
  2078. let _v : (Syntax.parameterized_rule list) = ( Error.error (Positions.two _startpos _endpos) "syntax error inside the definition of a nonterminal symbol." ) in
  2079. _menhir_goto_rule _menhir_env _menhir_stack _menhir_s _v
  2080.  
  2081. and _menhir_reduce45 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  2082. fun _menhir_env _menhir_stack _menhir_s ->
  2083. (* Reducing production option(precedence) -> *)
  2084. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  2085. let _v : (Syntax.symbol Positions.located option) = ( None ) in
  2086. _menhir_goto_option_precedence_ _menhir_env _menhir_stack _menhir_s _v _endpos
  2087.  
  2088. and _menhir_run96 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  2089. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  2090. (* State 96: *)
  2091. let _menhir_stack = (_menhir_stack, _menhir_s, _startpos, _endpos) in
  2092. let _menhir_env = _menhir_discard _menhir_env in
  2093. let _tok = _menhir_env._menhir_token in
  2094. match _tok with
  2095. | ACTION _v ->
  2096. (* Shifting (ACTION) to state 98 *)
  2097. let _menhir_stack = Obj.magic _menhir_stack in
  2098. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  2099. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  2100. (* _menhir_run98 *)
  2101. (* State 98: *)
  2102. let _menhir_stack = (_menhir_stack, _v, _startpos, _endpos) in
  2103. let _menhir_env = _menhir_discard _menhir_env in
  2104. let _tok = _menhir_env._menhir_token in
  2105. (match _tok with
  2106. | PREC ->
  2107. (* Shifting (PREC) to state 99 *)
  2108. _menhir_run99 _menhir_env (Obj.magic _menhir_stack) MenhirState98
  2109. | BAR | EOF | INLINE | LID _ | PERCENTPERCENT _ | PUBLIC | UID _ ->
  2110. _menhir_reduce45 _menhir_env (Obj.magic _menhir_stack) MenhirState98
  2111. | _ ->
  2112. assert (not _menhir_env._menhir_error);
  2113. (* Initiating error handling *)
  2114. _menhir_env._menhir_error <- true;
  2115. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState98)
  2116. | EOF ->
  2117. (* Shifting (EOF) to state 97 *)
  2118. let _menhir_stack = Obj.magic _menhir_stack in
  2119. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  2120. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  2121. (* _menhir_run97 *)
  2122. (* State 97: *)
  2123. (* Not allocating top stack cell *)
  2124. let _menhir_env = _menhir_discard _menhir_env in
  2125. (* Reducing without looking ahead at BAR | EOF | INLINE | LID _ | PERCENTPERCENT _ | PUBLIC | UID _ | error *)
  2126. let _menhir_stack = Obj.magic _menhir_stack in
  2127. let _startpos__2_ = _startpos in
  2128. let _endpos__2_ = _endpos in
  2129. (* _menhir_reduce57 *)
  2130. (* Reducing production production_group -> error EOF *)
  2131. let (_menhir_stack, _menhir_s, _startpos__1_, _endpos__1_) = _menhir_stack in
  2132. let _v : (Syntax.parameterized_branch list) = ( Error.error (Positions.two _startpos__1_ _endpos__1_) "syntax error inside a production." ) in
  2133. _menhir_goto_production_group _menhir_env _menhir_stack _menhir_s _v
  2134. | _ ->
  2135. assert (not _menhir_env._menhir_error);
  2136. (* Initiating error handling *)
  2137. _menhir_env._menhir_error <- true;
  2138. let _menhir_stack = Obj.magic _menhir_stack in
  2139. (* _menhir_error96 *)
  2140. let (_menhir_stack, _menhir_s, _, _) = _menhir_stack in
  2141. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2142.  
  2143. and _menhir_run1 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  2144. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  2145. (* State 1: *)
  2146. (* Not allocating top stack cell *)
  2147. let _menhir_env = _menhir_discard _menhir_env in
  2148. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2149. let _menhir_stack = Obj.magic _menhir_stack in
  2150. let _startpos__1_ = _startpos in
  2151. let _endpos__1_ = _endpos in
  2152. (* _menhir_reduce18 *)
  2153. (* Reducing production declaration -> error *)
  2154. let _startpos = _startpos__1_ in
  2155. let _endpos = _endpos__1_ in
  2156. let _v : (Syntax.declaration Positions.located list) = ( Error.error (Positions.two _startpos _endpos) "syntax error inside a declaration." ) in
  2157. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  2158.  
  2159. and _menhir_goto_list_declaration_ : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.declaration Positions.located list list) -> 'ttv_return =
  2160. fun _menhir_env _menhir_stack _menhir_s _v ->
  2161. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  2162. match _menhir_s with
  2163. | MenhirState0 ->
  2164. let _menhir_stack = Obj.magic _menhir_stack in
  2165. (* _menhir_run75 *)
  2166. (* State 75: *)
  2167. assert (not _menhir_env._menhir_error);
  2168. let _tok = _menhir_env._menhir_token in
  2169. (match _tok with
  2170. | PERCENTPERCENT _v ->
  2171. (* Shifting (PERCENTPERCENT) to state 76 *)
  2172. let _menhir_stack = Obj.magic _menhir_stack in
  2173. (* _menhir_run76 *)
  2174. (* State 76: *)
  2175. let _menhir_stack = (_menhir_stack, _v) in
  2176. let _menhir_env = _menhir_discard _menhir_env in
  2177. let _tok = _menhir_env._menhir_token in
  2178. (match _tok with
  2179. | INLINE ->
  2180. (* Shifting (INLINE) to state 80 *)
  2181. _menhir_run80 _menhir_env (Obj.magic _menhir_stack) MenhirState76 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2182. | PUBLIC ->
  2183. (* Shifting (PUBLIC) to state 78 *)
  2184. _menhir_run78 _menhir_env (Obj.magic _menhir_stack) MenhirState76 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2185. | EOF | PERCENTPERCENT _ ->
  2186. _menhir_reduce30 _menhir_env (Obj.magic _menhir_stack) MenhirState76
  2187. | LID _ | UID _ ->
  2188. _menhir_reduce20 _menhir_env (Obj.magic _menhir_stack) MenhirState76
  2189. | _ ->
  2190. assert (not _menhir_env._menhir_error);
  2191. (* Initiating error handling *)
  2192. _menhir_env._menhir_error <- true;
  2193. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState76)
  2194. | _ ->
  2195. assert (not _menhir_env._menhir_error);
  2196. (* Initiating error handling *)
  2197. _menhir_env._menhir_error <- true;
  2198. let _menhir_stack = Obj.magic _menhir_stack in
  2199. (* _menhir_error75 *)
  2200. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  2201. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s)
  2202. | MenhirState127 ->
  2203. let _menhir_stack = Obj.magic _menhir_stack in
  2204. (* _menhir_run128 *)
  2205. (* State 128: *)
  2206. (* Reducing without looking ahead at PERCENTPERCENT _ *)
  2207. let _menhir_stack = Obj.magic _menhir_stack in
  2208. (* _menhir_reduce27 *)
  2209. (* Reducing production list(declaration) -> declaration list(declaration) *)
  2210. let ((_menhir_stack, _menhir_s, x), _, xs) = _menhir_stack in
  2211. let _v : (Syntax.declaration Positions.located list list) = ( x :: xs ) in
  2212. _menhir_goto_list_declaration_ _menhir_env _menhir_stack _menhir_s _v
  2213. | _ ->
  2214. _menhir_fail ()
  2215.  
  2216. and _menhir_run6 : _menhir_env -> 'ttv_tail -> _menhir_state -> (string Positions.located) -> Lexing.position -> Lexing.position -> 'ttv_return =
  2217. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  2218. (* State 6: *)
  2219. (* Not allocating top stack cell *)
  2220. let _menhir_env = _menhir_discard _menhir_env in
  2221. (* Reducing without looking ahead at BAR | COLON | COMMA | EOF | HEADER _ | INLINE | LEFT | LID _ | LPAREN | NONASSOC | PARAMETER | PERCENTPERCENT _ | PLUS | PUBLIC | QUESTION | RIGHT | STAR | START | TOKEN | TYPE | UID _ | error *)
  2222. _menhir_reduce81 _menhir_env (Obj.magic _menhir_stack) _menhir_s _v _startpos _endpos
  2223.  
  2224. and _menhir_run7 : _menhir_env -> 'ttv_tail -> _menhir_state -> (string Positions.located) -> Lexing.position -> Lexing.position -> 'ttv_return =
  2225. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  2226. (* State 7: *)
  2227. let _menhir_stack = (_menhir_stack, _menhir_s, _v, _startpos, _endpos) in
  2228. let _menhir_env = _menhir_discard _menhir_env in
  2229. (* Reducing without looking ahead at BAR | COLON | COMMA | EOF | HEADER _ | INLINE | LEFT | LID _ | LPAREN | NONASSOC | PARAMETER | PERCENTPERCENT _ | PLUS | PUBLIC | QUESTION | RIGHT | STAR | START | TOKEN | TYPE | UID _ | error *)
  2230. _menhir_reduce80 _menhir_env (Obj.magic _menhir_stack)
  2231.  
  2232. and _menhir_reduce41 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  2233. fun _menhir_env _menhir_stack _menhir_s ->
  2234. (* Reducing production option(OCAMLTYPE) -> *)
  2235. let _v : (Stretch.ocamltype option) = ( None ) in
  2236. _menhir_goto_option_OCAMLTYPE_ _menhir_env _menhir_stack _menhir_s _v
  2237.  
  2238. and _menhir_run40 : _menhir_env -> 'ttv_tail -> _menhir_state -> (Stretch.ocamltype) -> Lexing.position -> 'ttv_return =
  2239. fun _menhir_env _menhir_stack _menhir_s _v _endpos ->
  2240. (* State 40: *)
  2241. (* Not allocating top stack cell *)
  2242. let _menhir_env = _menhir_discard _menhir_env in
  2243. (* Reducing without looking ahead at LID _ | UID _ | error *)
  2244. let _menhir_stack = Obj.magic _menhir_stack in
  2245. let x = _v in
  2246. let _endpos_x_ = _endpos in
  2247. (* _menhir_reduce42 *)
  2248. (* Reducing production option(OCAMLTYPE) -> OCAMLTYPE *)
  2249. let _v : (Stretch.ocamltype option) = ( Some x ) in
  2250. _menhir_goto_option_OCAMLTYPE_ _menhir_env _menhir_stack _menhir_s _v
  2251.  
  2252. and _menhir_goto_priority_keyword : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.token_associativity) -> Lexing.position -> Lexing.position -> 'ttv_return =
  2253. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  2254. let _menhir_stack = (_menhir_stack, _menhir_s, _v, _startpos, _endpos) in
  2255. (* State should be MenhirState127 | MenhirState0 *)
  2256. let _menhir_stack = Obj.magic _menhir_stack in
  2257. (* _menhir_run68 *)
  2258. (* State 68: *)
  2259. if _menhir_env._menhir_error then
  2260. (* Resuming error handling *)
  2261. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState68
  2262. else
  2263. let _tok = _menhir_env._menhir_token in
  2264. match _tok with
  2265. | LID _v ->
  2266. (* Shifting (LID) to state 7 *)
  2267. _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2268. | UID _v ->
  2269. (* Shifting (UID) to state 6 *)
  2270. _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState68 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2271. | _ ->
  2272. (assert (not _menhir_env._menhir_error);
  2273. (* Initiating error handling *)
  2274. _menhir_env._menhir_error <- true;
  2275. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState68)
  2276.  
  2277. and _menhir_goto_declaration : _menhir_env -> 'ttv_tail -> _menhir_state -> (Syntax.declaration Positions.located list) -> 'ttv_return =
  2278. fun _menhir_env _menhir_stack _menhir_s _v ->
  2279. let _menhir_stack = (_menhir_stack, _menhir_s, _v) in
  2280. (* State should be MenhirState127 | MenhirState0 *)
  2281. let _menhir_stack = Obj.magic _menhir_stack in
  2282. (* _menhir_run127 *)
  2283. (* State 127: *)
  2284. if _menhir_env._menhir_error then
  2285. (* Resuming error handling *)
  2286. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState127
  2287. else
  2288. let _tok = _menhir_env._menhir_token in
  2289. match _tok with
  2290. | COLON ->
  2291. (* Shifting (COLON) to state 66 *)
  2292. _menhir_run66 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2293. | EOF ->
  2294. (* Shifting (EOF) to state 65 *)
  2295. _menhir_run65 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2296. | HEADER _v ->
  2297. (* Shifting (HEADER) to state 64 *)
  2298. _menhir_run64 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2299. | INLINE ->
  2300. (* Shifting (INLINE) to state 63 *)
  2301. _menhir_run63 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2302. | LEFT ->
  2303. (* Shifting (LEFT) to state 62 *)
  2304. _menhir_run62 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2305. | NONASSOC ->
  2306. (* Shifting (NONASSOC) to state 61 *)
  2307. _menhir_run61 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2308. | PARAMETER ->
  2309. (* Shifting (PARAMETER) to state 58 *)
  2310. _menhir_run58 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p
  2311. | PUBLIC ->
  2312. (* Shifting (PUBLIC) to state 57 *)
  2313. _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2314. | RIGHT ->
  2315. (* Shifting (RIGHT) to state 56 *)
  2316. _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2317. | START ->
  2318. (* Shifting (START) to state 48 *)
  2319. _menhir_run48 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p
  2320. | TOKEN ->
  2321. (* Shifting (TOKEN) to state 39 *)
  2322. _menhir_run39 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p
  2323. | TYPE ->
  2324. (* Shifting (TYPE) to state 2 *)
  2325. _menhir_run2 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p
  2326. | PERCENTPERCENT _ ->
  2327. _menhir_reduce26 _menhir_env (Obj.magic _menhir_stack) MenhirState127
  2328. | _ ->
  2329. (assert (not _menhir_env._menhir_error);
  2330. (* Initiating error handling *)
  2331. _menhir_env._menhir_error <- true;
  2332. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState127)
  2333.  
  2334. and _menhir_goto_rule_specific_token : _menhir_env -> 'ttv_tail -> _menhir_state -> (unit) -> Lexing.position -> Lexing.position -> 'ttv_return =
  2335. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  2336. (* State should be MenhirState127 | MenhirState0 *)
  2337. let _menhir_stack = Obj.magic _menhir_stack in
  2338. (* _menhir_run67 *)
  2339. (* State 67: *)
  2340. (* Not allocating top stack cell *)
  2341. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2342. let _menhir_stack = Obj.magic _menhir_stack in
  2343. let _startpos__1_ = _startpos in
  2344. let _endpos__1_ = _endpos in
  2345. (* _menhir_reduce19 *)
  2346. (* Reducing production declaration -> rule_specific_token *)
  2347. let _startpos = _startpos__1_ in
  2348. let _endpos = _endpos__1_ in
  2349. let _v : (Syntax.declaration Positions.located list) = (
  2350. Error.error (Positions.two _startpos _endpos)
  2351. "syntax error inside a declaration.\n\
  2352. Did you perhaps forget the %% that separates declarations and rules?"
  2353. ) in
  2354. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  2355.  
  2356. and _menhir_errorcase : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  2357. fun _menhir_env _menhir_stack _menhir_s ->
  2358. match _menhir_s with
  2359. | MenhirState127 ->
  2360. let _menhir_stack = Obj.magic _menhir_stack in
  2361. (* _menhir_error127 *)
  2362. (* Handling error in state 127 *)
  2363. (* Shifting (error) to state 1 *)
  2364. _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState127 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2365. | MenhirState119 ->
  2366. let _menhir_stack = Obj.magic _menhir_stack in
  2367. (* _menhir_error119 *)
  2368. let (_menhir_stack, _menhir_s) = _menhir_stack in
  2369. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2370. | MenhirState118 ->
  2371. let _menhir_stack = Obj.magic _menhir_stack in
  2372. (* _menhir_error118 *)
  2373. let (_menhir_stack, _menhir_s, _, _) = _menhir_stack in
  2374. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2375. | MenhirState115 ->
  2376. let _menhir_stack = Obj.magic _menhir_stack in
  2377. (* _menhir_error115 *)
  2378. let (_menhir_stack, _menhir_s, _, _) = _menhir_stack in
  2379. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2380. | MenhirState113 ->
  2381. let _menhir_stack = Obj.magic _menhir_stack in
  2382. (* _menhir_error113 *)
  2383. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  2384. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2385. | MenhirState110 ->
  2386. let _menhir_stack = Obj.magic _menhir_stack in
  2387. (* _menhir_error110 *)
  2388. (* Handling error in state 110 *)
  2389. (* Shifting (error) to state 96 *)
  2390. _menhir_run96 _menhir_env (Obj.magic _menhir_stack) MenhirState110 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2391. | MenhirState107 ->
  2392. let _menhir_stack = Obj.magic _menhir_stack in
  2393. (* _menhir_error107 *)
  2394. (* Handling error in state 107 *)
  2395. _menhir_reduce45 _menhir_env (Obj.magic _menhir_stack) MenhirState107
  2396. | MenhirState103 ->
  2397. let _menhir_stack = Obj.magic _menhir_stack in
  2398. (* _menhir_error103 *)
  2399. let (_menhir_stack, _menhir_s, _, _, _) = _menhir_stack in
  2400. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2401. | MenhirState99 ->
  2402. let _menhir_stack = Obj.magic _menhir_stack in
  2403. (* _menhir_error99 *)
  2404. let (_menhir_stack, _menhir_s) = _menhir_stack in
  2405. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2406. | MenhirState98 ->
  2407. let _menhir_stack = Obj.magic _menhir_stack in
  2408. (* _menhir_error98 *)
  2409. (* Handling error in state 98 *)
  2410. _menhir_reduce45 _menhir_env (Obj.magic _menhir_stack) MenhirState98
  2411. | MenhirState95 ->
  2412. let _menhir_stack = Obj.magic _menhir_stack in
  2413. (* _menhir_error95 *)
  2414. (* Handling error in state 95 *)
  2415. (* Shifting (error) to state 96 *)
  2416. _menhir_run96 _menhir_env (Obj.magic _menhir_stack) MenhirState95 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2417. | MenhirState88 ->
  2418. let _menhir_stack = Obj.magic _menhir_stack in
  2419. (* _menhir_error88 *)
  2420. let (_menhir_stack, _menhir_s, _, _, _) = _menhir_stack in
  2421. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2422. | MenhirState86 ->
  2423. let _menhir_stack = Obj.magic _menhir_stack in
  2424. (* _menhir_error86 *)
  2425. raise _eRR
  2426. | MenhirState84 ->
  2427. let _menhir_stack = Obj.magic _menhir_stack in
  2428. (* _menhir_error84 *)
  2429. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  2430. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2431. | MenhirState82 ->
  2432. let _menhir_stack = Obj.magic _menhir_stack in
  2433. (* _menhir_error82 *)
  2434. (* Handling error in state 82 *)
  2435. (* Shifting (error) to state 77 *)
  2436. _menhir_run77 _menhir_env (Obj.magic _menhir_stack) MenhirState82 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2437. | MenhirState76 ->
  2438. let _menhir_stack = Obj.magic _menhir_stack in
  2439. (* _menhir_error76 *)
  2440. (* Handling error in state 76 *)
  2441. (* Shifting (error) to state 77 *)
  2442. _menhir_run77 _menhir_env (Obj.magic _menhir_stack) MenhirState76 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2443. | MenhirState71 ->
  2444. let _menhir_stack = Obj.magic _menhir_stack in
  2445. (* _menhir_error71 *)
  2446. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  2447. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2448. | MenhirState70 ->
  2449. let _menhir_stack = Obj.magic _menhir_stack in
  2450. (* _menhir_error70 *)
  2451. (* Handling error in state 70 *)
  2452. _menhir_reduce76 _menhir_env (Obj.magic _menhir_stack)
  2453. | MenhirState68 ->
  2454. let _menhir_stack = Obj.magic _menhir_stack in
  2455. (* _menhir_error68 *)
  2456. (* Handling error in state 68 *)
  2457. (* Shifting (error) to state 69 *)
  2458. let _menhir_stack = Obj.magic _menhir_stack in
  2459. let _menhir_s = MenhirState68 in
  2460. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  2461. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  2462. (* _menhir_run69 *)
  2463. (* State 69: *)
  2464. (* Not allocating top stack cell *)
  2465. let _menhir_env = _menhir_discard _menhir_env in
  2466. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2467. let _menhir_stack = Obj.magic _menhir_stack in
  2468. let _startpos__2_ = _startpos in
  2469. let _endpos__2_ = _endpos in
  2470. (* _menhir_reduce15 *)
  2471. (* Reducing production declaration -> priority_keyword error *)
  2472. let (_menhir_stack, _menhir_s, _, _startpos__1_, _endpos__1_) = _menhir_stack in
  2473. let _startpos = _startpos__1_ in
  2474. let _endpos = _endpos__2_ in
  2475. let _v : (Syntax.declaration Positions.located list) = ( Error.error (Positions.two _startpos _endpos) (String.concat "\n" [
  2476. "syntax error in a precedence declaration.";
  2477. "Here are sample valid declarations:";
  2478. " %left PLUS TIMES";
  2479. " %nonassoc unary_minus";
  2480. " %right CONCAT";
  2481. ])
  2482. ) in
  2483. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  2484. | MenhirState52 ->
  2485. let _menhir_stack = Obj.magic _menhir_stack in
  2486. (* _menhir_error52 *)
  2487. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  2488. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2489. | MenhirState51 ->
  2490. let _menhir_stack = Obj.magic _menhir_stack in
  2491. (* _menhir_error51 *)
  2492. (* Handling error in state 51 *)
  2493. _menhir_reduce74 _menhir_env (Obj.magic _menhir_stack)
  2494. | MenhirState49 ->
  2495. let _menhir_stack = Obj.magic _menhir_stack in
  2496. (* _menhir_error49 *)
  2497. (* Handling error in state 49 *)
  2498. (* Shifting (error) to state 50 *)
  2499. let _menhir_stack = Obj.magic _menhir_stack in
  2500. let _menhir_s = MenhirState49 in
  2501. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  2502. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  2503. (* _menhir_run50 *)
  2504. (* State 50: *)
  2505. (* Not allocating top stack cell *)
  2506. let _menhir_env = _menhir_discard _menhir_env in
  2507. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2508. let _menhir_stack = Obj.magic _menhir_stack in
  2509. let _startpos__3_ = _startpos in
  2510. let _endpos__3_ = _endpos in
  2511. (* _menhir_reduce8 *)
  2512. (* Reducing production declaration -> START option(OCAMLTYPE) error *)
  2513. let ((_menhir_stack, _menhir_s, _startpos__1_), _, _) = _menhir_stack in
  2514. let _startpos = _startpos__1_ in
  2515. let _endpos = _endpos__3_ in
  2516. let _v : (Syntax.declaration Positions.located list) = ( Error.error (Positions.two _startpos _endpos) (String.concat "\n" [
  2517. "syntax error in a %start declaration.";
  2518. "Here are sample valid declarations:";
  2519. " %start expression phrase";
  2520. " %start <int> date time";
  2521. ])
  2522. ) in
  2523. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  2524. | MenhirState48 ->
  2525. let _menhir_stack = Obj.magic _menhir_stack in
  2526. (* _menhir_error48 *)
  2527. (* Handling error in state 48 *)
  2528. _menhir_reduce41 _menhir_env (Obj.magic _menhir_stack) MenhirState48
  2529. | MenhirState44 ->
  2530. let _menhir_stack = Obj.magic _menhir_stack in
  2531. (* _menhir_error44 *)
  2532. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  2533. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2534. | MenhirState43 ->
  2535. let _menhir_stack = Obj.magic _menhir_stack in
  2536. (* _menhir_error43 *)
  2537. (* Handling error in state 43 *)
  2538. _menhir_reduce78 _menhir_env (Obj.magic _menhir_stack)
  2539. | MenhirState41 ->
  2540. let _menhir_stack = Obj.magic _menhir_stack in
  2541. (* _menhir_error41 *)
  2542. (* Handling error in state 41 *)
  2543. (* Shifting (error) to state 42 *)
  2544. let _menhir_stack = Obj.magic _menhir_stack in
  2545. let _menhir_s = MenhirState41 in
  2546. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  2547. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  2548. (* _menhir_run42 *)
  2549. (* State 42: *)
  2550. (* Not allocating top stack cell *)
  2551. let _menhir_env = _menhir_discard _menhir_env in
  2552. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2553. let _menhir_stack = Obj.magic _menhir_stack in
  2554. let _startpos__3_ = _startpos in
  2555. let _endpos__3_ = _endpos in
  2556. (* _menhir_reduce5 *)
  2557. (* Reducing production declaration -> TOKEN option(OCAMLTYPE) error *)
  2558. let ((_menhir_stack, _menhir_s, _startpos__1_), _, _) = _menhir_stack in
  2559. let _startpos = _startpos__1_ in
  2560. let _endpos = _endpos__3_ in
  2561. let _v : (Syntax.declaration Positions.located list) = ( Error.error (Positions.two _startpos _endpos) (String.concat "\n" [
  2562. "syntax error in a %token declaration.";
  2563. "Here are sample valid declarations:";
  2564. " %token DOT SEMICOLON";
  2565. " %token <string> LID UID";
  2566. ])
  2567. ) in
  2568. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  2569. | MenhirState39 ->
  2570. let _menhir_stack = Obj.magic _menhir_stack in
  2571. (* _menhir_error39 *)
  2572. (* Handling error in state 39 *)
  2573. _menhir_reduce41 _menhir_env (Obj.magic _menhir_stack) MenhirState39
  2574. | MenhirState37 ->
  2575. let _menhir_stack = Obj.magic _menhir_stack in
  2576. (* _menhir_error37 *)
  2577. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  2578. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2579. | MenhirState35 ->
  2580. let _menhir_stack = Obj.magic _menhir_stack in
  2581. (* _menhir_error35 *)
  2582. (* Handling error in state 35 *)
  2583. _menhir_reduce72 _menhir_env (Obj.magic _menhir_stack)
  2584. | MenhirState27 ->
  2585. let _menhir_stack = Obj.magic _menhir_stack in
  2586. (* _menhir_error27 *)
  2587. (* Handling error in state 27 *)
  2588. _menhir_reduce43 _menhir_env (Obj.magic _menhir_stack) MenhirState27
  2589. | MenhirState19 ->
  2590. let _menhir_stack = Obj.magic _menhir_stack in
  2591. (* _menhir_error19 *)
  2592. let (_menhir_stack, _menhir_s, _) = _menhir_stack in
  2593. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2594. | MenhirState17 ->
  2595. let _menhir_stack = Obj.magic _menhir_stack in
  2596. (* _menhir_error17 *)
  2597. let (_menhir_stack, _menhir_s, _, _) = _menhir_stack in
  2598. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2599. | MenhirState13 ->
  2600. let _menhir_stack = Obj.magic _menhir_stack in
  2601. (* _menhir_error13 *)
  2602. let (_menhir_stack, _menhir_s) = _menhir_stack in
  2603. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2604. | MenhirState12 ->
  2605. let _menhir_stack = Obj.magic _menhir_stack in
  2606. (* _menhir_error12 *)
  2607. let (_menhir_stack, _menhir_s, _, _, _) = _menhir_stack in
  2608. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2609. | MenhirState9 ->
  2610. let _menhir_stack = Obj.magic _menhir_stack in
  2611. (* _menhir_error9 *)
  2612. let (_menhir_stack, _menhir_s) = _menhir_stack in
  2613. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) _menhir_s
  2614. | MenhirState8 ->
  2615. let _menhir_stack = Obj.magic _menhir_stack in
  2616. (* _menhir_error8 *)
  2617. (* Handling error in state 8 *)
  2618. _menhir_reduce32 _menhir_env (Obj.magic _menhir_stack) MenhirState8
  2619. | MenhirState4 ->
  2620. let _menhir_stack = Obj.magic _menhir_stack in
  2621. (* _menhir_error4 *)
  2622. (* Handling error in state 4 *)
  2623. (* Shifting (error) to state 5 *)
  2624. let _menhir_stack = Obj.magic _menhir_stack in
  2625. let _menhir_s = MenhirState4 in
  2626. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  2627. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  2628. (* _menhir_run5 *)
  2629. (* State 5: *)
  2630. (* Not allocating top stack cell *)
  2631. let _menhir_env = _menhir_discard _menhir_env in
  2632. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2633. let _menhir_stack = Obj.magic _menhir_stack in
  2634. let _startpos__3_ = _startpos in
  2635. let _endpos__3_ = _endpos in
  2636. (* _menhir_reduce11 *)
  2637. (* Reducing production declaration -> TYPE OCAMLTYPE error *)
  2638. let ((_menhir_stack, _menhir_s, _startpos__1_), _, _endpos__2_) = _menhir_stack in
  2639. let _startpos = _startpos__1_ in
  2640. let _endpos = _endpos__3_ in
  2641. let _v : (Syntax.declaration Positions.located list) = ( Error.error (Positions.two _startpos _endpos) (String.concat "\n" [
  2642. "syntax error in a %type declaration.";
  2643. "Here are sample valid declarations:";
  2644. " %type <Syntax.expression> expression";
  2645. " %type <int> date time";
  2646. ])
  2647. ) in
  2648. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  2649. | MenhirState0 ->
  2650. let _menhir_stack = Obj.magic _menhir_stack in
  2651. (* _menhir_error0 *)
  2652. (* Handling error in state 0 *)
  2653. (* Shifting (error) to state 1 *)
  2654. _menhir_run1 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2655.  
  2656. and _menhir_reduce26 : _menhir_env -> 'ttv_tail -> _menhir_state -> 'ttv_return =
  2657. fun _menhir_env _menhir_stack _menhir_s ->
  2658. (* Reducing production list(declaration) -> *)
  2659. let _v : (Syntax.declaration Positions.located list list) = ( [] ) in
  2660. _menhir_goto_list_declaration_ _menhir_env _menhir_stack _menhir_s _v
  2661.  
  2662. and _menhir_run2 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> 'ttv_return =
  2663. fun _menhir_env _menhir_stack _menhir_s _startpos ->
  2664. (* State 2: *)
  2665. let _menhir_stack = (_menhir_stack, _menhir_s, _startpos) in
  2666. let _menhir_env = _menhir_discard _menhir_env in
  2667. let _tok = _menhir_env._menhir_token in
  2668. match _tok with
  2669. | OCAMLTYPE _v ->
  2670. (* Shifting (OCAMLTYPE) to state 4 *)
  2671. let _menhir_stack = Obj.magic _menhir_stack in
  2672. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  2673. (* _menhir_run4 *)
  2674. (* State 4: *)
  2675. let _menhir_stack = (_menhir_stack, _v, _endpos) in
  2676. let _menhir_env = _menhir_discard _menhir_env in
  2677. let _tok = _menhir_env._menhir_token in
  2678. (match _tok with
  2679. | LID _v ->
  2680. (* Shifting (LID) to state 7 *)
  2681. _menhir_run7 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2682. | UID _v ->
  2683. (* Shifting (UID) to state 6 *)
  2684. _menhir_run6 _menhir_env (Obj.magic _menhir_stack) MenhirState4 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2685. | _ ->
  2686. assert (not _menhir_env._menhir_error);
  2687. (* Initiating error handling *)
  2688. _menhir_env._menhir_error <- true;
  2689. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState4)
  2690. | _ ->
  2691. assert (not _menhir_env._menhir_error);
  2692. (* Initiating error handling *)
  2693. _menhir_env._menhir_error <- true;
  2694. let _menhir_stack = Obj.magic _menhir_stack in
  2695. (* _menhir_error2 *)
  2696. (* Handling error in state 2 *)
  2697. (* Shifting (error) to state 3 *)
  2698. let _menhir_stack = Obj.magic _menhir_stack in
  2699. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  2700. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  2701. (* _menhir_run3 *)
  2702. (* State 3: *)
  2703. (* Not allocating top stack cell *)
  2704. let _menhir_env = _menhir_discard _menhir_env in
  2705. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2706. let _menhir_stack = Obj.magic _menhir_stack in
  2707. let _startpos__2_ = _startpos in
  2708. let _endpos__2_ = _endpos in
  2709. (* _menhir_reduce12 *)
  2710. (* Reducing production declaration -> TYPE error *)
  2711. let (_menhir_stack, _menhir_s, _startpos__1_) = _menhir_stack in
  2712. let _startpos = _startpos__1_ in
  2713. let _endpos = _endpos__2_ in
  2714. let _v : (Syntax.declaration Positions.located list) = ( Error.error (Positions.two _startpos _endpos) (String.concat "\n" [
  2715. "syntax error in a %type declaration.";
  2716. "Here are sample valid declarations:";
  2717. " %type <Syntax.expression> expression";
  2718. " %type <int> date time";
  2719. ])
  2720. ) in
  2721. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  2722.  
  2723. and _menhir_run39 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> 'ttv_return =
  2724. fun _menhir_env _menhir_stack _menhir_s _startpos ->
  2725. (* State 39: *)
  2726. let _menhir_stack = (_menhir_stack, _menhir_s, _startpos) in
  2727. let _menhir_env = _menhir_discard _menhir_env in
  2728. let _tok = _menhir_env._menhir_token in
  2729. match _tok with
  2730. | OCAMLTYPE _v ->
  2731. (* Shifting (OCAMLTYPE) to state 40 *)
  2732. _menhir_run40 _menhir_env (Obj.magic _menhir_stack) MenhirState39 _v _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2733. | UID _ ->
  2734. _menhir_reduce41 _menhir_env (Obj.magic _menhir_stack) MenhirState39
  2735. | _ ->
  2736. assert (not _menhir_env._menhir_error);
  2737. (* Initiating error handling *)
  2738. _menhir_env._menhir_error <- true;
  2739. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState39
  2740.  
  2741. and _menhir_run48 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> 'ttv_return =
  2742. fun _menhir_env _menhir_stack _menhir_s _startpos ->
  2743. (* State 48: *)
  2744. let _menhir_stack = (_menhir_stack, _menhir_s, _startpos) in
  2745. let _menhir_env = _menhir_discard _menhir_env in
  2746. let _tok = _menhir_env._menhir_token in
  2747. match _tok with
  2748. | OCAMLTYPE _v ->
  2749. (* Shifting (OCAMLTYPE) to state 40 *)
  2750. _menhir_run40 _menhir_env (Obj.magic _menhir_stack) MenhirState48 _v _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2751. | LID _ ->
  2752. _menhir_reduce41 _menhir_env (Obj.magic _menhir_stack) MenhirState48
  2753. | _ ->
  2754. assert (not _menhir_env._menhir_error);
  2755. (* Initiating error handling *)
  2756. _menhir_env._menhir_error <- true;
  2757. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState48
  2758.  
  2759. and _menhir_run56 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  2760. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  2761. (* State 56: *)
  2762. (* Not allocating top stack cell *)
  2763. let _menhir_env = _menhir_discard _menhir_env in
  2764. (* Reducing without looking ahead at LID _ | UID _ | error *)
  2765. let _menhir_stack = Obj.magic _menhir_stack in
  2766. let _startpos__1_ = _startpos in
  2767. let _endpos__1_ = _endpos in
  2768. (* _menhir_reduce50 *)
  2769. (* Reducing production priority_keyword -> RIGHT *)
  2770. let _startpos = _startpos__1_ in
  2771. let _endpos = _endpos__1_ in
  2772. let _v : (Syntax.token_associativity) = ( RightAssoc ) in
  2773. _menhir_goto_priority_keyword _menhir_env _menhir_stack _menhir_s _v _startpos _endpos
  2774.  
  2775. and _menhir_run57 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  2776. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  2777. (* State 57: *)
  2778. (* Not allocating top stack cell *)
  2779. let _menhir_env = _menhir_discard _menhir_env in
  2780. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2781. let _menhir_stack = Obj.magic _menhir_stack in
  2782. let _startpos__1_ = _startpos in
  2783. let _endpos__1_ = _endpos in
  2784. (* _menhir_reduce60 *)
  2785. (* Reducing production rule_specific_token -> PUBLIC *)
  2786. let _startpos = _startpos__1_ in
  2787. let _endpos = _endpos__1_ in
  2788. let _v : (unit) = ( () ) in
  2789. _menhir_goto_rule_specific_token _menhir_env _menhir_stack _menhir_s _v _startpos _endpos
  2790.  
  2791. and _menhir_run58 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> 'ttv_return =
  2792. fun _menhir_env _menhir_stack _menhir_s _startpos ->
  2793. (* State 58: *)
  2794. let _menhir_stack = (_menhir_stack, _menhir_s, _startpos) in
  2795. let _menhir_env = _menhir_discard _menhir_env in
  2796. let _tok = _menhir_env._menhir_token in
  2797. match _tok with
  2798. | OCAMLTYPE _v ->
  2799. (* Shifting (OCAMLTYPE) to state 60 *)
  2800. let _menhir_stack = Obj.magic _menhir_stack in
  2801. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  2802. (* _menhir_run60 *)
  2803. (* State 60: *)
  2804. (* Not allocating top stack cell *)
  2805. let _menhir_env = _menhir_discard _menhir_env in
  2806. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2807. let _menhir_stack = Obj.magic _menhir_stack in
  2808. let t = _v in
  2809. let _endpos_t_ = _endpos in
  2810. (* _menhir_reduce16 *)
  2811. (* Reducing production declaration -> PARAMETER OCAMLTYPE *)
  2812. let (_menhir_stack, _menhir_s, _startpos__1_) = _menhir_stack in
  2813. let _startpos = _startpos__1_ in
  2814. let _endpos = _endpos_t_ in
  2815. let _v : (Syntax.declaration Positions.located list) = ( [ with_poss _startpos _endpos (DParameter t) ] ) in
  2816. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  2817. | _ ->
  2818. assert (not _menhir_env._menhir_error);
  2819. (* Initiating error handling *)
  2820. _menhir_env._menhir_error <- true;
  2821. let _menhir_stack = Obj.magic _menhir_stack in
  2822. (* _menhir_error58 *)
  2823. (* Handling error in state 58 *)
  2824. (* Shifting (error) to state 59 *)
  2825. let _menhir_stack = Obj.magic _menhir_stack in
  2826. let _startpos = _menhir_env._menhir_lexbuf.Lexing.lex_start_p in
  2827. let _endpos = _menhir_env._menhir_lexbuf.Lexing.lex_curr_p in
  2828. (* _menhir_run59 *)
  2829. (* State 59: *)
  2830. (* Not allocating top stack cell *)
  2831. let _menhir_env = _menhir_discard _menhir_env in
  2832. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2833. let _menhir_stack = Obj.magic _menhir_stack in
  2834. let _startpos__2_ = _startpos in
  2835. let _endpos__2_ = _endpos in
  2836. (* _menhir_reduce17 *)
  2837. (* Reducing production declaration -> PARAMETER error *)
  2838. let (_menhir_stack, _menhir_s, _startpos__1_) = _menhir_stack in
  2839. let _startpos = _startpos__1_ in
  2840. let _endpos = _endpos__2_ in
  2841. let _v : (Syntax.declaration Positions.located list) = ( Error.error (Positions.two _startpos _endpos) (String.concat "\n" [
  2842. "syntax error in a %parameter declaration.";
  2843. "Here is a sample valid declaration:";
  2844. " %parameter <X : sig type t end>";
  2845. ])
  2846. ) in
  2847. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  2848.  
  2849. and _menhir_run61 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  2850. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  2851. (* State 61: *)
  2852. (* Not allocating top stack cell *)
  2853. let _menhir_env = _menhir_discard _menhir_env in
  2854. (* Reducing without looking ahead at LID _ | UID _ | error *)
  2855. let _menhir_stack = Obj.magic _menhir_stack in
  2856. let _startpos__1_ = _startpos in
  2857. let _endpos__1_ = _endpos in
  2858. (* _menhir_reduce51 *)
  2859. (* Reducing production priority_keyword -> NONASSOC *)
  2860. let _startpos = _startpos__1_ in
  2861. let _endpos = _endpos__1_ in
  2862. let _v : (Syntax.token_associativity) = ( NonAssoc ) in
  2863. _menhir_goto_priority_keyword _menhir_env _menhir_stack _menhir_s _v _startpos _endpos
  2864.  
  2865. and _menhir_run62 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  2866. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  2867. (* State 62: *)
  2868. (* Not allocating top stack cell *)
  2869. let _menhir_env = _menhir_discard _menhir_env in
  2870. (* Reducing without looking ahead at LID _ | UID _ | error *)
  2871. let _menhir_stack = Obj.magic _menhir_stack in
  2872. let _startpos__1_ = _startpos in
  2873. let _endpos__1_ = _endpos in
  2874. (* _menhir_reduce49 *)
  2875. (* Reducing production priority_keyword -> LEFT *)
  2876. let _startpos = _startpos__1_ in
  2877. let _endpos = _endpos__1_ in
  2878. let _v : (Syntax.token_associativity) = ( LeftAssoc ) in
  2879. _menhir_goto_priority_keyword _menhir_env _menhir_stack _menhir_s _v _startpos _endpos
  2880.  
  2881. and _menhir_run63 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  2882. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  2883. (* State 63: *)
  2884. (* Not allocating top stack cell *)
  2885. let _menhir_env = _menhir_discard _menhir_env in
  2886. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2887. let _menhir_stack = Obj.magic _menhir_stack in
  2888. let _startpos__1_ = _startpos in
  2889. let _endpos__1_ = _endpos in
  2890. (* _menhir_reduce61 *)
  2891. (* Reducing production rule_specific_token -> INLINE *)
  2892. let _startpos = _startpos__1_ in
  2893. let _endpos = _endpos__1_ in
  2894. let _v : (unit) = ( () ) in
  2895. _menhir_goto_rule_specific_token _menhir_env _menhir_stack _menhir_s _v _startpos _endpos
  2896.  
  2897. and _menhir_run64 : _menhir_env -> 'ttv_tail -> _menhir_state -> (Stretch.t) -> Lexing.position -> Lexing.position -> 'ttv_return =
  2898. fun _menhir_env _menhir_stack _menhir_s _v _startpos _endpos ->
  2899. (* State 64: *)
  2900. (* Not allocating top stack cell *)
  2901. let _menhir_env = _menhir_discard _menhir_env in
  2902. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2903. let _menhir_stack = Obj.magic _menhir_stack in
  2904. let h = _v in
  2905. let _startpos_h_ = _startpos in
  2906. let _endpos_h_ = _endpos in
  2907. (* _menhir_reduce2 *)
  2908. (* Reducing production declaration -> HEADER *)
  2909. let _startpos = _startpos_h_ in
  2910. let _endpos = _endpos_h_ in
  2911. let _v : (Syntax.declaration Positions.located list) = ( [ with_poss _startpos _endpos (DCode h) ] ) in
  2912. _menhir_goto_declaration _menhir_env _menhir_stack _menhir_s _v
  2913.  
  2914. and _menhir_run65 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  2915. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  2916. (* State 65: *)
  2917. (* Not allocating top stack cell *)
  2918. let _menhir_env = _menhir_discard _menhir_env in
  2919. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2920. let _menhir_stack = Obj.magic _menhir_stack in
  2921. let _startpos__1_ = _startpos in
  2922. let _endpos__1_ = _endpos in
  2923. (* _menhir_reduce63 *)
  2924. (* Reducing production rule_specific_token -> EOF *)
  2925. let _startpos = _startpos__1_ in
  2926. let _endpos = _endpos__1_ in
  2927. let _v : (unit) = ( () ) in
  2928. _menhir_goto_rule_specific_token _menhir_env _menhir_stack _menhir_s _v _startpos _endpos
  2929.  
  2930. and _menhir_run66 : _menhir_env -> 'ttv_tail -> _menhir_state -> Lexing.position -> Lexing.position -> 'ttv_return =
  2931. fun _menhir_env _menhir_stack _menhir_s _startpos _endpos ->
  2932. (* State 66: *)
  2933. (* Not allocating top stack cell *)
  2934. let _menhir_env = _menhir_discard _menhir_env in
  2935. (* Reducing without looking ahead at COLON | EOF | HEADER _ | INLINE | LEFT | NONASSOC | PARAMETER | PERCENTPERCENT _ | PUBLIC | RIGHT | START | TOKEN | TYPE | error *)
  2936. let _menhir_stack = Obj.magic _menhir_stack in
  2937. let _startpos__1_ = _startpos in
  2938. let _endpos__1_ = _endpos in
  2939. (* _menhir_reduce62 *)
  2940. (* Reducing production rule_specific_token -> COLON *)
  2941. let _startpos = _startpos__1_ in
  2942. let _endpos = _endpos__1_ in
  2943. let _v : (unit) = ( () ) in
  2944. _menhir_goto_rule_specific_token _menhir_env _menhir_stack _menhir_s _v _startpos _endpos
  2945.  
  2946. and _menhir_discard : _menhir_env -> _menhir_env =
  2947. fun _menhir_env ->
  2948. let lexer = _menhir_env._menhir_lexer in
  2949. let lexbuf = _menhir_env._menhir_lexbuf in
  2950. let _tok = lexer lexbuf in
  2951. {
  2952. _menhir_lexer = lexer;
  2953. _menhir_lexbuf = lexbuf;
  2954. _menhir_token = _tok;
  2955. _menhir_error = false;
  2956. }
  2957.  
  2958. and grammar : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (ConcreteSyntax.grammar) =
  2959. fun lexer lexbuf ->
  2960. let _menhir_env = (* _menhir_init *)
  2961. let _tok = Obj.magic () in
  2962. {
  2963. _menhir_lexer = lexer;
  2964. _menhir_lexbuf = lexbuf;
  2965. _menhir_token = _tok;
  2966. _menhir_error = false;
  2967. } in
  2968. Obj.magic (let _menhir_stack = () in
  2969. (* _menhir_run0 *)
  2970. (* State 0: *)
  2971. let _menhir_env = _menhir_discard _menhir_env in
  2972. let _tok = _menhir_env._menhir_token in
  2973. match _tok with
  2974. | COLON ->
  2975. (* Shifting (COLON) to state 66 *)
  2976. _menhir_run66 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2977. | EOF ->
  2978. (* Shifting (EOF) to state 65 *)
  2979. _menhir_run65 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2980. | HEADER _v ->
  2981. (* Shifting (HEADER) to state 64 *)
  2982. _menhir_run64 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _v _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2983. | INLINE ->
  2984. (* Shifting (INLINE) to state 63 *)
  2985. _menhir_run63 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2986. | LEFT ->
  2987. (* Shifting (LEFT) to state 62 *)
  2988. _menhir_run62 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2989. | NONASSOC ->
  2990. (* Shifting (NONASSOC) to state 61 *)
  2991. _menhir_run61 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2992. | PARAMETER ->
  2993. (* Shifting (PARAMETER) to state 58 *)
  2994. _menhir_run58 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p
  2995. | PUBLIC ->
  2996. (* Shifting (PUBLIC) to state 57 *)
  2997. _menhir_run57 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  2998. | RIGHT ->
  2999. (* Shifting (RIGHT) to state 56 *)
  3000. _menhir_run56 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p _menhir_env._menhir_lexbuf.Lexing.lex_curr_p
  3001. | START ->
  3002. (* Shifting (START) to state 48 *)
  3003. _menhir_run48 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p
  3004. | TOKEN ->
  3005. (* Shifting (TOKEN) to state 39 *)
  3006. _menhir_run39 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p
  3007. | TYPE ->
  3008. (* Shifting (TYPE) to state 2 *)
  3009. _menhir_run2 _menhir_env (Obj.magic _menhir_stack) MenhirState0 _menhir_env._menhir_lexbuf.Lexing.lex_start_p
  3010. | PERCENTPERCENT _ ->
  3011. _menhir_reduce26 _menhir_env (Obj.magic _menhir_stack) MenhirState0
  3012. | _ ->
  3013. assert (not _menhir_env._menhir_error);
  3014. (* Initiating error handling *)
  3015. _menhir_env._menhir_error <- true;
  3016. _menhir_errorcase _menhir_env (Obj.magic _menhir_stack) MenhirState0)
Add Comment
Please, Sign In to add comment