text stringlengths 0 601k |
|---|
let type_parameter = Gramf . mk " type_parameter " |
let type_parameters = Gramf . mk " type_parameters " |
let typevars = Gramf . mk " typevars " |
let val_longident = Gramf . mk " val_longident " |
let constr = Gramf . mk " constr " |
let exp_quot = Gramf . mk " exp_quot " |
let pat_quot = Gramf . mk " pat_quot " |
let ep_quot = Gramf . mk " ep_quot " |
let ep = Gramf . mk " ep " |
let ctyp_quot = Gramf . mk " ctyp_quot " |
let stru_quot = Gramf . mk " stru_quot " |
let sigi_quot = Gramf . mk " sigi_quot " |
let clfield_quot = Gramf . mk " clfield_quot " |
let clsigi_quot = Gramf . mk " clsigi_quot " |
let mexp_quot = Gramf . mk " mexp_quot " |
let mtyp_quot = Gramf . mk " mtyp_quot " |
let cltyp_quot = Gramf . mk " cltyp_quot " |
let clexp_quot = Gramf . mk " clexp_quot " |
let constr_quot = Gramf . mk " constr_quot " |
let bind_quot = Gramf . mk " bind_quot " |
let rec_exp_quot = Gramf . mk " rec_exp_quot " |
let module_declaration = Gramf . mk " module_declaration " |
let type_info = Gramf . mk " type_info " |
let type_repr = Gramf . mk " type_repr " |
let case_quot = Gramf . mk " quotation of case ( try / match / function case ) " |
let module_longident_dot_lparen = Gramf . mk " module_longident_dot_lparen " |
let sequence ' = Gramf . mk " sequence ' " |
let fun_def = Gramf . mk " fun_def " |
let mbind_quot = Gramf . mk " mbind_quot " |
let ident_quot = Gramf . mk " ident_quot " |
let string_list = Gramf . mk " string_list " |
let method_opt_override = Gramf . mk " method_opt_override " |
let value_val_opt_override = Gramf . mk " value_val_opt_override " |
let unquoted_typevars = Gramf . mk " unquoted_typevars " |
let lang = Gramf . mk " lang " |
let with_exp_lang = Gramf . mk " with_exp_lang " |
let with_stru_lang = Gramf . mk " with_stru_lang " |
let dot_lstrings = Gramf . mk " dot_lstrings " |
let a_string = Gramf . mk " a_string " |
let a_lident = Gramf . mk " a_lident " |
let a_uident = Gramf . mk " a_uident " |
let luident = Gramf . mk " luident " |
let uident = Gramf . mk " uident " |
let vid = Gramf . mk " vid " |
let astr = Gramf . mk " astr " |
let regexp = Gram . Entry . mk " regexp " ; ; |
let regexp_match_case = Gram . Entry . mk " regexp_match_case " ; ; |
let range = Gram . Entry . mk " range " ; ; |
let seq _loc e = match e with <: expr < $ _ $ ; $ _ $ >> -> <: expr < do { $ e $ } >> | _ -> e |
let extend_common ( ) = ( try DELETE_RULE Gram patt : LIDENT END with _rule_not_found -> ( ) ) ; ( try DELETE_RULE Gram expr : " let " ; opt_rec ; binding ; " in " ; expr LEVEL " ; " END with _rule_not_found -> Messages . cannot_delete_rule " ( 1 ) " ) ; ( try DELETE_RULE Gram str_item : " let " ; opt_rec ; binding ; "... |
let extend_regular ( ) = extend_common ( ) ; ( try DELETE_RULE Gram expr : " function " ; match_case END with _rule_not_found -> Messages . cannot_delete_rule " ( reg 1 ) " ) ; ( try DELETE_RULE Gram expr : " match " ; sequence ; " with " ; match_case END with _rule_not_found -> Messages . cannot_delete_rule " ( reg 2 ... |
let ( ) = init_named_regexps ( ) ; Camlp4 . Options . add " - tailrec " ( Arg . Set tailrec ) " produce code that preserves tail - recursivity ( default ) " ; Camlp4 . Options . add " - direct " ( Arg . Clear tailrec ) " produce code that does not try to preserve tail - recursivity " ; extend_regular ( ) |
let header ( col : int ) ( e : Indent . expectation ) : Pretty . doc = let open Indent in let open Pretty in match e with | Indent i -> assert ( col < i ) ; [ wrap_words " indented at least " ; text ( string_of_int ( i - col ) ) ; wrap_words " columns more " ] |> separated_by ( group space ) | Align i -> assert ( col <... |
let one_group ( col : int ) ( ( e , lst ) : Indent . expectation option * string list ) : Pretty . doc list = let open Pretty in let lst = List . map ( fun str -> text " - " <+> ( wrap_words str |> nest 2 ) <+> cut ) lst in match e with | None -> lst | Some e -> [ text " - " <+> ( header col e |> nest 2 ) <+> cut <+> c... |
let document ( col : int ) ( es : ( string * Indent . expectation option ) list ) : Pretty . doc = let open Pretty in let _ = Indent . group es in wrap_words " I have encountered something unexpected . I was expecting one of " <+> cut <+> cut <+> ( Indent . group es |> List . map ( one_group col ) |> List . concat |> p... |
let typ = <: obus_func < string -> uint -> string -> string -> string -> string list -> ( string , variant ) assoc -> int -> uint >> |
type t = int with obus |
type ( ' a , ' b , ' c ) t = ( int * ' a list ) structure * ( ' c , ' b ) balbla with obus |
module type M = sig type ( ' a , ' b , ' c ) t = ( int * ' a list ) structure * ( ' c , ' b ) balbla with obus ( single -> basic -> basic -> container ) end |
type foo = { a : A . B . string ; b : int list ; c : ( int , string , char ) machin ; d : ( int * byte_array * ( int , string ) dict_entry set ) structure * int ; |
let big_tuple = <: obus_type < int * string * uint * int32 * byte * char * int list * int * int * string * variant * signature >> |
let super_big_tuple = <: obus_type < x0 * x1 * x2 * x3 * x4 * x5 * x6 * x7 * x8 * x9 * x10 * x11 * x12 * x13 * x14 * x15 * x16 * x17 * x18 * x19 * x20 * x21 * x22 * x23 * x24 * x25 * x26 * x27 * x28 * x29 * x30 * x31 * x32 * x33 * x34 * x35 * x36 * x37 * x38 * x39 * x40 * x41 * x42 >> with obus ( " org . foo . Error . ... |
module Proxy = OBus_proxy . Make ( struct type proxy = t let cast x = x . proxy let make x = failwith " not implemented " end ) |
module MetaLoc = struct let loc_name = ref None let meta_loc_expr _loc loc = match ! loc_name with | None -> <: expr < $ lid :! Loc . name $ >> | Some " here " -> MetaLocHere . meta_loc_expr _loc loc | Some x -> <: expr < $ lid : x $ >> let meta_loc_patt _loc _ = <: patt < _ ; >> end |
let is_antiquot s = let len = String . length s in len > 2 && s [ . 0 ] 0 = ' \\ ' && s [ . 1 ] 1 = ' $ ' |
let handle_antiquot_in_string s term parse loc decorate = if is_antiquot s then let pos = String . index s ' : ' in let name = String . sub s 2 ( pos - 2 ) 2 and code = String . sub s ( pos + 1 ) 1 ( String . length s - pos - 1 ) 1 in decorate name ( parse loc code ) code else term |
let antiquot_expander = object inherit Ast . map as super method expr = function | <: expr @ _loc < $ anti : s $ >> | <: expr @ _loc < $ str : s $ >> as e -> handle_antiquot_in_string s e TheAntiquotSyntax . parse_expr _loc ( fun n e -> <: expr < inline_antiexp $ e $ ) >> | e -> super # expr e end |
let add_quotation name entry mexpr = let entry_eoi = entry in let parse_quot_string entry loc s = let q = ! Camlp4_config . antiquotations in let ( ) = Camlp4_config . antiquotations := true in let nea = ! Jslib_parse . non_exp_antiquots in let ( ) = Jslib_parse . non_exp_antiquots := false in let res = Jslib_parse . G... |
module MetaLoc = struct let loc_name = ref None let meta_loc_expr _loc loc = match ! loc_name with | None -> <: expr < $ lid :! Loc . name $ >> | Some " here " -> MetaLocHere . meta_loc_expr _loc loc | Some x -> <: expr < $ lid : x $ >> let meta_loc_patt _loc _ = <: patt < _ ; >> end |
let is_antiquot s = let len = String . length s in len > 2 && s [ . 0 ] 0 = ' \\ ' && s [ . 1 ] 1 = ' $ ' |
let handle_antiquot_in_string s term parse loc decorate = if is_antiquot s then let pos = String . index s ' : ' in let name = String . sub s 2 ( pos - 2 ) 2 and code = String . sub s ( pos + 1 ) 1 ( String . length s - pos - 1 ) 1 in decorate name ( parse loc code ) code else term |
let antiquot_expander = object inherit Ast . map as super method patt = function | <: patt @ _loc < $ anti : s $ >> | <: patt @ _loc < $ str : s $ >> as p -> handle_antiquot_in_string s p TheAntiquotSyntax . parse_patt _loc ( fun n p -> p ) p | p -> super # patt p method expr = function | <: expr @ _loc < $ anti : s $ ... |
let add_js_quotation name entry mexpr mpatt = let entry_eoi = entry in let parse_quot_string entry loc s = let q = ! Camlp4_config . antiquotations in let ( ) = Camlp4_config . antiquotations := true in let res = Jslib_parse . Gram . parse_string entry loc s in let ( ) = Camlp4_config . antiquotations := q in res in le... |
let add_ocaml_quotation name entry mexpr mpatt = let entry_eoi = Syntax . Gram . Entry . mk ( Syntax . Gram . Entry . name entry ) entry in let parse_quot_string entry loc s = let q = ! Camlp4_config . antiquotations in let ( ) = Camlp4_config . antiquotations := true in let res = Syntax . Gram . parse_string entry loc... |
let expand_macro ( ? sharing = false ) ( ? anchored = false ) _loc re e f = warnings re ; let ( num , re_name ) = Constants . new_regexp ( ) in let var_name = var_of_regexp re_name in let ( re_args , re_source , named_groups , postbindings ) = ( ! lib ) . process_regexp ~ sharing _loc re re_name in let get_re = Match .... |
let check_assertion ~ lookahead positive re = let rec check ~ branched = function Bind ( _loc , e , name , conv ) -> | Bind_pos ( _loc , name ) -> 0 | Epsilon _ -> 0 | Characters _ -> 1 | Special ( _loc , s , ( name , Some len ) ) -> len | Special ( _loc , s , ( name , None ) ) -> | Backref ( _loc , _ ) -> | Variable (... |
let lookahead _loc bopt re = let positive = bopt = None in check_assertion ~ lookahead : true positive re ; Lookahead ( _loc , positive , if positive then re else Closed re ) |
let lookbehind _loc bopt re = let positive = bopt = None in check_assertion ~ lookahead : false positive re ; Lookbehind ( _loc , positive , if positive then re else Closed re ) |
let seq _loc e = <: expr < do { $ e $ } >> |
let extend_common ( ) = let expr_level = " top " in expr : LEVEL $ expr_level $ [ [ " RE_PCRE " ; re = regexp -> <: expr < ( $ re_fragments , $ | " REPLACE " ; re = regexp ; " " ; -> e = sequence -> | " SEARCH " ; re = regexp ; " " ; -> e = sequence -> | " MAP " ; re = regexp ; " " ; -> e = sequence -> | " COLLECT " ; ... |
let extend_regular ( ) = extend_common ( ) |
let _ = select_lib Pcre_lib . lib ; Camlp4 . Options . add " - thread " ( Arg . Unit ( fun ( ) -> ) ) " Deprecated option that protects access to shared data with a mutex . \ Currently only patterns containing @ are concerned . " ; extend_regular ( ) |
module MetaLoc = struct let loc_name = ref None let meta_loc_expr _loc loc = match ! loc_name with | None -> <: expr < $ lid :! Loc . name $ >> | Some " here " -> MetaLocHere . meta_loc_expr _loc loc | Some x -> <: expr < $ lid : x $ >> let meta_loc_patt _loc _ = <: patt < _ ; >> end |
let is_antiquot s = let len = String . length s in len > 2 && s [ . 0 ] 0 = ' \\ ' && s [ . 1 ] 1 = ' $ ' |
let handle_antiquot_in_string s term parse loc decorate = if is_antiquot s then let pos = String . index s ' : ' in let name = String . sub s 2 ( pos - 2 ) 2 and code = String . sub s ( pos + 1 ) 1 ( String . length s - pos - 1 ) 1 in decorate name ( parse loc code ) code else term |
let antiquot_expander = object inherit Ast . map as super method patt = function | <: patt @ _loc < $ anti : s $ >> | <: patt @ _loc < $ str : s $ >> as p -> handle_antiquot_in_string s p TheAntiquotSyntax . parse_patt _loc ( fun n p -> p ) p | p -> super # patt p method expr = function | <: expr @ _loc < $ anti : s $ ... |
let add_quotation name entry mexpr mpatt = let entry_eoi = entry in let parse_quot_string entry loc s = let q = ! Camlp4_config . antiquotations in let ( ) = Camlp4_config . antiquotations := true in let res = Jslib_parse . Gram . parse_string entry loc s in let ( ) = Camlp4_config . antiquotations := q in res in let e... |
let extend_common ( ) = expr : [ [ " RE_STR " ; re = regexp -> ] ; Syntax_common . regexp : LEVEL " simple " [ [ " _ " -> Regexp_ast . Characters ( _loc , Charset . full ) ] ] ; END ; ; |
let extend_regular ( ) = extend_common ( ) |
let _ = select_lib Str_lib . lib ; Camlp4 . Options . add " - thread " ( Arg . Unit ( fun ( ) -> ) ) " Deprecated option that protects access to shared data with a mutex . \ Currently only patterns containing @ are concerned . " ; extend_regular ( ) |
let name = " syntax - table " let here = [ % here ] let is_in_subtype = Value . is_syntax_table end ) |
let standard = Funcall . Wrap . ( " standard - syntax - table " <: nullary @-> return t ) ( ) |
let make_syntax_table = Funcall . Wrap . ( " make - syntax - table " <: nil_or t @-> return t ) |
let create ? parent ( ) = make_syntax_table parent |
let copy = Funcall . Wrap . ( " copy - syntax - table " <: t @-> return t ) |
module Class = struct module T = struct type t = | Char_quote | Close_paren | Comment_end | Comment_start | Escape | Expression_prefix | Generic_comment_delimiter | Generic_string_delimiter | Inherit_standard | Open_paren | Paired | Punctuation | String_quote | Symbol_constitutent | Whitespace | Word_constituent [ @@ d... |
module Flag = struct type t = | Alternative_comment | Commend_end_first_char | Comment_end_second_char | Comment_start_first_char | Comment_start_second_char | Nested | Prefix_char [ @@ deriving enumerate , sexp_of ] let to_char = function | Alternative_comment -> ' b ' | Commend_end_first_char -> ' 3 ' | Comment_end_s... |
module Descriptor = struct type t = Class . t * Flag . t list [ @@ deriving sexp_of ] let to_value ( class_ , flags ) = let s = Bytes . create ( 1 + List . length flags ) in Bytes . set s 0 ( class_ |> Class . to_char ) ; List . iteri flags ~ f ( : fun i flag -> Bytes . set s ( i + 1 ) ( flag |> Flag . to_char ) ) ; s ... |
let modify_syntax_entry = Funcall . Wrap . ( " modify - syntax - entry " <: Char_code . t @-> value @-> t @-> return nil ) ; ; |
let set t char_code class_ flags = modify_syntax_entry char_code ( ( class_ , flags ) |> Descriptor . to_value ) t ; ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.