package js_of_ocaml-compiler

  1. Overview
  2. Docs
Compiler from OCaml bytecode to JavaScript

Install

dune-project
 Dependency

Authors

Maintainers

Sources

js_of_ocaml-5.9.1.tbz
sha256=68c95c60871d8e9c9a54c82f35e2ed50413bcb440f220d0b3516b2a1ee1c7307
sha512=288d68ea7a45e92375cf51c34bb1071dd26d0d8de54883f3422639561e1494ff43aa45c3d7466627fd7b5a9bb29a0c75e5744a3e7147f5d544bf2c5414083778

doc/src/js_of_ocaml-compiler/reserved.ml.html

Source file reserved.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
(* Js_of_ocaml compiler
 * http://www.ocsigen.org/js_of_ocaml/
 * Copyright (C) 2013 Hugo Heuzard
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, with linking exception;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *)

open! Stdlib

let keyword =
  List.fold_left
    ~f:(fun acc x -> StringSet.add x acc)
    ~init:StringSet.empty
    [ (* keyword *)
      "break"
    ; "case"
    ; "catch"
    ; "continue"
    ; "debugger"
    ; "default"
    ; "delete"
    ; "do"
    ; "else"
    ; "finally"
    ; "for"
    ; "function"
    ; "if"
    ; "in"
    ; "instanceof"
    ; "new"
    ; "return"
    ; "switch"
    ; "this"
    ; "throw"
    ; "try"
    ; "typeof"
    ; "var"
    ; "void"
    ; "while"
    ; "with"
    ; (* reserved in ECMAScript 5 *)
      "class"
    ; "enum"
    ; "export"
    ; "extends"
    ; "import"
    ; "super"
    ; "implements"
    ; "interface"
    ; "let"
    ; "package"
    ; "private"
    ; "protected"
    ; "public"
    ; "static"
    ; "yield"
    ; (* other *)
      "null"
    ; "true"
    ; "false"
    ; "NaN"
    ; "undefined"
    ; "this"
    ; (* Unexpected eval or arguments in strict mode *)
      "eval"
    ; "arguments"
    ; (* also reserved in ECMAScript 3 *)
      "abstract"
    ; "boolean"
    ; "byte"
    ; "char"
    ; "const"
    ; "double"
    ; "final"
    ; "float"
    ; "goto"
    ; "int"
    ; "long"
    ; "native"
    ; "short"
    ; "synchronized"
    ; "throws"
    ; "transient"
    ; "volatile"
    ; (* also reserved in ECMAScript 6 *)
      "await"
    ]

let provided =
  List.fold_left
    ~f:(fun acc x -> StringSet.add x acc)
    ~init:StringSet.empty
    [ "event"
    ; "location"
    ; "window"
    ; "document"
    ; "eval"
    ; "navigator"
    ; "self"
    ; "Array"
    ; "Function"
    ; "Date"
    ; "Math"
    ; "JSON"
    ; "Object"
    ; "globalThis"
    ; "RegExp"
    ; "String"
    ; "Boolean"
    ; "Number"
    ; "BigInt"
    ; "Infinity"
    ; "isFinite"
    ; "ActiveXObject"
    ; "XMLHttpRequest"
    ; "XDomainRequest"
    ; "DOMException"
    ; "Error"
    ; "SyntaxError"
    ; "TypeError"
    ; "arguments"
    ; "decodeURI"
    ; "decodeURIComponent"
    ; "encodeURI"
    ; "encodeURIComponent"
    ; "escape"
    ; "unescape"
    ; "isNaN"
    ; "parseFloat"
    ; "parseInt"
    ; "module" (* only available in node *)
    ; "require" (* only available in node *)
    ; "Symbol"
    ; "ArrayBuffer"
    ; "Float32Array"
    ; "Float64Array"
    ; "Int16Array"
    ; "Int32Array"
    ; "Int8Array"
    ; "TextDecoder"
    ; "TextEncoder"
    ; "Uint16Array"
    ; "Uint32Array"
    ; "Uint8Array"
    ; "Uint8ClampedArray"
    ; "atob"
    ; "btoa"
    ; "clearInterval"
    ; "console"
    ; "global" (* only available in node *)
    ; "importScripts" (* only available in WebWorker *)
    ; "performance" (* Not available in node until v16+ *)
    ; "setTimeout"
    ]