Skip to content

Commit

Permalink
Rename postponed fixity pragma constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
MartyO256 committed Sep 11, 2023
1 parent 5cab9a6 commit 54181ec
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/parser/disambiguation_state.ml
Original file line number Diff line number Diff line change
Expand Up @@ -808,16 +808,16 @@ module Disambiguation_state = struct
determined where the pragma is declared, hence why those fields are not
optional like in the parser syntax. *)
type postponed_fixity_pragma =
| Prefix_fixity of
| Postponed_prefix_fixity of
{ constant : Qualified_identifier.t
; precedence : Int.t
}
| Infix_fixity of
| Postponed_infix_fixity of
{ constant : Qualified_identifier.t
; precedence : Int.t
; associativity : Associativity.t
}
| Postfix_fixity of
| Postponed_postfix_fixity of
{ constant : Qualified_identifier.t
; precedence : Int.t
}
Expand Down Expand Up @@ -1349,26 +1349,28 @@ module Disambiguation_state = struct

let add_postponed_prefix_notation state ?precedence constant =
let precedence = get_default_precedence_opt state precedence in
add_postponed_notation state (Prefix_fixity { precedence; constant })
add_postponed_notation state
(Postponed_prefix_fixity { precedence; constant })

let add_postponed_infix_notation state ?precedence ?associativity constant
=
let precedence = get_default_precedence_opt state precedence in
let associativity = get_default_associativity_opt state associativity in
add_postponed_notation state
(Infix_fixity { precedence; associativity; constant })
(Postponed_infix_fixity { precedence; associativity; constant })

let add_postponed_postfix_notation state ?precedence constant =
let precedence = get_default_precedence_opt state precedence in
add_postponed_notation state (Postfix_fixity { precedence; constant })
add_postponed_notation state
(Postponed_postfix_fixity { precedence; constant })

let apply_postponed_fixity_pragmas =
let apply_postponed_fixity_pragma state = function
| Prefix_fixity { constant; precedence } ->
| Postponed_prefix_fixity { constant; precedence } ->
add_prefix_notation state ~precedence constant
| Infix_fixity { constant; precedence; associativity } ->
| Postponed_infix_fixity { constant; precedence; associativity } ->
add_infix_notation state ~precedence ~associativity constant
| Postfix_fixity { constant; precedence } ->
| Postponed_postfix_fixity { constant; precedence } ->
add_postfix_notation state ~precedence constant
in
fun state ->
Expand Down

0 comments on commit 54181ec

Please sign in to comment.