Legend:
Library
Module
Module type
Parameter
Class
Class type
Mode_expr appears in several places:
let local_ x = ...
local_ exp
local string -> string
global_ x : int
Note that in the first two cases, axes other than locality are not specified; in the second case, other axes are defaulted to legacy. In the last case, we are specifying modalities.
In the future the three annotations will be quite different, but for now they are all lists of modes/modalities. Typemode has the three different interpretations of the annotation.
(TODO: in the future we will have mutable(...), which is similar to the second occurrence above and should be covered by this module)
Extract the mode attribute (if any) from a list of attributes; also returns the rest of the attributes; Raises if multiple relevant attributes are found
Given a list of attributes, extracts the mode expression and returns the rest of attributes. Raises if multiple relevant attributes are found. Raises if attributes encodes empty mode expression