HEX
Server: Apache/2.4.65 (Debian)
System: Linux 744648315b55 6.8.0-84-generic #84-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 5 22:36:38 UTC 2025 x86_64
User: (1000)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //usr/share/re2c/stdlib/ocaml
// supported feature lists -----------------------------------------------------

supported_apis = ["record", "generic"];
supported_api_styles = ["free-form"];
supported_code_models = ["recursive-functions"];
supported_targets = ["code", "dot"];
supported_features = ["nested-ifs", "bitmaps", "case-ranges",
    "tags", "captures", "captvars"];


// language-specific options ---------------------------------------------------

semicolons = 0;
backtick_quoted_strings = 0;
single_quoted_strings = 0;
indentation_sensitive = 0;
wrap_blocks_in_braces = 0;
special_escapes = "\b\n\r\t\\'\"";


// immutable configurations (command-line only options) ------------------------

re2c:target = code;
re2c:code-model = recursive-functions;
re2c:input-encoding = ascii;
re2c:date = 1;
re2c:version = 1;
re2c:conditions = 0;
re2c:storable-state = 0;
re2c:flex-syntax = 0;
re2c:verbose = 0;
re2c:line-dirs = 1;


// mutable configurations ------------------------------------------------------

re2c:api = record;
re2c:api:style = free-form;
re2c:api:sigil = "@@";
re2c:YYGETCOND:naked = 0;
re2c:YYSETCOND:naked = 0;
re2c:YYSETCOND@cond = "@@";
re2c:YYGETSTATE:naked = 0;
re2c:YYSETSTATE:naked = 0;
re2c:YYSETSTATE@state = "@@";
re2c:YYFILL@len = "@@";
re2c:YYFILL:naked = 0;
re2c:YYFN = ["<undefined-function-name>;<undefined-function-type>"];
re2c:yyfn:sep = ";";
re2c:yycond = "yycond";
re2c:yyctable = "yyctable";
re2c:yyaccept = "yyaccept";
re2c:yytarget = "yytarget";
re2c:yystate = "yystate";
re2c:yynmatch = "yynmatch";
re2c:yypmatch = "yypmatch";
re2c:yyrecord = "yyrecord";
re2c:yych = "yych";
re2c:yych:conversion = 0;
re2c:yych:literals = char;
re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);
re2c:yybm = "yybm";
re2c:yybm:hex = 0;
re2c:yyfill = "";
re2c:yystable = ""; // deprecated
re2c:header = "";
re2c:eof = -1;
re2c:sentinel = -1;
re2c:yyfill:enable = 1;
re2c:yyfill:parameter = 1;
re2c:yyfill:check = 1;
re2c:tags = 0;
re2c:tags:prefix = "yyt";
re2c:captures = 0;
re2c:captvars = 0;
re2c:posix-captures = 0;
re2c:posix-captvars = 0;
re2c:invert-captures = 0;
re2c:cond:abort = 0; // default case causes [redundant-case] warnings
re2c:cond:prefix = "yyc_";
re2c:cond:enumprefix = "YYC_";
re2c:cond:divider@cond = "@@";
re2c:cond:goto@cond = "@@";
re2c:state:abort = 1;
re2c:state:nextlabel = 0;
re2c:bit-vectors = 0;
re2c:debug-output = 0;
re2c:computed-gotos = 0;
re2c:computed-gotos:threshold = 9;
re2c:nested-ifs = 0;
re2c:case-insensitive = 0;
re2c:case-inverted = 0;
re2c:case-ranges = 1;
re2c:unsafe = 0;
re2c:monadic = 0;
re2c:encoding:ebcdic = 0;
re2c:encoding:utf32 = 0;
re2c:encoding:ucs2 = 0;
re2c:encoding:utf16 = 0;
re2c:encoding:utf8 = 0;
re2c:encoding-policy = ignore;
re2c:empty-class = match-empty;
re2c:indent:string = "    ";
re2c:indent:top = 0;
re2c:label:prefix = "yy"; // used for generating function names
re2c:label:yyfill = "";
re2c:label:yyloop = "";
re2c:label:yyNext = "";
re2c:label:start = 0;


// mutable code configuration --------------------------------------------------

re2c:YYBACKUP = "yybackup";
re2c:YYBACKUPCTX = "yybackupctx";
re2c:YYCONDTYPE = "yycondtype";
re2c:YYCOPYMTAG = sigil "{lhs} <- " sigil "{rhs};";
re2c:YYCOPYSTAG = sigil "{lhs} <- " sigil "{rhs};";
re2c:YYCTYPE = "char";
re2c:YYCTXMARKER = (.api.record ? yyrecord ".") "yyctxmarker";
re2c:YYCURSOR = (.api.record ? yyrecord ".") "yycursor";
re2c:YYDEBUG = "yydebug";
re2c:YYFILL = "yyfill";
re2c:YYGETACCEPT = sigil "{var}";
re2c:YYGETCOND = "yygetcond";
re2c:YYGETSTATE = "yygetstate";
re2c:YYINPUT = (.api.record ? yyrecord ".") "yyinput";
re2c:YYLESSTHAN = "yylesthan";
re2c:YYLIMIT = (.api.record ? yyrecord ".") "yylimit";
re2c:YYMARKER = (.api.record ? yyrecord ".") "yymarker";
re2c:YYMAXFILL = "yymaxfill";
re2c:YYMAXNMATCH = "yymaxnmatch";
re2c:YYMTAGN = "yymatgn";
re2c:YYMTAGP = "yymtagp";
re2c:YYPEEK = (.api.record ? "unsafe_get" : "yypeek");
re2c:YYRESTORE = "yyrestore";
re2c:YYRESTORECTX = "yyrestorectx";
re2c:YYRESTORETAG = "yyrestoretag";
re2c:YYSETACCEPT = sigil "{var} <- " sigil "{val};";
re2c:YYSETCOND = "yysetcond";
re2c:YYSETSTATE = "yysetstate";
re2c:YYSHIFT = "yyshift";
re2c:YYSHIFTSTAG = "yyshiftstag";
re2c:YYSHIFTMTAG = "yyshiftmtag";
re2c:YYSKIP = "yyskip";
re2c:YYSTAGN = "yystagn";
re2c:YYSTAGP = "yystagp";
re2c:tags:expression = (.api.record ? yyrecord ".") sigil;
re2c:tags:negative = (.api.generic ? "@@" : "-1");
re2c:cond:divider = "";
re2c:cond:goto = "";


// code templates --------------------------------------------------------------

code:var_local = topindent "let " name " = " init " in" nl;
code:var_global = topindent "let " name " = " init nl;

code:const_local = topindent "let " name " = " init " in" nl;
code:const_global = topindent "let " name " = " init nl;

code:array_local =
    topindent "and " name " = [|" nl indent
        [row: topindent [elem{0:-2}: elem "; "] [elem{-1}: elem ";"] nl]
    dedent topindent "|]" nl;

code:array_global = code:array_local;

code:array_elem = array ".(" index ")";

code:enum =
    "type " type " = "
        [elem{0}:          elem]
        [elem{1:-1}: " | " elem]
    nl;

code:enum_elem = name;

code:assign = topindent lhs " <- " rhs ";" nl;

code:type_int = "int";
code:type_uint = "uint";
code:type_yybm = "int";
code:type_yytarget = <undefined>;

code:cmp_eq = "=="; // physical equality, as this is used to compare primitive values
code:cmp_ne = "!="; // physical inequality, as this is used to compare primitive values
code:cmp_lt = "<";
code:cmp_gt = ">";
code:cmp_le = "<=";
code:cmp_ge = ">=";

code:if_then_else =
    [branch{0}: topindent "if (" cond ") then (" nl
        indent [stmt: stmt] dedent]
    [branch{1:-1}: topindent ") else " (.cond ? "if (" cond ") then ") "(" nl
        indent [stmt: stmt] dedent]
    topindent ")" nl;

code:if_then_else_oneline =
    [branch{0}: topindent "if (" cond ") then " [stmt: stmt] nl]
    [branch{1:-1}: topindent "else " (.cond ? "if (" cond ") then ") [stmt: stmt] nl];

code:switch =
    topindent "match " expr " with" nl
        indent [case: case] dedent;

code:switch_cases =
    [case{0:-2}: topindent "| " case nl]
    [case{-1}:   topindent "| " case " ->" nl
        indent [stmt: stmt] dedent
    ];

code:switch_cases_oneline =
    [case{0:-2}: topindent "| " case nl]
    [case{-1}:   topindent "| " case " -> " [stmt: stmt] nl];

// In OCaml only literals of type `char` support case ranges.
// For `int`, we have to explicitly list all range values. We cannot use
//     `"c when " [val{0}: val] " <= c && c <= " [val{-1}: val]`
// as it causes error when there are multiple cases:
//     `Error: Variable c must occur on both sides of this | pattern`.
code:switch_case_range = (.char_literals
    ? [val{0}: val] (.many ? ".." [val{-1}: val])
    : [val{0}: val] [val{1:-1}: "|" val]);

code:switch_case_default = "_";

code:loop = <undefined>;

code:continue = <undefined>;

code:goto = <undefined>;

code:fndecl = <undefined>;

code:fndef =
    name [arg: " (" argname " : " argtype ")"] " : " type " =" nl
        indent [stmt: stmt] dedent;

code:fncall =
    topindent (.retval ? "let " retval " = ")
        "(" name " [@tailcall])" (.args ? [arg: " " arg] : " ()") nl;

code:tailcall = topindent "(" name " [@tailcall])" (.args ? [arg: " " arg] : " ()") nl;

code:recursive_functions =
    [fn{0}:    "let rec " fndef nl]
    [fn{1:-1}: "and "     fndef nl];

code:fingerprint =
    "(* Generated by re2ocaml" (.version ? " " version) (.date ? " on " date) " *)" nl;

code:line_info = "#" line " \"" file "\"" nl;

code:abort = topindent "raise (Failure \"internal lexer error\")" nl;

code:yydebug =
    topindent (.api.record
        ? YYDEBUG " " yyrecord
        : YYDEBUG
    ) nl;

code:yypeek =
    topindent (.api.record
        ? "let " yych " = " YYPEEK " " YYINPUT " " YYCURSOR " in"
        : "let " yych " = " YYPEEK " in"
    ) nl;

code:yyskip =
    topindent (.api.record
        ? YYCURSOR " <- " YYCURSOR " + 1;"
        : YYSKIP
    ) nl;

code:yybackup =
    topindent (.api.record
        ? YYMARKER " <- " YYCURSOR ";"
        : YYBACKUP
    ) nl;

code:yybackupctx =
    topindent (.api.record
        ? YYCTXMARKER " <- " YYCURSOR ";"
        : YYBACKUPCTX
    ) nl;

code:yyskip_yypeek = <undefined>;
code:yypeek_yyskip = <undefined>;
code:yyskip_yybackup = <undefined>;
code:yybackup_yyskip = <undefined>;
code:yybackup_yypeek = <undefined>;
code:yyskip_yybackup_yypeek = <undefined>;
code:yybackup_yypeek_yyskip = <undefined>;

code:yyrestore =
    topindent (.api.record
        ? YYCURSOR " <- " YYMARKER ";"
        : YYRESTORE
    ) nl;

code:yyrestorectx =
    topindent (.api.record
        ? YYCURSOR " <- " YYCTXMARKER ";"
        : YYRESTORECTX
    ) nl;

code:yyrestoretag =
    topindent (.api.record
        ? YYCURSOR " <- " tag ";"
        : YYRESTORETAG
    ) nl;

code:yyshift =
    topindent (.api.record
        ? YYCURSOR " <- " YYCURSOR " - " offset ";"
        : YYSHIFT
    ) nl;

code:yyshiftstag =
    topindent (.nested ? "if " tag " <> " neg " then ") (.api.record
        ? tag " <- " tag " - " offset ";"
        : YYSHIFTSTAG
    ) nl;

code:yyshiftmtag =
    topindent YYSHIFTMTAG nl;

code:yystagp =
    topindent (.api.record
        ? tag " <- " YYCURSOR ";"
        : YYSTAGP
    ) nl;

code:yymtagp =
    topindent YYMTAGP nl;

code:yystagn =
    topindent (.api.record
        ? tag " <- " neg ";"
        : YYSTAGN
    ) nl;

code:yymtagn =
    topindent YYMTAGN nl;

code:yycopystag =
    topindent (.api.record
        ? lhs " <- " rhs ";"
        : YYCOPYSTAG
    ) nl;

code:yycopymtag =
    topindent (.api.record
        ? lhs " <- " rhs ";"
        : YYCOPYMTAG
    ) nl;

code:yygetaccept =
    (.api.record ? yyrecord "." var : YYGETACCEPT);

code:yysetaccept =
    topindent (.api.record
        ? yyrecord "." var " <- " val ";"
        : YYSETACCEPT
    ) nl;

code:yygetcond =
    (.api.record ? yyrecord "." var : YYGETCOND);

code:yysetcond =
    topindent (.api.record
        ? yyrecord "." var " <- " val ";"
        : YYSETCOND
    ) nl;

code:yygetstate =
    (.api.record ? yyrecord "." var : YYGETSTATE);

code:yysetstate =
    topindent (.api.record
        ? yyrecord "." var " <- " val ";"
        : YYSETSTATE
    ) nl;

code:yylessthan =
    (.api.record
        ? (.many
            ? "(" YYLIMIT " - " YYCURSOR ") < " need
            : YYLIMIT " <= " YYCURSOR)
        : YYLESSTHAN);

code:yybm_filter = yych " land ~0xFF";

code:yybm_match = "(" yybm ".(" offset " + Char.code " yych ") land " mask ") != 0";