package rocq-runtime

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

Source file gramext.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(* camlp5r *)
(* gramext.ml,v *)
(* Copyright (c) INRIA 2007-2017 *)

type position =
  | First
  | Last
  | Before of string
  | After of string

type g_assoc = NonA | RightA | LeftA | BothA

let pr_assoc = function
  | BothA -> Pp.str "multi associativity"
  | LeftA -> Pp.str "left associativity"
  | RightA -> Pp.str "right associativity"
  | NonA -> Pp.str "no associativity"

(** Returns whether SELF means SELF, respectively on the left and on the right. *)
let split_assoc = function
  | BothA -> (true, true)
  | LeftA -> (true, false)
  | RightA -> (false, true)
  | NonA -> (false, false)

let self_on_the_left assoc = fst (split_assoc assoc)
let self_on_the_right assoc = snd (split_assoc assoc)