package reason

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Reason_parser.MenhirInterpreter

include MenhirLib.IncrementalEngine.INCREMENTAL_ENGINE with type token = token
type token = token
type production

A value of type production is (an index for) a production. The start productions (which do not exist in an .mly file, but are constructed by Menhir internally) are not part of this type.

type 'a env

A value of type 'a env represents a configuration of the automaton: current state, stack, lookahead token, etc. The parameter 'a is the type of the semantic value that will eventually be produced if the parser succeeds.

In normal operation, the parser works with checkpoints: see the functions offer and resume. However, it is also possible to work directly with environments (see the functions pop, force_reduction, and feed) and to reconstruct a checkpoint out of an environment (see input_needed). This is considered advanced functionality; its purpose is to allow error recovery strategies to be programmed by the user.

type 'a checkpoint = private
  1. | InputNeeded of 'a env
  2. | Shifting of 'a env * 'a env * bool
  3. | AboutToReduce of 'a env * production
  4. | HandlingError of 'a env
  5. | Accepted of 'a
  6. | Rejected

The type 'a checkpoint represents an intermediate or final state of the parser. An intermediate checkpoint is a suspension: it records the parser's current state, and allows parsing to be resumed. The parameter 'a is the type of the semantic value that will eventually be produced if the parser succeeds.

Accepted and Rejected are final checkpoints. Accepted carries a semantic value.

InputNeeded is an intermediate checkpoint. It means that the parser wishes to read one token before continuing.

Shifting is an intermediate checkpoint. It means that the parser is taking a shift transition. It exposes the state of the parser before and after the transition. The Boolean parameter tells whether the parser intends to request a new token after this transition. (It always does, except when it is about to accept.)

AboutToReduce is an intermediate checkpoint. It means that the parser is about to perform a reduction step. It exposes the parser's current state as well as the production that is about to be reduced.

HandlingError is an intermediate checkpoint. It means that the parser has detected an error and is currently handling it, in several steps.

offer allows the user to resume the parser after it has suspended itself with a checkpoint of the form InputNeeded env. offer expects the old checkpoint as well as a new token and produces a new checkpoint. It does not raise any exception.

type strategy = [
  1. | `Legacy
  2. | `Simplified
]

The optional argument strategy influences the manner in which resume deals with checkpoints of the form HandlingError _. Its default value is `Legacy. It can be briefly described as follows:

  • If the error token is used only to report errors (that is, if the error token appears only at the end of a production, whose semantic action raises an exception) then the simplified strategy should be preferred. (This includes the case where the error token does not appear at all in the grammar.)
  • If the error token is used to recover after an error, or if perfect backward compatibility is required, the legacy strategy should be selected.

More details on strategies appear in the file Engine.ml.

val resume : ?strategy:strategy -> 'a checkpoint -> 'a checkpoint

resume allows the user to resume the parser after it has suspended itself with a checkpoint of the form Shifting _, AboutToReduce _, or HandlingError _. resume expects the old checkpoint and produces a new checkpoint. It does not raise any exception.

A token supplier is a function of no arguments which delivers a new token (together with its start and end positions) every time it is called.

val lexer_lexbuf_to_supplier : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> supplier

A pair of a lexer and a lexing buffer can be turned into a supplier.

The functions offer and resume are sufficient to write a parser loop. One can imagine many variations (which is why we expose these functions in the first place!). Here, we expose a few variations of the main loop, ready for use.

val loop : ?strategy:strategy -> supplier -> 'a checkpoint -> 'a

loop supplier checkpoint begins parsing from checkpoint, reading tokens from supplier. It continues parsing until it reaches a checkpoint of the form Accepted v or Rejected. In the former case, it returns v. In the latter case, it raises the exception Error. The optional argument strategy, whose default value is Legacy, is passed to resume and influences the error-handling strategy.

val loop_handle : ('a -> 'answer) -> ('a checkpoint -> 'answer) -> supplier -> 'a checkpoint -> 'answer

loop_handle succeed fail supplier checkpoint begins parsing from checkpoint, reading tokens from supplier. It continues parsing until it reaches a checkpoint of the form Accepted v or HandlingError env (or Rejected, but that should not happen, as HandlingError _ will be observed first). In the former case, it calls succeed v. In the latter case, it calls fail with this checkpoint. It cannot raise Error.

This means that Menhir's error-handling procedure does not get a chance to run. For this reason, there is no strategy parameter. Instead, the user can implement her own error handling code, in the fail continuation.

val loop_handle_undo : ('a -> 'answer) -> ('a checkpoint -> 'a checkpoint -> 'answer) -> supplier -> 'a checkpoint -> 'answer

loop_handle_undo is analogous to loop_handle, except it passes a pair of checkpoints to the failure continuation.

The first (and oldest) checkpoint is the last InputNeeded checkpoint that was encountered before the error was detected. The second (and newest) checkpoint is where the error was detected, as in loop_handle. Going back to the first checkpoint can be thought of as undoing any reductions that were performed after seeing the problematic token. (These reductions must be default reductions or spurious reductions.)

loop_handle_undo must initially be applied to an InputNeeded checkpoint. The parser's initial checkpoints satisfy this constraint.

val shifts : 'a checkpoint -> 'a env option

shifts checkpoint assumes that checkpoint has been obtained by submitting a token to the parser. It runs the parser from checkpoint, through an arbitrary number of reductions, until the parser either accepts this token (i.e., shifts) or rejects it (i.e., signals an error). If the parser decides to shift, then Some env is returned, where env is the parser's state just before shifting. Otherwise, None is returned.

It is desirable that the semantic actions be side-effect free, or that their side-effects be harmless (replayable).

val acceptable : 'a checkpoint -> token -> MenhirLib.IncrementalEngine.position -> bool

The function acceptable allows testing, after an error has been detected, which tokens would have been accepted at this point. It is implemented using shifts. Its argument should be an InputNeeded checkpoint.

For completeness, one must undo any spurious reductions before carrying out this test -- that is, one must apply acceptable to the FIRST checkpoint that is passed by loop_handle_undo to its failure continuation.

This test causes some semantic actions to be run! The semantic actions should be side-effect free, or their side-effects should be harmless.

The position pos is used as the start and end positions of the hypothetical token, and may be picked up by the semantic actions. We suggest using the position where the error was detected.

type 'a lr1state

The abstract type 'a lr1state describes the non-initial states of the LR(1) automaton. The index 'a represents the type of the semantic value associated with this state's incoming symbol.

val number : _ lr1state -> int

The states of the LR(1) automaton are numbered (from 0 and up).

val production_index : production -> int

production_index maps a production to its integer index.

val find_production : int -> production

find_production maps a production index to a production. Its argument must be a valid index; use with care.

An element is a pair of a non-initial state s and a semantic value v associated with the incoming symbol of this state. The idea is, the value v was pushed onto the stack just before the state s was entered. Thus, for some type 'a, the state s has type 'a lr1state and the value v has type 'a. In other words, the type element is an existential type.

The parser's stack is (or, more precisely, can be viewed as) a stream of elements. The functions top and pop offer access to this stream.

val top : 'a env -> element option

top env returns the parser's top stack element. The state contained in this stack element is the current state of the automaton. If the stack is empty, None is returned. In that case, the current state of the automaton must be an initial state.

val pop_many : int -> 'a env -> 'a env option

pop_many i env pops i cells off the automaton's stack. This is done via i successive invocations of pop. Thus, pop_many 1 is pop. The index i must be nonnegative. The time complexity is O(i).

val get : int -> 'a env -> element option

get i env returns the parser's i-th stack element. The index i is 0-based: thus, get 0 is top. If i is greater than or equal to the number of elements in the stack, None is returned. The time complexity is O(i).

val current_state_number : 'a env -> int

current_state_number env is (the integer number of) the automaton's current state. This works even if the automaton's stack is empty, in which case the current state is an initial state. This number can be passed as an argument to a message function generated by menhir --compile-errors.

val equal : 'a env -> 'a env -> bool

equal env1 env2 tells whether the parser configurations env1 and env2 are equal in the sense that the automaton's current state is the same in env1 and env2 and the stack is *physically* the same in env1 and env2. If equal env1 env2 is true, then the sequence of the stack elements, as observed via pop and top, must be the same in env1 and env2. Also, if equal env1 env2 holds, then the checkpoints input_needed env1 and input_needed env2 must be equivalent. The function equal has time complexity O(1).

positions env returns the start and end positions of the current lookahead token. In an initial state, a pair of twice the initial position is returned.

val env_has_default_reduction : 'a env -> bool

When applied to an environment taken from a checkpoint of the form AboutToReduce (env, prod), the function env_has_default_reduction tells whether the reduction that is about to take place is a default reduction.

val state_has_default_reduction : _ lr1state -> bool

state_has_default_reduction s tells whether the state s has a default reduction. This includes the case where s is an accepting state.

val pop : 'a env -> 'a env option

pop env returns a new environment, where the parser's top stack cell has been popped off. (If the stack is empty, None is returned.) This amounts to pretending that the (terminal or nonterminal) symbol that corresponds to this stack cell has not been read.

val force_reduction : production -> 'a env -> 'a env

force_reduction prod env should be called only if in the state env the parser is capable of reducing the production prod. If this condition is satisfied, then this production is reduced, which means that its semantic action is executed (this can have side effects!) and the automaton makes a goto (nonterminal) transition. If this condition is not satisfied, Invalid_argument _ is raised.

val input_needed : 'a env -> 'a checkpoint

input_needed env returns InputNeeded env. That is, out of an env that might have been obtained via a series of calls to the functions pop, force_reduction, feed, etc., it produces a checkpoint, which can be used to resume normal parsing, by supplying this checkpoint as an argument to offer.

This function should be used with some care. It could "mess up the lookahead" in the sense that it allows parsing to resume in an arbitrary state s with an arbitrary lookahead symbol t, even though Menhir's reachability analysis (menhir --list-errors) might well think that it is impossible to reach this particular configuration. If one is using Menhir's new error reporting facility, this could cause the parser to reach an error state for which no error message has been prepared.

type _ terminal =
  1. | T_error : unit terminal
  2. | T_WITH : unit terminal
  3. | T_WHILE : unit terminal
  4. | T_WHEN : unit terminal
  5. | T_VIRTUAL : unit terminal
  6. | T_VAL : unit terminal
  7. | T_UNDERSCORE : unit terminal
  8. | T_UIDENT : string terminal
  9. | T_TYPE : unit terminal
  10. | T_TRY : unit terminal
  11. | T_TRUE : unit terminal
  12. | T_TO : unit terminal
  13. | T_TILDE : unit terminal
  14. | T_THEN : unit terminal
  15. | T_SWITCH : unit terminal
  16. | T_STRUCT : unit terminal
  17. | T_STRING : (string * string option * string option) terminal
  18. | T_STAR : unit terminal
  19. | T_SLASHGREATER : unit terminal
  20. | T_SIG : unit terminal
  21. | T_SHARPOP : string terminal
  22. | T_SHARPEQUAL : unit terminal
  23. | T_SHARP : unit terminal
  24. | T_SEMISEMI : unit terminal
  25. | T_SEMI : unit terminal
  26. | T_RPAREN : unit terminal
  27. | T_REC : unit terminal
  28. | T_RBRACKET : unit terminal
  29. | T_RBRACE : unit terminal
  30. | T_QUOTE : unit terminal
  31. | T_QUESTION : unit terminal
  32. | T_PUB : unit terminal
  33. | T_PRI : unit terminal
  34. | T_PREFIXOP : string terminal
  35. | T_POSTFIXOP : string terminal
  36. | T_PLUSEQ : unit terminal
  37. | T_PLUSDOT : unit terminal
  38. | T_PLUS : unit terminal
  39. | T_PERCENT : unit terminal
  40. | T_OR : unit terminal
  41. | T_OPEN : unit terminal
  42. | T_OF : unit terminal
  43. | T_OBJECT : unit terminal
  44. | T_NONREC : unit terminal
  45. | T_NEW : unit terminal
  46. | T_NATIVEINT : nativeint terminal
  47. | T_MUTABLE : unit terminal
  48. | T_MODULE : unit terminal
  49. | T_MINUSGREATER : unit terminal
  50. | T_MINUSDOT : unit terminal
  51. | T_MINUS : unit terminal
  52. | T_LPAREN : unit terminal
  53. | T_LIDENT : string terminal
  54. | T_LETOP : string terminal
  55. | T_LET : unit terminal
  56. | T_LESSSLASHIDENTGREATER : string terminal
  57. | T_LESSSLASHGREATER : unit terminal
  58. | T_LESSIDENT : string terminal
  59. | T_LESSGREATER : unit terminal
  60. | T_LESSDOTDOTGREATER : unit terminal
  61. | T_LESS : unit terminal
  62. | T_LBRACKETPERCENTPERCENT : unit terminal
  63. | T_LBRACKETPERCENT : unit terminal
  64. | T_LBRACKETLESS : unit terminal
  65. | T_LBRACKETGREATER : unit terminal
  66. | T_LBRACKETBAR : unit terminal
  67. | T_LBRACKETAT : unit terminal
  68. | T_LBRACKET : unit terminal
  69. | T_LBRACELESS : unit terminal
  70. | T_LBRACE : unit terminal
  71. | T_LAZY : unit terminal
  72. | T_INT : (string * char option) terminal
  73. | T_INITIALIZER : unit terminal
  74. | T_INHERIT : unit terminal
  75. | T_INFIXOP4 : string terminal
  76. | T_INFIXOP3 : string terminal
  77. | T_INFIXOP2 : string terminal
  78. | T_INFIXOP1 : string terminal
  79. | T_INFIXOP0 : string terminal
  80. | T_INCLUDE : unit terminal
  81. | T_IN : unit terminal
  82. | T_IF : unit terminal
  83. | T_GREATERRBRACE : unit terminal
  84. | T_GREATERDOTDOTDOT : unit terminal
  85. | T_GREATER : unit terminal
  86. | T_FUNCTOR : unit terminal
  87. | T_FUNCTION : unit terminal
  88. | T_FUN : unit terminal
  89. | T_FOR : unit terminal
  90. | T_FLOAT : (string * char option) terminal
  91. | T_FALSE : unit terminal
  92. | T_EXTERNAL : unit terminal
  93. | T_EXCEPTION : unit terminal
  94. | T_ES6_FUN : unit terminal
  95. | T_EQUALGREATER : unit terminal
  96. | T_EQUAL : unit terminal
  97. | T_EOL : unit terminal
  98. | T_EOF : unit terminal
  99. | T_END : unit terminal
  100. | T_ELSE : unit terminal
  101. | T_DOWNTO : unit terminal
  102. | T_DOTDOTDOT : unit terminal
  103. | T_DOTDOT : unit terminal
  104. | T_DOT : unit terminal
  105. | T_DONE : unit terminal
  106. | T_DOCSTRING : string terminal
  107. | T_DO : unit terminal
  108. | T_CONSTRAINT : unit terminal
  109. | T_COMMENT : (string * Location.t) terminal
  110. | T_COMMA : unit terminal
  111. | T_COLONGREATER : unit terminal
  112. | T_COLONEQUAL : unit terminal
  113. | T_COLONCOLON : unit terminal
  114. | T_COLON : unit terminal
  115. | T_CLASS : unit terminal
  116. | T_CHAR : char terminal
  117. | T_BEGIN : unit terminal
  118. | T_BARRBRACKET : unit terminal
  119. | T_BARBAR : unit terminal
  120. | T_BAR : unit terminal
  121. | T_BANG : unit terminal
  122. | T_BACKQUOTE : unit terminal
  123. | T_ASSERT : unit terminal
  124. | T_AS : unit terminal
  125. | T_ANDOP : string terminal
  126. | T_AND : unit terminal
  127. | T_AMPERSAND : unit terminal
  128. | T_AMPERAMPER : unit terminal
type _ nonterminal =
  1. | N_with_constraint : Migrate_parsetree.Ast_408.Parsetree.with_constraint nonterminal
  2. | N_virtual_flag : Migrate_parsetree.Ast_408.Asttypes.virtual_flag nonterminal
  3. | N_value_type : (string Location.loc * Migrate_parsetree.Ast_408.Asttypes.mutable_flag * Migrate_parsetree.Ast_408.Asttypes.virtual_flag * Migrate_parsetree.Ast_408.Parsetree.typ) nonterminal
  4. | N_value : (string Location.loc * Migrate_parsetree.Ast_408.Asttypes.mutable_flag * Migrate_parsetree.Ast_408.Parsetree.class_field_kind) nonterminal
  5. | N_val_longident : Longident.t nonterminal
  6. | N_val_ident : string nonterminal
  7. | N_use_file_no_mapper : Migrate_parsetree.Ast_408.Parsetree.toplevel_phrase list nonterminal
  8. | N_use_file : Migrate_parsetree.Ast_408.Parsetree.toplevel_phrase list nonterminal
  9. | N_unattributed_expr : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  10. | N_unattributed_core_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  11. | N_type_variance : Migrate_parsetree.Ast_408.Asttypes.variance nonterminal
  12. | N_type_variables_with_variance_comma_list : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) list nonterminal
  13. | N_type_variables_with_variance : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) list nonterminal
  14. | N_type_variable_with_variance : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) nonterminal
  15. | N_type_variable : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  16. | N_type_subst_other_kind : (Migrate_parsetree.Ast_408.Parsetree.type_kind * Migrate_parsetree.Ast_408.Asttypes.private_flag * Migrate_parsetree.Ast_408.Parsetree.typ option) nonterminal
  17. | N_type_subst_kind : ((Migrate_parsetree.Ast_408.Parsetree.type_kind * Migrate_parsetree.Ast_408.Asttypes.private_flag * Migrate_parsetree.Ast_408.Parsetree.typ option) * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Parsetree.typ * Warnings.loc) list * Lexing.position * Migrate_parsetree.Ast_408.Parsetree.type_declaration list) nonterminal
  18. | N_type_subst_declarations : Migrate_parsetree.Ast_408.Parsetree.type_declaration list nonterminal
  19. | N_type_subst_constructor_declarations_aux : (Migrate_parsetree.Ast_408.Parsetree.constructor_declaration list * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Parsetree.typ * Warnings.loc) list * Lexing.position * Migrate_parsetree.Ast_408.Parsetree.type_declaration list) nonterminal
  20. | N_type_subst_constructor_declarations : (Migrate_parsetree.Ast_408.Parsetree.constructor_declaration list * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Parsetree.typ * Warnings.loc) list * Lexing.position * Migrate_parsetree.Ast_408.Parsetree.type_declaration list) nonterminal
  21. | N_type_parameters : Migrate_parsetree.Ast_408.Parsetree.typ list nonterminal
  22. | N_type_parameter : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) nonterminal
  23. | N_type_other_kind : (Migrate_parsetree.Ast_408.Parsetree.type_kind * Migrate_parsetree.Ast_408.Asttypes.private_flag * Migrate_parsetree.Ast_408.Parsetree.typ option) nonterminal
  24. | N_type_longident : Migrate_parsetree.Ast_408.Ast_helper.lid nonterminal
  25. | N_type_declarations : (Migrate_parsetree.Ast_408.Asttypes.rec_flag * Migrate_parsetree.Ast_408.Parsetree.type_declaration list) nonterminal
  26. | N_type_declaration_kind : ((Migrate_parsetree.Ast_408.Parsetree.type_kind * Migrate_parsetree.Ast_408.Asttypes.private_flag * Migrate_parsetree.Ast_408.Parsetree.typ option) * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Parsetree.typ * Warnings.loc) list * Lexing.position * Migrate_parsetree.Ast_408.Parsetree.type_declaration list) nonterminal
  27. | N_type_declaration_details : ((Migrate_parsetree.Ast_408.Ast_helper.str * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) list * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Parsetree.typ * Warnings.loc) list * Migrate_parsetree.Ast_408.Parsetree.type_kind * Migrate_parsetree.Ast_408.Asttypes.private_flag * Migrate_parsetree.Ast_408.Parsetree.typ option) * Lexing.position * Migrate_parsetree.Ast_408.Parsetree.type_declaration list) nonterminal
  28. | N_type_constraint : (Migrate_parsetree.Ast_408.Parsetree.typ option * Migrate_parsetree.Ast_408.Parsetree.typ option) nonterminal
  29. | N_toplevel_phrase : Migrate_parsetree.Ast_408.Parsetree.toplevel_phrase nonterminal
  30. | N_toplevel_directive : Migrate_parsetree.Ast_408.Parsetree.toplevel_phrase nonterminal
  31. | N_tag_field : Migrate_parsetree.Ast_408.Parsetree.row_field nonterminal
  32. | N_subtractive : string nonterminal
  33. | N_structure_item : Migrate_parsetree.OCaml_408.Ast.Parsetree.structure nonterminal
  34. | N_structure : Migrate_parsetree.OCaml_408.Ast.Parsetree.structure nonterminal
  35. | N_string_literal_labels : Migrate_parsetree.Ast_408.Parsetree.object_field list nonterminal
  36. | N_string_literal_label : Migrate_parsetree.Ast_408.Parsetree.object_field nonterminal
  37. | N_string_literal_exprs_maybe_punned : (Longident.t Location.loc * Migrate_parsetree.Ast_408.Parsetree.expression) list nonterminal
  38. | N_string_literal_expr_maybe_punned_with_comma : (Longident.t Location.loc * Migrate_parsetree.Ast_408.Parsetree.expression) nonterminal
  39. | N_string_literal_expr_maybe_punned : (Longident.t Location.loc * Migrate_parsetree.Ast_408.Parsetree.expression) nonterminal
  40. | N_str_type_extension : Migrate_parsetree.Ast_408.Parsetree.type_extension nonterminal
  41. | N_str_exception_declaration : Migrate_parsetree.Ast_408.Parsetree.extension_constructor nonterminal
  42. | N_single_attr_id : string nonterminal
  43. | N_simple_pattern_not_ident_ : Migrate_parsetree.Ast_408.Parsetree.pattern nonterminal
  44. | N_simple_pattern_not_ident : Migrate_parsetree.Ast_408.Parsetree.pattern nonterminal
  45. | N_simple_pattern_ident : Migrate_parsetree.Ast_408.Parsetree.pattern nonterminal
  46. | N_simple_pattern_direct_argument : Migrate_parsetree.Ast_408.Parsetree.pattern nonterminal
  47. | N_simple_pattern : Migrate_parsetree.Ast_408.Parsetree.pattern nonterminal
  48. | N_simple_module_type : Migrate_parsetree.Ast_408.Parsetree.module_type nonterminal
  49. | N_simple_expr_template_constructor : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  50. | N_simple_expr_no_constructor : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  51. | N_simple_expr_no_call : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  52. | N_simple_expr_direct_argument : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  53. | N_simple_expr_call : (Migrate_parsetree.Ast_408.Parsetree.expression * (Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.expression) list) nonterminal
  54. | N_signed_constant : (Migrate_parsetree.Ast_408.Ast_helper.attrs * Migrate_parsetree.Ast_408.Parsetree.constant) nonterminal
  55. | N_signature_items : Migrate_parsetree.OCaml_408.Ast.Parsetree.signature nonterminal
  56. | N_signature_item : Migrate_parsetree.Ast_408.Parsetree.signature_item_desc nonterminal
  57. | N_signature : Migrate_parsetree.OCaml_408.Ast.Parsetree.signature nonterminal
  58. | N_sig_type_extension : Migrate_parsetree.Ast_408.Parsetree.type_extension nonterminal
  59. | N_sig_exception_declaration : Migrate_parsetree.Ast_408.Parsetree.type_exception nonterminal
  60. | N_seq_expr_no_seq : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  61. | N_seq_expr : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  62. | N_separated_nonempty_list_AMPERSAND_non_arrowed_simple_core_types_ : Migrate_parsetree.Ast_408.Parsetree.typ list nonterminal
  63. | N_row_field_list : Migrate_parsetree.Ast_408.Parsetree.row_field list nonterminal
  64. | N_row_field : Migrate_parsetree.Ast_408.Parsetree.row_field nonterminal
  65. | N_record_label_declaration : Migrate_parsetree.Ast_408.Parsetree.label_declaration nonterminal
  66. | N_record_expr_with_string_keys : (Migrate_parsetree.Ast_408.Parsetree.expression option * (Longident.t Location.loc * Migrate_parsetree.Ast_408.Parsetree.expression) list) nonterminal
  67. | N_record_expr : (Migrate_parsetree.Ast_408.Parsetree.expression option * (Longident.t Location.loc * Migrate_parsetree.Ast_408.Parsetree.expression) list) nonterminal
  68. | N_record_declaration : Migrate_parsetree.Ast_408.Parsetree.label_declaration list nonterminal
  69. | N_rec_flag : Migrate_parsetree.Ast_408.Asttypes.rec_flag nonterminal
  70. | N_protected_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  71. | N_primitive_declaration : string list nonterminal
  72. | N_poly_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  73. | N_payload : Migrate_parsetree.Ast_408.Parsetree.payload nonterminal
  74. | N_pattern_without_or : Migrate_parsetree.Ast_408.Parsetree.pattern nonterminal
  75. | N_pattern_optional_constraint : Migrate_parsetree.Ast_408.Parsetree.pattern nonterminal
  76. | N_pattern_constructor_argument : Migrate_parsetree.Ast_408.Parsetree.pattern list nonterminal
  77. | N_pattern_comma_list_extension : (Migrate_parsetree.Ast_408.Parsetree.pattern list * Migrate_parsetree.Ast_408.Parsetree.pattern option) nonterminal
  78. | N_pattern : Migrate_parsetree.Ast_408.Parsetree.pattern nonterminal
  79. | N_parse_pattern : Migrate_parsetree.Ast_408.Parsetree.pattern nonterminal
  80. | N_parse_expression : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  81. | N_parse_core_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  82. | N_parenthesized_expr : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  83. | N_package_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  84. | N_override_flag : Migrate_parsetree.Ast_408.Asttypes.override_flag nonterminal
  85. | N_optional_expr_extension : (Migrate_parsetree.Ast_408.Parsetree.expression -> Migrate_parsetree.Ast_408.Parsetree.expression) nonterminal
  86. | N_optional : (string -> Migrate_parsetree.Ast_408.Asttypes.arg_label) nonterminal
  87. | N_option_type_constraint_ : (Migrate_parsetree.Ast_408.Parsetree.typ option * Migrate_parsetree.Ast_408.Parsetree.typ option) option nonterminal
  88. | N_option_preceded_WHEN_expr__ : Migrate_parsetree.Ast_408.Parsetree.expression option nonterminal
  89. | N_option_preceded_COLONGREATER_core_type__ : Migrate_parsetree.Ast_408.Parsetree.typ option nonterminal
  90. | N_option_preceded_COLON_simple_module_type__ : Migrate_parsetree.Ast_408.Parsetree.module_type option nonterminal
  91. | N_option_preceded_COLON_poly_type__ : Migrate_parsetree.Ast_408.Parsetree.typ option nonterminal
  92. | N_option_preceded_COLON_non_arrowed_core_type__ : Migrate_parsetree.Ast_408.Parsetree.typ option nonterminal
  93. | N_option_preceded_COLON_expr__ : Migrate_parsetree.Ast_408.Parsetree.expression option nonterminal
  94. | N_option_preceded_COLON_core_type__ : Migrate_parsetree.Ast_408.Parsetree.typ option nonterminal
  95. | N_option_preceded_COLON_class_constructor_type__ : Migrate_parsetree.Ast_408.Parsetree.class_type option nonterminal
  96. | N_option_item_extension_sugar_ : (Migrate_parsetree.Ast_408.Ast_helper.attrs * string Location.loc) option nonterminal
  97. | N_option_constructor_arguments_ : Migrate_parsetree.Ast_408.Parsetree.constructor_arguments option nonterminal
  98. | N_option_as_loc_preceded_AS_LIDENT___ : string Location.loc option nonterminal
  99. | N_option_SEMI_ : unit option nonterminal
  100. | N_option_OF_ : unit option nonterminal
  101. | N_option_MODULE_ : unit option nonterminal
  102. | N_option_LET_ : unit option nonterminal
  103. | N_option_DOTDOTDOT_ : unit option nonterminal
  104. | N_option_DOT_ : unit option nonterminal
  105. | N_option_COMMA_ : unit option nonterminal
  106. | N_opt_LET_MODULE_ident : Migrate_parsetree.Ast_408.Ast_helper.str nonterminal
  107. | N_opt_LET_MODULE_REC_ident : Migrate_parsetree.Ast_408.Ast_helper.str nonterminal
  108. | N_opt_LET_MODULE : unit nonterminal
  109. | N_operator : string nonterminal
  110. | N_open_description : Migrate_parsetree.OCaml_408.Ast.Parsetree.open_description nonterminal
  111. | N_open_declaration : Migrate_parsetree.Ast_408.Parsetree.module_expr Migrate_parsetree.Ast_408.Parsetree.open_infos nonterminal
  112. | N_object_record_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  113. | N_object_label_declarations : Migrate_parsetree.Ast_408.Parsetree.object_field list nonterminal
  114. | N_object_label_declaration : Migrate_parsetree.Ast_408.Parsetree.object_field nonterminal
  115. | N_object_body_class_fields : Migrate_parsetree.Ast_408.Parsetree.class_field list nonterminal
  116. | N_object_body : Migrate_parsetree.Ast_408.Parsetree.class_structure nonterminal
  117. | N_nonrec_flag : Migrate_parsetree.Ast_408.Asttypes.rec_flag nonterminal
  118. | N_nonempty_list_preceded_CONSTRAINT_constrain__ : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Parsetree.typ * Warnings.loc) list nonterminal
  119. | N_nonempty_list_name_tag_ : string list nonterminal
  120. | N_nonempty_list_attributed_ext_constructor_extension_constructor_declaration__ : Migrate_parsetree.Ast_408.Parsetree.extension_constructor list nonterminal
  121. | N_nonempty_list_attributed_ext_constructor_either_extension_constructor_declaration_extension_constructor_rebind___ : Migrate_parsetree.Ast_408.Parsetree.extension_constructor list nonterminal
  122. | N_nonempty_list_as_loc_preceded_QUOTE_ident___ : string Location.loc list nonterminal
  123. | N_nonempty_list_as_loc_attribute__ : Migrate_parsetree.Ast_408.Parsetree.attribute Location.loc list nonterminal
  124. | N_nonempty_list_as_loc_LIDENT__ : string Location.loc list nonterminal
  125. | N_nonempty_list___anonymous_32_ : string list nonterminal
  126. | N_non_labeled_argument_list : Migrate_parsetree.Ast_408.Parsetree.expression list nonterminal
  127. | N_non_arrowed_simple_core_types : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  128. | N_non_arrowed_simple_core_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  129. | N_non_arrowed_core_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  130. | N_mutable_or_virtual_flags : (Migrate_parsetree.Ast_408.Asttypes.mutable_flag * Migrate_parsetree.Ast_408.Asttypes.virtual_flag) nonterminal
  131. | N_mutable_flag : Migrate_parsetree.Ast_408.Asttypes.mutable_flag nonterminal
  132. | N_mty_longident : Longident.t nonterminal
  133. | N_module_type_signature : Migrate_parsetree.Ast_408.Parsetree.module_type nonterminal
  134. | N_module_type_body_EQUAL_ : Migrate_parsetree.Ast_408.Parsetree.module_type nonterminal
  135. | N_module_type_body_COLON_ : Migrate_parsetree.Ast_408.Parsetree.module_type nonterminal
  136. | N_module_type : Migrate_parsetree.Ast_408.Parsetree.module_type nonterminal
  137. | N_module_parameter : (string Location.loc option * Migrate_parsetree.Ast_408.Parsetree.module_type option) Location.loc nonterminal
  138. | N_module_expr_structure : Migrate_parsetree.Ast_408.Parsetree.module_expr nonterminal
  139. | N_module_expr_body : Migrate_parsetree.Ast_408.Parsetree.module_expr nonterminal
  140. | N_module_expr : Migrate_parsetree.Ast_408.Parsetree.module_expr nonterminal
  141. | N_module_declaration : Migrate_parsetree.Ast_408.Parsetree.module_type nonterminal
  142. | N_module_complex_expr : Migrate_parsetree.Ast_408.Parsetree.module_expr nonterminal
  143. | N_module_binding_body : Migrate_parsetree.Ast_408.Parsetree.module_expr nonterminal
  144. | N_module_arguments_comma_list : Migrate_parsetree.Ast_408.Parsetree.module_expr list nonterminal
  145. | N_module_arguments : Migrate_parsetree.Ast_408.Parsetree.module_expr list nonterminal
  146. | N_mod_longident : Longident.t nonterminal
  147. | N_mod_ext_longident : Longident.t nonterminal
  148. | N_mod_ext_apply : Longident.t nonterminal
  149. | N_method_ : (string Location.loc * Migrate_parsetree.Ast_408.Parsetree.class_field_kind) nonterminal
  150. | N_match_case_seq_expr_ : Migrate_parsetree.Ast_408.Parsetree.case nonterminal
  151. | N_match_case_expr_ : Migrate_parsetree.Ast_408.Parsetree.case nonterminal
  152. | N_lseparated_nonempty_list_aux_SEMI_class_sig_field_ : Migrate_parsetree.Ast_408.Parsetree.class_type_field list list nonterminal
  153. | N_lseparated_nonempty_list_aux_SEMI_class_field_ : Migrate_parsetree.Ast_408.Parsetree.class_field list list nonterminal
  154. | N_lseparated_nonempty_list_aux_COMMA_uncurried_labeled_expr_ : (Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.expression) list nonterminal
  155. | N_lseparated_nonempty_list_aux_COMMA_uncurried_arrow_type_parameter_ : ((Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.typ) Location.loc * bool) list nonterminal
  156. | N_lseparated_nonempty_list_aux_COMMA_type_variable_with_variance_ : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) list nonterminal
  157. | N_lseparated_nonempty_list_aux_COMMA_type_parameter_ : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) list nonterminal
  158. | N_lseparated_nonempty_list_aux_COMMA_string_literal_label_ : Migrate_parsetree.Ast_408.Parsetree.object_field list nonterminal
  159. | N_lseparated_nonempty_list_aux_COMMA_string_literal_expr_maybe_punned_ : (Longident.t Location.loc * Migrate_parsetree.Ast_408.Parsetree.expression) list nonterminal
  160. | N_lseparated_nonempty_list_aux_COMMA_record_label_declaration_ : Migrate_parsetree.Ast_408.Parsetree.label_declaration list nonterminal
  161. | N_lseparated_nonempty_list_aux_COMMA_protected_type_ : Migrate_parsetree.Ast_408.Parsetree.typ list nonterminal
  162. | N_lseparated_nonempty_list_aux_COMMA_pattern_optional_constraint_ : Migrate_parsetree.Ast_408.Parsetree.pattern list nonterminal
  163. | N_lseparated_nonempty_list_aux_COMMA_opt_spread_pattern__ : (Warnings.loc option * Migrate_parsetree.Ast_408.Parsetree.pattern) list nonterminal
  164. | N_lseparated_nonempty_list_aux_COMMA_opt_spread_lbl_expr__ : (Warnings.loc option * (Longident.t Location.loc * Migrate_parsetree.Ast_408.Parsetree.expression)) list nonterminal
  165. | N_lseparated_nonempty_list_aux_COMMA_opt_spread_expr_optional_constraint__ : (Warnings.loc option * Migrate_parsetree.Ast_408.Parsetree.expression) list nonterminal
  166. | N_lseparated_nonempty_list_aux_COMMA_object_label_declaration_ : Migrate_parsetree.Ast_408.Parsetree.object_field list nonterminal
  167. | N_lseparated_nonempty_list_aux_COMMA_module_parameter_ : (string Location.loc option * Migrate_parsetree.Ast_408.Parsetree.module_type option) Location.loc list nonterminal
  168. | N_lseparated_nonempty_list_aux_COMMA_module_complex_expr_ : Migrate_parsetree.Ast_408.Parsetree.module_expr list nonterminal
  169. | N_lseparated_nonempty_list_aux_COMMA_mod_ext_longident_ : Longident.t list nonterminal
  170. | N_lseparated_nonempty_list_aux_COMMA_labeled_pattern_ : Reason_parser_def.labelled_parameter Location.loc list nonterminal
  171. | N_lseparated_nonempty_list_aux_COMMA_field_expr_ : (string Location.loc * Migrate_parsetree.Ast_408.Parsetree.expression) list nonterminal
  172. | N_lseparated_nonempty_list_aux_COMMA_expr_optional_constraint_ : Migrate_parsetree.Ast_408.Parsetree.expression list nonterminal
  173. | N_lseparated_nonempty_list_aux_COMMA_expr_ : Migrate_parsetree.Ast_408.Parsetree.expression list nonterminal
  174. | N_lseparated_nonempty_list_aux_COMMA_core_type_ : Migrate_parsetree.Ast_408.Parsetree.typ list nonterminal
  175. | N_lseparated_nonempty_list_aux_AND_with_constraint_ : Migrate_parsetree.Ast_408.Parsetree.with_constraint list nonterminal
  176. | N_loption_type_parameters_ : Migrate_parsetree.Ast_408.Parsetree.typ list nonterminal
  177. | N_loption_terminated_pattern_comma_list_option_COMMA___ : Migrate_parsetree.Ast_408.Parsetree.pattern list nonterminal
  178. | N_loption_row_field_list_ : Migrate_parsetree.Ast_408.Parsetree.row_field list nonterminal
  179. | N_loption_preceded_GREATER_nonempty_list_name_tag___ : string list nonterminal
  180. | N_loption_parenthesized_type_variables_with_variance_comma_list__ : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) list nonterminal
  181. | N_loption_parenthesized_class_type_arguments_comma_list__ : Migrate_parsetree.Ast_408.Parsetree.typ list nonterminal
  182. | N_loption_object_label_declarations_ : Migrate_parsetree.Ast_408.Parsetree.object_field list nonterminal
  183. | N_loption_located_attributes_ : Migrate_parsetree.Ast_408.Parsetree.attribute Location.loc list nonterminal
  184. | N_loption_functor_parameters_ : (string Location.loc option * Migrate_parsetree.Ast_408.Parsetree.module_type option) Location.loc list nonterminal
  185. | N_loption_class_type_parameters_ : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) list nonterminal
  186. | N_longident_type_constraint : (Longident.t Location.loc * (Migrate_parsetree.Ast_408.Parsetree.typ option * Migrate_parsetree.Ast_408.Parsetree.typ option) option) nonterminal
  187. | N_llist_aux_preceded_COMMA_opt_spread_lbl_expr___ : (Warnings.loc option * (Longident.t Location.loc * Migrate_parsetree.Ast_408.Parsetree.expression)) list nonterminal
  188. | N_llist_aux_match_case_seq_expr__ : Migrate_parsetree.Ast_408.Parsetree.case list nonterminal
  189. | N_llist_aux_match_case_expr__ : Migrate_parsetree.Ast_408.Parsetree.case list nonterminal
  190. | N_list_simple_expr_no_call_ : Migrate_parsetree.Ast_408.Parsetree.expression list nonterminal
  191. | N_list_bar_row_field_ : Migrate_parsetree.Ast_408.Parsetree.row_field list nonterminal
  192. | N_list_attributed_ext_constructor_extension_constructor_declaration__ : Migrate_parsetree.Ast_408.Parsetree.extension_constructor list nonterminal
  193. | N_list_attributed_ext_constructor_either_extension_constructor_declaration_extension_constructor_rebind___ : Migrate_parsetree.Ast_408.Parsetree.extension_constructor list nonterminal
  194. | N_list_and_module_rec_declaration_ : Migrate_parsetree.Ast_408.Parsetree.module_declaration list nonterminal
  195. | N_list_and_module_bindings_ : Migrate_parsetree.Ast_408.Parsetree.module_binding list nonterminal
  196. | N_list_and_let_binding_ : Migrate_parsetree.Ast_408.Parsetree.value_binding list nonterminal
  197. | N_list_and_class_type_declaration_ : Migrate_parsetree.OCaml_408.Ast.Parsetree.class_type_declaration list nonterminal
  198. | N_list_and_class_description_ : Migrate_parsetree.OCaml_408.Ast.Parsetree.class_description list nonterminal
  199. | N_list_and_class_declaration_ : Migrate_parsetree.OCaml_408.Ast.Parsetree.class_declaration list nonterminal
  200. | N_letop_bindings : (Migrate_parsetree.Ast_408.Parsetree.pattern * Migrate_parsetree.Ast_408.Parsetree.expression * Migrate_parsetree.Ast_408.Parsetree.binding_op list) nonterminal
  201. | N_letop_binding_body : (Migrate_parsetree.Ast_408.Parsetree.pattern * Migrate_parsetree.Ast_408.Parsetree.expression) nonterminal
  202. | N_let_bindings : Reason_parser_def.let_bindings nonterminal
  203. | N_let_binding_body : (Migrate_parsetree.Ast_408.Parsetree.pattern * Migrate_parsetree.Ast_408.Parsetree.expression) nonterminal
  204. | N_let_binding : Reason_parser_def.let_bindings nonterminal
  205. | N_lbl_pattern : (Longident.t Location.loc * Migrate_parsetree.Ast_408.Parsetree.pattern) nonterminal
  206. | N_labelled_arrow_type_parameter_optional : (Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.typ) nonterminal
  207. | N_labeled_pattern_constraint : (string Location.loc -> Migrate_parsetree.Ast_408.Parsetree.pattern) nonterminal
  208. | N_labeled_pattern : Reason_parser_def.labelled_parameter Location.loc nonterminal
  209. | N_labeled_expr_constraint : (Longident.t Location.loc -> Migrate_parsetree.Ast_408.Parsetree.expression) nonterminal
  210. | N_labeled_expr : (Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.expression) nonterminal
  211. | N_labeled_arguments : (Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.expression) list nonterminal
  212. | N_label_longident : Longident.t nonterminal
  213. | N_jsx_without_leading_less : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  214. | N_jsx_start_tag_and_args_without_leading_less : (((Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.expression) list -> Warnings.loc -> Migrate_parsetree.Ast_408.Parsetree.expression) * Longident.t) nonterminal
  215. | N_jsx_start_tag_and_args : (((Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.expression) list -> Warnings.loc -> Migrate_parsetree.Ast_408.Parsetree.expression) * Longident.t) nonterminal
  216. | N_jsx_arguments : (Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.expression) list nonterminal
  217. | N_jsx : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  218. | N_item_extension_sugar : (Migrate_parsetree.Ast_408.Ast_helper.attrs * string Location.loc) nonterminal
  219. | N_item_extension : Migrate_parsetree.OCaml_408.Ast.Parsetree.extension nonterminal
  220. | N_interface : Migrate_parsetree.Ast_408.Parsetree.signature nonterminal
  221. | N_implementation : Migrate_parsetree.Ast_408.Parsetree.structure nonterminal
  222. | N_ident : string nonterminal
  223. | N_greater_spread : string nonterminal
  224. | N_generalized_constructor_arguments : (Migrate_parsetree.Ast_408.Parsetree.constructor_arguments * Migrate_parsetree.Ast_408.Parsetree.typ option) nonterminal
  225. | N_functor_parameters : (string Location.loc option * Migrate_parsetree.Ast_408.Parsetree.module_type option) Location.loc list nonterminal
  226. | N_fun_def_EQUALGREATER_non_arrowed_core_type_ : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  227. | N_fun_def_EQUAL_core_type_ : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  228. | N_field_expr : (string Location.loc * Migrate_parsetree.Ast_408.Parsetree.expression) nonterminal
  229. | N_extension_constructor_rebind : Migrate_parsetree.Ast_408.Parsetree.extension_constructor nonterminal
  230. | N_extension_constructor_declaration : Migrate_parsetree.Ast_408.Parsetree.extension_constructor nonterminal
  231. | N_extension : Migrate_parsetree.OCaml_408.Ast.Parsetree.extension nonterminal
  232. | N_expr_optional_constraint : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  233. | N_expr_list : Migrate_parsetree.Ast_408.Parsetree.expression list nonterminal
  234. | N_expr_comma_seq_extension : (Migrate_parsetree.Ast_408.Parsetree.expression list * Migrate_parsetree.Ast_408.Parsetree.expression option) nonterminal
  235. | N_expr : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  236. | N_es6_parameters : (Reason_parser_def.labelled_parameter Location.loc list * bool) nonterminal
  237. | N_embedded_private_flag_ : Migrate_parsetree.Ast_408.Asttypes.private_flag nonterminal
  238. | N_embedded___anonymous_39_ : Migrate_parsetree.Ast_408.Parsetree.directive_argument_desc option nonterminal
  239. | N_embedded___anonymous_33_ : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) nonterminal
  240. | N_embedded___anonymous_1_ : Migrate_parsetree.Ast_408.Parsetree.toplevel_phrase list nonterminal
  241. | N_embedded___anonymous_0_ : Migrate_parsetree.Ast_408.Parsetree.toplevel_phrase nonterminal
  242. | N_either_preceded_EQUALGREATER_expr__braced_expr_ : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  243. | N_either_preceded_EQUAL_expr__braced_expr_ : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  244. | N_either_preceded_EQUAL_class_instance_type__class_type_body_ : Migrate_parsetree.Ast_408.Parsetree.class_type nonterminal
  245. | N_either_preceded_EQUAL_class_expr__class_body_expr_ : Migrate_parsetree.Ast_408.Parsetree.class_expr nonterminal
  246. | N_either_parenthesized_longident_type_constraint__longident_type_constraint_ : (Longident.t Location.loc * (Migrate_parsetree.Ast_408.Parsetree.typ option * Migrate_parsetree.Ast_408.Parsetree.typ option) option) nonterminal
  247. | N_either_extension_constructor_declaration_extension_constructor_rebind_ : Migrate_parsetree.Ast_408.Parsetree.extension_constructor nonterminal
  248. | N_either_constructor_declaration_bar_constructor_declaration_ : Migrate_parsetree.Ast_408.Parsetree.constructor_declaration nonterminal
  249. | N_either___anonymous_12___anonymous_13_ : Migrate_parsetree.Ast_408.Asttypes.private_flag nonterminal
  250. | N_either_ES6_FUN_FUN_ : unit nonterminal
  251. | N_direction_flag : Migrate_parsetree.Ast_408.Asttypes.direction_flag nonterminal
  252. | N_core_type2 : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  253. | N_core_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  254. | N_constructor_declarations_aux : (Migrate_parsetree.Ast_408.Parsetree.constructor_declaration list * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Parsetree.typ * Warnings.loc) list * Lexing.position * Migrate_parsetree.Ast_408.Parsetree.type_declaration list) nonterminal
  255. | N_constructor_declarations : (Migrate_parsetree.Ast_408.Parsetree.constructor_declaration list * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Parsetree.typ * Warnings.loc) list * Lexing.position * Migrate_parsetree.Ast_408.Parsetree.type_declaration list) nonterminal
  256. | N_constructor_declaration : Migrate_parsetree.Ast_408.Parsetree.constructor_declaration nonterminal
  257. | N_constructor_arguments_comma_list : Migrate_parsetree.Ast_408.Parsetree.typ list nonterminal
  258. | N_constructor_arguments : Migrate_parsetree.Ast_408.Parsetree.constructor_arguments nonterminal
  259. | N_constrain_field : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Parsetree.typ) nonterminal
  260. | N_constrain : (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Parsetree.typ * Warnings.loc) nonterminal
  261. | N_constr_longident : Longident.t nonterminal
  262. | N_constant : (Migrate_parsetree.Ast_408.Ast_helper.attrs * Migrate_parsetree.Ast_408.Parsetree.constant) nonterminal
  263. | N_clty_longident : Longident.t nonterminal
  264. | N_class_type_declarations : Migrate_parsetree.OCaml_408.Ast.Parsetree.class_type_declaration list nonterminal
  265. | N_class_type_declaration_details : (Migrate_parsetree.Ast_408.Ast_helper.str * Migrate_parsetree.Ast_408.Parsetree.class_type * Migrate_parsetree.Ast_408.Asttypes.virtual_flag * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) list) nonterminal
  266. | N_class_type_body : Migrate_parsetree.Ast_408.Parsetree.class_type nonterminal
  267. | N_class_type_arguments_comma_list : Migrate_parsetree.Ast_408.Parsetree.typ list nonterminal
  268. | N_class_simple_expr : Migrate_parsetree.Ast_408.Parsetree.class_expr nonterminal
  269. | N_class_sig_field : Migrate_parsetree.Ast_408.Parsetree.class_type_field list nonterminal
  270. | N_class_sig_body_fields : Migrate_parsetree.Ast_408.Parsetree.class_type_field list nonterminal
  271. | N_class_sig_body_cty : Migrate_parsetree.Ast_408.Parsetree.class_type_desc nonterminal
  272. | N_class_sig_body : Migrate_parsetree.Ast_408.Parsetree.class_signature nonterminal
  273. | N_class_self_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  274. | N_class_self_expr : Migrate_parsetree.Ast_408.Parsetree.pattern nonterminal
  275. | N_class_longident : Longident.t nonterminal
  276. | N_class_instance_type : Migrate_parsetree.Ast_408.Parsetree.class_type nonterminal
  277. | N_class_field : Migrate_parsetree.Ast_408.Parsetree.class_field list nonterminal
  278. | N_class_expr_lets_and_rest : Migrate_parsetree.Ast_408.Parsetree.class_expr nonterminal
  279. | N_class_expr : Migrate_parsetree.Ast_408.Parsetree.class_expr nonterminal
  280. | N_class_descriptions : Migrate_parsetree.OCaml_408.Ast.Parsetree.class_description list nonterminal
  281. | N_class_description_details : (Migrate_parsetree.Ast_408.Ast_helper.str * Migrate_parsetree.Ast_408.Parsetree.class_type * Migrate_parsetree.Ast_408.Asttypes.virtual_flag * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) list) nonterminal
  282. | N_class_declaration_details : (Migrate_parsetree.Ast_408.Ast_helper.str * Migrate_parsetree.Ast_408.Parsetree.class_expr * Migrate_parsetree.Ast_408.Asttypes.virtual_flag * (Migrate_parsetree.Ast_408.Parsetree.typ * Migrate_parsetree.Ast_408.Asttypes.variance) list) nonterminal
  283. | N_class_declaration_body : Migrate_parsetree.Ast_408.Parsetree.class_expr nonterminal
  284. | N_class_constructor_type : Migrate_parsetree.Ast_408.Parsetree.class_type nonterminal
  285. | N_braced_expr : Migrate_parsetree.Ast_408.Parsetree.expression nonterminal
  286. | N_boption_AMPERSAND_ : bool nonterminal
  287. | N_basic_core_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  288. | N_bar_row_field : Migrate_parsetree.Ast_408.Parsetree.row_field nonterminal
  289. | N_bar_constructor_declaration : Migrate_parsetree.Ast_408.Parsetree.constructor_declaration nonterminal
  290. | N_attributed_ext_constructors_extension_constructor_declaration_ : Migrate_parsetree.Ast_408.Parsetree.extension_constructor list nonterminal
  291. | N_attributed_ext_constructors_either_extension_constructor_declaration_extension_constructor_rebind__ : Migrate_parsetree.Ast_408.Parsetree.extension_constructor list nonterminal
  292. | N_attribute : Migrate_parsetree.Ast_408.Parsetree.attribute nonterminal
  293. | N_attr_id : string Location.loc nonterminal
  294. | N_arrowed_simple_core_type : Migrate_parsetree.Ast_408.Parsetree.typ nonterminal
  295. | N_arrow_type_parameters : ((Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.typ) Location.loc * bool) list nonterminal
  296. | N_arrow_type_parameter : (Migrate_parsetree.Ast_408.Asttypes.arg_label * Migrate_parsetree.Ast_408.Parsetree.typ) nonterminal
  297. | N_and_type_subst_declaration : Migrate_parsetree.Ast_408.Parsetree.type_declaration list nonterminal
  298. | N_and_type_declaration : Migrate_parsetree.Ast_408.Parsetree.type_declaration list nonterminal
  299. | N_and_module_rec_declaration : Migrate_parsetree.Ast_408.Parsetree.module_declaration nonterminal
  300. | N_and_module_bindings : Migrate_parsetree.Ast_408.Parsetree.module_binding nonterminal
  301. | N_and_class_type_declaration : Migrate_parsetree.OCaml_408.Ast.Parsetree.class_type_declaration nonterminal
  302. | N_and_class_description : Migrate_parsetree.OCaml_408.Ast.Parsetree.class_description nonterminal
  303. | N_and_class_declaration : Migrate_parsetree.Ast_408.Parsetree.class_expr Migrate_parsetree.Ast_408.Parsetree.class_infos nonterminal
  304. | N_additive : string nonterminal
  305. | N__lbl_pattern_list : ((Warnings.loc option * (Longident.t Location.loc * Migrate_parsetree.Ast_408.Parsetree.pattern)) list * Migrate_parsetree.Ast_408.Asttypes.closed_flag) nonterminal
include MenhirLib.IncrementalEngine.INSPECTION with type 'a lr1state := 'a lr1state with type production := production with type 'a terminal := 'a terminal with type 'a nonterminal := 'a nonterminal with type 'a env := 'a env
include MenhirLib.IncrementalEngine.SYMBOLS with type 'a terminal := 'a terminal with type 'a nonterminal := 'a nonterminal
type 'a symbol =
  1. | T : 'a terminal -> 'a symbol
  2. | N : 'a nonterminal -> 'a symbol

The type 'a symbol represents a terminal or nonterminal symbol. It is the disjoint union of the types 'a terminal and 'a nonterminal.

type xsymbol =
  1. | X : 'a symbol -> xsymbol

The type xsymbol is an existentially quantified version of the type 'a symbol. This type is useful in situations where 'a is not statically known.

type item = production * int

An LR(0) item is a pair of a production prod and a valid index i into this production. That is, if the length of rhs prod is n, then i is comprised between 0 and n, inclusive.

The following are total ordering functions.

val compare_terminals : _ terminal -> _ terminal -> int
val compare_nonterminals : _ nonterminal -> _ nonterminal -> int
val compare_symbols : xsymbol -> xsymbol -> int
val compare_productions : production -> production -> int
val compare_items : item -> item -> int
val incoming_symbol : 'a lr1state -> 'a symbol

incoming_symbol s is the incoming symbol of the state s, that is, the symbol that the parser must recognize before (has recognized when) it enters the state s. This function gives access to the semantic value v stored in a stack element Element (s, v, _, _). Indeed, by case analysis on the symbol incoming_symbol s, one discovers the type 'a of the value v.

val items : _ lr1state -> item list

items s is the set of the LR(0) items in the LR(0) core of the LR(1) state s. This set is not epsilon-closed. This set is presented as a list, in an arbitrary order.

val lhs : production -> xsymbol

lhs prod is the left-hand side of the production prod. This is always a non-terminal symbol.

val rhs : production -> xsymbol list

rhs prod is the right-hand side of the production prod. This is a (possibly empty) sequence of (terminal or nonterminal) symbols.

val nullable : _ nonterminal -> bool

nullable nt tells whether the non-terminal symbol nt is nullable. That is, it is true if and only if this symbol produces the empty word epsilon.

val first : _ nonterminal -> _ terminal -> bool

first nt t tells whether the FIRST set of the nonterminal symbol nt contains the terminal symbol t. That is, it is true if and only if nt produces a word that begins with t.

val xfirst : xsymbol -> _ terminal -> bool

xfirst is analogous to first, but expects a first argument of type xsymbol instead of _ terminal.

val foreach_terminal : (xsymbol -> 'a -> 'a) -> 'a -> 'a

foreach_terminal enumerates the terminal symbols, including error.

val foreach_terminal_but_error : (xsymbol -> 'a -> 'a) -> 'a -> 'a

foreach_terminal_but_error enumerates the terminal symbols, excluding error.

feed symbol startp semv endp env causes the parser to consume the (terminal or nonterminal) symbol symbol, accompanied with the semantic value semv and with the start and end positions startp and endp. Thus, the automaton makes a transition, and reaches a new state. The stack grows by one cell. This operation is permitted only if the current state (as determined by env) has an outgoing transition labeled with symbol. Otherwise, Invalid_argument _ is raised.