quickjs 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +4 -0
- data/LICENSE +21 -0
- data/Rakefile +22 -0
- data/ext/quickjsrb/extconf.rb +45 -0
- data/ext/quickjsrb/quickjs/LICENSE +22 -0
- data/ext/quickjsrb/quickjs/cutils.c +631 -0
- data/ext/quickjsrb/quickjs/cutils.h +347 -0
- data/ext/quickjsrb/quickjs/libbf.c +8475 -0
- data/ext/quickjsrb/quickjs/libbf.h +535 -0
- data/ext/quickjsrb/quickjs/libregexp-opcode.h +57 -0
- data/ext/quickjsrb/quickjs/libregexp.c +2501 -0
- data/ext/quickjsrb/quickjs/libregexp.h +55 -0
- data/ext/quickjsrb/quickjs/libunicode-table.h +4557 -0
- data/ext/quickjsrb/quickjs/libunicode.c +1910 -0
- data/ext/quickjsrb/quickjs/libunicode.h +182 -0
- data/ext/quickjsrb/quickjs/list.h +99 -0
- data/ext/quickjsrb/quickjs/qjs.c +564 -0
- data/ext/quickjsrb/quickjs/qjsc.c +761 -0
- data/ext/quickjsrb/quickjs/qjscalc.c +4005 -0
- data/ext/quickjsrb/quickjs/quickjs-atom.h +273 -0
- data/ext/quickjsrb/quickjs/quickjs-libc.c +4052 -0
- data/ext/quickjsrb/quickjs/quickjs-libc.h +60 -0
- data/ext/quickjsrb/quickjs/quickjs-opcode.h +372 -0
- data/ext/quickjsrb/quickjs/quickjs.c +55978 -0
- data/ext/quickjsrb/quickjs/quickjs.h +1087 -0
- data/ext/quickjsrb/quickjs/repl.c +2057 -0
- data/ext/quickjsrb/quickjs/run-test262.c +2216 -0
- data/ext/quickjsrb/quickjs/unicode_gen.c +3225 -0
- data/ext/quickjsrb/quickjs/unicode_gen_def.h +291 -0
- data/ext/quickjsrb/quickjsrb.c +105 -0
- data/ext/quickjsrb/quickjsrb.h +14 -0
- data/lib/quickjs/version.rb +5 -0
- data/lib/quickjs.rb +28 -0
- data/sig/quickjs.rbs +4 -0
- metadata +81 -0
| @@ -0,0 +1,273 @@ | |
| 1 | 
            +
            /*
         | 
| 2 | 
            +
             * QuickJS atom definitions
         | 
| 3 | 
            +
             *
         | 
| 4 | 
            +
             * Copyright (c) 2017-2018 Fabrice Bellard
         | 
| 5 | 
            +
             * Copyright (c) 2017-2018 Charlie Gordon
         | 
| 6 | 
            +
             *
         | 
| 7 | 
            +
             * Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 8 | 
            +
             * of this software and associated documentation files (the "Software"), to deal
         | 
| 9 | 
            +
             * in the Software without restriction, including without limitation the rights
         | 
| 10 | 
            +
             * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 11 | 
            +
             * copies of the Software, and to permit persons to whom the Software is
         | 
| 12 | 
            +
             * furnished to do so, subject to the following conditions:
         | 
| 13 | 
            +
             *
         | 
| 14 | 
            +
             * The above copyright notice and this permission notice shall be included in
         | 
| 15 | 
            +
             * all copies or substantial portions of the Software.
         | 
| 16 | 
            +
             *
         | 
| 17 | 
            +
             * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 18 | 
            +
             * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 19 | 
            +
             * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
         | 
| 20 | 
            +
             * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 21 | 
            +
             * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 22 | 
            +
             * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 23 | 
            +
             * THE SOFTWARE.
         | 
| 24 | 
            +
             */
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            #ifdef DEF
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            /* Note: first atoms are considered as keywords in the parser */
         | 
| 29 | 
            +
            DEF(null, "null") /* must be first */
         | 
| 30 | 
            +
            DEF(false, "false")
         | 
| 31 | 
            +
            DEF(true, "true")
         | 
| 32 | 
            +
            DEF(if, "if")
         | 
| 33 | 
            +
            DEF(else, "else")
         | 
| 34 | 
            +
            DEF(return, "return")
         | 
| 35 | 
            +
            DEF(var, "var")
         | 
| 36 | 
            +
            DEF(this, "this")
         | 
| 37 | 
            +
            DEF(delete, "delete")
         | 
| 38 | 
            +
            DEF(void, "void")
         | 
| 39 | 
            +
            DEF(typeof, "typeof")
         | 
| 40 | 
            +
            DEF(new, "new")
         | 
| 41 | 
            +
            DEF(in, "in")
         | 
| 42 | 
            +
            DEF(instanceof, "instanceof")
         | 
| 43 | 
            +
            DEF(do, "do")
         | 
| 44 | 
            +
            DEF(while, "while")
         | 
| 45 | 
            +
            DEF(for, "for")
         | 
| 46 | 
            +
            DEF(break, "break")
         | 
| 47 | 
            +
            DEF(continue, "continue")
         | 
| 48 | 
            +
            DEF(switch, "switch")
         | 
| 49 | 
            +
            DEF(case, "case")
         | 
| 50 | 
            +
            DEF(default, "default")
         | 
| 51 | 
            +
            DEF(throw, "throw")
         | 
| 52 | 
            +
            DEF(try, "try")
         | 
| 53 | 
            +
            DEF(catch, "catch")
         | 
| 54 | 
            +
            DEF(finally, "finally")
         | 
| 55 | 
            +
            DEF(function, "function")
         | 
| 56 | 
            +
            DEF(debugger, "debugger")
         | 
| 57 | 
            +
            DEF(with, "with")
         | 
| 58 | 
            +
            /* FutureReservedWord */
         | 
| 59 | 
            +
            DEF(class, "class")
         | 
| 60 | 
            +
            DEF(const, "const")
         | 
| 61 | 
            +
            DEF(enum, "enum")
         | 
| 62 | 
            +
            DEF(export, "export")
         | 
| 63 | 
            +
            DEF(extends, "extends")
         | 
| 64 | 
            +
            DEF(import, "import")
         | 
| 65 | 
            +
            DEF(super, "super")
         | 
| 66 | 
            +
            /* FutureReservedWords when parsing strict mode code */
         | 
| 67 | 
            +
            DEF(implements, "implements")
         | 
| 68 | 
            +
            DEF(interface, "interface")
         | 
| 69 | 
            +
            DEF(let, "let")
         | 
| 70 | 
            +
            DEF(package, "package")
         | 
| 71 | 
            +
            DEF(private, "private")
         | 
| 72 | 
            +
            DEF(protected, "protected")
         | 
| 73 | 
            +
            DEF(public, "public")
         | 
| 74 | 
            +
            DEF(static, "static")
         | 
| 75 | 
            +
            DEF(yield, "yield")
         | 
| 76 | 
            +
            DEF(await, "await")
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            /* empty string */
         | 
| 79 | 
            +
            DEF(empty_string, "")
         | 
| 80 | 
            +
            /* identifiers */
         | 
| 81 | 
            +
            DEF(length, "length")
         | 
| 82 | 
            +
            DEF(fileName, "fileName")
         | 
| 83 | 
            +
            DEF(lineNumber, "lineNumber")
         | 
| 84 | 
            +
            DEF(message, "message")
         | 
| 85 | 
            +
            DEF(cause, "cause")
         | 
| 86 | 
            +
            DEF(errors, "errors")
         | 
| 87 | 
            +
            DEF(stack, "stack")
         | 
| 88 | 
            +
            DEF(name, "name")
         | 
| 89 | 
            +
            DEF(toString, "toString")
         | 
| 90 | 
            +
            DEF(toLocaleString, "toLocaleString")
         | 
| 91 | 
            +
            DEF(valueOf, "valueOf")
         | 
| 92 | 
            +
            DEF(eval, "eval")
         | 
| 93 | 
            +
            DEF(prototype, "prototype")
         | 
| 94 | 
            +
            DEF(constructor, "constructor")
         | 
| 95 | 
            +
            DEF(configurable, "configurable")
         | 
| 96 | 
            +
            DEF(writable, "writable")
         | 
| 97 | 
            +
            DEF(enumerable, "enumerable")
         | 
| 98 | 
            +
            DEF(value, "value")
         | 
| 99 | 
            +
            DEF(get, "get")
         | 
| 100 | 
            +
            DEF(set, "set")
         | 
| 101 | 
            +
            DEF(of, "of")
         | 
| 102 | 
            +
            DEF(__proto__, "__proto__")
         | 
| 103 | 
            +
            DEF(undefined, "undefined")
         | 
| 104 | 
            +
            DEF(number, "number")
         | 
| 105 | 
            +
            DEF(boolean, "boolean")
         | 
| 106 | 
            +
            DEF(string, "string")
         | 
| 107 | 
            +
            DEF(object, "object")
         | 
| 108 | 
            +
            DEF(symbol, "symbol")
         | 
| 109 | 
            +
            DEF(integer, "integer")
         | 
| 110 | 
            +
            DEF(unknown, "unknown")
         | 
| 111 | 
            +
            DEF(arguments, "arguments")
         | 
| 112 | 
            +
            DEF(callee, "callee")
         | 
| 113 | 
            +
            DEF(caller, "caller")
         | 
| 114 | 
            +
            DEF(_eval_, "<eval>")
         | 
| 115 | 
            +
            DEF(_ret_, "<ret>")
         | 
| 116 | 
            +
            DEF(_var_, "<var>")
         | 
| 117 | 
            +
            DEF(_arg_var_, "<arg_var>")
         | 
| 118 | 
            +
            DEF(_with_, "<with>")
         | 
| 119 | 
            +
            DEF(lastIndex, "lastIndex")
         | 
| 120 | 
            +
            DEF(target, "target")
         | 
| 121 | 
            +
            DEF(index, "index")
         | 
| 122 | 
            +
            DEF(input, "input")
         | 
| 123 | 
            +
            DEF(defineProperties, "defineProperties")
         | 
| 124 | 
            +
            DEF(apply, "apply")
         | 
| 125 | 
            +
            DEF(join, "join")
         | 
| 126 | 
            +
            DEF(concat, "concat")
         | 
| 127 | 
            +
            DEF(split, "split")
         | 
| 128 | 
            +
            DEF(construct, "construct")
         | 
| 129 | 
            +
            DEF(getPrototypeOf, "getPrototypeOf")
         | 
| 130 | 
            +
            DEF(setPrototypeOf, "setPrototypeOf")
         | 
| 131 | 
            +
            DEF(isExtensible, "isExtensible")
         | 
| 132 | 
            +
            DEF(preventExtensions, "preventExtensions")
         | 
| 133 | 
            +
            DEF(has, "has")
         | 
| 134 | 
            +
            DEF(deleteProperty, "deleteProperty")
         | 
| 135 | 
            +
            DEF(defineProperty, "defineProperty")
         | 
| 136 | 
            +
            DEF(getOwnPropertyDescriptor, "getOwnPropertyDescriptor")
         | 
| 137 | 
            +
            DEF(ownKeys, "ownKeys")
         | 
| 138 | 
            +
            DEF(add, "add")
         | 
| 139 | 
            +
            DEF(done, "done")
         | 
| 140 | 
            +
            DEF(next, "next")
         | 
| 141 | 
            +
            DEF(values, "values")
         | 
| 142 | 
            +
            DEF(source, "source")
         | 
| 143 | 
            +
            DEF(flags, "flags")
         | 
| 144 | 
            +
            DEF(global, "global")
         | 
| 145 | 
            +
            DEF(unicode, "unicode")
         | 
| 146 | 
            +
            DEF(raw, "raw")
         | 
| 147 | 
            +
            DEF(new_target, "new.target")
         | 
| 148 | 
            +
            DEF(this_active_func, "this.active_func")
         | 
| 149 | 
            +
            DEF(home_object, "<home_object>")
         | 
| 150 | 
            +
            DEF(computed_field, "<computed_field>")
         | 
| 151 | 
            +
            DEF(static_computed_field, "<static_computed_field>") /* must come after computed_fields */
         | 
| 152 | 
            +
            DEF(class_fields_init, "<class_fields_init>")
         | 
| 153 | 
            +
            DEF(brand, "<brand>")
         | 
| 154 | 
            +
            DEF(hash_constructor, "#constructor")
         | 
| 155 | 
            +
            DEF(as, "as")
         | 
| 156 | 
            +
            DEF(from, "from")
         | 
| 157 | 
            +
            DEF(meta, "meta")
         | 
| 158 | 
            +
            DEF(_default_, "*default*")
         | 
| 159 | 
            +
            DEF(_star_, "*")
         | 
| 160 | 
            +
            DEF(Module, "Module")
         | 
| 161 | 
            +
            DEF(then, "then")
         | 
| 162 | 
            +
            DEF(resolve, "resolve")
         | 
| 163 | 
            +
            DEF(reject, "reject")
         | 
| 164 | 
            +
            DEF(promise, "promise")
         | 
| 165 | 
            +
            DEF(proxy, "proxy")
         | 
| 166 | 
            +
            DEF(revoke, "revoke")
         | 
| 167 | 
            +
            DEF(async, "async")
         | 
| 168 | 
            +
            DEF(exec, "exec")
         | 
| 169 | 
            +
            DEF(groups, "groups")
         | 
| 170 | 
            +
            DEF(indices, "indices")
         | 
| 171 | 
            +
            DEF(status, "status")
         | 
| 172 | 
            +
            DEF(reason, "reason")
         | 
| 173 | 
            +
            DEF(globalThis, "globalThis")
         | 
| 174 | 
            +
            DEF(bigint, "bigint")
         | 
| 175 | 
            +
            #ifdef CONFIG_BIGNUM
         | 
| 176 | 
            +
            DEF(bigfloat, "bigfloat")
         | 
| 177 | 
            +
            DEF(bigdecimal, "bigdecimal")
         | 
| 178 | 
            +
            DEF(roundingMode, "roundingMode")
         | 
| 179 | 
            +
            DEF(maximumSignificantDigits, "maximumSignificantDigits")
         | 
| 180 | 
            +
            DEF(maximumFractionDigits, "maximumFractionDigits")
         | 
| 181 | 
            +
            #endif
         | 
| 182 | 
            +
            /* the following 3 atoms are only used with CONFIG_ATOMICS */
         | 
| 183 | 
            +
            DEF(not_equal, "not-equal")
         | 
| 184 | 
            +
            DEF(timed_out, "timed-out")
         | 
| 185 | 
            +
            DEF(ok, "ok")
         | 
| 186 | 
            +
            /* */
         | 
| 187 | 
            +
            DEF(toJSON, "toJSON")
         | 
| 188 | 
            +
            /* class names */
         | 
| 189 | 
            +
            DEF(Object, "Object")
         | 
| 190 | 
            +
            DEF(Array, "Array")
         | 
| 191 | 
            +
            DEF(Error, "Error")
         | 
| 192 | 
            +
            DEF(Number, "Number")
         | 
| 193 | 
            +
            DEF(String, "String")
         | 
| 194 | 
            +
            DEF(Boolean, "Boolean")
         | 
| 195 | 
            +
            DEF(Symbol, "Symbol")
         | 
| 196 | 
            +
            DEF(Arguments, "Arguments")
         | 
| 197 | 
            +
            DEF(Math, "Math")
         | 
| 198 | 
            +
            DEF(JSON, "JSON")
         | 
| 199 | 
            +
            DEF(Date, "Date")
         | 
| 200 | 
            +
            DEF(Function, "Function")
         | 
| 201 | 
            +
            DEF(GeneratorFunction, "GeneratorFunction")
         | 
| 202 | 
            +
            DEF(ForInIterator, "ForInIterator")
         | 
| 203 | 
            +
            DEF(RegExp, "RegExp")
         | 
| 204 | 
            +
            DEF(ArrayBuffer, "ArrayBuffer")
         | 
| 205 | 
            +
            DEF(SharedArrayBuffer, "SharedArrayBuffer")
         | 
| 206 | 
            +
            /* must keep same order as class IDs for typed arrays */
         | 
| 207 | 
            +
            DEF(Uint8ClampedArray, "Uint8ClampedArray")
         | 
| 208 | 
            +
            DEF(Int8Array, "Int8Array")
         | 
| 209 | 
            +
            DEF(Uint8Array, "Uint8Array")
         | 
| 210 | 
            +
            DEF(Int16Array, "Int16Array")
         | 
| 211 | 
            +
            DEF(Uint16Array, "Uint16Array")
         | 
| 212 | 
            +
            DEF(Int32Array, "Int32Array")
         | 
| 213 | 
            +
            DEF(Uint32Array, "Uint32Array")
         | 
| 214 | 
            +
            DEF(BigInt64Array, "BigInt64Array")
         | 
| 215 | 
            +
            DEF(BigUint64Array, "BigUint64Array")
         | 
| 216 | 
            +
            DEF(Float32Array, "Float32Array")
         | 
| 217 | 
            +
            DEF(Float64Array, "Float64Array")
         | 
| 218 | 
            +
            DEF(DataView, "DataView")
         | 
| 219 | 
            +
            DEF(BigInt, "BigInt")
         | 
| 220 | 
            +
            #ifdef CONFIG_BIGNUM
         | 
| 221 | 
            +
            DEF(BigFloat, "BigFloat")
         | 
| 222 | 
            +
            DEF(BigFloatEnv, "BigFloatEnv")
         | 
| 223 | 
            +
            DEF(BigDecimal, "BigDecimal")
         | 
| 224 | 
            +
            DEF(OperatorSet, "OperatorSet")
         | 
| 225 | 
            +
            DEF(Operators, "Operators")
         | 
| 226 | 
            +
            #endif
         | 
| 227 | 
            +
            DEF(Map, "Map")
         | 
| 228 | 
            +
            DEF(Set, "Set") /* Map + 1 */
         | 
| 229 | 
            +
            DEF(WeakMap, "WeakMap") /* Map + 2 */
         | 
| 230 | 
            +
            DEF(WeakSet, "WeakSet") /* Map + 3 */
         | 
| 231 | 
            +
            DEF(Map_Iterator, "Map Iterator")
         | 
| 232 | 
            +
            DEF(Set_Iterator, "Set Iterator")
         | 
| 233 | 
            +
            DEF(Array_Iterator, "Array Iterator")
         | 
| 234 | 
            +
            DEF(String_Iterator, "String Iterator")
         | 
| 235 | 
            +
            DEF(RegExp_String_Iterator, "RegExp String Iterator")
         | 
| 236 | 
            +
            DEF(Generator, "Generator")
         | 
| 237 | 
            +
            DEF(Proxy, "Proxy")
         | 
| 238 | 
            +
            DEF(Promise, "Promise")
         | 
| 239 | 
            +
            DEF(PromiseResolveFunction, "PromiseResolveFunction")
         | 
| 240 | 
            +
            DEF(PromiseRejectFunction, "PromiseRejectFunction")
         | 
| 241 | 
            +
            DEF(AsyncFunction, "AsyncFunction")
         | 
| 242 | 
            +
            DEF(AsyncFunctionResolve, "AsyncFunctionResolve")
         | 
| 243 | 
            +
            DEF(AsyncFunctionReject, "AsyncFunctionReject")
         | 
| 244 | 
            +
            DEF(AsyncGeneratorFunction, "AsyncGeneratorFunction")
         | 
| 245 | 
            +
            DEF(AsyncGenerator, "AsyncGenerator")
         | 
| 246 | 
            +
            DEF(EvalError, "EvalError")
         | 
| 247 | 
            +
            DEF(RangeError, "RangeError")
         | 
| 248 | 
            +
            DEF(ReferenceError, "ReferenceError")
         | 
| 249 | 
            +
            DEF(SyntaxError, "SyntaxError")
         | 
| 250 | 
            +
            DEF(TypeError, "TypeError")
         | 
| 251 | 
            +
            DEF(URIError, "URIError")
         | 
| 252 | 
            +
            DEF(InternalError, "InternalError")
         | 
| 253 | 
            +
            /* private symbols */
         | 
| 254 | 
            +
            DEF(Private_brand, "<brand>")
         | 
| 255 | 
            +
            /* symbols */
         | 
| 256 | 
            +
            DEF(Symbol_toPrimitive, "Symbol.toPrimitive")
         | 
| 257 | 
            +
            DEF(Symbol_iterator, "Symbol.iterator")
         | 
| 258 | 
            +
            DEF(Symbol_match, "Symbol.match")
         | 
| 259 | 
            +
            DEF(Symbol_matchAll, "Symbol.matchAll")
         | 
| 260 | 
            +
            DEF(Symbol_replace, "Symbol.replace")
         | 
| 261 | 
            +
            DEF(Symbol_search, "Symbol.search")
         | 
| 262 | 
            +
            DEF(Symbol_split, "Symbol.split")
         | 
| 263 | 
            +
            DEF(Symbol_toStringTag, "Symbol.toStringTag")
         | 
| 264 | 
            +
            DEF(Symbol_isConcatSpreadable, "Symbol.isConcatSpreadable")
         | 
| 265 | 
            +
            DEF(Symbol_hasInstance, "Symbol.hasInstance")
         | 
| 266 | 
            +
            DEF(Symbol_species, "Symbol.species")
         | 
| 267 | 
            +
            DEF(Symbol_unscopables, "Symbol.unscopables")
         | 
| 268 | 
            +
            DEF(Symbol_asyncIterator, "Symbol.asyncIterator")
         | 
| 269 | 
            +
            #ifdef CONFIG_BIGNUM
         | 
| 270 | 
            +
            DEF(Symbol_operatorSet, "Symbol.operatorSet")
         | 
| 271 | 
            +
            #endif
         | 
| 272 | 
            +
             | 
| 273 | 
            +
            #endif /* DEF */
         |