Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bson-transpilers

Package Overview
Dependencies
Maintainers
38
Versions
490
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bson-transpilers - npm Package Compare versions

Comparing version 0.11.5 to 0.11.6

.idea/bson-transpilers.iml

2

lib/symbol-table/pythontojava.js

@@ -1,1 +0,1 @@

module.exports="SymbolTypes:\n VAR: &var 0\n CONSTRUCTOR: &constructor 1\n FUNC: &func 2\n# Internal patterns to save typing\n__type: &__type\n id: null\n callable: *var\n args: null\n type: null\n attr: {}\n template: null\n argsTemplate: null\n__func: &__func\n callable: *func\n args: []\n attr: {}\n template: null\n argsTemplate: null\n\n# Java Templates\nTemplates:\n # Misc\n RegexFlags: &RegexFlags\n i: 'i'\n m: 'm'\n u: 'u'\n y: ''\n g: ''\n BSONRegexFlags: &BSONRegexFlags\n i: 'i'\n m: 'm'\n x: 'x'\n s: 's'\n l: 'l'\n u: 'u'\n # Syntax\n EqualitySyntaxTemplate: &EqualitySyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n if (op.includes('!') || op.includes('not')) {\n return `${lhs} != ${rhs}`;\n } else if (op === '==' || op === '===' || op === 'is') {\n return `${lhs} == ${rhs}`;\n }\n return `${lhs} ${op} ${rhs}`;\n }\n InSyntaxTemplate: &InSyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n let str = '';\n if (op.includes('!') || op.includes('not')) {\n str = '!';\n }\n return `${str}${rhs}.contains(${lhs})`\n }\n AndSyntaxTemplate: &AndSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' && ');\n }\n OrSyntaxTemplate: &OrSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' || ');\n }\n NotSyntaxTemplate: &NotSyntaxTemplate !!js/function >\n (arg) => {\n return `!${arg}`;\n }\n UnarySyntaxTemplate: &UnarySyntaxTemplate null\n BinarySyntaxTemplate: &BinarySyntaxTemplate !!js/function >\n (args) => {\n return args.reduce((s, op, i, arr) => {\n if (i % 2 === 0) {\n return s;\n }\n const rhs = arr[i + 1];\n switch(op) {\n case '//':\n return `floor(${s}, ${rhs})`;\n case '**':\n return `pow(${s}, ${rhs})`;\n default:\n return `${s} ${op} ${rhs}`;\n }\n }, args[0]);\n }\n ParensSyntaxTemplate: &ParensSyntaxTemplate null\n EosSyntaxTemplate: &EosSyntaxTemplate null\n EofSyntaxTemplate: &EofSyntaxTemplate null\n NewTemplate: &NewSyntaxTemplate !!js/function >\n (expr, skip, code) => {\n // Add codes of classes that don't need new.\n // Currently: Decimal128/NumberDecimal, Long/NumberLong, Double, Int32, Number, regex, Date\n noNew = [112, 106, 104, 105, 2, 8, 200];\n if (skip || (code && noNew.indexOf(code) !== -1)) {\n return expr;\n }\n return `new ${expr}`;\n }\n # BSON Object Type templates\n CodeTypeTemplate: &CodeTypeTemplate null\n StringTypeTemplate: &StringTypeTemplate !!js/function >\n (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n RegexTypeTemplate: &RegexTypeTemplate !!js/function >\n (pattern, flags) => {\n flags = flags === '' ? '' : `(?${flags})`;\n // Double escape characters except for slashes\n const escaped = pattern.replace(/\\\\/, '\\\\\\\\');\n\n // Double-quote stringify\n const str = escaped + flags;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `Pattern.compile(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n BoolTypeTemplate: &BoolTypeTemplate !!js/function >\n (literal) => {\n return literal.toLowerCase();\n }\n IntegerTypeTemplate: &IntegerTypeTemplate null\n DecimalTypeTemplate: &DecimalTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n return `${literal}d`;\n }\n return `(double) ${literal}`;\n }\n LongBasicTypeTemplate: &LongBasicTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long') {\n return `${literal}L`;\n }\n return `new Long(${literal})`;\n }\n HexTypeTemplate: &HexTypeTemplate null # TODO\n OctalTypeTemplate: &OctalTypeTemplate !!js/function >\n (literal, type) => {\n if ((literal.charAt(0) === '0' && literal.charAt(1) === '0') ||\n (literal.charAt(0) === '0' && (literal.charAt(1) === 'o' || literal.charAt(1) === 'O'))) {\n return `0${literal.substr(2, literal.length - 1)}`;\n }\n return literal;\n }\n NumericTypeTemplate: &NumericTypeTemplate null\n ArrayTypeTemplate: &ArrayTypeTemplate !!js/function >\n (literal, depth) => {\n depth++;\n // TODO: figure out how to best do depth in an array and where to\n // insert and indent\n const indent = '\\n' + ' '.repeat(depth);\n // have an indent on every ', new Document' in an array not\n // entirely perfect, but at least makes this more readable/also\n // compiles\n const arr = literal.split(', new').join(`, ${indent}new`)\n\n return `Arrays.asList(${arr})`;\n }\n ArrayTypeArgsTemplate: &ArrayTypeArgsTemplate null\n NullTypeTemplate: &NullTypeTemplate !!js/function >\n () => {\n return 'new BsonNull()';\n }\n UndefinedTypeTemplate: &UndefinedTypeTemplate !!js/function >\n () => {\n return 'new BsonUndefined()';\n }\n ObjectTypeTemplate: &ObjectTypeTemplate !!js/function >\n (literal, depth) => {\n\n if (literal === '') {\n return `new Document()`;\n }\n return literal;\n }\n ObjectTypeArgsTemplate: &ObjectTypeArgsTemplate !!js/function >\n (args, depth) => {\n if (args.length === 0) {\n return 'new Document()';\n }\n depth++;\n const indent = '\\n' + ' '.repeat(depth);\n const doubleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n const start = `new Document(${doubleStringify(args[0][0])}, ${args[0][1]})`;\n\n args = args.slice(1);\n const result = args.reduce((str, pair) => {\n return `${str}${indent}.append(${doubleStringify(pair[0])}, ${pair[1]})`;\n }, start);\n\n return `${result}`;\n }\n DoubleTypeTemplate: &DoubleTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n return `${literal}d`;\n }\n return `(double) ${literal}`;\n }\n DoubleTypeArgsTemplate: &DoubleTypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongTypeTemplate: &LongTemplate !!js/function >\n () => {\n return '';\n }\n LongTypeArgsTemplate: &LongSymbolArgsTemplate null\n # BSON Object Method templates\n ObjectIdToStringTemplate: &ObjectIdToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toHexString()`;\n }\n ObjectIdToStringArgsTemplate: &ObjectIdToStringArgsTemplate !!js/function >\n () => {\n return '';\n }\n ObjectIdEqualsTemplate: &ObjectIdEqualsTemplate null\n ObjectIdEqualsArgsTemplate: &ObjectIdEqualsArgsTemplate null\n ObjectIdGetTimestampTemplate: &ObjectIdGetTimestampTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTimestamp()`;\n }\n ObjectIdGetTimestampArgsTemplate: &ObjectIdGetTimestampArgsTemplate !!js/function >\n () => {\n return '';\n }\n CodeCodeTemplate: &CodeCodeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getCode()`;\n }\n CodeCodeArgsTemplate: &CodeCodeArgsTemplate null\n CodeScopeTemplate: &CodeScopeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getScope()`;\n }\n CodeScopeArgsTemplate: &CodeScopeArgsTemplate null\n BinaryValueTemplate: &BinaryValueTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getData`;\n }\n BinaryValueArgsTemplate: &BinaryValueArgsTemplate null\n BinaryLengthTemplate: &BinaryLengthTemplate null\n BinaryLengthArgsTemplate: &BinaryLengthArgsTemplate null\n BinaryToStringTemplate: &BinaryToStringTemplate null\n BinaryToStringArgsTemplate: &BinaryToStringArgsTemplate null\n BinarySubtypeTemplate: &BinarySubtypeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getType()`;\n }\n BinarySubtypeArgsTemplate: &BinarySubtypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetDBTemplate: &DBRefGetDBTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getDatabaseName()`;\n }\n DBRefGetDBArgsTemplate: &DBRefGetDBArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetCollectionTemplate: &DBRefGetCollectionTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getCollectionName()`;\n }\n DBRefGetCollectionArgsTemplate: &DBRefGetCollectionArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetIdTemplate: &DBRefGetIdTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getId()`;\n }\n DBRefGetIdArgsTemplate: &DBRefGetIdArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongEqualsTemplate: &LongEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} ==`;\n }\n LongEqualsArgsTemplate: &LongEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongToStringTemplate: &LongToStringTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongToStringArgsTemplate: &LongToStringArgsTemplate null\n LongToIntTemplate: &LongToIntTemplate !!js/function >\n (lhs) => {\n return `(int) ${lhs}`;\n }\n LongToIntArgsTemplate: &LongToIntArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongToNumberTemplate: &LongToNumberTemplate !!js/function >\n (lhs) => {\n return `(double) ${lhs}`;\n }\n LongToNumberArgsTemplate: &LongToNumberArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongAddTemplate: &LongAddTemplate !!js/function >\n (lhs) => {\n return `${lhs} +`;\n }\n LongAddArgsTemplate: &LongAddArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongSubtractTemplate: &LongSubtractTemplate !!js/function >\n (arg) => {\n return `${arg} -`;\n }\n LongSubtractArgsTemplate: &LongSubtractArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongMultiplyTemplate: &LongMultiplyTemplate !!js/function >\n (arg) => {\n return `${arg} *`;\n }\n LongMultiplyArgsTemplate: &LongMultiplyArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongDivTemplate: &LongDivTemplate !!js/function >\n (lhs) => {\n return `${lhs} /`;\n }\n LongDivArgsTemplate: &LongDivArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongModuloTemplate: &LongModuloTemplate !!js/function >\n (lhs) => {\n return `${lhs} %`;\n }\n LongModuloArgsTemplate: &LongModuloArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongAndTemplate: &LongAndTemplate !!js/function >\n (lhs) => {\n return `${lhs} &`;\n }\n LongAndArgsTemplate: &LongAndArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongOrTemplate: &LongOrTemplate !!js/function >\n (lhs) => {\n return `${lhs} |`;\n }\n LongOrArgsTemplate: &LongOrArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongXorTemplate: &LongXorTemplate !!js/function >\n (lhs) => {\n return `${lhs} ^`;\n }\n LongXorArgsTemplate: &LongXorArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongShiftLeftTemplate: &LongShiftLeftTemplate !!js/function >\n () => {\n return 'Long.rotateLeft';\n }\n LongShiftLeftArgsTemplate: &LongShiftLeftArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${lhs}, ${arg})`;\n }\n LongShiftRightTemplate: &LongShiftRightTemplate !!js/function >\n () => {\n return 'Long.rotateRight';\n }\n LongShiftRightArgsTemplate: &LongShiftRightArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${lhs}, ${arg})`;\n }\n LongCompareTemplate: &LongCompareTemplate !!js/function >\n (lhs) => {\n return `${lhs} -`;\n }\n LongCompareArgsTemplate: &LongCompareArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongIsOddTemplate: &LongIsOddTemplate !!js/function >\n (lhs) => {\n return `(${lhs} % 2) == 1`;\n }\n LongIsOddArgsTemplate: &LongIsOddArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsZeroTemplate: &LongIsZeroTemplate !!js/function >\n (lhs) => {\n return `${lhs} == 0`;\n }\n LongIsZeroArgsTemplate: &LongIsZeroArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsNegativeTemplate: &LongIsNegativeTemplate !!js/function >\n (lhs) => {\n return `${lhs} < 0`;\n }\n LongIsNegativeArgsTemplate: &LongIsNegativeArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongNegateTemplate: &LongNegateTemplate !!js/function >\n () => {\n return '-';\n }\n LongNegateArgsTemplate: &LongNegateArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotTemplate: &LongNotTemplate !!js/function >\n () => {\n return '~';\n }\n LongNotArgsTemplate: &LongNotArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotEqualsTemplate: &LongNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} !=`;\n }\n LongNotEqualsArgsTemplate: &LongNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanTemplate: &LongGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} >`;\n }\n LongGreaterThanArgsTemplate: &LongGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanOrEqualTemplate: &LongGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} >=`;\n }\n LongGreaterThanOrEqualArgsTemplate: &LongGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanTemplate: &LongLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} <`;\n }\n LongLessThanArgsTemplate: &LongLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanOrEqualTemplate: &LongLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} <=`;\n }\n LongLessThanOrEqualArgsTemplate: &LongLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongFloatApproxTemplate: &LongFloatApproxTemplate !!js/function >\n (lhs) => {\n return `(float) ${lhs}`;\n }\n LongTopTemplate: &LongTopTemplate !!js/function >\n (lhs) => {\n return `${lhs} >> 32`;\n }\n LongBottomTemplate: &LongBottomTemplate !!js/function >\n (lhs) => {\n return `${lhs} & 0x0000ffff`;\n }\n TimestampToStringTemplate: &TimestampToStringTemplate null\n TimestampToStringArgsTemplate: &TimestampToStringArgsTemplate null\n TimestampEqualsTemplate: &TimestampEqualsTemplate null\n TimestampEqualsArgsTemplate: &TimestampEqualsArgsTemplate null\n TimestampGetLowBitsTemplate: &TimestampGetLowBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTime`;\n }\n TimestampGetLowBitsArgsTemplate: &TimestampGetLowBitsArgsTemplate null\n TimestampGetHighBitsTemplate: &TimestampGetHighBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getInc`;\n }\n TimestampGetHighBitsArgsTemplate: &TimestampGetHighBitsArgsTemplate null\n TimestampTTemplate: &TimestampTTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTime()`;\n }\n TimestampITemplate: &TimestampITemplate !!js/function >\n (lhs) => {\n return `${lhs}.getInc()`;\n }\n TimestampAsDateTemplate: &TimestampAsDateTemplate !!js/function >\n (lhs) => {\n return `new Date(${lhs}.getTime())`;\n }\n TimestampAsDateArgsTemplate: &TimestampAsDateArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampCompareTemplate: &TimestampCompareTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampCompareArgsTemplate: &TimestampCompareArgsTemplate null\n TimestampNotEqualsTemplate: &TimestampNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampNotEqualsArgsTemplate: &TimestampNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) != 0`;\n }\n TimestampGreaterThanTemplate: &TimestampGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampGreaterThanArgsTemplate: &TimestampGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) > 0`;\n }\n TimestampGreaterThanOrEqualTemplate: &TimestampGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampGreaterThanOrEqualArgsTemplate: &TimestampGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) >= 0`;\n }\n TimestampLessThanTemplate: &TimestampLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampLessThanArgsTemplate: &TimestampLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) < 0`;\n }\n TimestampLessThanOrEqualTemplate: &TimestampLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampLessThanOrEqualArgsTemplate: &TimestampLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) <= 0`;\n }\n SymbolValueOfTemplate: &SymbolValueOfTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getSymbol`;\n }\n SymbolValueOfArgsTemplate: &SymbolValueOfArgsTemplate null\n SymbolInspectTemplate: &SymbolInspectTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getSymbol`;\n }\n SymbolInspectArgsTemplate: &SymbolInspectArgsTemplate null\n SymbolToStringTemplate: &SymbolToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toString`;\n }\n SymbolToStringArgsTemplate: &SymbolToStringArgsTemplate null\n # Symbol Templates\n CodeSymbolTemplate: &CodeSymbolTemplate !!js/function > # Also has process method\n () => {\n return 'Code';\n }\n CodeSymbolArgsTemplate: &CodeSymbolArgsTemplate !!js/function > # Also has process method\n (lhs, code, scope) => {\n // Double quote stringify\n let newStr = code === undefined ? '' : code;\n const str = newStr;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n code = `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n return (scope === undefined) ? `(${code})` : `WithScope(${code}, ${scope})`;\n }\n ObjectIdSymbolTemplate: &ObjectIdSymbolTemplate null\n ObjectIdSymbolArgsTemplate: &ObjectIdSymbolArgsTemplate !!js/function >\n (lhs, str) => {\n if (!str || str.length === 0) {\n return '()';\n }\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n BinarySymbolTemplate: &BinarySymbolTemplate null\n BinarySymbolArgsTemplate: &BinarySymbolArgsTemplate !!js/function >\n (lhs, bytes, type) => {\n const str = bytes;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n bytes = `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n\n if (type === null) {\n return `(${bytes}.getBytes(\"UTF-8\"))`;\n }\n return `(${type}, ${bytes}.getBytes(\"UTF-8\"))`;\n }\n BinarySymbolSubtypeDefaultTemplate: &BinarySymbolSubtypeDefaultTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.BINARY';\n }\n BinarySymbolSubtypeFunctionTemplate: &BinarySymbolSubtypeFunctionTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.FUNCTION';\n }\n BinarySymbolSubtypeByteArrayTemplate: &BinarySymbolSubtypeByteArrayTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.BINARY';\n }\n BinarySymbolSubtypeUuidOldTemplate: &BinarySymbolSubtypeUuidOldTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.UUID_LEGACY';\n }\n BinarySymbolSubtypeUuidTemplate: &BinarySymbolSubtypeUuidTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.UUID_STANDARD';\n }\n BinarySymbolSubtypeMd5Template: &BinarySymbolSubtypeMd5Template !!js/function >\n () => {\n return 'BsonBinarySubType.MD5';\n }\n BinarySymbolSubtypeUserDefinedTemplate: &BinarySymbolSubtypeUserDefinedTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.USER_DEFINED';\n }\n DBRefSymbolTemplate: &DBRefSymbolTemplate null\n DBRefSymbolArgsTemplate: &DBRefSymbolArgsTemplate !!js/function >\n (lhs, coll, id, db) => {\n const dbstr = db === undefined ? '' : `${db}, `;\n return `(${dbstr}${coll}, ${id})`;\n }\n DoubleSymbolTemplate: &DoubleSymbolTemplate !!js/function >\n () => {\n return '';\n }\n DoubleSymbolArgsTemplate: &DoubleSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Double.parseDouble(${arg})`;\n }\n if (type === '_integer' || type === '_long' || type === '_double' || type === '_decimal') {\n if (arg.includes('L') || arg.includes('d')) {\n return `${arg.substr(0, arg.length - 1)}d`;\n }\n return `${arg}d`;\n }\n return `(double) ${arg}`;\n }\n Int32SymbolTemplate: &Int32SymbolTemplate !!js/function >\n () => {\n return '';\n }\n Int32SymbolArgsTemplate: &Int32SymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Integer.parseInt(${arg})`;\n }\n if (type === '_integer' || type === '_long') {\n if (arg.includes('L') || arg.includes('d')) {\n return arg.substr(0, arg.length - 1);\n }\n return arg;\n }\n return `(int) ${arg}`;\n }\n LongSymbolTemplate: &LongSymbolTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolArgsTemplate: &LongSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Long.parseLong(${arg})`;\n }\n if (type === '_integer' || type === '_long') {\n if (arg.includes('d') || arg.includes('L')) {\n return `${arg.substr(0, arg.length - 1)}L`;\n }\n return `${arg}L`;\n }\n return `new Long(${arg})`;\n }\n LongSymbolMaxTemplate: &LongSymbolMaxTemplate !!js/function >\n () => {\n return 'Long.MAX_VALUE';\n }\n LongSymbolMaxArgsTemplate: &LongSymbolMaxArgsTemplate null\n LongSymbolMinTemplate: &LongSymbolMinTemplate !!js/function >\n () => {\n return 'Long.MIN_VALUE';\n }\n LongSymbolMinArgsTemplate: &LongSymbolMinArgsTemplate null\n LongSymbolZeroTemplate: &LongSymbolZeroTemplate !!js/function >\n () => {\n return '0L';\n }\n LongSymbolZeroArgsTemplate: &LongSymbolZeroArgsTemplate null\n LongSymbolOneTemplate: &LongSymbolOneTemplate !!js/function >\n () => {\n return '1L';\n }\n LongSymbolOneArgsTemplate: &LongSymbolOneArgsTemplate null\n LongSymbolNegOneTemplate: &LongSymbolNegOneTemplate !!js/function >\n () => {\n return '-1L';\n }\n LongSymbolNegOneArgsTemplate: &LongSymbolNegOneArgsTemplate null\n LongSymbolFromBitsTemplate: &LongSymbolFromBitsTemplate !!js/function > # Also has process method\n () => {\n return '';\n }\n LongSymbolFromBitsArgsTemplate: &LongSymbolFromBitsArgsTemplate null\n LongSymbolFromIntTemplate: &LongSymbolFromIntTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolFromIntArgsTemplate: &LongSymbolFromIntArgsTemplate !!js/function >\n (lhs, arg) => {\n return `${arg}L`;\n }\n LongSymbolFromNumberTemplate: &LongSymbolFromNumberTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolFromNumberArgsTemplate: &LongSymbolFromNumberArgsTemplate !!js/function >\n (lhs, arg) => {\n return `${arg}L`;\n }\n LongSymbolFromStringTemplate: &LongSymbolFromStringTemplate !!js/function >\n (lhs) => {\n return `Long.parseLong`;\n }\n LongSymbolFromStringArgsTemplate: &LongSymbolFromStringArgsTemplate null\n MinKeySymbolTemplate: &MinKeySymbolTemplate null\n MinKeySymbolArgsTemplate: &MinKeySymbolArgsTemplate null\n MaxKeySymbolTemplate: &MaxKeySymbolTemplate null\n MaxKeySymbolArgsTemplate: &MaxKeySymbolArgsTemplate null\n TimestampSymbolTemplate: &TimestampSymbolTemplate !!js/function >\n () => {\n return 'BSONTimestamp';\n }\n TimestampSymbolArgsTemplate: &TimestampSymbolArgsTemplate !!js/function >\n (lhs, arg1, arg2) => {\n return `(${arg1 === undefined ? 0 : arg1}, ${arg2 === undefined ? 0 : arg2})`;\n }\n SymbolSymbolTemplate: &SymbolSymbolTemplate !!js/function >\n () => {\n return 'Symbol';\n }\n SymbolSymbolArgsTemplate: &SymbolSymbolArgsTemplate null\n BSONRegExpSymbolTemplate: &BSONRegExpSymbolTemplate !!js/function >\n () => {\n return 'BsonRegularExpression';\n }\n BSONRegExpSymbolArgsTemplate: &BSONRegExpSymbolArgsTemplate !!js/function >\n (lhs, pattern, flags) => {\n const doubleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n return `(${doubleStringify(pattern)}${flags ? ', ' + doubleStringify(flags) : ''})`;\n }\n Decimal128SymbolTemplate: &Decimal128SymbolTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolArgsTemplate: &Decimal128SymbolArgsTemplate !!js/function >\n (_, str) => { // just stringify\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `.parse(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n Decimal128SymbolFromStringTemplate: &Decimal128SymbolFromStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.parse`;\n }\n Decimal128SymbolFromStringArgsTemplate: &Decimal128SymbolFromStringArgsTemplate null\n Decimal128ToStringTemplate: &Decimal128ToStringTemplate null\n Decimal128ToStringArgsTemplate: &Decimal128ToStringArgsTemplate null\n # BSON Util Templates\n ObjectIdCreateFromHexStringTemplate: &ObjectIdCreateFromHexStringTemplate !!js/function >\n () => {\n return 'new ObjectId';\n }\n ObjectIdCreateFromHexStringArgsTemplate: &ObjectIdCreateFromHexStringArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n ObjectIdCreateFromTimeTemplate: &ObjectIdCreateFromTimeTemplate !!js/function >\n () => {\n return 'new ObjectId';\n }\n ObjectIdCreateFromTimeArgsTemplate: &ObjectIdCreateFromTimeArgsTemplate !!js/function >\n (lhs, arg, isNumber) => {\n if (isNumber) {\n return `(new java.util.Date(${arg}))`;\n }\n return `(${arg})`;\n }\n ObjectIdIsValidTemplate: &ObjectIdIsValidTemplate !!js/function >\n () => {\n return 'ObjectId.isValid';\n }\n ObjectIdIsValidArgsTemplate: &ObjectIdIsValidArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n # JS Symbol Templates\n NumberSymbolTemplate: &NumberSymbolTemplate !!js/function >\n () => {\n return '';\n }\n NumberSymbolArgsTemplate: &NumberSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Double.parseDouble(${arg})`;\n }\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n if (arg.includes('L') || arg.includes('d')) {\n return `${arg.substr(0, arg.length - 1)}d`;\n }\n return `${arg}d`;\n }\n return `(double) ${arg}`;\n }\n DateSymbolTemplate: &DateSymbolTemplate !!js/function >\n () => {\n return 'java.util.Date';\n }\n DateSymbolArgsTemplate: &DateSymbolArgsTemplate !!js/function >\n (lhs, date, isString) => {\n let toStr = (d) => d;\n if (isString) {\n toStr = (d) => `new SimpleDateFormat(\"EEE MMMMM dd yyyy HH:mm:ss\").format(${d})`;\n }\n if (date === null) {\n return toStr(`new ${lhs}()`);\n }\n return toStr(`new ${lhs}(${date.getTime()}L)`);\n }\n DateSymbolNowTemplate: &DateSymbolNowTemplate !!js/function >\n () => {\n return '';\n }\n DateSymbolNowArgsTemplate: &DateSymbolNowArgsTemplate !!js/function >\n () => {\n return 'new java.util.Date().getTime()';\n }\n RegExpSymbolTemplate: &RegExpSymbolTemplate !!js/function >\n () => {\n return 'Pattern';\n }\n RegExpSymbolArgsTemplate: &RegExpSymbolArgsTemplate null\n ImportTemplate: &ImportTemplate null\n 0ImportTemplate: &0ImportTemplate null\n 1ImportTemplate: &1ImportTemplate null\n 2ImportTemplate: &2ImportTemplate null\n 3ImportTemplate: &3ImportTemplate null\n 4ImportTemplate: &4ImportTemplate null\n 5ImportTemplate: &5ImportTemplate null\n 6ImportTemplate: &6ImportTemplate null\n 7ImportTemplate: &7ImportTemplate null\n 8ImportTemplate: &8ImportTemplate !!js/function >\n () => {\n return 'import java.util.regex.Pattern;';\n }\n 9ImportTemplate: &9ImportTemplate !!js/function >\n () => {\n return 'import java.util.Arrays;';\n }\n 10ImportTemplate: &10ImportTemplate !!js/function >\n () => {\n return 'import org.bson.Document;';\n }\n 11ImportTemplate: &11ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonNull;';\n }\n 12ImportTemplate: &12ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonUndefined;';\n }\n 100ImportTemplate: &100ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Code;';\n }\n 113ImportTemplate: &113ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.CodeWithScope;';\n }\n 101ImportTemplate: &101ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.ObjectId;';\n }\n 102ImportTemplate: &102ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Binary;';\n }\n 103ImportTemplate: &103ImportTemplate !!js/function >\n () => {\n return 'import com.mongodb.DBRef;';\n }\n 104ImportTemplate: &104ImportTemplate null\n 105ImportTemplate: &105ImportTemplate null\n 106ImportTemplate: &106ImportTemplate null\n 107ImportTemplate: &107ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.MinKey;';\n }\n 108ImportTemplate: &108ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.MaxKey;';\n }\n 109ImportTemplate: &109ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonRegularExpression;';\n }\n 110ImportTemplate: &110ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.BSONTimestamp;';\n }\n 111ImportTemplate: &111ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Symbol;';\n }\n 112ImportTemplate: &112ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Decimal128;';\n }\n 114ImportTemplate: &114ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonBinarySubType;';\n }\n 200ImportTemplate: &200ImportTemplate null\n 201ImportTemplate: &201ImportTemplate !!js/function >\n () => {\n return 'import java.text.SimpleDateFormat;';\n }\n 300ImportTemplate: &300ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i && f !== 'options'))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Filters.${c};`;\n }).join('\\n');\n }\n 301ImportTemplate: &301ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Aggregates.${c};`;\n }).join('\\n');\n }\n 302ImportTemplate: &302ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Accumulators.${c};`;\n }).join('\\n');\n }\n 303ImportTemplate: &303ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Projections.${c};`;\n }).join('\\n');\n }\n 304ImportTemplate: &304ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Sorts.${c};`;\n }).join('\\n');\n }\n 305ImportTemplate: &305ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import com.mongodb.client.model.geojson.${c};`;\n }).join('\\n');\n }\n 306ImportTemplate: &306ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import com.mongodb.client.model.${c};`;\n }).join('\\n');\n }\n# Universal types\n# Everything inherits from StringType because we haven't implemented any of them.\nBasicTypes:\n # Universal basic types\n _bool: &BoolType\n <<: *__type\n id: \"_bool\"\n code: 0\n template: *BoolTypeTemplate\n _integer: &IntegerType\n <<: *__type\n id: \"_integer\"\n code: 1\n template: *IntegerTypeTemplate\n _long: &LongBasicType\n <<: *__type\n id: \"_long\"\n code: 2\n template: *LongBasicTypeTemplate\n _decimal: &DecimalType\n <<: *__type\n id: \"_decimal\"\n code: 3\n template: *DecimalTypeTemplate\n _hex: &HexType\n <<: *__type\n id: \"_hex\"\n code: 4\n template: *HexTypeTemplate\n _octal: &OctalType\n <<: *__type\n id: \"_octal\"\n code: 5\n template: *OctalTypeTemplate\n _numeric: &NumericType\n <<: *__type\n id: \"_numeric\"\n code: 6\n template: *NumericTypeTemplate\n _string: &StringType\n <<: *__type\n id: \"_string\"\n code: 7\n template: *StringTypeTemplate\n _regex: &RegexType\n <<: *__type\n id: \"_regex\"\n code: 8\n template: *RegexTypeTemplate\n _array: &ArrayType\n <<: *__type\n id: \"_array\"\n code: 9\n template: *ArrayTypeTemplate\n argsTemplate: *ArrayTypeArgsTemplate\n _object: &ObjectType\n <<: *__type\n id: \"_object\"\n code: 10\n template: *ObjectTypeTemplate\n argsTemplate: *ObjectTypeArgsTemplate\n _null: &NullType\n <<: *__type\n id: \"_null\"\n code: 11\n template: *NullTypeTemplate\n _undefined: &UndefinedType\n <<: *__type\n id: \"_undefined\"\n code: 12\n template: *UndefinedTypeTemplate\n\nSyntax:\n equality:\n template: *EqualitySyntaxTemplate\n in:\n template: *InSyntaxTemplate\n and:\n template: *AndSyntaxTemplate\n or:\n template: *OrSyntaxTemplate\n not:\n template: *NotSyntaxTemplate\n unary:\n template: *UnarySyntaxTemplate\n binary:\n template: *BinarySyntaxTemplate\n parens:\n template: *ParensSyntaxTemplate\n eos:\n template: *EosSyntaxTemplate\n eof:\n template: *EofSyntaxTemplate\n # The new template takes in expr, and an optional skip argument and optional\n # id argument. The skip argument is a boolean that if true then doesn't add\n # new. The code argument is the symbol code being called. The template will check\n # if it is an exception, i.e. a type that is a constructor but may not use new.\n new:\n template: *NewSyntaxTemplate\n # The regex flags that change symbols between languages can be defined here.\n # Flags that aren't defined can be left blank and will be ignored.\n regexFlags: *RegexFlags\n bsonRegexFlags: *BSONRegexFlags\nImports:\n import:\n template: *ImportTemplate\n 0:\n template: *0ImportTemplate\n 1:\n template: *1ImportTemplate\n 2:\n template: *2ImportTemplate\n 3:\n template: *3ImportTemplate\n 4:\n template: *4ImportTemplate\n 5:\n template: *5ImportTemplate\n 6:\n template: *6ImportTemplate\n 7:\n template: *7ImportTemplate\n 8:\n template: *8ImportTemplate\n 9:\n template: *9ImportTemplate\n 10:\n template: *10ImportTemplate\n 11:\n template: *11ImportTemplate\n 12:\n template: *12ImportTemplate\n 100:\n template: *100ImportTemplate\n 101:\n template: *101ImportTemplate\n 102:\n template: *102ImportTemplate\n 103:\n template: *103ImportTemplate\n 104:\n template: *104ImportTemplate\n 105:\n template: *105ImportTemplate\n 106:\n template: *106ImportTemplate\n 107:\n template: *107ImportTemplate\n 108:\n template: *108ImportTemplate\n 109:\n template: *109ImportTemplate\n 110:\n template: *110ImportTemplate\n 111:\n template: *111ImportTemplate\n 112:\n template: *112ImportTemplate\n 113:\n template: *113ImportTemplate\n 114:\n template: *114ImportTemplate\n 200:\n template: *200ImportTemplate\n 201:\n template: *201ImportTemplate\n 300:\n template: *300ImportTemplate\n 301:\n template: *301ImportTemplate\n 302:\n template: *302ImportTemplate\n 303:\n template: *303ImportTemplate\n 304:\n template: *304ImportTemplate\n 305:\n template: *305ImportTemplate\n 306:\n template: *306ImportTemplate\nNativeTypes:\n Date: &DateType\n <<: *__type\n id: \"Date\"\n code: 200\n type: *ObjectType\n attr: {} # TODO: no built-in date methods added yet\n int: &intType\n <<: *__type\n id: \"int\"\n code: 105\n type: *IntegerType\n attr: {}\n float: &floatType\n <<: *__type\n id: \"float\"\n code: 104\n type: *IntegerType\n attr: {}\nBsonTypes:\n Code: &CodeType\n <<: *__type\n id: \"Code\"\n code: 100\n type: *ObjectType\n attr:\n scope:\n callable: *var\n args: null\n attr: null\n id: \"scope\"\n type: *ObjectType\n template: *CodeScopeTemplate\n argsTemplate: *CodeScopeArgsTemplate\n ObjectId: &ObjectIdType\n <<: *__type\n id: \"ObjectId\"\n code: 101\n type: *ObjectType\n attr:\n binary:\n callable: *var\n args: null\n attr: null\n type: *StringType\n template: *ObjectIdToStringTemplate\n argsTemplate: *ObjectIdToStringArgsTemplate\n generation_time:\n callable: *var\n args: null\n attr: null\n id: \"db\"\n type: *DateType\n template: *ObjectIdGetTimestampTemplate\n argsTemplate: *ObjectIdGetTimestampArgsTemplate\n Binary: &BinaryType # Not currently supported\n <<: *__type\n id: \"Binary\"\n code: 102\n type: *ObjectType\n DBRef: &DBRefType\n <<: *__type\n id: \"DBRef\"\n code: 103\n type: *ObjectType\n attr:\n database:\n callable: *var\n args: null\n attr: null\n id: \"db\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n collection:\n callable: *var\n args: null\n attr: null\n id: \"collection\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n id:\n callable: *var\n args: null\n attr: null\n id: \"id\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n Int64: &LongType\n <<: *__type\n id: \"Int64\"\n code: 106\n type: *ObjectType\n attr: {}\n MinKey: &MinKeyType\n <<: *__type\n id: \"MinKey\"\n code: 107\n type: *ObjectType\n MaxKey: &MaxKeyType\n <<: *__type\n id: \"MaxKey\"\n code: 108\n type: *ObjectType\n Regex: &BSONRegExpType\n <<: *__type\n id: \"BSONRegExp\"\n code: 109\n type: *ObjectType\n Timestamp: &TimestampType\n <<: *__type\n id: \"Timestamp\"\n code: 110\n type: *ObjectType\n attr:\n time:\n callable: *var\n args: null\n attr: null\n id: \"time\"\n type: *IntegerType\n template: *TimestampTTemplate\n argsTemplate: null\n inc:\n callable: *var\n args: null\n attr: null\n id: \"inc\"\n type: *IntegerType\n template: *TimestampITemplate\n argsTemplate: null\n as_datetime:\n <<: *__func\n id: \"inc\"\n type: *DateType\n template: *TimestampAsDateTemplate\n argsTemplate: *TimestampAsDateArgsTemplate\n Decimal128: &Decimal128Type\n <<: *__type\n id: \"Decimal128\"\n code: 112\n type: *ObjectType\n attr: {}\nBsonSymbols:\n Code: &CodeSymbol\n id: \"Code\"\n code: 100\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectType, null ]\n namedArgs:\n scope:\n default: {}\n type: [ *ObjectType ]\n type: *CodeType\n attr: {}\n template: *CodeSymbolTemplate\n argsTemplate: *CodeSymbolArgsTemplate\n ObjectId: &ObjectIdSymbol\n id: \"ObjectId\"\n code: 101\n callable: *constructor\n args:\n - [ *StringType, null ]\n namedArgs:\n oid:\n default: null\n type: [ *StringType, *ObjectIdType ]\n type: *ObjectIdType\n attr:\n from_datetime:\n <<: *__func\n id: \"ObjectIdfrom_datetime\"\n args:\n - [ \"Date\" ]\n type: *ObjectIdType\n template: *ObjectIdCreateFromTimeTemplate\n argsTemplate: *ObjectIdCreateFromTimeArgsTemplate\n is_valid:\n <<: *__func\n id: \"is_valid\"\n args:\n - [ *StringType, ]\n type: *BoolType\n template: *ObjectIdIsValidTemplate\n argsTemplate: *ObjectIdIsValidArgsTemplate\n template: *ObjectIdSymbolTemplate\n argsTemplate: *ObjectIdSymbolArgsTemplate\n Binary: &BinarySymbol # Not currently supported\n id: \"Binary\"\n code: 102\n callable: *constructor\n args: null\n type: *BinaryType\n attr: {}\n template: *BinarySymbolTemplate\n argsTemplate: *BinarySymbolArgsTemplate\n DBRef:\n id: \"DBRef\"\n code: 103\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectIdType, *StringType ]\n - [ *StringType, null ]\n namedArgs:\n database:\n default: null\n type: [ *StringType ]\n type: *DBRefType\n attr: {}\n template: *DBRefSymbolTemplate\n argsTemplate: *DBRefSymbolArgsTemplate\n Int64:\n id: \"Int64\"\n code: 106\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *LongType\n attr: {}\n template: *LongSymbolTemplate\n argsTemplate: *LongSymbolArgsTemplate\n MinKey:\n id: \"MinKey\"\n code: 107\n callable: *constructor\n args: []\n type: *MinKeyType\n attr: {}\n template: *MinKeySymbolTemplate\n argsTemplate: *MinKeySymbolArgsTemplate\n MaxKey:\n id: \"MaxKey\"\n code: 108\n callable: *constructor\n args: []\n type: *MaxKeyType\n attr: {}\n template: *MaxKeySymbolTemplate\n argsTemplate: *MaxKeySymbolArgsTemplate\n Regex:\n id: \"Regex\"\n code: 109\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *StringType, *IntegerType, null ]\n namedArgs:\n flags:\n default: 0\n type: [ *StringType, *IntegerType ]\n type: *BSONRegExpType\n attr:\n from_native:\n <<: *__func\n id: \"from_native\"\n args:\n - [ *RegexType ]\n type: *BSONRegExpType\n template: null\n argsTemplate: null\n template: *BSONRegExpSymbolTemplate\n argsTemplate: *BSONRegExpSymbolArgsTemplate\n Timestamp:\n id: \"Timestamp\"\n code: 110\n callable: *constructor\n args:\n - [ *IntegerType ]\n - [ *IntegerType ]\n type: *TimestampType\n attr: {}\n template: *TimestampSymbolTemplate\n argsTemplate: *TimestampSymbolArgsTemplate\n Decimal128:\n id: \"Decimal128\"\n code: 112\n callable: *constructor\n args:\n - [ *StringType ]\n type: *Decimal128Type\n attr: {}\n template: *Decimal128SymbolTemplate\n argsTemplate: *Decimal128SymbolArgsTemplate\n\nNativeSymbols:\n datetime: # Needs process method\n id: \"datetime\"\n code: 200\n callable: *constructor\n args:\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n type: *DateType\n attr: {} # TODO: add more date funcs?\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n re:\n id: \"re\"\n code: 8\n callable: *var\n args: null\n type: null\n attr:\n compile:\n id: \"compile\"\n code: 8\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *IntegerType, null ]\n namedArgs:\n flags:\n default: 0\n type: [ *IntegerType ]\n type: *RegexType\n attr: {}\n template: *RegExpSymbolTemplate\n argsTemplate: *RegExpSymbolArgsTemplate\n A:\n <<: *__type\n id: 're.A'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '256';\n }\n ASCII:\n <<: *__type\n id: 're.ASCII'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '256';\n }\n I:\n <<: *__type\n id: 're.I'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '2';\n }\n IGNORECASE:\n <<: *__type\n id: 're.IGNORECASE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '2';\n }\n DEBUG:\n <<: *__type\n id: 're.DEBUG'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '128';\n }\n L:\n <<: *__type\n id: 're.L'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '4';\n }\n LOCAL:\n <<: *__type\n id: 're.LOCAL'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '4';\n }\n M:\n <<: *__type\n id: 're.M'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '8';\n }\n MULTILINE:\n <<: *__type\n id: 're.MULTILINE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '8';\n }\n S:\n <<: *__type\n id: 're.S'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '16';\n }\n DOTALL:\n <<: *__type\n id: 're.DOTALL'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '16';\n }\n X:\n <<: *__type\n id: 're.X'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '64';\n }\n VERBOSE:\n <<: *__type\n id: 're.VERBOSE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '64';\n }\n template: !!js/function >\n () => {\n return '';\n }\n argsTemplate: null\n float:\n id: \"float\"\n code: 104\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *floatType\n attr: {}\n template: *DoubleSymbolTemplate\n argsTemplate: *DoubleSymbolArgsTemplate\n int:\n id: \"int\"\n code: 105\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *intType\n attr: {}\n template: *Int32SymbolTemplate\n argsTemplate: *Int32SymbolArgsTemplate\n";
module.exports="SymbolTypes:\n VAR: &var 0\n CONSTRUCTOR: &constructor 1\n FUNC: &func 2\n# Internal patterns to save typing\n__type: &__type\n id: null\n callable: *var\n args: null\n type: null\n attr: {}\n template: null\n argsTemplate: null\n__func: &__func\n callable: *func\n args: []\n attr: {}\n template: null\n argsTemplate: null\n\n# Java Templates\nTemplates:\n # Misc\n RegexFlags: &RegexFlags\n i: 'i'\n m: 'm'\n u: 'u'\n y: ''\n g: ''\n BSONRegexFlags: &BSONRegexFlags\n i: 'i'\n m: 'm'\n x: 'x'\n s: 's'\n l: 'l'\n u: 'u'\n # Syntax\n EqualitySyntaxTemplate: &EqualitySyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n if (op.includes('!') || op.includes('not')) {\n return `${lhs} != ${rhs}`;\n } else if (op === '==' || op === '===' || op === 'is') {\n return `${lhs} == ${rhs}`;\n }\n return `${lhs} ${op} ${rhs}`;\n }\n InSyntaxTemplate: &InSyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n let str = '';\n if (op.includes('!') || op.includes('not')) {\n str = '!';\n }\n return `${str}${rhs}.contains(${lhs})`\n }\n AndSyntaxTemplate: &AndSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' && ');\n }\n OrSyntaxTemplate: &OrSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' || ');\n }\n NotSyntaxTemplate: &NotSyntaxTemplate !!js/function >\n (arg) => {\n return `!${arg}`;\n }\n UnarySyntaxTemplate: &UnarySyntaxTemplate null\n BinarySyntaxTemplate: &BinarySyntaxTemplate !!js/function >\n (args) => {\n return args.reduce((s, op, i, arr) => {\n if (i % 2 === 0) {\n return s;\n }\n const rhs = arr[i + 1];\n switch(op) {\n case '//':\n return `floor(${s})`;\n case '**':\n return `pow(${s}, ${rhs})`;\n default:\n return `${s} ${op} ${rhs}`;\n }\n }, args[0]);\n }\n ParensSyntaxTemplate: &ParensSyntaxTemplate null\n EosSyntaxTemplate: &EosSyntaxTemplate null\n EofSyntaxTemplate: &EofSyntaxTemplate null\n NewTemplate: &NewSyntaxTemplate !!js/function >\n (expr, skip, code) => {\n // Add codes of classes that don't need new.\n // Currently: Decimal128/NumberDecimal, Long/NumberLong, Double, Int32, Number, regex, Date\n noNew = [112, 106, 104, 105, 2, 8, 200];\n if (skip || (code && noNew.indexOf(code) !== -1)) {\n return expr;\n }\n return `new ${expr}`;\n }\n # BSON Object Type templates\n CodeTypeTemplate: &CodeTypeTemplate null\n StringTypeTemplate: &StringTypeTemplate !!js/function >\n (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n RegexTypeTemplate: &RegexTypeTemplate !!js/function >\n (pattern, flags) => {\n flags = flags === '' ? '' : `(?${flags})`;\n // Double escape characters except for slashes\n const escaped = pattern.replace(/\\\\/, '\\\\\\\\');\n\n // Double-quote stringify\n const str = escaped + flags;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `Pattern.compile(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n BoolTypeTemplate: &BoolTypeTemplate !!js/function >\n (literal) => {\n return literal.toLowerCase();\n }\n IntegerTypeTemplate: &IntegerTypeTemplate null\n DecimalTypeTemplate: &DecimalTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n return `${literal}d`;\n }\n return `(double) ${literal}`;\n }\n LongBasicTypeTemplate: &LongBasicTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long') {\n return `${literal}L`;\n }\n return `new Long(${literal})`;\n }\n HexTypeTemplate: &HexTypeTemplate null # TODO\n OctalTypeTemplate: &OctalTypeTemplate !!js/function >\n (literal, type) => {\n if ((literal.charAt(0) === '0' && literal.charAt(1) === '0') ||\n (literal.charAt(0) === '0' && (literal.charAt(1) === 'o' || literal.charAt(1) === 'O'))) {\n return `0${literal.substr(2, literal.length - 1)}`;\n }\n return literal;\n }\n NumericTypeTemplate: &NumericTypeTemplate null\n ArrayTypeTemplate: &ArrayTypeTemplate !!js/function >\n (literal, depth) => {\n depth++;\n // TODO: figure out how to best do depth in an array and where to\n // insert and indent\n const indent = '\\n' + ' '.repeat(depth);\n // have an indent on every ', new Document' in an array not\n // entirely perfect, but at least makes this more readable/also\n // compiles\n const arr = literal.split(', new').join(`, ${indent}new`)\n\n return `Arrays.asList(${arr})`;\n }\n ArrayTypeArgsTemplate: &ArrayTypeArgsTemplate null\n NullTypeTemplate: &NullTypeTemplate !!js/function >\n () => {\n return 'new BsonNull()';\n }\n UndefinedTypeTemplate: &UndefinedTypeTemplate !!js/function >\n () => {\n return 'new BsonUndefined()';\n }\n ObjectTypeTemplate: &ObjectTypeTemplate !!js/function >\n (literal, depth) => {\n\n if (literal === '') {\n return `new Document()`;\n }\n return literal;\n }\n ObjectTypeArgsTemplate: &ObjectTypeArgsTemplate !!js/function >\n (args, depth) => {\n if (args.length === 0) {\n return 'new Document()';\n }\n depth++;\n const indent = '\\n' + ' '.repeat(depth);\n const doubleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n const start = `new Document(${doubleStringify(args[0][0])}, ${args[0][1]})`;\n\n args = args.slice(1);\n const result = args.reduce((str, pair) => {\n return `${str}${indent}.append(${doubleStringify(pair[0])}, ${pair[1]})`;\n }, start);\n\n return `${result}`;\n }\n DoubleTypeTemplate: &DoubleTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n return `${literal}d`;\n }\n return `(double) ${literal}`;\n }\n DoubleTypeArgsTemplate: &DoubleTypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongTypeTemplate: &LongTemplate !!js/function >\n () => {\n return '';\n }\n LongTypeArgsTemplate: &LongSymbolArgsTemplate null\n # BSON Object Method templates\n ObjectIdToStringTemplate: &ObjectIdToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toHexString()`;\n }\n ObjectIdToStringArgsTemplate: &ObjectIdToStringArgsTemplate !!js/function >\n () => {\n return '';\n }\n ObjectIdEqualsTemplate: &ObjectIdEqualsTemplate null\n ObjectIdEqualsArgsTemplate: &ObjectIdEqualsArgsTemplate null\n ObjectIdGetTimestampTemplate: &ObjectIdGetTimestampTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTimestamp()`;\n }\n ObjectIdGetTimestampArgsTemplate: &ObjectIdGetTimestampArgsTemplate !!js/function >\n () => {\n return '';\n }\n CodeCodeTemplate: &CodeCodeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getCode()`;\n }\n CodeCodeArgsTemplate: &CodeCodeArgsTemplate null\n CodeScopeTemplate: &CodeScopeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getScope()`;\n }\n CodeScopeArgsTemplate: &CodeScopeArgsTemplate null\n BinaryValueTemplate: &BinaryValueTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getData`;\n }\n BinaryValueArgsTemplate: &BinaryValueArgsTemplate null\n BinaryLengthTemplate: &BinaryLengthTemplate null\n BinaryLengthArgsTemplate: &BinaryLengthArgsTemplate null\n BinaryToStringTemplate: &BinaryToStringTemplate null\n BinaryToStringArgsTemplate: &BinaryToStringArgsTemplate null\n BinarySubtypeTemplate: &BinarySubtypeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getType()`;\n }\n BinarySubtypeArgsTemplate: &BinarySubtypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetDBTemplate: &DBRefGetDBTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getDatabaseName()`;\n }\n DBRefGetDBArgsTemplate: &DBRefGetDBArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetCollectionTemplate: &DBRefGetCollectionTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getCollectionName()`;\n }\n DBRefGetCollectionArgsTemplate: &DBRefGetCollectionArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetIdTemplate: &DBRefGetIdTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getId()`;\n }\n DBRefGetIdArgsTemplate: &DBRefGetIdArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongEqualsTemplate: &LongEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} ==`;\n }\n LongEqualsArgsTemplate: &LongEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongToStringTemplate: &LongToStringTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongToStringArgsTemplate: &LongToStringArgsTemplate null\n LongToIntTemplate: &LongToIntTemplate !!js/function >\n (lhs) => {\n return `(int) ${lhs}`;\n }\n LongToIntArgsTemplate: &LongToIntArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongToNumberTemplate: &LongToNumberTemplate !!js/function >\n (lhs) => {\n return `(double) ${lhs}`;\n }\n LongToNumberArgsTemplate: &LongToNumberArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongAddTemplate: &LongAddTemplate !!js/function >\n (lhs) => {\n return `${lhs} +`;\n }\n LongAddArgsTemplate: &LongAddArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongSubtractTemplate: &LongSubtractTemplate !!js/function >\n (arg) => {\n return `${arg} -`;\n }\n LongSubtractArgsTemplate: &LongSubtractArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongMultiplyTemplate: &LongMultiplyTemplate !!js/function >\n (arg) => {\n return `${arg} *`;\n }\n LongMultiplyArgsTemplate: &LongMultiplyArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongDivTemplate: &LongDivTemplate !!js/function >\n (lhs) => {\n return `${lhs} /`;\n }\n LongDivArgsTemplate: &LongDivArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongModuloTemplate: &LongModuloTemplate !!js/function >\n (lhs) => {\n return `${lhs} %`;\n }\n LongModuloArgsTemplate: &LongModuloArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongAndTemplate: &LongAndTemplate !!js/function >\n (lhs) => {\n return `${lhs} &`;\n }\n LongAndArgsTemplate: &LongAndArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongOrTemplate: &LongOrTemplate !!js/function >\n (lhs) => {\n return `${lhs} |`;\n }\n LongOrArgsTemplate: &LongOrArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongXorTemplate: &LongXorTemplate !!js/function >\n (lhs) => {\n return `${lhs} ^`;\n }\n LongXorArgsTemplate: &LongXorArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongShiftLeftTemplate: &LongShiftLeftTemplate !!js/function >\n () => {\n return 'Long.rotateLeft';\n }\n LongShiftLeftArgsTemplate: &LongShiftLeftArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${lhs}, ${arg})`;\n }\n LongShiftRightTemplate: &LongShiftRightTemplate !!js/function >\n () => {\n return 'Long.rotateRight';\n }\n LongShiftRightArgsTemplate: &LongShiftRightArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${lhs}, ${arg})`;\n }\n LongCompareTemplate: &LongCompareTemplate !!js/function >\n (lhs) => {\n return `${lhs} -`;\n }\n LongCompareArgsTemplate: &LongCompareArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongIsOddTemplate: &LongIsOddTemplate !!js/function >\n (lhs) => {\n return `(${lhs} % 2) == 1`;\n }\n LongIsOddArgsTemplate: &LongIsOddArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsZeroTemplate: &LongIsZeroTemplate !!js/function >\n (lhs) => {\n return `${lhs} == 0`;\n }\n LongIsZeroArgsTemplate: &LongIsZeroArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsNegativeTemplate: &LongIsNegativeTemplate !!js/function >\n (lhs) => {\n return `${lhs} < 0`;\n }\n LongIsNegativeArgsTemplate: &LongIsNegativeArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongNegateTemplate: &LongNegateTemplate !!js/function >\n () => {\n return '-';\n }\n LongNegateArgsTemplate: &LongNegateArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotTemplate: &LongNotTemplate !!js/function >\n () => {\n return '~';\n }\n LongNotArgsTemplate: &LongNotArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotEqualsTemplate: &LongNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} !=`;\n }\n LongNotEqualsArgsTemplate: &LongNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanTemplate: &LongGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} >`;\n }\n LongGreaterThanArgsTemplate: &LongGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanOrEqualTemplate: &LongGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} >=`;\n }\n LongGreaterThanOrEqualArgsTemplate: &LongGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanTemplate: &LongLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} <`;\n }\n LongLessThanArgsTemplate: &LongLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanOrEqualTemplate: &LongLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} <=`;\n }\n LongLessThanOrEqualArgsTemplate: &LongLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongFloatApproxTemplate: &LongFloatApproxTemplate !!js/function >\n (lhs) => {\n return `(float) ${lhs}`;\n }\n LongTopTemplate: &LongTopTemplate !!js/function >\n (lhs) => {\n return `${lhs} >> 32`;\n }\n LongBottomTemplate: &LongBottomTemplate !!js/function >\n (lhs) => {\n return `${lhs} & 0x0000ffff`;\n }\n TimestampToStringTemplate: &TimestampToStringTemplate null\n TimestampToStringArgsTemplate: &TimestampToStringArgsTemplate null\n TimestampEqualsTemplate: &TimestampEqualsTemplate null\n TimestampEqualsArgsTemplate: &TimestampEqualsArgsTemplate null\n TimestampGetLowBitsTemplate: &TimestampGetLowBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTime`;\n }\n TimestampGetLowBitsArgsTemplate: &TimestampGetLowBitsArgsTemplate null\n TimestampGetHighBitsTemplate: &TimestampGetHighBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getInc`;\n }\n TimestampGetHighBitsArgsTemplate: &TimestampGetHighBitsArgsTemplate null\n TimestampTTemplate: &TimestampTTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTime()`;\n }\n TimestampITemplate: &TimestampITemplate !!js/function >\n (lhs) => {\n return `${lhs}.getInc()`;\n }\n TimestampAsDateTemplate: &TimestampAsDateTemplate !!js/function >\n (lhs) => {\n return `new java.util.Date(${lhs}.getTime())`;\n }\n TimestampAsDateArgsTemplate: &TimestampAsDateArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampCompareTemplate: &TimestampCompareTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampCompareArgsTemplate: &TimestampCompareArgsTemplate null\n TimestampNotEqualsTemplate: &TimestampNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampNotEqualsArgsTemplate: &TimestampNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) != 0`;\n }\n TimestampGreaterThanTemplate: &TimestampGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampGreaterThanArgsTemplate: &TimestampGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) > 0`;\n }\n TimestampGreaterThanOrEqualTemplate: &TimestampGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampGreaterThanOrEqualArgsTemplate: &TimestampGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) >= 0`;\n }\n TimestampLessThanTemplate: &TimestampLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampLessThanArgsTemplate: &TimestampLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) < 0`;\n }\n TimestampLessThanOrEqualTemplate: &TimestampLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampLessThanOrEqualArgsTemplate: &TimestampLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) <= 0`;\n }\n SymbolValueOfTemplate: &SymbolValueOfTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getSymbol`;\n }\n SymbolValueOfArgsTemplate: &SymbolValueOfArgsTemplate null\n SymbolInspectTemplate: &SymbolInspectTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getSymbol`;\n }\n SymbolInspectArgsTemplate: &SymbolInspectArgsTemplate null\n SymbolToStringTemplate: &SymbolToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toString`;\n }\n SymbolToStringArgsTemplate: &SymbolToStringArgsTemplate null\n # Symbol Templates\n CodeSymbolTemplate: &CodeSymbolTemplate !!js/function > # Also has process method\n () => {\n return 'Code';\n }\n CodeSymbolArgsTemplate: &CodeSymbolArgsTemplate !!js/function > # Also has process method\n (lhs, code, scope) => {\n // Double quote stringify\n let newStr = code === undefined ? '' : code;\n const str = newStr;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n code = `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n return (scope === undefined) ? `(${code})` : `WithScope(${code}, ${scope})`;\n }\n ObjectIdSymbolTemplate: &ObjectIdSymbolTemplate null\n ObjectIdSymbolArgsTemplate: &ObjectIdSymbolArgsTemplate !!js/function >\n (lhs, str) => {\n if (!str || str.length === 0) {\n return '()';\n }\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n BinarySymbolTemplate: &BinarySymbolTemplate null\n BinarySymbolArgsTemplate: &BinarySymbolArgsTemplate !!js/function >\n (lhs, bytes, type) => {\n const str = bytes;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n bytes = `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n\n if (type === null) {\n return `(${bytes}.getBytes(\"UTF-8\"))`;\n }\n return `(${type}, ${bytes}.getBytes(\"UTF-8\"))`;\n }\n BinarySymbolSubtypeDefaultTemplate: &BinarySymbolSubtypeDefaultTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.BINARY';\n }\n BinarySymbolSubtypeFunctionTemplate: &BinarySymbolSubtypeFunctionTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.FUNCTION';\n }\n BinarySymbolSubtypeByteArrayTemplate: &BinarySymbolSubtypeByteArrayTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.BINARY';\n }\n BinarySymbolSubtypeUuidOldTemplate: &BinarySymbolSubtypeUuidOldTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.UUID_LEGACY';\n }\n BinarySymbolSubtypeUuidTemplate: &BinarySymbolSubtypeUuidTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.UUID_STANDARD';\n }\n BinarySymbolSubtypeMd5Template: &BinarySymbolSubtypeMd5Template !!js/function >\n () => {\n return 'BsonBinarySubType.MD5';\n }\n BinarySymbolSubtypeUserDefinedTemplate: &BinarySymbolSubtypeUserDefinedTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.USER_DEFINED';\n }\n DBRefSymbolTemplate: &DBRefSymbolTemplate null\n DBRefSymbolArgsTemplate: &DBRefSymbolArgsTemplate !!js/function >\n (lhs, coll, id, db) => {\n const dbstr = db === undefined ? '' : `${db}, `;\n return `(${dbstr}${coll}, ${id})`;\n }\n DoubleSymbolTemplate: &DoubleSymbolTemplate !!js/function >\n () => {\n return '';\n }\n DoubleSymbolArgsTemplate: &DoubleSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Double.parseDouble(${arg})`;\n }\n if (type === '_integer' || type === '_long' || type === '_double' || type === '_decimal') {\n if (arg.includes('L') || arg.includes('d')) {\n return `${arg.substr(0, arg.length - 1)}d`;\n }\n return `${arg}d`;\n }\n return `(double) ${arg}`;\n }\n Int32SymbolTemplate: &Int32SymbolTemplate !!js/function >\n () => {\n return '';\n }\n Int32SymbolArgsTemplate: &Int32SymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Integer.parseInt(${arg})`;\n }\n if (type === '_integer' || type === '_long') {\n if (arg.includes('L') || arg.includes('d')) {\n return arg.substr(0, arg.length - 1);\n }\n return arg;\n }\n return `(int) ${arg}`;\n }\n LongSymbolTemplate: &LongSymbolTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolArgsTemplate: &LongSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Long.parseLong(${arg})`;\n }\n if (type === '_integer' || type === '_long') {\n if (arg.includes('d') || arg.includes('L')) {\n return `${arg.substr(0, arg.length - 1)}L`;\n }\n return `${arg}L`;\n }\n return `new Long(${arg})`;\n }\n LongSymbolMaxTemplate: &LongSymbolMaxTemplate !!js/function >\n () => {\n return 'Long.MAX_VALUE';\n }\n LongSymbolMaxArgsTemplate: &LongSymbolMaxArgsTemplate null\n LongSymbolMinTemplate: &LongSymbolMinTemplate !!js/function >\n () => {\n return 'Long.MIN_VALUE';\n }\n LongSymbolMinArgsTemplate: &LongSymbolMinArgsTemplate null\n LongSymbolZeroTemplate: &LongSymbolZeroTemplate !!js/function >\n () => {\n return '0L';\n }\n LongSymbolZeroArgsTemplate: &LongSymbolZeroArgsTemplate null\n LongSymbolOneTemplate: &LongSymbolOneTemplate !!js/function >\n () => {\n return '1L';\n }\n LongSymbolOneArgsTemplate: &LongSymbolOneArgsTemplate null\n LongSymbolNegOneTemplate: &LongSymbolNegOneTemplate !!js/function >\n () => {\n return '-1L';\n }\n LongSymbolNegOneArgsTemplate: &LongSymbolNegOneArgsTemplate null\n LongSymbolFromBitsTemplate: &LongSymbolFromBitsTemplate !!js/function > # Also has process method\n () => {\n return '';\n }\n LongSymbolFromBitsArgsTemplate: &LongSymbolFromBitsArgsTemplate null\n LongSymbolFromIntTemplate: &LongSymbolFromIntTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolFromIntArgsTemplate: &LongSymbolFromIntArgsTemplate !!js/function >\n (lhs, arg) => {\n return `${arg}L`;\n }\n LongSymbolFromNumberTemplate: &LongSymbolFromNumberTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolFromNumberArgsTemplate: &LongSymbolFromNumberArgsTemplate !!js/function >\n (lhs, arg) => {\n return `${arg}L`;\n }\n LongSymbolFromStringTemplate: &LongSymbolFromStringTemplate !!js/function >\n (lhs) => {\n return `Long.parseLong`;\n }\n LongSymbolFromStringArgsTemplate: &LongSymbolFromStringArgsTemplate null\n MinKeySymbolTemplate: &MinKeySymbolTemplate null\n MinKeySymbolArgsTemplate: &MinKeySymbolArgsTemplate null\n MaxKeySymbolTemplate: &MaxKeySymbolTemplate null\n MaxKeySymbolArgsTemplate: &MaxKeySymbolArgsTemplate null\n TimestampSymbolTemplate: &TimestampSymbolTemplate !!js/function >\n () => {\n return 'BSONTimestamp';\n }\n TimestampSymbolArgsTemplate: &TimestampSymbolArgsTemplate !!js/function >\n (lhs, arg1, arg2) => {\n return `(${arg1 === undefined ? 0 : arg1}, ${arg2 === undefined ? 0 : arg2})`;\n }\n SymbolSymbolTemplate: &SymbolSymbolTemplate !!js/function >\n () => {\n return 'Symbol';\n }\n SymbolSymbolArgsTemplate: &SymbolSymbolArgsTemplate null\n BSONRegExpSymbolTemplate: &BSONRegExpSymbolTemplate !!js/function >\n () => {\n return 'BsonRegularExpression';\n }\n BSONRegExpSymbolArgsTemplate: &BSONRegExpSymbolArgsTemplate !!js/function >\n (lhs, pattern, flags) => {\n const doubleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n return `(${doubleStringify(pattern)}${flags ? ', ' + doubleStringify(flags) : ''})`;\n }\n Decimal128SymbolTemplate: &Decimal128SymbolTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolArgsTemplate: &Decimal128SymbolArgsTemplate !!js/function >\n (_, str) => { // just stringify\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `.parse(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n Decimal128SymbolFromStringTemplate: &Decimal128SymbolFromStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.parse`;\n }\n Decimal128SymbolFromStringArgsTemplate: &Decimal128SymbolFromStringArgsTemplate null\n Decimal128ToStringTemplate: &Decimal128ToStringTemplate null\n Decimal128ToStringArgsTemplate: &Decimal128ToStringArgsTemplate null\n # BSON Util Templates\n ObjectIdCreateFromHexStringTemplate: &ObjectIdCreateFromHexStringTemplate !!js/function >\n () => {\n return 'new ObjectId';\n }\n ObjectIdCreateFromHexStringArgsTemplate: &ObjectIdCreateFromHexStringArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n ObjectIdCreateFromTimeTemplate: &ObjectIdCreateFromTimeTemplate !!js/function >\n () => {\n return 'new ObjectId';\n }\n ObjectIdCreateFromTimeArgsTemplate: &ObjectIdCreateFromTimeArgsTemplate !!js/function >\n (lhs, arg, isNumber) => {\n if (isNumber) {\n return `(new java.util.Date(${arg}))`;\n }\n return `(${arg})`;\n }\n ObjectIdIsValidTemplate: &ObjectIdIsValidTemplate !!js/function >\n () => {\n return 'ObjectId.isValid';\n }\n ObjectIdIsValidArgsTemplate: &ObjectIdIsValidArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n # JS Symbol Templates\n NumberSymbolTemplate: &NumberSymbolTemplate !!js/function >\n () => {\n return '';\n }\n NumberSymbolArgsTemplate: &NumberSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Double.parseDouble(${arg})`;\n }\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n if (arg.includes('L') || arg.includes('d')) {\n return `${arg.substr(0, arg.length - 1)}d`;\n }\n return `${arg}d`;\n }\n return `(double) ${arg}`;\n }\n DateSymbolTemplate: &DateSymbolTemplate !!js/function >\n () => {\n return 'java.util.Date';\n }\n DateSymbolArgsTemplate: &DateSymbolArgsTemplate !!js/function >\n (lhs, date, isString) => {\n let toStr = (d) => d;\n if (isString) {\n toStr = (d) => `new SimpleDateFormat(\"EEE MMMMM dd yyyy HH:mm:ss\").format(${d})`;\n }\n if (date === null) {\n return toStr(`new ${lhs}()`);\n }\n return toStr(`new ${lhs}(${date.getTime()}L)`);\n }\n DateSymbolNowTemplate: &DateSymbolNowTemplate !!js/function >\n () => {\n return '';\n }\n DateSymbolNowArgsTemplate: &DateSymbolNowArgsTemplate !!js/function >\n () => {\n return 'new java.util.Date().getTime()';\n }\n RegExpSymbolTemplate: &RegExpSymbolTemplate !!js/function >\n () => {\n return 'Pattern';\n }\n RegExpSymbolArgsTemplate: &RegExpSymbolArgsTemplate null\n ImportTemplate: &ImportTemplate null\n 0ImportTemplate: &0ImportTemplate null\n 1ImportTemplate: &1ImportTemplate null\n 2ImportTemplate: &2ImportTemplate null\n 3ImportTemplate: &3ImportTemplate null\n 4ImportTemplate: &4ImportTemplate null\n 5ImportTemplate: &5ImportTemplate null\n 6ImportTemplate: &6ImportTemplate null\n 7ImportTemplate: &7ImportTemplate null\n 8ImportTemplate: &8ImportTemplate !!js/function >\n () => {\n return 'import java.util.regex.Pattern;';\n }\n 9ImportTemplate: &9ImportTemplate !!js/function >\n () => {\n return 'import java.util.Arrays;';\n }\n 10ImportTemplate: &10ImportTemplate !!js/function >\n () => {\n return 'import org.bson.Document;';\n }\n 11ImportTemplate: &11ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonNull;';\n }\n 12ImportTemplate: &12ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonUndefined;';\n }\n 100ImportTemplate: &100ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Code;';\n }\n 113ImportTemplate: &113ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.CodeWithScope;';\n }\n 101ImportTemplate: &101ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.ObjectId;';\n }\n 102ImportTemplate: &102ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Binary;';\n }\n 103ImportTemplate: &103ImportTemplate !!js/function >\n () => {\n return 'import com.mongodb.DBRef;';\n }\n 104ImportTemplate: &104ImportTemplate null\n 105ImportTemplate: &105ImportTemplate null\n 106ImportTemplate: &106ImportTemplate null\n 107ImportTemplate: &107ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.MinKey;';\n }\n 108ImportTemplate: &108ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.MaxKey;';\n }\n 109ImportTemplate: &109ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonRegularExpression;';\n }\n 110ImportTemplate: &110ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.BSONTimestamp;';\n }\n 111ImportTemplate: &111ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Symbol;';\n }\n 112ImportTemplate: &112ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Decimal128;';\n }\n 114ImportTemplate: &114ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonBinarySubType;';\n }\n 200ImportTemplate: &200ImportTemplate null\n 201ImportTemplate: &201ImportTemplate !!js/function >\n () => {\n return 'import java.text.SimpleDateFormat;';\n }\n 300ImportTemplate: &300ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i && f !== 'options'))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Filters.${c};`;\n }).join('\\n');\n }\n 301ImportTemplate: &301ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Aggregates.${c};`;\n }).join('\\n');\n }\n 302ImportTemplate: &302ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Accumulators.${c};`;\n }).join('\\n');\n }\n 303ImportTemplate: &303ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Projections.${c};`;\n }).join('\\n');\n }\n 304ImportTemplate: &304ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Sorts.${c};`;\n }).join('\\n');\n }\n 305ImportTemplate: &305ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import com.mongodb.client.model.geojson.${c};`;\n }).join('\\n');\n }\n 306ImportTemplate: &306ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import com.mongodb.client.model.${c};`;\n }).join('\\n');\n }\n# Universal types\n# Everything inherits from StringType because we haven't implemented any of them.\nBasicTypes:\n # Universal basic types\n _bool: &BoolType\n <<: *__type\n id: \"_bool\"\n code: 0\n template: *BoolTypeTemplate\n _integer: &IntegerType\n <<: *__type\n id: \"_integer\"\n code: 1\n template: *IntegerTypeTemplate\n _long: &LongBasicType\n <<: *__type\n id: \"_long\"\n code: 2\n template: *LongBasicTypeTemplate\n _decimal: &DecimalType\n <<: *__type\n id: \"_decimal\"\n code: 3\n template: *DecimalTypeTemplate\n _hex: &HexType\n <<: *__type\n id: \"_hex\"\n code: 4\n template: *HexTypeTemplate\n _octal: &OctalType\n <<: *__type\n id: \"_octal\"\n code: 5\n template: *OctalTypeTemplate\n _numeric: &NumericType\n <<: *__type\n id: \"_numeric\"\n code: 6\n template: *NumericTypeTemplate\n _string: &StringType\n <<: *__type\n id: \"_string\"\n code: 7\n template: *StringTypeTemplate\n _regex: &RegexType\n <<: *__type\n id: \"_regex\"\n code: 8\n template: *RegexTypeTemplate\n _array: &ArrayType\n <<: *__type\n id: \"_array\"\n code: 9\n template: *ArrayTypeTemplate\n argsTemplate: *ArrayTypeArgsTemplate\n _object: &ObjectType\n <<: *__type\n id: \"_object\"\n code: 10\n template: *ObjectTypeTemplate\n argsTemplate: *ObjectTypeArgsTemplate\n _null: &NullType\n <<: *__type\n id: \"_null\"\n code: 11\n template: *NullTypeTemplate\n _undefined: &UndefinedType\n <<: *__type\n id: \"_undefined\"\n code: 12\n template: *UndefinedTypeTemplate\n\nSyntax:\n equality:\n template: *EqualitySyntaxTemplate\n in:\n template: *InSyntaxTemplate\n and:\n template: *AndSyntaxTemplate\n or:\n template: *OrSyntaxTemplate\n not:\n template: *NotSyntaxTemplate\n unary:\n template: *UnarySyntaxTemplate\n binary:\n template: *BinarySyntaxTemplate\n parens:\n template: *ParensSyntaxTemplate\n eos:\n template: *EosSyntaxTemplate\n eof:\n template: *EofSyntaxTemplate\n # The new template takes in expr, and an optional skip argument and optional\n # id argument. The skip argument is a boolean that if true then doesn't add\n # new. The code argument is the symbol code being called. The template will check\n # if it is an exception, i.e. a type that is a constructor but may not use new.\n new:\n template: *NewSyntaxTemplate\n # The regex flags that change symbols between languages can be defined here.\n # Flags that aren't defined can be left blank and will be ignored.\n regexFlags: *RegexFlags\n bsonRegexFlags: *BSONRegexFlags\nImports:\n import:\n template: *ImportTemplate\n 0:\n template: *0ImportTemplate\n 1:\n template: *1ImportTemplate\n 2:\n template: *2ImportTemplate\n 3:\n template: *3ImportTemplate\n 4:\n template: *4ImportTemplate\n 5:\n template: *5ImportTemplate\n 6:\n template: *6ImportTemplate\n 7:\n template: *7ImportTemplate\n 8:\n template: *8ImportTemplate\n 9:\n template: *9ImportTemplate\n 10:\n template: *10ImportTemplate\n 11:\n template: *11ImportTemplate\n 12:\n template: *12ImportTemplate\n 100:\n template: *100ImportTemplate\n 101:\n template: *101ImportTemplate\n 102:\n template: *102ImportTemplate\n 103:\n template: *103ImportTemplate\n 104:\n template: *104ImportTemplate\n 105:\n template: *105ImportTemplate\n 106:\n template: *106ImportTemplate\n 107:\n template: *107ImportTemplate\n 108:\n template: *108ImportTemplate\n 109:\n template: *109ImportTemplate\n 110:\n template: *110ImportTemplate\n 111:\n template: *111ImportTemplate\n 112:\n template: *112ImportTemplate\n 113:\n template: *113ImportTemplate\n 114:\n template: *114ImportTemplate\n 200:\n template: *200ImportTemplate\n 201:\n template: *201ImportTemplate\n 300:\n template: *300ImportTemplate\n 301:\n template: *301ImportTemplate\n 302:\n template: *302ImportTemplate\n 303:\n template: *303ImportTemplate\n 304:\n template: *304ImportTemplate\n 305:\n template: *305ImportTemplate\n 306:\n template: *306ImportTemplate\nNativeTypes:\n Date: &DateType\n <<: *__type\n id: \"Date\"\n code: 200\n type: *ObjectType\n attr: {} # TODO: no built-in date methods added yet\n int: &intType\n <<: *__type\n id: \"int\"\n code: 105\n type: *IntegerType\n attr: {}\n float: &floatType\n <<: *__type\n id: \"float\"\n code: 104\n type: *IntegerType\n attr: {}\nBsonTypes:\n Code: &CodeType\n <<: *__type\n id: \"Code\"\n code: 100\n type: *ObjectType\n attr:\n scope:\n callable: *var\n args: null\n attr: null\n id: \"scope\"\n type: *ObjectType\n template: *CodeScopeTemplate\n argsTemplate: *CodeScopeArgsTemplate\n ObjectId: &ObjectIdType\n <<: *__type\n id: \"ObjectId\"\n code: 101\n type: *ObjectType\n attr:\n binary:\n callable: *var\n args: null\n attr: null\n type: *StringType\n template: *ObjectIdToStringTemplate\n argsTemplate: *ObjectIdToStringArgsTemplate\n generation_time:\n callable: *var\n args: null\n attr: null\n id: \"db\"\n type: *DateType\n template: *ObjectIdGetTimestampTemplate\n argsTemplate: *ObjectIdGetTimestampArgsTemplate\n Binary: &BinaryType # Not currently supported\n <<: *__type\n id: \"Binary\"\n code: 102\n type: *ObjectType\n DBRef: &DBRefType\n <<: *__type\n id: \"DBRef\"\n code: 103\n type: *ObjectType\n attr:\n database:\n callable: *var\n args: null\n attr: null\n id: \"db\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n collection:\n callable: *var\n args: null\n attr: null\n id: \"collection\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n id:\n callable: *var\n args: null\n attr: null\n id: \"id\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n Int64: &LongType\n <<: *__type\n id: \"Int64\"\n code: 106\n type: *ObjectType\n attr: {}\n MinKey: &MinKeyType\n <<: *__type\n id: \"MinKey\"\n code: 107\n type: *ObjectType\n MaxKey: &MaxKeyType\n <<: *__type\n id: \"MaxKey\"\n code: 108\n type: *ObjectType\n Regex: &BSONRegExpType\n <<: *__type\n id: \"BSONRegExp\"\n code: 109\n type: *ObjectType\n Timestamp: &TimestampType\n <<: *__type\n id: \"Timestamp\"\n code: 110\n type: *ObjectType\n attr:\n time:\n callable: *var\n args: null\n attr: null\n id: \"time\"\n type: *IntegerType\n template: *TimestampTTemplate\n argsTemplate: null\n inc:\n callable: *var\n args: null\n attr: null\n id: \"inc\"\n type: *IntegerType\n template: *TimestampITemplate\n argsTemplate: null\n as_datetime:\n <<: *__func\n id: \"inc\"\n type: *DateType\n template: *TimestampAsDateTemplate\n argsTemplate: *TimestampAsDateArgsTemplate\n Decimal128: &Decimal128Type\n <<: *__type\n id: \"Decimal128\"\n code: 112\n type: *ObjectType\n attr: {}\nBsonSymbols:\n Code: &CodeSymbol\n id: \"Code\"\n code: 100\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectType, null ]\n namedArgs:\n scope:\n default: {}\n type: [ *ObjectType ]\n type: *CodeType\n attr: {}\n template: *CodeSymbolTemplate\n argsTemplate: *CodeSymbolArgsTemplate\n ObjectId: &ObjectIdSymbol\n id: \"ObjectId\"\n code: 101\n callable: *constructor\n args:\n - [ *StringType, null ]\n namedArgs:\n oid:\n default: null\n type: [ *StringType, *ObjectIdType ]\n type: *ObjectIdType\n attr:\n from_datetime:\n <<: *__func\n id: \"ObjectIdfrom_datetime\"\n args:\n - [ \"Date\" ]\n type: *ObjectIdType\n template: *ObjectIdCreateFromTimeTemplate\n argsTemplate: *ObjectIdCreateFromTimeArgsTemplate\n is_valid:\n <<: *__func\n id: \"is_valid\"\n args:\n - [ *StringType, ]\n type: *BoolType\n template: *ObjectIdIsValidTemplate\n argsTemplate: *ObjectIdIsValidArgsTemplate\n template: *ObjectIdSymbolTemplate\n argsTemplate: *ObjectIdSymbolArgsTemplate\n Binary: &BinarySymbol # Not currently supported\n id: \"Binary\"\n code: 102\n callable: *constructor\n args: null\n type: *BinaryType\n attr: {}\n template: *BinarySymbolTemplate\n argsTemplate: *BinarySymbolArgsTemplate\n DBRef:\n id: \"DBRef\"\n code: 103\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectIdType, *StringType ]\n - [ *StringType, null ]\n namedArgs:\n database:\n default: null\n type: [ *StringType ]\n type: *DBRefType\n attr: {}\n template: *DBRefSymbolTemplate\n argsTemplate: *DBRefSymbolArgsTemplate\n Int64:\n id: \"Int64\"\n code: 106\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *LongType\n attr: {}\n template: *LongSymbolTemplate\n argsTemplate: *LongSymbolArgsTemplate\n MinKey:\n id: \"MinKey\"\n code: 107\n callable: *constructor\n args: []\n type: *MinKeyType\n attr: {}\n template: *MinKeySymbolTemplate\n argsTemplate: *MinKeySymbolArgsTemplate\n MaxKey:\n id: \"MaxKey\"\n code: 108\n callable: *constructor\n args: []\n type: *MaxKeyType\n attr: {}\n template: *MaxKeySymbolTemplate\n argsTemplate: *MaxKeySymbolArgsTemplate\n Regex:\n id: \"Regex\"\n code: 109\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *StringType, *IntegerType, null ]\n namedArgs:\n flags:\n default: 0\n type: [ *StringType, *IntegerType ]\n type: *BSONRegExpType\n attr:\n from_native:\n <<: *__func\n id: \"from_native\"\n args:\n - [ *RegexType ]\n type: *BSONRegExpType\n template: null\n argsTemplate: null\n template: *BSONRegExpSymbolTemplate\n argsTemplate: *BSONRegExpSymbolArgsTemplate\n Timestamp:\n id: \"Timestamp\"\n code: 110\n callable: *constructor\n args:\n - [ *IntegerType ]\n - [ *IntegerType ]\n type: *TimestampType\n attr: {}\n template: *TimestampSymbolTemplate\n argsTemplate: *TimestampSymbolArgsTemplate\n Decimal128:\n id: \"Decimal128\"\n code: 112\n callable: *constructor\n args:\n - [ *StringType ]\n type: *Decimal128Type\n attr: {}\n template: *Decimal128SymbolTemplate\n argsTemplate: *Decimal128SymbolArgsTemplate\n\nNativeSymbols:\n datetime: # Needs process method\n id: \"datetime\"\n code: 200\n callable: *constructor\n args:\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n type: *DateType\n attr: {} # TODO: add more date funcs?\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n re:\n id: \"re\"\n code: 8\n callable: *var\n args: null\n type: null\n attr:\n compile:\n id: \"compile\"\n code: 8\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *IntegerType, null ]\n namedArgs:\n flags:\n default: 0\n type: [ *IntegerType ]\n type: *RegexType\n attr: {}\n template: *RegExpSymbolTemplate\n argsTemplate: *RegExpSymbolArgsTemplate\n A:\n <<: *__type\n id: 're.A'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '256';\n }\n ASCII:\n <<: *__type\n id: 're.ASCII'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '256';\n }\n I:\n <<: *__type\n id: 're.I'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '2';\n }\n IGNORECASE:\n <<: *__type\n id: 're.IGNORECASE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '2';\n }\n DEBUG:\n <<: *__type\n id: 're.DEBUG'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '128';\n }\n L:\n <<: *__type\n id: 're.L'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '4';\n }\n LOCAL:\n <<: *__type\n id: 're.LOCAL'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '4';\n }\n M:\n <<: *__type\n id: 're.M'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '8';\n }\n MULTILINE:\n <<: *__type\n id: 're.MULTILINE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '8';\n }\n S:\n <<: *__type\n id: 're.S'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '16';\n }\n DOTALL:\n <<: *__type\n id: 're.DOTALL'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '16';\n }\n X:\n <<: *__type\n id: 're.X'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '64';\n }\n VERBOSE:\n <<: *__type\n id: 're.VERBOSE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '64';\n }\n template: !!js/function >\n () => {\n return '';\n }\n argsTemplate: null\n float:\n id: \"float\"\n code: 104\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *floatType\n attr: {}\n template: *DoubleSymbolTemplate\n argsTemplate: *DoubleSymbolArgsTemplate\n int:\n id: \"int\"\n code: 105\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *intType\n attr: {}\n template: *Int32SymbolTemplate\n argsTemplate: *Int32SymbolArgsTemplate\n";

@@ -1,1 +0,1 @@

module.exports="SymbolTypes:\n VAR: &var 0\n CONSTRUCTOR: &constructor 1\n FUNC: &func 2\n# Internal patterns to save typing\n__type: &__type\n id: null\n callable: *var\n args: null\n type: null\n attr: {}\n template: null\n argsTemplate: null\n__func: &__func\n callable: *func\n args: []\n attr: {}\n template: null\n argsTemplate: null\n\n# Javascript Templates\nTemplates:\n # Misc\n RegexFlags: &RegexFlags\n i: 'i'\n m: 'm'\n u: 'u'\n y: 'y'\n g: 'g'\n BSONRegexFlags: &BSONRegexFlags\n i: 'i'\n m: 'm'\n x: 'x'\n s: 's'\n l: 'l'\n u: 'u'\n # Syntax\n EqualitySyntaxTemplate: &EqualitySyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n if (op.includes('!') || op.includes('not')) {\n return `${lhs} !== ${rhs}`;\n } else if (op === '==' || op === '===' || op === 'is') {\n return `${lhs} === ${rhs}`;\n }\n return `${lhs} ${op} ${rhs}`;\n }\n InSyntaxTemplate: &InSyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n let str = '!==';\n if (op.includes('!') || op.includes('not')) {\n str = '===';\n }\n return `${rhs}.indexOf(${lhs}) ${str} -1`\n }\n AndSyntaxTemplate: &AndSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' && ');\n }\n OrSyntaxTemplate: &OrSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' || ');\n }\n NotSyntaxTemplate: &NotSyntaxTemplate !!js/function >\n (arg) => {\n return `!${arg}`;\n }\n UnarySyntaxTemplate: &UnarySyntaxTemplate null\n BinarySyntaxTemplate: &BinarySyntaxTemplate !!js/function >\n (args) => {\n return args.reduce((s, op, i, arr) => {\n if (i % 2 === 0) {\n return s;\n }\n const rhs = arr[i + 1];\n switch(op) {\n case '//':\n return `Math.floor(${s}, ${rhs})`;\n case '**':\n return `Math.pow(${s}, ${rhs})`;\n default:\n return `${s} ${op} ${rhs}`;\n }\n }, args[0]);\n }\n ParensSyntaxTemplate: &ParensSyntaxTemplate null\n EosSyntaxTemplate: &EosSyntaxTemplate null\n EofSyntaxTemplate: &EofSyntaxTemplate null\n NewTemplate: &NewSyntaxTemplate !!js/function >\n (expr, skip, code) => {\n // Add classes that don't use \"new\" to array.\n // So far: [Date.now, Decimal128/NumberDecimal, Long/NumberLong]\n noNew = [200.1, 112, 106];\n if (skip || (code && noNew.indexOf(code) !== -1)) {\n return expr;\n }\n return `new ${expr}`;\n }\n # BSON Object Type templates\n CodeTypeTemplate: &CodeTypeTemplate null\n StringTypeTemplate: &StringTypeTemplate !!js/function >\n (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n }\n RegexTypeTemplate: &RegexTypeTemplate !!js/function >\n (pattern, flags) => {\n const str = pattern;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n pattern = `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n return `RegExp(${pattern}${flags ? ', ' + '\\'' + flags + '\\'': ''})`;\n }\n BoolTypeTemplate: &BoolTypeTemplate !!js/function >\n (literal) => {\n return literal.toLowerCase();\n }\n IntegerTypeTemplate: &IntegerTypeTemplate null\n DecimalTypeTemplate: &DecimalTypeTemplate null\n LongBasicTypeTemplate: &LongBasicTypeTemplate null\n HexTypeTemplate: &HexTypeTemplate null\n OctalTypeTemplate: &OctalTypeTemplate null\n NumericTypeTemplate: &NumericTypeTemplate null\n ArrayTypeTemplate: &ArrayTypeTemplate !!js/function >\n (literal, depth) => {\n depth++;\n if (literal === '') {\n return '[]'\n }\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n\n return `[${indent}${literal}${closingIndent}]`;\n }\n ArrayTypeArgsTemplate: &ArrayTypeArgsTemplate null\n NullTypeTemplate: &NullTypeTemplate !!js/function >\n () => {\n return 'null';\n }\n UndefinedTypeTemplate: &UndefinedTypeTemplate !!js/function >\n () => {\n return 'undefined';\n }\n ObjectTypeTemplate: &ObjectTypeTemplate !!js/function >\n (literal) => {\n if (literal === '') {\n return '{}';\n }\n return literal;\n }\n ObjectTypeArgsTemplate: &ObjectTypeArgsTemplate !!js/function >\n (args, depth) => {\n if (args.length === 0) {\n return '{}';\n }\n depth++;\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n }\n const pairs = args.map((arg) => {\n return `${indent}${singleStringify(arg[0])}: ${arg[1]}`;\n }).join(', ');\n\n return `{${pairs}${closingIndent}}`\n }\n # BSON Object Method templates\n CodeCodeTemplate: &CodeCodeTemplate null\n CodeCodeArgsTemplate: &CodeCodeArgsTemplate null\n CodeScopeTemplate: &CodeScopeTemplate null\n CodeScopeArgsTemplate: &CodeScopeArgsTemplate null\n ObjectIdToStringTemplate: &ObjectIdToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toString()`;\n }\n ObjectIdToStringArgsTemplate: &ObjectIdToStringArgsTemplate !!js/function >\n () => {\n return '';\n }\n ObjectIdEqualsTemplate: &ObjectIdEqualsTemplate null\n ObjectIdEqualsArgsTemplate: &ObjectIdEqualsArgsTemplate null\n ObjectIdGetTimestampTemplate: &ObjectIdGetTimestampTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTimestamp()`;\n }\n ObjectIdGetTimestampArgsTemplate: &ObjectIdGetTimestampArgsTemplate !!js/function >\n () => {\n return '';\n }\n BinaryValueTemplate: &BinaryValueTemplate null\n BinaryValueArgsTemplate: &BinaryValueArgsTemplate null\n BinaryLengthTemplate: &BinaryLengthTemplate null\n BinaryLengthArgsTemplate: &BinaryLengthArgsTemplate null\n BinaryToStringTemplate: &BinaryToStringTemplate null\n BinaryToStringArgsTemplate: &BinaryToStringArgsTemplate null\n BinarySubtypeTemplate: &BinarySubtypeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.sub_type`;\n }\n BinarySubtypeArgsTemplate: &BinarySubtypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetDBTemplate: &DBRefGetDBTemplate !!js/function >\n (lhs) => {\n return `${lhs}.db`;\n }\n DBRefGetCollectionTemplate: &DBRefGetCollectionTemplate !!js/function >\n (lhs) => {\n return `${lhs}.namespace`;\n }\n DBRefGetIdTemplate: &DBRefGetIdTemplate !!js/function >\n (lhs) => {\n return `${lhs}.oid`;\n }\n DBRefGetDBArgsTemplate: &DBRefGetDBArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetCollectionArgsTemplate: &DBRefGetCollectionArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetIdArgsTemplate: &DBRefGetIdArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongEqualsTemplate: &LongEqualsTemplate null\n LongEqualsArgsTemplate: &LongEqualsArgsTemplate null\n LongToStringTemplate: &LongToStringTemplate null\n LongToStringArgsTemplate: &LongToStringArgsTemplate null\n LongToIntTemplate: &LongToIntTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toInt`;\n }\n LongToIntArgsTemplate: &LongToIntArgsTemplate null\n LongToNumberTemplate: &LongToNumberTemplate null\n LongToNumberArgsTemplate: &LongToNumberArgsTemplate null\n LongAddTemplate: &LongAddTemplate null\n LongAddArgsTemplate: &LongAddArgsTemplate null\n LongSubtractTemplate: &LongSubtractTemplate null\n LongSubtractArgsTemplate: &LongSubtractArgsTemplate null\n LongMultiplyTemplate: &LongMultiplyTemplate null\n LongMultiplyArgsTemplate: &LongMultiplyArgsTemplate null\n LongDivTemplate: &LongDivTemplate null\n LongDivArgsTemplate: &LongDivArgsTemplate null\n LongModuloTemplate: &LongModuloTemplate null\n LongModuloArgsTemplate: &LongModuloArgsTemplate null\n LongAndTemplate: &LongAndTemplate null\n LongAndArgsTemplate: &LongAndArgsTemplate null\n LongOrTemplate: &LongOrTemplate null\n LongOrArgsTemplate: &LongOrArgsTemplate null\n LongXorTemplate: &LongXorTemplate null\n LongXorArgsTemplate: &LongXorArgsTemplate null\n LongShiftLeftTemplate: &LongShiftLeftTemplate null\n LongShiftLeftArgsTemplate: &LongShiftLeftArgsTemplate null\n LongShiftRightTemplate: &LongShiftRightTemplate null\n LongShiftRightArgsTemplate: &LongShiftRightArgsTemplate null\n LongCompareTemplate: &LongCompareTemplate null\n LongCompareArgsTemplate: &LongCompareArgsTemplate null\n LongIsOddTemplate: &LongIsOddTemplate null\n LongIsOddArgsTemplate: &LongIsOddArgsTemplate null\n LongIsZeroTemplate: &LongIsZeroTemplate null\n LongIsZeroArgsTemplate: &LongIsZeroArgsTemplate null\n LongIsNegativeTemplate: &LongIsNegativeTemplate null\n LongIsNegativeArgsTemplate: &LongIsNegativeArgsTemplate null\n LongNegateTemplate: &LongNegateTemplate null\n LongNegateArgsTemplate: &LongNegateArgsTemplate null\n LongNotTemplate: &LongNotTemplate null\n LongNotArgsTemplate: &LongNotArgsTemplate null\n LongNotEqualsTemplate: &LongNotEqualsTemplate null\n LongNotEqualsArgsTemplate: &LongNotEqualsArgsTemplate null\n LongGreaterThanTemplate: &LongGreaterThanTemplate null\n LongGreaterThanArgsTemplate: &LongGreaterThanArgsTemplate null\n LongGreaterThanOrEqualTemplate: &LongGreaterThanOrEqualTemplate null\n LongGreaterThanOrEqualArgsTemplate: &LongGreaterThanOrEqualArgsTemplate null\n LongLessThanTemplate: &LongLessThanTemplate null\n LongLessThanArgsTemplate: &LongLessThanArgsTemplate null\n LongLessThanOrEqualTemplate: &LongLessThanOrEqualTemplate null\n LongLessThanOrEqualArgsTemplate: &LongLessThanOrEqualArgsTemplate null\n LongFloatApproxTemplate: &LongFloatApproxTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toNumber()`;\n }\n LongTopTemplate: &LongTopTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits()`;\n }\n LongBottomTemplate: &LongBottomTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits()`;\n }\n TimestampToStringTemplate: &TimestampToStringTemplate null\n TimestampToStringArgsTemplate: &TimestampToStringArgsTemplate null\n TimestampEqualsTemplate: &TimestampEqualsTemplate null\n TimestampEqualsArgsTemplate: &TimestampEqualsArgsTemplate null\n TimestampGetLowBitsTemplate: &TimestampGetLowBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits`;\n }\n TimestampGetLowBitsArgsTemplate: &TimestampGetLowBitsArgsTemplate null\n TimestampGetHighBitsTemplate: &TimestampGetHighBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits`;\n }\n TimestampGetHighBitsArgsTemplate: &TimestampGetHighBitsArgsTemplate null\n TimestampTTemplate: &TimestampTTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits()`;\n }\n TimestampITemplate: &TimestampITemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits()`;\n }\n TimestampAsDateTemplate: &TimestampAsDateTemplate !!js/function >\n (lhs) => {\n return `new Date(${lhs}.getHighBits() * 1000)`;\n }\n TimestampAsDateArgsTemplate: &TimestampAsDateArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampCompareTemplate: &TimestampCompareTemplate null\n TimestampCompareArgsTemplate: &TimestampCompareArgsTemplate null\n TimestampNotEqualsTemplate: &TimestampNotEqualsTemplate null\n TimestampNotEqualsArgsTemplate: &TimestampNotEqualsArgsTemplate null\n TimestampGreaterThanTemplate: &TimestampGreaterThanTemplate null\n TimestampGreaterThanArgsTemplate: &TimestampGreaterThanArgsTemplate null\n TimestampGreaterThanOrEqualTemplate: &TimestampGreaterThanOrEqualTemplate null\n TimestampGreaterThanOrEqualArgsTemplate: &TimestampGreaterThanOrEqualArgsTemplate null\n TimestampLessThanTemplate: &TimestampLessThanTemplate null\n TimestampLessThanArgsTemplate: &TimestampLessThanArgsTemplate null\n TimestampLessThanOrEqualTemplate: &TimestampLessThanOrEqualTemplate null\n TimestampLessThanOrEqualArgsTemplate: &TimestampLessThanOrEqualArgsTemplate null\n SymbolValueOfTemplate: &SymbolValueOfTemplate null\n SymbolValueOfArgsTemplate: &SymbolValueOfArgsTemplate null\n SymbolInspectTemplate: &SymbolInspectTemplate null\n SymbolInspectArgsTemplate: &SymbolInspectArgsTemplate null\n SymbolToStringTemplate: &SymbolToStringTemplate null\n SymbolToStringArgsTemplate: &SymbolToStringArgsTemplate null\n # Symbol Templates\n CodeSymbolTemplate: &CodeSymbolTemplate null\n CodeSymbolArgsTemplate: &CodeSymbolArgsTemplate !!js/function >\n (lhs, code, scope) => {\n code = code === undefined ? '\\'\\'' : code;\n scope = scope === undefined ? '' : `, ${scope}`;\n return `(${code}${scope})`;\n }\n ObjectIdSymbolTemplate: &ObjectIdSymbolTemplate null\n ObjectIdSymbolArgsTemplate: &ObjectIdSymbolArgsTemplate !!js/function >\n (lhs, str) => {\n if (!str || str.length === 0) {\n return '()';\n }\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `('${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}')`;\n }\n BinarySymbolTemplate: &BinarySymbolTemplate !!js/function >\n () => {\n return 'Binary';\n }\n BinarySymbolArgsTemplate: &BinarySymbolArgsTemplate !!js/function >\n (lhs, buffer, subtype) => {\n return `(${buffer.toString('base64')}, '${subtype}')`;\n }\n BinarySymbolSubtypeDefaultTemplate: &BinarySymbolSubtypeDefaultTemplate null\n BinarySymbolSubtypeFunctionTemplate: &BinarySymbolSubtypeFunctionTemplate null\n BinarySymbolSubtypeByteArrayTemplate: &BinarySymbolSubtypeByteArrayTemplate null\n BinarySymbolSubtypeUuidOldTemplate: &BinarySymbolSubtypeUuidOldTemplate null\n BinarySymbolSubtypeUuidTemplate: &BinarySymbolSubtypeUuidTemplate null\n BinarySymbolSubtypeMd5Template: &BinarySymbolSubtypeMd5Template null\n BinarySymbolSubtypeUserDefinedTemplate: &BinarySymbolSubtypeUserDefinedTemplate null\n DBRefSymbolTemplate: &DBRefSymbolTemplate null\n DBRefSymbolArgsTemplate: &DBRefSymbolArgsTemplate null\n DoubleSymbolTemplate: &DoubleSymbolTemplate !!js/function >\n () => {\n return 'Double';\n }\n DoubleSymbolArgsTemplate: &DoubleSymbolArgsTemplate null\n Int32SymbolTemplate: &Int32SymbolTemplate !!js/function >\n () => {\n return 'Int32';\n }\n Int32SymbolArgsTemplate: &Int32SymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? 0 : arg;\n return `(${arg})`;\n }\n LongSymbolTemplate: &LongSymbolTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolArgsTemplate: &LongSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Long.fromString(${arg})`;\n }\n return `Long.fromNumber(${arg})`;\n }\n LongSymbolMaxTemplate: &LongSymbolMaxTemplate null\n LongSymbolMaxArgsTemplate: &LongSymbolMaxArgsTemplate null\n LongSymbolMinTemplate: &LongSymbolMinTemplate null\n LongSymbolMinArgsTemplate: &LongSymbolMinArgsTemplate null\n LongSymbolZeroTemplate: &LongSymbolZeroTemplate null\n LongSymbolZeroArgsTemplate: &LongSymbolZeroArgsTemplate null\n LongSymbolOneTemplate: &LongSymbolOneTemplate null\n LongSymbolOneArgsTemplate: &LongSymbolOneArgsTemplate null\n LongSymbolNegOneTemplate: &LongSymbolNegOneTemplate null\n LongSymbolNegOneArgsTemplate: &LongSymbolNegOneArgsTemplate null\n LongSymbolFromBitsTemplate: &LongSymbolFromBitsTemplate null\n LongSymbolFromBitsArgsTemplate: &LongSymbolFromBitsArgsTemplate null\n LongSymbolFromIntTemplate: &LongSymbolFromIntTemplate null\n LongSymbolFromIntArgsTemplate: &LongSymbolFromIntArgsTemplate null\n LongSymbolFromNumberTemplate: &LongSymbolFromNumberTemplate null\n LongSymbolFromNumberArgsTemplate: &LongSymbolFromNumberArgsTemplate null\n LongSymbolFromStringTemplate: &LongSymbolFromStringTemplate null\n LongSymbolFromStringArgsTemplate: &LongSymbolFromStringArgsTemplate null\n MinKeySymbolTemplate: &MinKeySymbolTemplate null\n MinKeySymbolArgsTemplate: &MinKeySymbolArgsTemplate null\n MaxKeySymbolTemplate: &MaxKeySymbolTemplate null\n MaxKeySymbolArgsTemplate: &MaxKeySymbolArgsTemplate null\n TimestampSymbolTemplate: &TimestampSymbolTemplate null\n TimestampSymbolArgsTemplate: &TimestampSymbolArgsTemplate !!js/function >\n (lhs, arg1, arg2) => {\n return `(${arg1 === undefined ? 0 : arg1}, ${arg2 === undefined ? 0 : arg2})`;\n }\n SymbolSymbolTemplate: &SymbolSymbolTemplate !!js/function >\n () => {\n return 'BSONSymbol';\n }\n SymbolSymbolArgsTemplate: &SymbolSymbolArgsTemplate null\n BSONRegExpSymbolTemplate: &BSONRegExpSymbolTemplate !!js/function >\n () => {\n return 'BSONRegExp';\n }\n BSONRegExpSymbolArgsTemplate: &BSONRegExpSymbolArgsTemplate !!js/function >\n (lhs, pattern, flags) => {\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n }\n return `(${singleStringify(pattern)}${flags ? ', ' + singleStringify(flags) : ''})`;\n }\n Decimal128SymbolTemplate: &Decimal128SymbolTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolArgsTemplate: &Decimal128SymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? '0' : arg.toString();\n if (arg.charAt(0) === '\\'' && arg.charAt(arg.length - 1) === '\\'') {\n return `.fromString(${arg})`;\n }\n return `.fromString('${arg}')`;\n }\n Decimal128SymbolFromStringTemplate: &Decimal128SymbolFromStringTemplate null\n Decimal128SymbolFromStringArgsTemplate: &Decimal128SymbolFromStringArgsTemplate null\n Decimal128ToStringTemplate: &Decimal128ToStringTemplate null\n Decimal128ToStringArgsTemplate: &Decimal128ToStringArgsTemplate null\n # BSON Util Templates\n ObjectIdCreateFromHexStringTemplate: &ObjectIdCreateFromHexStringTemplate null\n ObjectIdCreateFromHexStringArgsTemplate: &ObjectIdCreateFromHexStringArgsTemplate null\n ObjectIdCreateFromTimeTemplate: &ObjectIdCreateFromTimeTemplate !!js/function >\n () => {\n return `ObjectId.createFromTime`;\n }\n ObjectIdCreateFromTimeArgsTemplate: &ObjectIdCreateFromTimeArgsTemplate !!js/function >\n (lhs, arg, isNumber) => {\n if (!isNumber) {\n return `(${arg}.getTime() / 1000)`;\n }\n return `(${arg})`;\n }\n ObjectIdIsValidTemplate: &ObjectIdIsValidTemplate !!js/function >\n (lhs) => {\n return `${lhs}.isValid`;\n }\n ObjectIdIsValidArgsTemplate: &ObjectIdIsValidArgsTemplate null\n # JS Symbol Templates\n NumberSymbolTemplate: &NumberSymbolTemplate !!js/function >\n () => {\n return 'Number';\n }\n NumberSymbolArgsTemplate: &NumberSymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? '0' : arg;\n return `(${arg})`;\n }\n DateSymbolTemplate: &DateSymbolTemplate !!js/function >\n () => {\n return 'Date';\n }\n DateSymbolArgsTemplate: &DateSymbolArgsTemplate null\n DateSymbolNowTemplate: &DateSymbolNowTemplate !!js/function >\n () => {\n return 'Date.now';\n }\n DateSymbolNowArgsTemplate: &DateSymbolNowArgsTemplate null\n RegExpSymbolTemplate: &RegExpSymbolTemplate !!js/function >\n () => {\n return 'RegExp';\n }\n RegExpSymbolArgsTemplate: &RegExpSymbolArgsTemplate null\n ImportTemplate: &ImportTemplate !!js/function >\n (args) => {\n const bson = [];\n const other = [];\n Object.keys(args).map(\n (m) => {\n if (m > 99 && m < 200) {\n bson.push(args[m]);\n } else {\n other.push(args[m]);\n }\n }\n );\n if (bson.length) {\n other.push(`const {\\n ${bson.join(',\\n ')}\\n} = require('mongo');`);\n }\n return other.join('\\n');\n }\n 0ImportTemplate: &0ImportTemplate null\n 1ImportTemplate: &1ImportTemplate null\n 2ImportTemplate: &2ImportTemplate null\n 3ImportTemplate: &3ImportTemplate null\n 4ImportTemplate: &4ImportTemplate null\n 5ImportTemplate: &5ImportTemplate null\n 6ImportTemplate: &6ImportTemplate null\n 7ImportTemplate: &7ImportTemplate null\n 8ImportTemplate: &8ImportTemplate null\n 9ImportTemplate: &9ImportTemplate null\n 10ImportTemplate: &10ImportTemplate null\n 11ImportTemplate: &11ImportTemplate null\n 12ImportTemplate: &12ImportTemplate null\n 100ImportTemplate: &100ImportTemplate !!js/function >\n () => {\n return 'Code';\n }\n 101ImportTemplate: &101ImportTemplate !!js/function >\n () => {\n return 'ObjectId';\n }\n 102ImportTemplate: &102ImportTemplate !!js/function >\n () => {\n return 'Binary';\n }\n 103ImportTemplate: &103ImportTemplate !!js/function >\n () => {\n return 'DBRef';\n }\n 104ImportTemplate: &104ImportTemplate !!js/function >\n () => {\n return 'Double';\n }\n 105ImportTemplate: &105ImportTemplate !!js/function >\n () => {\n return 'Int32';\n }\n 106ImportTemplate: &106ImportTemplate !!js/function >\n () => {\n return 'Long';\n }\n 107ImportTemplate: &107ImportTemplate !!js/function >\n () => {\n return 'MinKey';\n }\n 108ImportTemplate: &108ImportTemplate !!js/function >\n () => {\n return 'MaxKey';\n }\n 109ImportTemplate: &109ImportTemplate !!js/function >\n () => {\n return 'BSONRegExp';\n }\n 110ImportTemplate: &110ImportTemplate !!js/function >\n () => {\n return 'Timestamp';\n }\n 111ImportTemplate: &111ImportTemplate !!js/function >\n () => {\n return 'BSONSymbol';\n }\n 112ImportTemplate: &112ImportTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n 113ImportTemplate: &113ImportTemplate null\n 114ImportTemplate: &114ImportTemplate null\n 200ImportTemplate: &200ImportTemplate null\n 201ImportTemplate: &201ImportTemplate null\n 300ImportTemplate: &300ImportTemplate null\n 301ImportTemplate: &301ImportTemplate null\n 302ImportTemplate: &302ImportTemplate null\n 303ImportTemplate: &303ImportTemplate null\n 304ImportTemplate: &304ImportTemplate null\n 305ImportTemplate: &305ImportTemplate null\n 306ImportTemplate: &306ImportTemplate null\n# Universal types\n# Everything inherits from StringType because we haven't implemented any of them.\nBasicTypes:\n # Universal basic types\n _bool: &BoolType\n <<: *__type\n id: \"_bool\"\n code: 0\n template: *BoolTypeTemplate\n _integer: &IntegerType\n <<: *__type\n id: \"_integer\"\n code: 1\n template: *IntegerTypeTemplate\n _long: &LongBasicType\n <<: *__type\n id: \"_long\"\n code: 2\n template: *LongBasicTypeTemplate\n _decimal: &DecimalType\n <<: *__type\n id: \"_decimal\"\n code: 3\n template: *DecimalTypeTemplate\n _hex: &HexType\n <<: *__type\n id: \"_hex\"\n code: 4\n template: *HexTypeTemplate\n _octal: &OctalType\n <<: *__type\n id: \"_octal\"\n code: 5\n template: *OctalTypeTemplate\n _numeric: &NumericType\n <<: *__type\n id: \"_numeric\"\n code: 6\n template: *NumericTypeTemplate\n _string: &StringType\n <<: *__type\n id: \"_string\"\n code: 7\n template: *StringTypeTemplate\n _regex: &RegexType\n <<: *__type\n id: \"_regex\"\n code: 8\n template: *RegexTypeTemplate\n _array: &ArrayType\n <<: *__type\n id: \"_array\"\n code: 9\n template: *ArrayTypeTemplate\n argsTemplate: *ArrayTypeArgsTemplate\n _object: &ObjectType\n <<: *__type\n id: \"_object\"\n code: 10\n template: *ObjectTypeTemplate\n argsTemplate: *ObjectTypeArgsTemplate\n _null: &NullType\n <<: *__type\n id: \"_null\"\n code: 11\n template: *NullTypeTemplate\n _undefined: &UndefinedType\n <<: *__type\n id: \"_undefined\"\n code: 12\n template: *UndefinedTypeTemplate\n\nSyntax:\n equality:\n template: *EqualitySyntaxTemplate\n in:\n template: *InSyntaxTemplate\n and:\n template: *AndSyntaxTemplate\n or:\n template: *OrSyntaxTemplate\n not:\n template: *NotSyntaxTemplate\n unary:\n template: *UnarySyntaxTemplate\n binary:\n template: *BinarySyntaxTemplate\n parens:\n template: *ParensSyntaxTemplate\n eos:\n template: *EosSyntaxTemplate\n eof:\n template: *EofSyntaxTemplate\n # The new template takes in expr, and an optional skip argument and optional\n # id argument. The skip argument is a boolean that if true then doesn't add\n # new. The code argument is the symbol code being called. The template will check\n # if it is an exception, i.e. a type that is a constructor but may not use new.\n new:\n template: *NewSyntaxTemplate\n # The regex flags that change symbols between languages can be defined here.\n # Flags that aren't defined can be left blank and will be ignored.\n regexFlags: *RegexFlags\n bsonRegexFlags: *BSONRegexFlags\nImports:\n import:\n template: *ImportTemplate\n 0:\n template: *0ImportTemplate\n 1:\n template: *1ImportTemplate\n 2:\n template: *2ImportTemplate\n 3:\n template: *3ImportTemplate\n 4:\n template: *4ImportTemplate\n 5:\n template: *5ImportTemplate\n 6:\n template: *6ImportTemplate\n 7:\n template: *7ImportTemplate\n 8:\n template: *8ImportTemplate\n 9:\n template: *9ImportTemplate\n 10:\n template: *10ImportTemplate\n 11:\n template: *11ImportTemplate\n 12:\n template: *12ImportTemplate\n 100:\n template: *100ImportTemplate\n 101:\n template: *101ImportTemplate\n 102:\n template: *102ImportTemplate\n 103:\n template: *103ImportTemplate\n 104:\n template: *104ImportTemplate\n 105:\n template: *105ImportTemplate\n 106:\n template: *106ImportTemplate\n 107:\n template: *107ImportTemplate\n 108:\n template: *108ImportTemplate\n 109:\n template: *109ImportTemplate\n 110:\n template: *110ImportTemplate\n 111:\n template: *111ImportTemplate\n 112:\n template: *112ImportTemplate\n 113:\n template: *113ImportTemplate\n 114:\n template: *114ImportTemplate\n 200:\n template: *200ImportTemplate\n 201:\n template: *201ImportTemplate\n 300:\n template: *300ImportTemplate\n 301:\n template: *301ImportTemplate\n 302:\n template: *302ImportTemplate\n 303:\n template: *303ImportTemplate\n 304:\n template: *304ImportTemplate\n 305:\n template: *305ImportTemplate\n 306:\n template: *306ImportTemplate\nNativeTypes:\n Date: &DateType\n <<: *__type\n id: \"Date\"\n code: 200\n type: *ObjectType\n attr: {} # TODO: no built-in date methods added yet\n int: &intType\n <<: *__type\n id: \"int\"\n code: 105\n type: *IntegerType\n attr: {}\n float: &floatType\n <<: *__type\n id: \"float\"\n code: 104\n type: *IntegerType\n attr: {}\nBsonTypes:\n Code: &CodeType\n <<: *__type\n id: \"Code\"\n code: 100\n type: *ObjectType\n attr:\n scope:\n callable: *var\n args: null\n attr: null\n id: \"scope\"\n type: *ObjectType\n template: *CodeScopeTemplate\n argsTemplate: *CodeScopeArgsTemplate\n ObjectId: &ObjectIdType\n <<: *__type\n id: \"ObjectId\"\n code: 101\n type: *ObjectType\n attr:\n binary:\n callable: *var\n args: null\n attr: null\n type: *StringType\n template: *ObjectIdToStringTemplate\n argsTemplate: *ObjectIdToStringArgsTemplate\n generation_time:\n callable: *var\n args: null\n attr: null\n id: \"db\"\n type: *DateType\n template: *ObjectIdGetTimestampTemplate\n argsTemplate: *ObjectIdGetTimestampArgsTemplate\n Binary: &BinaryType # Not currently supported\n <<: *__type\n id: \"Binary\"\n code: 102\n type: *ObjectType\n DBRef: &DBRefType\n <<: *__type\n id: \"DBRef\"\n code: 103\n type: *ObjectType\n attr:\n database:\n callable: *var\n args: null\n attr: null\n id: \"db\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n collection:\n callable: *var\n args: null\n attr: null\n id: \"collection\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n id:\n callable: *var\n args: null\n attr: null\n id: \"id\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n Int64: &LongType\n <<: *__type\n id: \"Int64\"\n code: 106\n type: *ObjectType\n attr: {}\n MinKey: &MinKeyType\n <<: *__type\n id: \"MinKey\"\n code: 107\n type: *ObjectType\n MaxKey: &MaxKeyType\n <<: *__type\n id: \"MaxKey\"\n code: 108\n type: *ObjectType\n Regex: &BSONRegExpType\n <<: *__type\n id: \"BSONRegExp\"\n code: 109\n type: *ObjectType\n Timestamp: &TimestampType\n <<: *__type\n id: \"Timestamp\"\n code: 110\n type: *ObjectType\n attr:\n time:\n callable: *var\n args: null\n attr: null\n id: \"time\"\n type: *IntegerType\n template: *TimestampTTemplate\n argsTemplate: null\n inc:\n callable: *var\n args: null\n attr: null\n id: \"inc\"\n type: *IntegerType\n template: *TimestampITemplate\n argsTemplate: null\n as_datetime:\n <<: *__func\n id: \"inc\"\n type: *DateType\n template: *TimestampAsDateTemplate\n argsTemplate: *TimestampAsDateArgsTemplate\n Decimal128: &Decimal128Type\n <<: *__type\n id: \"Decimal128\"\n code: 112\n type: *ObjectType\n attr: {}\nBsonSymbols:\n Code: &CodeSymbol\n id: \"Code\"\n code: 100\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectType, null ]\n namedArgs:\n scope:\n default: {}\n type: [ *ObjectType ]\n type: *CodeType\n attr: {}\n template: *CodeSymbolTemplate\n argsTemplate: *CodeSymbolArgsTemplate\n ObjectId: &ObjectIdSymbol\n id: \"ObjectId\"\n code: 101\n callable: *constructor\n args:\n - [ *StringType, null ]\n namedArgs:\n oid:\n default: null\n type: [ *StringType, *ObjectIdType ]\n type: *ObjectIdType\n attr:\n from_datetime:\n <<: *__func\n id: \"ObjectIdfrom_datetime\"\n args:\n - [ \"Date\" ]\n type: *ObjectIdType\n template: *ObjectIdCreateFromTimeTemplate\n argsTemplate: *ObjectIdCreateFromTimeArgsTemplate\n is_valid:\n <<: *__func\n id: \"is_valid\"\n args:\n - [ *StringType, ]\n type: *BoolType\n template: *ObjectIdIsValidTemplate\n argsTemplate: *ObjectIdIsValidArgsTemplate\n template: *ObjectIdSymbolTemplate\n argsTemplate: *ObjectIdSymbolArgsTemplate\n Binary: &BinarySymbol # Not currently supported\n id: \"Binary\"\n code: 102\n callable: *constructor\n args: null\n type: *BinaryType\n attr: {}\n template: *BinarySymbolTemplate\n argsTemplate: *BinarySymbolArgsTemplate\n DBRef:\n id: \"DBRef\"\n code: 103\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectIdType, *StringType ]\n - [ *StringType, null ]\n namedArgs:\n database:\n default: null\n type: [ *StringType ]\n type: *DBRefType\n attr: {}\n template: *DBRefSymbolTemplate\n argsTemplate: *DBRefSymbolArgsTemplate\n Int64:\n id: \"Int64\"\n code: 106\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *LongType\n attr: {}\n template: *LongSymbolTemplate\n argsTemplate: *LongSymbolArgsTemplate\n MinKey:\n id: \"MinKey\"\n code: 107\n callable: *constructor\n args: []\n type: *MinKeyType\n attr: {}\n template: *MinKeySymbolTemplate\n argsTemplate: *MinKeySymbolArgsTemplate\n MaxKey:\n id: \"MaxKey\"\n code: 108\n callable: *constructor\n args: []\n type: *MaxKeyType\n attr: {}\n template: *MaxKeySymbolTemplate\n argsTemplate: *MaxKeySymbolArgsTemplate\n Regex:\n id: \"Regex\"\n code: 109\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *StringType, *IntegerType, null ]\n namedArgs:\n flags:\n default: 0\n type: [ *StringType, *IntegerType ]\n type: *BSONRegExpType\n attr:\n from_native:\n <<: *__func\n id: \"from_native\"\n args:\n - [ *RegexType ]\n type: *BSONRegExpType\n template: null\n argsTemplate: null\n template: *BSONRegExpSymbolTemplate\n argsTemplate: *BSONRegExpSymbolArgsTemplate\n Timestamp:\n id: \"Timestamp\"\n code: 110\n callable: *constructor\n args:\n - [ *IntegerType ]\n - [ *IntegerType ]\n type: *TimestampType\n attr: {}\n template: *TimestampSymbolTemplate\n argsTemplate: *TimestampSymbolArgsTemplate\n Decimal128:\n id: \"Decimal128\"\n code: 112\n callable: *constructor\n args:\n - [ *StringType ]\n type: *Decimal128Type\n attr: {}\n template: *Decimal128SymbolTemplate\n argsTemplate: *Decimal128SymbolArgsTemplate\n\nNativeSymbols:\n datetime: # Needs process method\n id: \"datetime\"\n code: 200\n callable: *constructor\n args:\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n type: *DateType\n attr: {} # TODO: add more date funcs?\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n re:\n id: \"re\"\n code: 8\n callable: *var\n args: null\n type: null\n attr:\n compile:\n id: \"compile\"\n code: 8\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *IntegerType, null ]\n namedArgs:\n flags:\n default: 0\n type: [ *IntegerType ]\n type: *RegexType\n attr: {}\n template: *RegExpSymbolTemplate\n argsTemplate: *RegExpSymbolArgsTemplate\n A:\n <<: *__type\n id: 're.A'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '256';\n }\n ASCII:\n <<: *__type\n id: 're.ASCII'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '256';\n }\n I:\n <<: *__type\n id: 're.I'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '2';\n }\n IGNORECASE:\n <<: *__type\n id: 're.IGNORECASE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '2';\n }\n DEBUG:\n <<: *__type\n id: 're.DEBUG'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '128';\n }\n L:\n <<: *__type\n id: 're.L'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '4';\n }\n LOCAL:\n <<: *__type\n id: 're.LOCAL'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '4';\n }\n M:\n <<: *__type\n id: 're.M'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '8';\n }\n MULTILINE:\n <<: *__type\n id: 're.MULTILINE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '8';\n }\n S:\n <<: *__type\n id: 're.S'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '16';\n }\n DOTALL:\n <<: *__type\n id: 're.DOTALL'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '16';\n }\n X:\n <<: *__type\n id: 're.X'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '64';\n }\n VERBOSE:\n <<: *__type\n id: 're.VERBOSE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '64';\n }\n template: !!js/function >\n () => {\n return '';\n }\n argsTemplate: null\n float:\n id: \"float\"\n code: 104\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *floatType\n attr: {}\n template: *DoubleSymbolTemplate\n argsTemplate: *DoubleSymbolArgsTemplate\n int:\n id: \"int\"\n code: 105\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *intType\n attr: {}\n template: *Int32SymbolTemplate\n argsTemplate: *Int32SymbolArgsTemplate\n";
module.exports="SymbolTypes:\n VAR: &var 0\n CONSTRUCTOR: &constructor 1\n FUNC: &func 2\n# Internal patterns to save typing\n__type: &__type\n id: null\n callable: *var\n args: null\n type: null\n attr: {}\n template: null\n argsTemplate: null\n__func: &__func\n callable: *func\n args: []\n attr: {}\n template: null\n argsTemplate: null\n\n# Javascript Templates\nTemplates:\n # Misc\n RegexFlags: &RegexFlags\n i: 'i'\n m: 'm'\n u: 'u'\n y: 'y'\n g: 'g'\n BSONRegexFlags: &BSONRegexFlags\n i: 'i'\n m: 'm'\n x: 'x'\n s: 's'\n l: 'l'\n u: 'u'\n # Syntax\n EqualitySyntaxTemplate: &EqualitySyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n if (op.includes('!') || op.includes('not')) {\n return `${lhs} !== ${rhs}`;\n } else if (op === '==' || op === '===' || op === 'is') {\n return `${lhs} === ${rhs}`;\n }\n return `${lhs} ${op} ${rhs}`;\n }\n InSyntaxTemplate: &InSyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n let str = '!==';\n if (op.includes('!') || op.includes('not')) {\n str = '===';\n }\n return `${rhs}.indexOf(${lhs}) ${str} -1`\n }\n AndSyntaxTemplate: &AndSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' && ');\n }\n OrSyntaxTemplate: &OrSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' || ');\n }\n NotSyntaxTemplate: &NotSyntaxTemplate !!js/function >\n (arg) => {\n return `!${arg}`;\n }\n UnarySyntaxTemplate: &UnarySyntaxTemplate null\n BinarySyntaxTemplate: &BinarySyntaxTemplate !!js/function >\n (args) => {\n return args.reduce((s, op, i, arr) => {\n if (i % 2 === 0) {\n return s;\n }\n const rhs = arr[i + 1];\n switch(op) {\n case '//':\n return `Math.floor(${s}, ${rhs})`;\n case '**':\n return `Math.pow(${s}, ${rhs})`;\n default:\n return `${s} ${op} ${rhs}`;\n }\n }, args[0]);\n }\n ParensSyntaxTemplate: &ParensSyntaxTemplate null\n EosSyntaxTemplate: &EosSyntaxTemplate null\n EofSyntaxTemplate: &EofSyntaxTemplate null\n NewTemplate: &NewSyntaxTemplate !!js/function >\n (expr, skip, code) => {\n // Add classes that don't use \"new\" to array.\n // So far: [Date.now, Decimal128/NumberDecimal, Long/NumberLong]\n noNew = [200.1, 112, 106];\n if (skip || (code && noNew.indexOf(code) !== -1)) {\n return expr;\n }\n return `new ${expr}`;\n }\n # BSON Object Type templates\n CodeTypeTemplate: &CodeTypeTemplate null\n StringTypeTemplate: &StringTypeTemplate !!js/function >\n (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n }\n RegexTypeTemplate: &RegexTypeTemplate !!js/function >\n (pattern, flags) => {\n const str = pattern;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n pattern = `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n return `RegExp(${pattern}${flags ? ', ' + '\\'' + flags + '\\'': ''})`;\n }\n BoolTypeTemplate: &BoolTypeTemplate !!js/function >\n (literal) => {\n return literal.toLowerCase();\n }\n IntegerTypeTemplate: &IntegerTypeTemplate null\n DecimalTypeTemplate: &DecimalTypeTemplate null\n LongBasicTypeTemplate: &LongBasicTypeTemplate null\n HexTypeTemplate: &HexTypeTemplate null\n OctalTypeTemplate: &OctalTypeTemplate null\n NumericTypeTemplate: &NumericTypeTemplate null\n ArrayTypeTemplate: &ArrayTypeTemplate !!js/function >\n (literal, depth) => {\n depth++;\n if (literal === '') {\n return '[]'\n }\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n\n return `[${indent}${literal}${closingIndent}]`;\n }\n ArrayTypeArgsTemplate: &ArrayTypeArgsTemplate null\n NullTypeTemplate: &NullTypeTemplate !!js/function >\n () => {\n return 'null';\n }\n UndefinedTypeTemplate: &UndefinedTypeTemplate !!js/function >\n () => {\n return 'undefined';\n }\n ObjectTypeTemplate: &ObjectTypeTemplate !!js/function >\n (literal) => {\n if (literal === '') {\n return '{}';\n }\n return literal;\n }\n ObjectTypeArgsTemplate: &ObjectTypeArgsTemplate !!js/function >\n (args, depth) => {\n if (args.length === 0) {\n return '{}';\n }\n depth++;\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n }\n const pairs = args.map((arg) => {\n return `${indent}${singleStringify(arg[0])}: ${arg[1]}`;\n }).join(', ');\n\n return `{${pairs}${closingIndent}}`\n }\n # BSON Object Method templates\n CodeCodeTemplate: &CodeCodeTemplate null\n CodeCodeArgsTemplate: &CodeCodeArgsTemplate null\n CodeScopeTemplate: &CodeScopeTemplate null\n CodeScopeArgsTemplate: &CodeScopeArgsTemplate null\n ObjectIdToStringTemplate: &ObjectIdToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toString()`;\n }\n ObjectIdToStringArgsTemplate: &ObjectIdToStringArgsTemplate !!js/function >\n () => {\n return '';\n }\n ObjectIdEqualsTemplate: &ObjectIdEqualsTemplate null\n ObjectIdEqualsArgsTemplate: &ObjectIdEqualsArgsTemplate null\n ObjectIdGetTimestampTemplate: &ObjectIdGetTimestampTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTimestamp()`;\n }\n ObjectIdGetTimestampArgsTemplate: &ObjectIdGetTimestampArgsTemplate !!js/function >\n () => {\n return '';\n }\n BinaryValueTemplate: &BinaryValueTemplate null\n BinaryValueArgsTemplate: &BinaryValueArgsTemplate null\n BinaryLengthTemplate: &BinaryLengthTemplate null\n BinaryLengthArgsTemplate: &BinaryLengthArgsTemplate null\n BinaryToStringTemplate: &BinaryToStringTemplate null\n BinaryToStringArgsTemplate: &BinaryToStringArgsTemplate null\n BinarySubtypeTemplate: &BinarySubtypeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.sub_type`;\n }\n BinarySubtypeArgsTemplate: &BinarySubtypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetDBTemplate: &DBRefGetDBTemplate !!js/function >\n (lhs) => {\n return `${lhs}.db`;\n }\n DBRefGetCollectionTemplate: &DBRefGetCollectionTemplate !!js/function >\n (lhs) => {\n return `${lhs}.namespace`;\n }\n DBRefGetIdTemplate: &DBRefGetIdTemplate !!js/function >\n (lhs) => {\n return `${lhs}.oid`;\n }\n DBRefGetDBArgsTemplate: &DBRefGetDBArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetCollectionArgsTemplate: &DBRefGetCollectionArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetIdArgsTemplate: &DBRefGetIdArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongEqualsTemplate: &LongEqualsTemplate null\n LongEqualsArgsTemplate: &LongEqualsArgsTemplate null\n LongToStringTemplate: &LongToStringTemplate null\n LongToStringArgsTemplate: &LongToStringArgsTemplate null\n LongToIntTemplate: &LongToIntTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toInt`;\n }\n LongToIntArgsTemplate: &LongToIntArgsTemplate null\n LongToNumberTemplate: &LongToNumberTemplate null\n LongToNumberArgsTemplate: &LongToNumberArgsTemplate null\n LongAddTemplate: &LongAddTemplate null\n LongAddArgsTemplate: &LongAddArgsTemplate null\n LongSubtractTemplate: &LongSubtractTemplate null\n LongSubtractArgsTemplate: &LongSubtractArgsTemplate null\n LongMultiplyTemplate: &LongMultiplyTemplate null\n LongMultiplyArgsTemplate: &LongMultiplyArgsTemplate null\n LongDivTemplate: &LongDivTemplate null\n LongDivArgsTemplate: &LongDivArgsTemplate null\n LongModuloTemplate: &LongModuloTemplate null\n LongModuloArgsTemplate: &LongModuloArgsTemplate null\n LongAndTemplate: &LongAndTemplate null\n LongAndArgsTemplate: &LongAndArgsTemplate null\n LongOrTemplate: &LongOrTemplate null\n LongOrArgsTemplate: &LongOrArgsTemplate null\n LongXorTemplate: &LongXorTemplate null\n LongXorArgsTemplate: &LongXorArgsTemplate null\n LongShiftLeftTemplate: &LongShiftLeftTemplate null\n LongShiftLeftArgsTemplate: &LongShiftLeftArgsTemplate null\n LongShiftRightTemplate: &LongShiftRightTemplate null\n LongShiftRightArgsTemplate: &LongShiftRightArgsTemplate null\n LongCompareTemplate: &LongCompareTemplate null\n LongCompareArgsTemplate: &LongCompareArgsTemplate null\n LongIsOddTemplate: &LongIsOddTemplate null\n LongIsOddArgsTemplate: &LongIsOddArgsTemplate null\n LongIsZeroTemplate: &LongIsZeroTemplate null\n LongIsZeroArgsTemplate: &LongIsZeroArgsTemplate null\n LongIsNegativeTemplate: &LongIsNegativeTemplate null\n LongIsNegativeArgsTemplate: &LongIsNegativeArgsTemplate null\n LongNegateTemplate: &LongNegateTemplate null\n LongNegateArgsTemplate: &LongNegateArgsTemplate null\n LongNotTemplate: &LongNotTemplate null\n LongNotArgsTemplate: &LongNotArgsTemplate null\n LongNotEqualsTemplate: &LongNotEqualsTemplate null\n LongNotEqualsArgsTemplate: &LongNotEqualsArgsTemplate null\n LongGreaterThanTemplate: &LongGreaterThanTemplate null\n LongGreaterThanArgsTemplate: &LongGreaterThanArgsTemplate null\n LongGreaterThanOrEqualTemplate: &LongGreaterThanOrEqualTemplate null\n LongGreaterThanOrEqualArgsTemplate: &LongGreaterThanOrEqualArgsTemplate null\n LongLessThanTemplate: &LongLessThanTemplate null\n LongLessThanArgsTemplate: &LongLessThanArgsTemplate null\n LongLessThanOrEqualTemplate: &LongLessThanOrEqualTemplate null\n LongLessThanOrEqualArgsTemplate: &LongLessThanOrEqualArgsTemplate null\n LongFloatApproxTemplate: &LongFloatApproxTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toNumber()`;\n }\n LongTopTemplate: &LongTopTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits()`;\n }\n LongBottomTemplate: &LongBottomTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits()`;\n }\n TimestampToStringTemplate: &TimestampToStringTemplate null\n TimestampToStringArgsTemplate: &TimestampToStringArgsTemplate null\n TimestampEqualsTemplate: &TimestampEqualsTemplate null\n TimestampEqualsArgsTemplate: &TimestampEqualsArgsTemplate null\n TimestampGetLowBitsTemplate: &TimestampGetLowBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits`;\n }\n TimestampGetLowBitsArgsTemplate: &TimestampGetLowBitsArgsTemplate null\n TimestampGetHighBitsTemplate: &TimestampGetHighBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits`;\n }\n TimestampGetHighBitsArgsTemplate: &TimestampGetHighBitsArgsTemplate null\n TimestampTTemplate: &TimestampTTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits()`;\n }\n TimestampITemplate: &TimestampITemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits()`;\n }\n TimestampAsDateTemplate: &TimestampAsDateTemplate !!js/function >\n (lhs) => {\n return `new Date(${lhs}.getHighBits() * 1000)`;\n }\n TimestampAsDateArgsTemplate: &TimestampAsDateArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampCompareTemplate: &TimestampCompareTemplate null\n TimestampCompareArgsTemplate: &TimestampCompareArgsTemplate null\n TimestampNotEqualsTemplate: &TimestampNotEqualsTemplate null\n TimestampNotEqualsArgsTemplate: &TimestampNotEqualsArgsTemplate null\n TimestampGreaterThanTemplate: &TimestampGreaterThanTemplate null\n TimestampGreaterThanArgsTemplate: &TimestampGreaterThanArgsTemplate null\n TimestampGreaterThanOrEqualTemplate: &TimestampGreaterThanOrEqualTemplate null\n TimestampGreaterThanOrEqualArgsTemplate: &TimestampGreaterThanOrEqualArgsTemplate null\n TimestampLessThanTemplate: &TimestampLessThanTemplate null\n TimestampLessThanArgsTemplate: &TimestampLessThanArgsTemplate null\n TimestampLessThanOrEqualTemplate: &TimestampLessThanOrEqualTemplate null\n TimestampLessThanOrEqualArgsTemplate: &TimestampLessThanOrEqualArgsTemplate null\n SymbolValueOfTemplate: &SymbolValueOfTemplate null\n SymbolValueOfArgsTemplate: &SymbolValueOfArgsTemplate null\n SymbolInspectTemplate: &SymbolInspectTemplate null\n SymbolInspectArgsTemplate: &SymbolInspectArgsTemplate null\n SymbolToStringTemplate: &SymbolToStringTemplate null\n SymbolToStringArgsTemplate: &SymbolToStringArgsTemplate null\n # Symbol Templates\n CodeSymbolTemplate: &CodeSymbolTemplate null\n CodeSymbolArgsTemplate: &CodeSymbolArgsTemplate !!js/function >\n (lhs, code, scope) => {\n code = code === undefined ? '\\'\\'' : code;\n scope = scope === undefined ? '' : `, ${scope}`;\n return `(${code}${scope})`;\n }\n ObjectIdSymbolTemplate: &ObjectIdSymbolTemplate null\n ObjectIdSymbolArgsTemplate: &ObjectIdSymbolArgsTemplate !!js/function >\n (lhs, str) => {\n if (!str || str.length === 0) {\n return '()';\n }\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `('${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}')`;\n }\n BinarySymbolTemplate: &BinarySymbolTemplate !!js/function >\n () => {\n return 'Binary';\n }\n BinarySymbolArgsTemplate: &BinarySymbolArgsTemplate !!js/function >\n (lhs, buffer, subtype) => {\n return `(${buffer.toString('base64')}, '${subtype}')`;\n }\n BinarySymbolSubtypeDefaultTemplate: &BinarySymbolSubtypeDefaultTemplate null\n BinarySymbolSubtypeFunctionTemplate: &BinarySymbolSubtypeFunctionTemplate null\n BinarySymbolSubtypeByteArrayTemplate: &BinarySymbolSubtypeByteArrayTemplate null\n BinarySymbolSubtypeUuidOldTemplate: &BinarySymbolSubtypeUuidOldTemplate null\n BinarySymbolSubtypeUuidTemplate: &BinarySymbolSubtypeUuidTemplate null\n BinarySymbolSubtypeMd5Template: &BinarySymbolSubtypeMd5Template null\n BinarySymbolSubtypeUserDefinedTemplate: &BinarySymbolSubtypeUserDefinedTemplate null\n DBRefSymbolTemplate: &DBRefSymbolTemplate null\n DBRefSymbolArgsTemplate: &DBRefSymbolArgsTemplate null\n DoubleSymbolTemplate: &DoubleSymbolTemplate !!js/function >\n () => {\n return 'Double';\n }\n DoubleSymbolArgsTemplate: &DoubleSymbolArgsTemplate null\n Int32SymbolTemplate: &Int32SymbolTemplate !!js/function >\n () => {\n return 'Int32';\n }\n Int32SymbolArgsTemplate: &Int32SymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? 0 : arg;\n return `(${arg})`;\n }\n LongSymbolTemplate: &LongSymbolTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolArgsTemplate: &LongSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Long.fromString(${arg})`;\n }\n return `Long.fromNumber(${arg})`;\n }\n LongSymbolMaxTemplate: &LongSymbolMaxTemplate null\n LongSymbolMaxArgsTemplate: &LongSymbolMaxArgsTemplate null\n LongSymbolMinTemplate: &LongSymbolMinTemplate null\n LongSymbolMinArgsTemplate: &LongSymbolMinArgsTemplate null\n LongSymbolZeroTemplate: &LongSymbolZeroTemplate null\n LongSymbolZeroArgsTemplate: &LongSymbolZeroArgsTemplate null\n LongSymbolOneTemplate: &LongSymbolOneTemplate null\n LongSymbolOneArgsTemplate: &LongSymbolOneArgsTemplate null\n LongSymbolNegOneTemplate: &LongSymbolNegOneTemplate null\n LongSymbolNegOneArgsTemplate: &LongSymbolNegOneArgsTemplate null\n LongSymbolFromBitsTemplate: &LongSymbolFromBitsTemplate null\n LongSymbolFromBitsArgsTemplate: &LongSymbolFromBitsArgsTemplate null\n LongSymbolFromIntTemplate: &LongSymbolFromIntTemplate null\n LongSymbolFromIntArgsTemplate: &LongSymbolFromIntArgsTemplate null\n LongSymbolFromNumberTemplate: &LongSymbolFromNumberTemplate null\n LongSymbolFromNumberArgsTemplate: &LongSymbolFromNumberArgsTemplate null\n LongSymbolFromStringTemplate: &LongSymbolFromStringTemplate null\n LongSymbolFromStringArgsTemplate: &LongSymbolFromStringArgsTemplate null\n MinKeySymbolTemplate: &MinKeySymbolTemplate null\n MinKeySymbolArgsTemplate: &MinKeySymbolArgsTemplate null\n MaxKeySymbolTemplate: &MaxKeySymbolTemplate null\n MaxKeySymbolArgsTemplate: &MaxKeySymbolArgsTemplate null\n TimestampSymbolTemplate: &TimestampSymbolTemplate null\n TimestampSymbolArgsTemplate: &TimestampSymbolArgsTemplate !!js/function >\n (lhs, arg1, arg2) => {\n return `(${arg1 === undefined ? 0 : arg1}, ${arg2 === undefined ? 0 : arg2})`;\n }\n SymbolSymbolTemplate: &SymbolSymbolTemplate !!js/function >\n () => {\n return 'BSONSymbol';\n }\n SymbolSymbolArgsTemplate: &SymbolSymbolArgsTemplate null\n BSONRegExpSymbolTemplate: &BSONRegExpSymbolTemplate !!js/function >\n () => {\n return 'BSONRegExp';\n }\n BSONRegExpSymbolArgsTemplate: &BSONRegExpSymbolArgsTemplate !!js/function >\n (lhs, pattern, flags) => {\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n }\n return `(${singleStringify(pattern)}${flags ? ', ' + singleStringify(flags) : ''})`;\n }\n Decimal128SymbolTemplate: &Decimal128SymbolTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolArgsTemplate: &Decimal128SymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? '0' : arg.toString();\n if (arg.charAt(0) === '\\'' && arg.charAt(arg.length - 1) === '\\'') {\n return `.fromString(${arg})`;\n }\n return `.fromString('${arg}')`;\n }\n Decimal128SymbolFromStringTemplate: &Decimal128SymbolFromStringTemplate null\n Decimal128SymbolFromStringArgsTemplate: &Decimal128SymbolFromStringArgsTemplate null\n Decimal128ToStringTemplate: &Decimal128ToStringTemplate null\n Decimal128ToStringArgsTemplate: &Decimal128ToStringArgsTemplate null\n # BSON Util Templates\n ObjectIdCreateFromHexStringTemplate: &ObjectIdCreateFromHexStringTemplate null\n ObjectIdCreateFromHexStringArgsTemplate: &ObjectIdCreateFromHexStringArgsTemplate null\n ObjectIdCreateFromTimeTemplate: &ObjectIdCreateFromTimeTemplate !!js/function >\n () => {\n return `ObjectId.createFromTime`;\n }\n ObjectIdCreateFromTimeArgsTemplate: &ObjectIdCreateFromTimeArgsTemplate !!js/function >\n (lhs, arg, isNumber) => {\n if (!isNumber) {\n return `(${arg}.getTime() / 1000)`;\n }\n return `(${arg})`;\n }\n ObjectIdIsValidTemplate: &ObjectIdIsValidTemplate !!js/function >\n (lhs) => {\n return `${lhs}.isValid`;\n }\n ObjectIdIsValidArgsTemplate: &ObjectIdIsValidArgsTemplate null\n # JS Symbol Templates\n NumberSymbolTemplate: &NumberSymbolTemplate !!js/function >\n () => {\n return 'Number';\n }\n NumberSymbolArgsTemplate: &NumberSymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? '0' : arg;\n return `(${arg})`;\n }\n DateSymbolTemplate: &DateSymbolTemplate !!js/function >\n () => {\n return 'Date';\n }\n DateSymbolArgsTemplate: &DateSymbolArgsTemplate null\n DateSymbolNowTemplate: &DateSymbolNowTemplate !!js/function >\n () => {\n return 'Date.now';\n }\n DateSymbolNowArgsTemplate: &DateSymbolNowArgsTemplate null\n RegExpSymbolTemplate: &RegExpSymbolTemplate !!js/function >\n () => {\n return 'RegExp';\n }\n RegExpSymbolArgsTemplate: &RegExpSymbolArgsTemplate null\n ImportTemplate: &ImportTemplate !!js/function >\n (args) => {\n const bson = [];\n const other = [];\n Object.keys(args).map(\n (m) => {\n if (m > 99 && m < 200) {\n bson.push(args[m]);\n } else {\n other.push(args[m]);\n }\n }\n );\n if (bson.length) {\n other.push(`const {\\n ${bson.join(',\\n ')}\\n} = require('bson');`);\n }\n return other.join('\\n');\n }\n 0ImportTemplate: &0ImportTemplate null\n 1ImportTemplate: &1ImportTemplate null\n 2ImportTemplate: &2ImportTemplate null\n 3ImportTemplate: &3ImportTemplate null\n 4ImportTemplate: &4ImportTemplate null\n 5ImportTemplate: &5ImportTemplate null\n 6ImportTemplate: &6ImportTemplate null\n 7ImportTemplate: &7ImportTemplate null\n 8ImportTemplate: &8ImportTemplate null\n 9ImportTemplate: &9ImportTemplate null\n 10ImportTemplate: &10ImportTemplate null\n 11ImportTemplate: &11ImportTemplate null\n 12ImportTemplate: &12ImportTemplate null\n 100ImportTemplate: &100ImportTemplate !!js/function >\n () => {\n return 'Code';\n }\n 101ImportTemplate: &101ImportTemplate !!js/function >\n () => {\n return 'ObjectId';\n }\n 102ImportTemplate: &102ImportTemplate !!js/function >\n () => {\n return 'Binary';\n }\n 103ImportTemplate: &103ImportTemplate !!js/function >\n () => {\n return 'DBRef';\n }\n 104ImportTemplate: &104ImportTemplate !!js/function >\n () => {\n return 'Double';\n }\n 105ImportTemplate: &105ImportTemplate !!js/function >\n () => {\n return 'Int32';\n }\n 106ImportTemplate: &106ImportTemplate !!js/function >\n () => {\n return 'Long';\n }\n 107ImportTemplate: &107ImportTemplate !!js/function >\n () => {\n return 'MinKey';\n }\n 108ImportTemplate: &108ImportTemplate !!js/function >\n () => {\n return 'MaxKey';\n }\n 109ImportTemplate: &109ImportTemplate !!js/function >\n () => {\n return 'BSONRegExp';\n }\n 110ImportTemplate: &110ImportTemplate !!js/function >\n () => {\n return 'Timestamp';\n }\n 111ImportTemplate: &111ImportTemplate !!js/function >\n () => {\n return 'BSONSymbol';\n }\n 112ImportTemplate: &112ImportTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n 113ImportTemplate: &113ImportTemplate null\n 114ImportTemplate: &114ImportTemplate null\n 200ImportTemplate: &200ImportTemplate null\n 201ImportTemplate: &201ImportTemplate null\n 300ImportTemplate: &300ImportTemplate null\n 301ImportTemplate: &301ImportTemplate null\n 302ImportTemplate: &302ImportTemplate null\n 303ImportTemplate: &303ImportTemplate null\n 304ImportTemplate: &304ImportTemplate null\n 305ImportTemplate: &305ImportTemplate null\n 306ImportTemplate: &306ImportTemplate null\n# Universal types\n# Everything inherits from StringType because we haven't implemented any of them.\nBasicTypes:\n # Universal basic types\n _bool: &BoolType\n <<: *__type\n id: \"_bool\"\n code: 0\n template: *BoolTypeTemplate\n _integer: &IntegerType\n <<: *__type\n id: \"_integer\"\n code: 1\n template: *IntegerTypeTemplate\n _long: &LongBasicType\n <<: *__type\n id: \"_long\"\n code: 2\n template: *LongBasicTypeTemplate\n _decimal: &DecimalType\n <<: *__type\n id: \"_decimal\"\n code: 3\n template: *DecimalTypeTemplate\n _hex: &HexType\n <<: *__type\n id: \"_hex\"\n code: 4\n template: *HexTypeTemplate\n _octal: &OctalType\n <<: *__type\n id: \"_octal\"\n code: 5\n template: *OctalTypeTemplate\n _numeric: &NumericType\n <<: *__type\n id: \"_numeric\"\n code: 6\n template: *NumericTypeTemplate\n _string: &StringType\n <<: *__type\n id: \"_string\"\n code: 7\n template: *StringTypeTemplate\n _regex: &RegexType\n <<: *__type\n id: \"_regex\"\n code: 8\n template: *RegexTypeTemplate\n _array: &ArrayType\n <<: *__type\n id: \"_array\"\n code: 9\n template: *ArrayTypeTemplate\n argsTemplate: *ArrayTypeArgsTemplate\n _object: &ObjectType\n <<: *__type\n id: \"_object\"\n code: 10\n template: *ObjectTypeTemplate\n argsTemplate: *ObjectTypeArgsTemplate\n _null: &NullType\n <<: *__type\n id: \"_null\"\n code: 11\n template: *NullTypeTemplate\n _undefined: &UndefinedType\n <<: *__type\n id: \"_undefined\"\n code: 12\n template: *UndefinedTypeTemplate\n\nSyntax:\n equality:\n template: *EqualitySyntaxTemplate\n in:\n template: *InSyntaxTemplate\n and:\n template: *AndSyntaxTemplate\n or:\n template: *OrSyntaxTemplate\n not:\n template: *NotSyntaxTemplate\n unary:\n template: *UnarySyntaxTemplate\n binary:\n template: *BinarySyntaxTemplate\n parens:\n template: *ParensSyntaxTemplate\n eos:\n template: *EosSyntaxTemplate\n eof:\n template: *EofSyntaxTemplate\n # The new template takes in expr, and an optional skip argument and optional\n # id argument. The skip argument is a boolean that if true then doesn't add\n # new. The code argument is the symbol code being called. The template will check\n # if it is an exception, i.e. a type that is a constructor but may not use new.\n new:\n template: *NewSyntaxTemplate\n # The regex flags that change symbols between languages can be defined here.\n # Flags that aren't defined can be left blank and will be ignored.\n regexFlags: *RegexFlags\n bsonRegexFlags: *BSONRegexFlags\nImports:\n import:\n template: *ImportTemplate\n 0:\n template: *0ImportTemplate\n 1:\n template: *1ImportTemplate\n 2:\n template: *2ImportTemplate\n 3:\n template: *3ImportTemplate\n 4:\n template: *4ImportTemplate\n 5:\n template: *5ImportTemplate\n 6:\n template: *6ImportTemplate\n 7:\n template: *7ImportTemplate\n 8:\n template: *8ImportTemplate\n 9:\n template: *9ImportTemplate\n 10:\n template: *10ImportTemplate\n 11:\n template: *11ImportTemplate\n 12:\n template: *12ImportTemplate\n 100:\n template: *100ImportTemplate\n 101:\n template: *101ImportTemplate\n 102:\n template: *102ImportTemplate\n 103:\n template: *103ImportTemplate\n 104:\n template: *104ImportTemplate\n 105:\n template: *105ImportTemplate\n 106:\n template: *106ImportTemplate\n 107:\n template: *107ImportTemplate\n 108:\n template: *108ImportTemplate\n 109:\n template: *109ImportTemplate\n 110:\n template: *110ImportTemplate\n 111:\n template: *111ImportTemplate\n 112:\n template: *112ImportTemplate\n 113:\n template: *113ImportTemplate\n 114:\n template: *114ImportTemplate\n 200:\n template: *200ImportTemplate\n 201:\n template: *201ImportTemplate\n 300:\n template: *300ImportTemplate\n 301:\n template: *301ImportTemplate\n 302:\n template: *302ImportTemplate\n 303:\n template: *303ImportTemplate\n 304:\n template: *304ImportTemplate\n 305:\n template: *305ImportTemplate\n 306:\n template: *306ImportTemplate\nNativeTypes:\n Date: &DateType\n <<: *__type\n id: \"Date\"\n code: 200\n type: *ObjectType\n attr: {} # TODO: no built-in date methods added yet\n int: &intType\n <<: *__type\n id: \"int\"\n code: 105\n type: *IntegerType\n attr: {}\n float: &floatType\n <<: *__type\n id: \"float\"\n code: 104\n type: *IntegerType\n attr: {}\nBsonTypes:\n Code: &CodeType\n <<: *__type\n id: \"Code\"\n code: 100\n type: *ObjectType\n attr:\n scope:\n callable: *var\n args: null\n attr: null\n id: \"scope\"\n type: *ObjectType\n template: *CodeScopeTemplate\n argsTemplate: *CodeScopeArgsTemplate\n ObjectId: &ObjectIdType\n <<: *__type\n id: \"ObjectId\"\n code: 101\n type: *ObjectType\n attr:\n binary:\n callable: *var\n args: null\n attr: null\n type: *StringType\n template: *ObjectIdToStringTemplate\n argsTemplate: *ObjectIdToStringArgsTemplate\n generation_time:\n callable: *var\n args: null\n attr: null\n id: \"db\"\n type: *DateType\n template: *ObjectIdGetTimestampTemplate\n argsTemplate: *ObjectIdGetTimestampArgsTemplate\n Binary: &BinaryType # Not currently supported\n <<: *__type\n id: \"Binary\"\n code: 102\n type: *ObjectType\n DBRef: &DBRefType\n <<: *__type\n id: \"DBRef\"\n code: 103\n type: *ObjectType\n attr:\n database:\n callable: *var\n args: null\n attr: null\n id: \"db\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n collection:\n callable: *var\n args: null\n attr: null\n id: \"collection\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n id:\n callable: *var\n args: null\n attr: null\n id: \"id\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n Int64: &LongType\n <<: *__type\n id: \"Int64\"\n code: 106\n type: *ObjectType\n attr: {}\n MinKey: &MinKeyType\n <<: *__type\n id: \"MinKey\"\n code: 107\n type: *ObjectType\n MaxKey: &MaxKeyType\n <<: *__type\n id: \"MaxKey\"\n code: 108\n type: *ObjectType\n Regex: &BSONRegExpType\n <<: *__type\n id: \"BSONRegExp\"\n code: 109\n type: *ObjectType\n Timestamp: &TimestampType\n <<: *__type\n id: \"Timestamp\"\n code: 110\n type: *ObjectType\n attr:\n time:\n callable: *var\n args: null\n attr: null\n id: \"time\"\n type: *IntegerType\n template: *TimestampTTemplate\n argsTemplate: null\n inc:\n callable: *var\n args: null\n attr: null\n id: \"inc\"\n type: *IntegerType\n template: *TimestampITemplate\n argsTemplate: null\n as_datetime:\n <<: *__func\n id: \"inc\"\n type: *DateType\n template: *TimestampAsDateTemplate\n argsTemplate: *TimestampAsDateArgsTemplate\n Decimal128: &Decimal128Type\n <<: *__type\n id: \"Decimal128\"\n code: 112\n type: *ObjectType\n attr: {}\nBsonSymbols:\n Code: &CodeSymbol\n id: \"Code\"\n code: 100\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectType, null ]\n namedArgs:\n scope:\n default: {}\n type: [ *ObjectType ]\n type: *CodeType\n attr: {}\n template: *CodeSymbolTemplate\n argsTemplate: *CodeSymbolArgsTemplate\n ObjectId: &ObjectIdSymbol\n id: \"ObjectId\"\n code: 101\n callable: *constructor\n args:\n - [ *StringType, null ]\n namedArgs:\n oid:\n default: null\n type: [ *StringType, *ObjectIdType ]\n type: *ObjectIdType\n attr:\n from_datetime:\n <<: *__func\n id: \"ObjectIdfrom_datetime\"\n args:\n - [ \"Date\" ]\n type: *ObjectIdType\n template: *ObjectIdCreateFromTimeTemplate\n argsTemplate: *ObjectIdCreateFromTimeArgsTemplate\n is_valid:\n <<: *__func\n id: \"is_valid\"\n args:\n - [ *StringType, ]\n type: *BoolType\n template: *ObjectIdIsValidTemplate\n argsTemplate: *ObjectIdIsValidArgsTemplate\n template: *ObjectIdSymbolTemplate\n argsTemplate: *ObjectIdSymbolArgsTemplate\n Binary: &BinarySymbol # Not currently supported\n id: \"Binary\"\n code: 102\n callable: *constructor\n args: null\n type: *BinaryType\n attr: {}\n template: *BinarySymbolTemplate\n argsTemplate: *BinarySymbolArgsTemplate\n DBRef:\n id: \"DBRef\"\n code: 103\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectIdType, *StringType ]\n - [ *StringType, null ]\n namedArgs:\n database:\n default: null\n type: [ *StringType ]\n type: *DBRefType\n attr: {}\n template: *DBRefSymbolTemplate\n argsTemplate: *DBRefSymbolArgsTemplate\n Int64:\n id: \"Int64\"\n code: 106\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *LongType\n attr: {}\n template: *LongSymbolTemplate\n argsTemplate: *LongSymbolArgsTemplate\n MinKey:\n id: \"MinKey\"\n code: 107\n callable: *constructor\n args: []\n type: *MinKeyType\n attr: {}\n template: *MinKeySymbolTemplate\n argsTemplate: *MinKeySymbolArgsTemplate\n MaxKey:\n id: \"MaxKey\"\n code: 108\n callable: *constructor\n args: []\n type: *MaxKeyType\n attr: {}\n template: *MaxKeySymbolTemplate\n argsTemplate: *MaxKeySymbolArgsTemplate\n Regex:\n id: \"Regex\"\n code: 109\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *StringType, *IntegerType, null ]\n namedArgs:\n flags:\n default: 0\n type: [ *StringType, *IntegerType ]\n type: *BSONRegExpType\n attr:\n from_native:\n <<: *__func\n id: \"from_native\"\n args:\n - [ *RegexType ]\n type: *BSONRegExpType\n template: null\n argsTemplate: null\n template: *BSONRegExpSymbolTemplate\n argsTemplate: *BSONRegExpSymbolArgsTemplate\n Timestamp:\n id: \"Timestamp\"\n code: 110\n callable: *constructor\n args:\n - [ *IntegerType ]\n - [ *IntegerType ]\n type: *TimestampType\n attr: {}\n template: *TimestampSymbolTemplate\n argsTemplate: *TimestampSymbolArgsTemplate\n Decimal128:\n id: \"Decimal128\"\n code: 112\n callable: *constructor\n args:\n - [ *StringType ]\n type: *Decimal128Type\n attr: {}\n template: *Decimal128SymbolTemplate\n argsTemplate: *Decimal128SymbolArgsTemplate\n\nNativeSymbols:\n datetime: # Needs process method\n id: \"datetime\"\n code: 200\n callable: *constructor\n args:\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n type: *DateType\n attr: {} # TODO: add more date funcs?\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n re:\n id: \"re\"\n code: 8\n callable: *var\n args: null\n type: null\n attr:\n compile:\n id: \"compile\"\n code: 8\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *IntegerType, null ]\n namedArgs:\n flags:\n default: 0\n type: [ *IntegerType ]\n type: *RegexType\n attr: {}\n template: *RegExpSymbolTemplate\n argsTemplate: *RegExpSymbolArgsTemplate\n A:\n <<: *__type\n id: 're.A'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '256';\n }\n ASCII:\n <<: *__type\n id: 're.ASCII'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '256';\n }\n I:\n <<: *__type\n id: 're.I'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '2';\n }\n IGNORECASE:\n <<: *__type\n id: 're.IGNORECASE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '2';\n }\n DEBUG:\n <<: *__type\n id: 're.DEBUG'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '128';\n }\n L:\n <<: *__type\n id: 're.L'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '4';\n }\n LOCAL:\n <<: *__type\n id: 're.LOCAL'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '4';\n }\n M:\n <<: *__type\n id: 're.M'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '8';\n }\n MULTILINE:\n <<: *__type\n id: 're.MULTILINE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '8';\n }\n S:\n <<: *__type\n id: 're.S'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '16';\n }\n DOTALL:\n <<: *__type\n id: 're.DOTALL'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '16';\n }\n X:\n <<: *__type\n id: 're.X'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '64';\n }\n VERBOSE:\n <<: *__type\n id: 're.VERBOSE'\n type: *IntegerType\n template: !!js/function >\n () => {\n return '64';\n }\n template: !!js/function >\n () => {\n return '';\n }\n argsTemplate: null\n float:\n id: \"float\"\n code: 104\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *floatType\n attr: {}\n template: *DoubleSymbolTemplate\n argsTemplate: *DoubleSymbolArgsTemplate\n int:\n id: \"int\"\n code: 105\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *intType\n attr: {}\n template: *Int32SymbolTemplate\n argsTemplate: *Int32SymbolArgsTemplate\n";

@@ -1,1 +0,1 @@

module.exports="SymbolTypes:\n VAR: &var 0\n CONSTRUCTOR: &constructor 1\n FUNC: &func 2\n# Internal patterns to save typing\n__type: &__type\n id: null\n callable: *var\n args: null\n type: null\n attr: {}\n template: null\n argsTemplate: null\n__func: &__func\n callable: *func\n args: []\n attr: {}\n template: null\n argsTemplate: null\n\n# Java Templates\nTemplates:\n # Misc\n RegexFlags: &RegexFlags\n i: 'i'\n m: 'm'\n u: 'u'\n y: ''\n g: ''\n BSONRegexFlags: &BSONRegexFlags\n i: 'i'\n m: 'm'\n x: 'x'\n s: 's'\n l: 'l'\n u: 'u'\n # Syntax\n EqualitySyntaxTemplate: &EqualitySyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n if (op.includes('!') || op.includes('not')) {\n return `${lhs} != ${rhs}`;\n } else if (op === '==' || op === '===' || op === 'is') {\n return `${lhs} == ${rhs}`;\n }\n return `${lhs} ${op} ${rhs}`;\n }\n InSyntaxTemplate: &InSyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n let str = '';\n if (op.includes('!') || op.includes('not')) {\n str = '!';\n }\n return `${str}${rhs}.contains(${lhs})`\n }\n AndSyntaxTemplate: &AndSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' && ');\n }\n OrSyntaxTemplate: &OrSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' || ');\n }\n NotSyntaxTemplate: &NotSyntaxTemplate !!js/function >\n (arg) => {\n return `!${arg}`;\n }\n UnarySyntaxTemplate: &UnarySyntaxTemplate null\n BinarySyntaxTemplate: &BinarySyntaxTemplate !!js/function >\n (args) => {\n return args.reduce((s, op, i, arr) => {\n if (i % 2 === 0) {\n return s;\n }\n const rhs = arr[i + 1];\n switch(op) {\n case '//':\n return `floor(${s}, ${rhs})`;\n case '**':\n return `pow(${s}, ${rhs})`;\n default:\n return `${s} ${op} ${rhs}`;\n }\n }, args[0]);\n }\n ParensSyntaxTemplate: &ParensSyntaxTemplate null\n EosSyntaxTemplate: &EosSyntaxTemplate null\n EofSyntaxTemplate: &EofSyntaxTemplate null\n NewTemplate: &NewSyntaxTemplate !!js/function >\n (expr, skip, code) => {\n // Add codes of classes that don't need new.\n // Currently: Decimal128/NumberDecimal, Long/NumberLong, Double, Int32, Number, regex, Date\n noNew = [112, 106, 104, 105, 2, 8, 200];\n if (skip || (code && noNew.indexOf(code) !== -1)) {\n return expr;\n }\n return `new ${expr}`;\n }\n # BSON Object Type templates\n CodeTypeTemplate: &CodeTypeTemplate null\n StringTypeTemplate: &StringTypeTemplate !!js/function >\n (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n RegexTypeTemplate: &RegexTypeTemplate !!js/function >\n (pattern, flags) => {\n flags = flags === '' ? '' : `(?${flags})`;\n // Double escape characters except for slashes\n const escaped = pattern.replace(/\\\\/, '\\\\\\\\');\n\n // Double-quote stringify\n const str = escaped + flags;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `Pattern.compile(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n BoolTypeTemplate: &BoolTypeTemplate !!js/function >\n (literal) => {\n return literal.toLowerCase();\n }\n IntegerTypeTemplate: &IntegerTypeTemplate null\n DecimalTypeTemplate: &DecimalTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n return `${literal}d`;\n }\n return `(double) ${literal}`;\n }\n LongBasicTypeTemplate: &LongBasicTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long') {\n return `${literal}L`;\n }\n return `new Long(${literal})`;\n }\n HexTypeTemplate: &HexTypeTemplate null # TODO\n OctalTypeTemplate: &OctalTypeTemplate !!js/function >\n (literal, type) => {\n if ((literal.charAt(0) === '0' && literal.charAt(1) === '0') ||\n (literal.charAt(0) === '0' && (literal.charAt(1) === 'o' || literal.charAt(1) === 'O'))) {\n return `0${literal.substr(2, literal.length - 1)}`;\n }\n return literal;\n }\n NumericTypeTemplate: &NumericTypeTemplate null\n ArrayTypeTemplate: &ArrayTypeTemplate !!js/function >\n (literal, depth) => {\n depth++;\n // TODO: figure out how to best do depth in an array and where to\n // insert and indent\n const indent = '\\n' + ' '.repeat(depth);\n // have an indent on every ', new Document' in an array not\n // entirely perfect, but at least makes this more readable/also\n // compiles\n const arr = literal.split(', new').join(`, ${indent}new`)\n\n return `Arrays.asList(${arr})`;\n }\n ArrayTypeArgsTemplate: &ArrayTypeArgsTemplate null\n NullTypeTemplate: &NullTypeTemplate !!js/function >\n () => {\n return 'new BsonNull()';\n }\n UndefinedTypeTemplate: &UndefinedTypeTemplate !!js/function >\n () => {\n return 'new BsonUndefined()';\n }\n ObjectTypeTemplate: &ObjectTypeTemplate !!js/function >\n (literal, depth) => {\n\n if (literal === '') {\n return `new Document()`;\n }\n return literal;\n }\n ObjectTypeArgsTemplate: &ObjectTypeArgsTemplate !!js/function >\n (args, depth) => {\n if (args.length === 0) {\n return 'new Document()';\n }\n depth++;\n const indent = '\\n' + ' '.repeat(depth);\n const doubleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n const start = `new Document(${doubleStringify(args[0][0])}, ${args[0][1]})`;\n\n args = args.slice(1);\n const result = args.reduce((str, pair) => {\n return `${str}${indent}.append(${doubleStringify(pair[0])}, ${pair[1]})`;\n }, start);\n\n return `${result}`;\n }\n DoubleTypeTemplate: &DoubleTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n return `${literal}d`;\n }\n return `(double) ${literal}`;\n }\n DoubleTypeArgsTemplate: &DoubleTypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongTypeTemplate: &LongTemplate !!js/function >\n () => {\n return '';\n }\n LongTypeArgsTemplate: &LongSymbolArgsTemplate null\n # BSON Object Method templates\n ObjectIdToStringTemplate: &ObjectIdToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toHexString()`;\n }\n ObjectIdToStringArgsTemplate: &ObjectIdToStringArgsTemplate !!js/function >\n () => {\n return '';\n }\n ObjectIdEqualsTemplate: &ObjectIdEqualsTemplate null\n ObjectIdEqualsArgsTemplate: &ObjectIdEqualsArgsTemplate null\n ObjectIdGetTimestampTemplate: &ObjectIdGetTimestampTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTimestamp()`;\n }\n ObjectIdGetTimestampArgsTemplate: &ObjectIdGetTimestampArgsTemplate !!js/function >\n () => {\n return '';\n }\n CodeCodeTemplate: &CodeCodeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getCode()`;\n }\n CodeCodeArgsTemplate: &CodeCodeArgsTemplate null\n CodeScopeTemplate: &CodeScopeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getScope()`;\n }\n CodeScopeArgsTemplate: &CodeScopeArgsTemplate null\n BinaryValueTemplate: &BinaryValueTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getData`;\n }\n BinaryValueArgsTemplate: &BinaryValueArgsTemplate null\n BinaryLengthTemplate: &BinaryLengthTemplate null\n BinaryLengthArgsTemplate: &BinaryLengthArgsTemplate null\n BinaryToStringTemplate: &BinaryToStringTemplate null\n BinaryToStringArgsTemplate: &BinaryToStringArgsTemplate null\n BinarySubtypeTemplate: &BinarySubtypeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getType()`;\n }\n BinarySubtypeArgsTemplate: &BinarySubtypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetDBTemplate: &DBRefGetDBTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getDatabaseName()`;\n }\n DBRefGetDBArgsTemplate: &DBRefGetDBArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetCollectionTemplate: &DBRefGetCollectionTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getCollectionName()`;\n }\n DBRefGetCollectionArgsTemplate: &DBRefGetCollectionArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetIdTemplate: &DBRefGetIdTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getId()`;\n }\n DBRefGetIdArgsTemplate: &DBRefGetIdArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongEqualsTemplate: &LongEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} ==`;\n }\n LongEqualsArgsTemplate: &LongEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongToStringTemplate: &LongToStringTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongToStringArgsTemplate: &LongToStringArgsTemplate null\n LongToIntTemplate: &LongToIntTemplate !!js/function >\n (lhs) => {\n return `(int) ${lhs}`;\n }\n LongToIntArgsTemplate: &LongToIntArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongToNumberTemplate: &LongToNumberTemplate !!js/function >\n (lhs) => {\n return `(double) ${lhs}`;\n }\n LongToNumberArgsTemplate: &LongToNumberArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongAddTemplate: &LongAddTemplate !!js/function >\n (lhs) => {\n return `${lhs} +`;\n }\n LongAddArgsTemplate: &LongAddArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongSubtractTemplate: &LongSubtractTemplate !!js/function >\n (arg) => {\n return `${arg} -`;\n }\n LongSubtractArgsTemplate: &LongSubtractArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongMultiplyTemplate: &LongMultiplyTemplate !!js/function >\n (arg) => {\n return `${arg} *`;\n }\n LongMultiplyArgsTemplate: &LongMultiplyArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongDivTemplate: &LongDivTemplate !!js/function >\n (lhs) => {\n return `${lhs} /`;\n }\n LongDivArgsTemplate: &LongDivArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongModuloTemplate: &LongModuloTemplate !!js/function >\n (lhs) => {\n return `${lhs} %`;\n }\n LongModuloArgsTemplate: &LongModuloArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongAndTemplate: &LongAndTemplate !!js/function >\n (lhs) => {\n return `${lhs} &`;\n }\n LongAndArgsTemplate: &LongAndArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongOrTemplate: &LongOrTemplate !!js/function >\n (lhs) => {\n return `${lhs} |`;\n }\n LongOrArgsTemplate: &LongOrArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongXorTemplate: &LongXorTemplate !!js/function >\n (lhs) => {\n return `${lhs} ^`;\n }\n LongXorArgsTemplate: &LongXorArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongShiftLeftTemplate: &LongShiftLeftTemplate !!js/function >\n () => {\n return 'Long.rotateLeft';\n }\n LongShiftLeftArgsTemplate: &LongShiftLeftArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${lhs}, ${arg})`;\n }\n LongShiftRightTemplate: &LongShiftRightTemplate !!js/function >\n () => {\n return 'Long.rotateRight';\n }\n LongShiftRightArgsTemplate: &LongShiftRightArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${lhs}, ${arg})`;\n }\n LongCompareTemplate: &LongCompareTemplate !!js/function >\n (lhs) => {\n return `${lhs} -`;\n }\n LongCompareArgsTemplate: &LongCompareArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongIsOddTemplate: &LongIsOddTemplate !!js/function >\n (lhs) => {\n return `(${lhs} % 2) == 1`;\n }\n LongIsOddArgsTemplate: &LongIsOddArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsZeroTemplate: &LongIsZeroTemplate !!js/function >\n (lhs) => {\n return `${lhs} == 0`;\n }\n LongIsZeroArgsTemplate: &LongIsZeroArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsNegativeTemplate: &LongIsNegativeTemplate !!js/function >\n (lhs) => {\n return `${lhs} < 0`;\n }\n LongIsNegativeArgsTemplate: &LongIsNegativeArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongNegateTemplate: &LongNegateTemplate !!js/function >\n () => {\n return '-';\n }\n LongNegateArgsTemplate: &LongNegateArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotTemplate: &LongNotTemplate !!js/function >\n () => {\n return '~';\n }\n LongNotArgsTemplate: &LongNotArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotEqualsTemplate: &LongNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} !=`;\n }\n LongNotEqualsArgsTemplate: &LongNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanTemplate: &LongGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} >`;\n }\n LongGreaterThanArgsTemplate: &LongGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanOrEqualTemplate: &LongGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} >=`;\n }\n LongGreaterThanOrEqualArgsTemplate: &LongGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanTemplate: &LongLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} <`;\n }\n LongLessThanArgsTemplate: &LongLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanOrEqualTemplate: &LongLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} <=`;\n }\n LongLessThanOrEqualArgsTemplate: &LongLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongFloatApproxTemplate: &LongFloatApproxTemplate !!js/function >\n (lhs) => {\n return `(float) ${lhs}`;\n }\n LongTopTemplate: &LongTopTemplate !!js/function >\n (lhs) => {\n return `${lhs} >> 32`;\n }\n LongBottomTemplate: &LongBottomTemplate !!js/function >\n (lhs) => {\n return `${lhs} & 0x0000ffff`;\n }\n TimestampToStringTemplate: &TimestampToStringTemplate null\n TimestampToStringArgsTemplate: &TimestampToStringArgsTemplate null\n TimestampEqualsTemplate: &TimestampEqualsTemplate null\n TimestampEqualsArgsTemplate: &TimestampEqualsArgsTemplate null\n TimestampGetLowBitsTemplate: &TimestampGetLowBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTime`;\n }\n TimestampGetLowBitsArgsTemplate: &TimestampGetLowBitsArgsTemplate null\n TimestampGetHighBitsTemplate: &TimestampGetHighBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getInc`;\n }\n TimestampGetHighBitsArgsTemplate: &TimestampGetHighBitsArgsTemplate null\n TimestampTTemplate: &TimestampTTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTime()`;\n }\n TimestampITemplate: &TimestampITemplate !!js/function >\n (lhs) => {\n return `${lhs}.getInc()`;\n }\n TimestampAsDateTemplate: &TimestampAsDateTemplate !!js/function >\n (lhs) => {\n return `new Date(${lhs}.getTime())`;\n }\n TimestampAsDateArgsTemplate: &TimestampAsDateArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampCompareTemplate: &TimestampCompareTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampCompareArgsTemplate: &TimestampCompareArgsTemplate null\n TimestampNotEqualsTemplate: &TimestampNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampNotEqualsArgsTemplate: &TimestampNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) != 0`;\n }\n TimestampGreaterThanTemplate: &TimestampGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampGreaterThanArgsTemplate: &TimestampGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) > 0`;\n }\n TimestampGreaterThanOrEqualTemplate: &TimestampGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampGreaterThanOrEqualArgsTemplate: &TimestampGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) >= 0`;\n }\n TimestampLessThanTemplate: &TimestampLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampLessThanArgsTemplate: &TimestampLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) < 0`;\n }\n TimestampLessThanOrEqualTemplate: &TimestampLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampLessThanOrEqualArgsTemplate: &TimestampLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) <= 0`;\n }\n SymbolValueOfTemplate: &SymbolValueOfTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getSymbol`;\n }\n SymbolValueOfArgsTemplate: &SymbolValueOfArgsTemplate null\n SymbolInspectTemplate: &SymbolInspectTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getSymbol`;\n }\n SymbolInspectArgsTemplate: &SymbolInspectArgsTemplate null\n SymbolToStringTemplate: &SymbolToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toString`;\n }\n SymbolToStringArgsTemplate: &SymbolToStringArgsTemplate null\n # Symbol Templates\n CodeSymbolTemplate: &CodeSymbolTemplate !!js/function > # Also has process method\n () => {\n return 'Code';\n }\n CodeSymbolArgsTemplate: &CodeSymbolArgsTemplate !!js/function > # Also has process method\n (lhs, code, scope) => {\n // Double quote stringify\n let newStr = code === undefined ? '' : code;\n const str = newStr;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n code = `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n return (scope === undefined) ? `(${code})` : `WithScope(${code}, ${scope})`;\n }\n ObjectIdSymbolTemplate: &ObjectIdSymbolTemplate null\n ObjectIdSymbolArgsTemplate: &ObjectIdSymbolArgsTemplate !!js/function >\n (lhs, str) => {\n if (!str || str.length === 0) {\n return '()';\n }\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n BinarySymbolTemplate: &BinarySymbolTemplate null\n BinarySymbolArgsTemplate: &BinarySymbolArgsTemplate !!js/function >\n (lhs, bytes, type) => {\n const str = bytes;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n bytes = `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n\n if (type === null) {\n return `(${bytes}.getBytes(\"UTF-8\"))`;\n }\n return `(${type}, ${bytes}.getBytes(\"UTF-8\"))`;\n }\n BinarySymbolSubtypeDefaultTemplate: &BinarySymbolSubtypeDefaultTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.BINARY';\n }\n BinarySymbolSubtypeFunctionTemplate: &BinarySymbolSubtypeFunctionTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.FUNCTION';\n }\n BinarySymbolSubtypeByteArrayTemplate: &BinarySymbolSubtypeByteArrayTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.BINARY';\n }\n BinarySymbolSubtypeUuidOldTemplate: &BinarySymbolSubtypeUuidOldTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.UUID_LEGACY';\n }\n BinarySymbolSubtypeUuidTemplate: &BinarySymbolSubtypeUuidTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.UUID_STANDARD';\n }\n BinarySymbolSubtypeMd5Template: &BinarySymbolSubtypeMd5Template !!js/function >\n () => {\n return 'BsonBinarySubType.MD5';\n }\n BinarySymbolSubtypeUserDefinedTemplate: &BinarySymbolSubtypeUserDefinedTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.USER_DEFINED';\n }\n DBRefSymbolTemplate: &DBRefSymbolTemplate null\n DBRefSymbolArgsTemplate: &DBRefSymbolArgsTemplate !!js/function >\n (lhs, coll, id, db) => {\n const dbstr = db === undefined ? '' : `${db}, `;\n return `(${dbstr}${coll}, ${id})`;\n }\n DoubleSymbolTemplate: &DoubleSymbolTemplate !!js/function >\n () => {\n return '';\n }\n DoubleSymbolArgsTemplate: &DoubleSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Double.parseDouble(${arg})`;\n }\n if (type === '_integer' || type === '_long' || type === '_double' || type === '_decimal') {\n if (arg.includes('L') || arg.includes('d')) {\n return `${arg.substr(0, arg.length - 1)}d`;\n }\n return `${arg}d`;\n }\n return `(double) ${arg}`;\n }\n Int32SymbolTemplate: &Int32SymbolTemplate !!js/function >\n () => {\n return '';\n }\n Int32SymbolArgsTemplate: &Int32SymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Integer.parseInt(${arg})`;\n }\n if (type === '_integer' || type === '_long') {\n if (arg.includes('L') || arg.includes('d')) {\n return arg.substr(0, arg.length - 1);\n }\n return arg;\n }\n return `(int) ${arg}`;\n }\n LongSymbolTemplate: &LongSymbolTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolArgsTemplate: &LongSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Long.parseLong(${arg})`;\n }\n if (type === '_integer' || type === '_long') {\n if (arg.includes('d') || arg.includes('L')) {\n return `${arg.substr(0, arg.length - 1)}L`;\n }\n return `${arg}L`;\n }\n return `new Long(${arg})`;\n }\n LongSymbolMaxTemplate: &LongSymbolMaxTemplate !!js/function >\n () => {\n return 'Long.MAX_VALUE';\n }\n LongSymbolMaxArgsTemplate: &LongSymbolMaxArgsTemplate null\n LongSymbolMinTemplate: &LongSymbolMinTemplate !!js/function >\n () => {\n return 'Long.MIN_VALUE';\n }\n LongSymbolMinArgsTemplate: &LongSymbolMinArgsTemplate null\n LongSymbolZeroTemplate: &LongSymbolZeroTemplate !!js/function >\n () => {\n return '0L';\n }\n LongSymbolZeroArgsTemplate: &LongSymbolZeroArgsTemplate null\n LongSymbolOneTemplate: &LongSymbolOneTemplate !!js/function >\n () => {\n return '1L';\n }\n LongSymbolOneArgsTemplate: &LongSymbolOneArgsTemplate null\n LongSymbolNegOneTemplate: &LongSymbolNegOneTemplate !!js/function >\n () => {\n return '-1L';\n }\n LongSymbolNegOneArgsTemplate: &LongSymbolNegOneArgsTemplate null\n LongSymbolFromBitsTemplate: &LongSymbolFromBitsTemplate !!js/function > # Also has process method\n () => {\n return '';\n }\n LongSymbolFromBitsArgsTemplate: &LongSymbolFromBitsArgsTemplate null\n LongSymbolFromIntTemplate: &LongSymbolFromIntTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolFromIntArgsTemplate: &LongSymbolFromIntArgsTemplate !!js/function >\n (lhs, arg) => {\n return `${arg}L`;\n }\n LongSymbolFromNumberTemplate: &LongSymbolFromNumberTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolFromNumberArgsTemplate: &LongSymbolFromNumberArgsTemplate !!js/function >\n (lhs, arg) => {\n return `${arg}L`;\n }\n LongSymbolFromStringTemplate: &LongSymbolFromStringTemplate !!js/function >\n (lhs) => {\n return `Long.parseLong`;\n }\n LongSymbolFromStringArgsTemplate: &LongSymbolFromStringArgsTemplate null\n MinKeySymbolTemplate: &MinKeySymbolTemplate null\n MinKeySymbolArgsTemplate: &MinKeySymbolArgsTemplate null\n MaxKeySymbolTemplate: &MaxKeySymbolTemplate null\n MaxKeySymbolArgsTemplate: &MaxKeySymbolArgsTemplate null\n TimestampSymbolTemplate: &TimestampSymbolTemplate !!js/function >\n () => {\n return 'BSONTimestamp';\n }\n TimestampSymbolArgsTemplate: &TimestampSymbolArgsTemplate !!js/function >\n (lhs, arg1, arg2) => {\n return `(${arg1 === undefined ? 0 : arg1}, ${arg2 === undefined ? 0 : arg2})`;\n }\n SymbolSymbolTemplate: &SymbolSymbolTemplate !!js/function >\n () => {\n return 'Symbol';\n }\n SymbolSymbolArgsTemplate: &SymbolSymbolArgsTemplate null\n BSONRegExpSymbolTemplate: &BSONRegExpSymbolTemplate !!js/function >\n () => {\n return 'BsonRegularExpression';\n }\n BSONRegExpSymbolArgsTemplate: &BSONRegExpSymbolArgsTemplate !!js/function >\n (lhs, pattern, flags) => {\n const doubleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n return `(${doubleStringify(pattern)}${flags ? ', ' + doubleStringify(flags) : ''})`;\n }\n Decimal128SymbolTemplate: &Decimal128SymbolTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolArgsTemplate: &Decimal128SymbolArgsTemplate !!js/function >\n (_, str) => { // just stringify\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `.parse(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n Decimal128SymbolFromStringTemplate: &Decimal128SymbolFromStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.parse`;\n }\n Decimal128SymbolFromStringArgsTemplate: &Decimal128SymbolFromStringArgsTemplate null\n Decimal128ToStringTemplate: &Decimal128ToStringTemplate null\n Decimal128ToStringArgsTemplate: &Decimal128ToStringArgsTemplate null\n # BSON Util Templates\n ObjectIdCreateFromHexStringTemplate: &ObjectIdCreateFromHexStringTemplate !!js/function >\n () => {\n return 'new ObjectId';\n }\n ObjectIdCreateFromHexStringArgsTemplate: &ObjectIdCreateFromHexStringArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n ObjectIdCreateFromTimeTemplate: &ObjectIdCreateFromTimeTemplate !!js/function >\n () => {\n return 'new ObjectId';\n }\n ObjectIdCreateFromTimeArgsTemplate: &ObjectIdCreateFromTimeArgsTemplate !!js/function >\n (lhs, arg, isNumber) => {\n if (isNumber) {\n return `(new java.util.Date(${arg}))`;\n }\n return `(${arg})`;\n }\n ObjectIdIsValidTemplate: &ObjectIdIsValidTemplate !!js/function >\n () => {\n return 'ObjectId.isValid';\n }\n ObjectIdIsValidArgsTemplate: &ObjectIdIsValidArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n # JS Symbol Templates\n NumberSymbolTemplate: &NumberSymbolTemplate !!js/function >\n () => {\n return '';\n }\n NumberSymbolArgsTemplate: &NumberSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Double.parseDouble(${arg})`;\n }\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n if (arg.includes('L') || arg.includes('d')) {\n return `${arg.substr(0, arg.length - 1)}d`;\n }\n return `${arg}d`;\n }\n return `(double) ${arg}`;\n }\n DateSymbolTemplate: &DateSymbolTemplate !!js/function >\n () => {\n return 'java.util.Date';\n }\n DateSymbolArgsTemplate: &DateSymbolArgsTemplate !!js/function >\n (lhs, date, isString) => {\n let toStr = (d) => d;\n if (isString) {\n toStr = (d) => `new SimpleDateFormat(\"EEE MMMMM dd yyyy HH:mm:ss\").format(${d})`;\n }\n if (date === null) {\n return toStr(`new ${lhs}()`);\n }\n return toStr(`new ${lhs}(${date.getTime()}L)`);\n }\n DateSymbolNowTemplate: &DateSymbolNowTemplate !!js/function >\n () => {\n return '';\n }\n DateSymbolNowArgsTemplate: &DateSymbolNowArgsTemplate !!js/function >\n () => {\n return 'new java.util.Date().getTime()';\n }\n RegExpSymbolTemplate: &RegExpSymbolTemplate !!js/function >\n () => {\n return 'Pattern';\n }\n RegExpSymbolArgsTemplate: &RegExpSymbolArgsTemplate null\n ImportTemplate: &ImportTemplate null\n 0ImportTemplate: &0ImportTemplate null\n 1ImportTemplate: &1ImportTemplate null\n 2ImportTemplate: &2ImportTemplate null\n 3ImportTemplate: &3ImportTemplate null\n 4ImportTemplate: &4ImportTemplate null\n 5ImportTemplate: &5ImportTemplate null\n 6ImportTemplate: &6ImportTemplate null\n 7ImportTemplate: &7ImportTemplate null\n 8ImportTemplate: &8ImportTemplate !!js/function >\n () => {\n return 'import java.util.regex.Pattern;';\n }\n 9ImportTemplate: &9ImportTemplate !!js/function >\n () => {\n return 'import java.util.Arrays;';\n }\n 10ImportTemplate: &10ImportTemplate !!js/function >\n () => {\n return 'import org.bson.Document;';\n }\n 11ImportTemplate: &11ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonNull;';\n }\n 12ImportTemplate: &12ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonUndefined;';\n }\n 100ImportTemplate: &100ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Code;';\n }\n 113ImportTemplate: &113ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.CodeWithScope;';\n }\n 101ImportTemplate: &101ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.ObjectId;';\n }\n 102ImportTemplate: &102ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Binary;';\n }\n 103ImportTemplate: &103ImportTemplate !!js/function >\n () => {\n return 'import com.mongodb.DBRef;';\n }\n 104ImportTemplate: &104ImportTemplate null\n 105ImportTemplate: &105ImportTemplate null\n 106ImportTemplate: &106ImportTemplate null\n 107ImportTemplate: &107ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.MinKey;';\n }\n 108ImportTemplate: &108ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.MaxKey;';\n }\n 109ImportTemplate: &109ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonRegularExpression;';\n }\n 110ImportTemplate: &110ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.BSONTimestamp;';\n }\n 111ImportTemplate: &111ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Symbol;';\n }\n 112ImportTemplate: &112ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Decimal128;';\n }\n 114ImportTemplate: &114ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonBinarySubType;';\n }\n 200ImportTemplate: &200ImportTemplate null\n 201ImportTemplate: &201ImportTemplate !!js/function >\n () => {\n return 'import java.text.SimpleDateFormat;';\n }\n 300ImportTemplate: &300ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i && f !== 'options'))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Filters.${c};`;\n }).join('\\n');\n }\n 301ImportTemplate: &301ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Aggregates.${c};`;\n }).join('\\n');\n }\n 302ImportTemplate: &302ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Accumulators.${c};`;\n }).join('\\n');\n }\n 303ImportTemplate: &303ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Projections.${c};`;\n }).join('\\n');\n }\n 304ImportTemplate: &304ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Sorts.${c};`;\n }).join('\\n');\n }\n 305ImportTemplate: &305ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import com.mongodb.client.model.geojson.${c};`;\n }).join('\\n');\n }\n 306ImportTemplate: &306ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import com.mongodb.client.model.${c};`;\n }).join('\\n');\n }\n# Universal types\n# Everything inherits from StringType because we haven't implemented any of them.\nBasicTypes:\n # Universal basic types\n _bool: &BoolType\n <<: *__type\n id: \"_bool\"\n code: 0\n template: *BoolTypeTemplate\n _integer: &IntegerType\n <<: *__type\n id: \"_integer\"\n code: 1\n template: *IntegerTypeTemplate\n _long: &LongBasicType\n <<: *__type\n id: \"_long\"\n code: 2\n template: *LongBasicTypeTemplate\n _decimal: &DecimalType\n <<: *__type\n id: \"_decimal\"\n code: 3\n template: *DecimalTypeTemplate\n _hex: &HexType\n <<: *__type\n id: \"_hex\"\n code: 4\n template: *HexTypeTemplate\n _octal: &OctalType\n <<: *__type\n id: \"_octal\"\n code: 5\n template: *OctalTypeTemplate\n _numeric: &NumericType\n <<: *__type\n id: \"_numeric\"\n code: 6\n template: *NumericTypeTemplate\n _string: &StringType\n <<: *__type\n id: \"_string\"\n code: 7\n template: *StringTypeTemplate\n _regex: &RegexType\n <<: *__type\n id: \"_regex\"\n code: 8\n template: *RegexTypeTemplate\n _array: &ArrayType\n <<: *__type\n id: \"_array\"\n code: 9\n template: *ArrayTypeTemplate\n argsTemplate: *ArrayTypeArgsTemplate\n _object: &ObjectType\n <<: *__type\n id: \"_object\"\n code: 10\n template: *ObjectTypeTemplate\n argsTemplate: *ObjectTypeArgsTemplate\n _null: &NullType\n <<: *__type\n id: \"_null\"\n code: 11\n template: *NullTypeTemplate\n _undefined: &UndefinedType\n <<: *__type\n id: \"_undefined\"\n code: 12\n template: *UndefinedTypeTemplate\n\nSyntax:\n equality:\n template: *EqualitySyntaxTemplate\n in:\n template: *InSyntaxTemplate\n and:\n template: *AndSyntaxTemplate\n or:\n template: *OrSyntaxTemplate\n not:\n template: *NotSyntaxTemplate\n unary:\n template: *UnarySyntaxTemplate\n binary:\n template: *BinarySyntaxTemplate\n parens:\n template: *ParensSyntaxTemplate\n eos:\n template: *EosSyntaxTemplate\n eof:\n template: *EofSyntaxTemplate\n # The new template takes in expr, and an optional skip argument and optional\n # id argument. The skip argument is a boolean that if true then doesn't add\n # new. The code argument is the symbol code being called. The template will check\n # if it is an exception, i.e. a type that is a constructor but may not use new.\n new:\n template: *NewSyntaxTemplate\n # The regex flags that change symbols between languages can be defined here.\n # Flags that aren't defined can be left blank and will be ignored.\n regexFlags: *RegexFlags\n bsonRegexFlags: *BSONRegexFlags\nImports:\n import:\n template: *ImportTemplate\n 0:\n template: *0ImportTemplate\n 1:\n template: *1ImportTemplate\n 2:\n template: *2ImportTemplate\n 3:\n template: *3ImportTemplate\n 4:\n template: *4ImportTemplate\n 5:\n template: *5ImportTemplate\n 6:\n template: *6ImportTemplate\n 7:\n template: *7ImportTemplate\n 8:\n template: *8ImportTemplate\n 9:\n template: *9ImportTemplate\n 10:\n template: *10ImportTemplate\n 11:\n template: *11ImportTemplate\n 12:\n template: *12ImportTemplate\n 100:\n template: *100ImportTemplate\n 101:\n template: *101ImportTemplate\n 102:\n template: *102ImportTemplate\n 103:\n template: *103ImportTemplate\n 104:\n template: *104ImportTemplate\n 105:\n template: *105ImportTemplate\n 106:\n template: *106ImportTemplate\n 107:\n template: *107ImportTemplate\n 108:\n template: *108ImportTemplate\n 109:\n template: *109ImportTemplate\n 110:\n template: *110ImportTemplate\n 111:\n template: *111ImportTemplate\n 112:\n template: *112ImportTemplate\n 113:\n template: *113ImportTemplate\n 114:\n template: *114ImportTemplate\n 200:\n template: *200ImportTemplate\n 201:\n template: *201ImportTemplate\n 300:\n template: *300ImportTemplate\n 301:\n template: *301ImportTemplate\n 302:\n template: *302ImportTemplate\n 303:\n template: *303ImportTemplate\n 304:\n template: *304ImportTemplate\n 305:\n template: *305ImportTemplate\n 306:\n template: *306ImportTemplate\nBsonTypes:\n Code: &CodeType\n <<: *__type\n id: \"Code\"\n code: 100\n type: *ObjectType\n attr:\n code:\n callable: *var\n args: null\n attr: null\n id: \"code\"\n type: *StringType\n template: *CodeCodeTemplate\n argsTemplate: *CodeCodeArgsTemplate\n scope:\n callable: *var\n args: null\n attr: null\n id: \"scope\"\n type: *StringType\n template: *CodeScopeTemplate\n argsTemplate: *CodeScopeArgsTemplate\n ObjectId: &ObjectIdType\n <<: *__type\n id: \"ObjectId\"\n code: 101\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *ObjectIdToStringTemplate\n argsTemplate: *ObjectIdToStringArgsTemplate\n equals:\n <<: *__func\n id: \"equals\"\n args:\n - [ \"ObjectId\" ]\n type: *BoolType\n template: *ObjectIdEqualsTemplate\n argsTemplate: *ObjectIdEqualsArgsTemplate\n getTimestamp:\n <<: *__func\n id: \"getTimestamp\"\n type: *IntegerType\n template: *ObjectIdGetTimestampTemplate\n argsTemplate: *ObjectIdGetTimestampArgsTemplate\n BinData: &BinaryType\n <<: *__type\n id: \"BinData\"\n code: 102\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *BinaryToStringTemplate\n argsTemplate: *BinaryToStringArgsTemplate\n base64:\n <<: *__func\n id: \"base64\"\n type: *StringType\n template: *BinaryValueTemplate\n argsTemplate: *BinaryValueArgsTemplate\n length:\n <<: *__func\n id: \"length\"\n type: *IntegerType\n template: *BinaryLengthTemplate\n argsTemplate: *BinaryLengthArgsTemplate\n subtype:\n <<: *__func\n id: \"subtype\"\n type: *IntegerType\n template: *BinarySubtypeTemplate\n argsTemplate: *BinarySubtypeArgsTemplate\n DBRef: &DBRefType\n <<: *__type\n id: \"DBRef\"\n code: 103\n type: *ObjectType\n attr:\n getDb:\n <<: *__func\n id: \"getDb\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n $db:\n callable: *var\n args: null\n attr: null\n id: \"$db\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n getCollection:\n <<: *__func\n id: \"getCollection\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getRef:\n <<: *__func\n id: \"getRef\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n $ref:\n callable: *var\n args: null\n attr: null\n id: \"$ref\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getId:\n <<: *__func\n id: \"getId\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n $id:\n callable: *var\n args: null\n attr: null\n id: \"$id\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n NumberInt: &Int32Type\n <<: *__type\n id: \"NumberInt\"\n code: 105\n type: *ObjectType\n attr: {}\n NumberLong: &LongType\n <<: *__type\n id: \"NumberLong\"\n code: 106\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"LongtoString\" # Needs process method\n type: *StringType\n top:\n callable: *var\n args: null\n attr: null\n id: \"top\"\n type: *IntegerType\n template: *LongTopTemplate\n argsTemplate: null\n bottom:\n callable: *var\n args: null\n attr: null\n id: \"bottom\"\n type: *IntegerType\n template: *LongBottomTemplate\n argsTemplate: null\n floatApprox:\n callable: *var\n args: null\n attr: null\n id: \"floatApprox\"\n type: *IntegerType\n template: *LongFloatApproxTemplate\n argsTemplate: null\n MinKeyType: &MinKeyType\n <<: *__type\n id: \"MinKey\"\n code: 107\n type: *ObjectType\n MaxKeyType: &MaxKeyType\n <<: *__type\n id: \"MaxKey\"\n code: 108\n type: *ObjectType\n Timestamp: &TimestampType\n <<: *__type\n id: \"TimestampFromShell\"\n code: 110\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *TimestampToStringTemplate\n argsTemplate: *TimestampToStringArgsTemplate\n getTime:\n <<: *__func\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampGetLowBitsTemplate\n argsTemplate: *TimestampGetLowBitsArgsTemplate\n getInc:\n <<: *__func\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampGetHighBitsTemplate\n argsTemplate: *TimestampGetHighBitsArgsTemplate\n t:\n callable: *var\n args: null\n attr: null\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampTTemplate\n argsTemplate: null\n i:\n callable: *var\n args: null\n attr: null\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampITemplate\n argsTemplate: null\n Symbol: &SymbolType\n <<: *__type\n id: \"Symbol\"\n code: 111\n type: *ObjectType\n NumberDecimal: &Decimal128Type\n <<: *__type\n id: \"NumberDecimal\"\n code: 112\n type: *ObjectType\n attr: {}\n SUBTYPE_DEFAULT:\n id: \"SUBTYPE_DEFAULT\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeDefaultTemplate\n SUBTYPE_FUNCTION:\n id: \"SUBTYPE_FUNCTION\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeFunctionTemplate\n SUBTYPE_BYTE_ARRAY:\n id: \"SUBTYPE_BYTE_ARRAY\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeByteArrayTemplate\n SUBTYPE_UUID_OLD:\n id: \"SUBTYPE_UUID_OLD\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidOldTemplate\n SUBTYPE_UUID:\n id: \"SUBTYPE_UUID\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidTemplate\n SUBTYPE_MD5:\n id: \"SUBTYPE_MD5\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeMd5Template\n SUBTYPE_USER_DEFINED:\n id: \"SUBTYPE_USER_DEFINED\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUserDefinedTemplate\nNativeTypes:\n Date: &DateType\n <<: *__type\n id: \"Date\"\n code: 200\n type: *ObjectType\n attr: {} # TODO: no built-in date methods added yet\n RegExp: &RegExpType\n <<: *__type\n id: \"RegExp\"\n code: 8\n type: *ObjectType\n attr: {}\n\n\n\n\nBsonSymbols:\n Code: &CodeSymbol\n id: \"Code\"\n code: 100\n callable: *constructor\n args:\n - [ *StringType, null ]\n - [ *ObjectType, null ]\n type: *CodeType\n attr: {}\n template: *CodeSymbolTemplate\n argsTemplate: *CodeSymbolArgsTemplate\n ObjectId: &ObjectIdSymbol\n id: \"ObjectId\"\n code: 101\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *ObjectIdType\n attr:\n fromDate:\n <<: *__func\n id: \"ObjectIdCreateFromTime\"\n args:\n - [ *DateType ]\n type: *ObjectIdType\n template: *ObjectIdCreateFromTimeTemplate\n argsTemplate: *ObjectIdCreateFromTimeArgsTemplate\n template: *ObjectIdSymbolTemplate\n argsTemplate: *ObjectIdSymbolArgsTemplate\n BinData: &BinarySymbol\n id: \"BinData\"\n code: 102\n callable: *constructor\n args:\n - [ *IntegerType ]\n - [ *StringType ]\n type: *BinaryType\n attr: {}\n template: *BinarySymbolTemplate\n argsTemplate: *BinarySymbolArgsTemplate\n DBRef:\n id: \"DBRef\"\n code: 103\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectIdType ]\n - [ *StringType, null ]\n type: *DBRefType\n attr: {}\n template: *DBRefSymbolTemplate\n argsTemplate: *DBRefSymbolArgsTemplate\n NumberInt:\n id: \"Int32\"\n code: 105\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *Int32Type\n attr: {}\n template: *Int32SymbolTemplate\n argsTemplate: *Int32SymbolArgsTemplate\n NumberLong:\n id: \"NumberLong\"\n code: 106\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *LongType\n attr: {}\n template: *LongSymbolTemplate\n argsTemplate: *LongSymbolArgsTemplate\n MinKey:\n id: \"MinKey\"\n code: 107\n callable: *constructor\n args: []\n type: *MinKeyType\n attr: {}\n template: *MinKeySymbolTemplate\n argsTemplate: *MinKeySymbolArgsTemplate\n MaxKey:\n id: \"MaxKey\"\n code: 108\n callable: *constructor\n args: []\n type: *MaxKeyType\n attr: {}\n template: *MaxKeySymbolTemplate\n argsTemplate: *MaxKeySymbolArgsTemplate\n Timestamp:\n id: \"Timestamp\"\n code: 110\n callable: *constructor\n args:\n - [ *IntegerType, null ]\n - [ *IntegerType, null ]\n type: *TimestampType\n attr: {}\n template: *TimestampSymbolTemplate\n argsTemplate: *TimestampSymbolArgsTemplate\n Symbol:\n id: \"Symbol\"\n code: 111\n callable: *constructor\n args:\n - [ *StringType ]\n type: *SymbolType\n attr: {}\n template: *SymbolSymbolTemplate\n argsTemplate: *SymbolSymbolArgsTemplate\n NumberDecimal:\n id: \"NumberDecimal\"\n code: 112\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n type: *Decimal128Type\n attr: {}\n template: *Decimal128SymbolTemplate\n argsTemplate: *Decimal128SymbolArgsTemplate\n\nNativeSymbols:\n Number:\n id: \"Number\"\n code: 2\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *NumericType\n attr: {} # TODO: no built-in number funcs added yet\n template: *NumberSymbolTemplate\n argsTemplate: *NumberSymbolArgsTemplate\n Date: # Needs emit method\n id: \"Date\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n type: *DateType\n attr: # TODO: add more date funcs?\n now:\n id: \"now\"\n code: 200.1\n callable: *func\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n ISODate: # Needs emit method\n id: \"ISODate\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *DateType\n attr:\n now:\n id: \"now\"\n callable: *constructor\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n RegExp: # Needs process method\n id: \"RegExp\"\n code: 8\n callable: *constructor\n args:\n - [ *StringType, *RegexType ]\n - [ *StringType, null ]\n type: *RegExpType\n attr: {} # TODO: no built-in regex funcs added yet\n template: *RegExpSymbolTemplate\n argsTemplate: *RegExpSymbolArgsTemplate\n\n";
module.exports="SymbolTypes:\n VAR: &var 0\n CONSTRUCTOR: &constructor 1\n FUNC: &func 2\n# Internal patterns to save typing\n__type: &__type\n id: null\n callable: *var\n args: null\n type: null\n attr: {}\n template: null\n argsTemplate: null\n__func: &__func\n callable: *func\n args: []\n attr: {}\n template: null\n argsTemplate: null\n\n# Java Templates\nTemplates:\n # Misc\n RegexFlags: &RegexFlags\n i: 'i'\n m: 'm'\n u: 'u'\n y: ''\n g: ''\n BSONRegexFlags: &BSONRegexFlags\n i: 'i'\n m: 'm'\n x: 'x'\n s: 's'\n l: 'l'\n u: 'u'\n # Syntax\n EqualitySyntaxTemplate: &EqualitySyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n if (op.includes('!') || op.includes('not')) {\n return `${lhs} != ${rhs}`;\n } else if (op === '==' || op === '===' || op === 'is') {\n return `${lhs} == ${rhs}`;\n }\n return `${lhs} ${op} ${rhs}`;\n }\n InSyntaxTemplate: &InSyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n let str = '';\n if (op.includes('!') || op.includes('not')) {\n str = '!';\n }\n return `${str}${rhs}.contains(${lhs})`\n }\n AndSyntaxTemplate: &AndSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' && ');\n }\n OrSyntaxTemplate: &OrSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' || ');\n }\n NotSyntaxTemplate: &NotSyntaxTemplate !!js/function >\n (arg) => {\n return `!${arg}`;\n }\n UnarySyntaxTemplate: &UnarySyntaxTemplate null\n BinarySyntaxTemplate: &BinarySyntaxTemplate !!js/function >\n (args) => {\n return args.reduce((s, op, i, arr) => {\n if (i % 2 === 0) {\n return s;\n }\n const rhs = arr[i + 1];\n switch(op) {\n case '//':\n return `floor(${s})`;\n case '**':\n return `pow(${s}, ${rhs})`;\n default:\n return `${s} ${op} ${rhs}`;\n }\n }, args[0]);\n }\n ParensSyntaxTemplate: &ParensSyntaxTemplate null\n EosSyntaxTemplate: &EosSyntaxTemplate null\n EofSyntaxTemplate: &EofSyntaxTemplate null\n NewTemplate: &NewSyntaxTemplate !!js/function >\n (expr, skip, code) => {\n // Add codes of classes that don't need new.\n // Currently: Decimal128/NumberDecimal, Long/NumberLong, Double, Int32, Number, regex, Date\n noNew = [112, 106, 104, 105, 2, 8, 200];\n if (skip || (code && noNew.indexOf(code) !== -1)) {\n return expr;\n }\n return `new ${expr}`;\n }\n # BSON Object Type templates\n CodeTypeTemplate: &CodeTypeTemplate null\n StringTypeTemplate: &StringTypeTemplate !!js/function >\n (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n RegexTypeTemplate: &RegexTypeTemplate !!js/function >\n (pattern, flags) => {\n flags = flags === '' ? '' : `(?${flags})`;\n // Double escape characters except for slashes\n const escaped = pattern.replace(/\\\\/, '\\\\\\\\');\n\n // Double-quote stringify\n const str = escaped + flags;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `Pattern.compile(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n BoolTypeTemplate: &BoolTypeTemplate !!js/function >\n (literal) => {\n return literal.toLowerCase();\n }\n IntegerTypeTemplate: &IntegerTypeTemplate null\n DecimalTypeTemplate: &DecimalTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n return `${literal}d`;\n }\n return `(double) ${literal}`;\n }\n LongBasicTypeTemplate: &LongBasicTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long') {\n return `${literal}L`;\n }\n return `new Long(${literal})`;\n }\n HexTypeTemplate: &HexTypeTemplate null # TODO\n OctalTypeTemplate: &OctalTypeTemplate !!js/function >\n (literal, type) => {\n if ((literal.charAt(0) === '0' && literal.charAt(1) === '0') ||\n (literal.charAt(0) === '0' && (literal.charAt(1) === 'o' || literal.charAt(1) === 'O'))) {\n return `0${literal.substr(2, literal.length - 1)}`;\n }\n return literal;\n }\n NumericTypeTemplate: &NumericTypeTemplate null\n ArrayTypeTemplate: &ArrayTypeTemplate !!js/function >\n (literal, depth) => {\n depth++;\n // TODO: figure out how to best do depth in an array and where to\n // insert and indent\n const indent = '\\n' + ' '.repeat(depth);\n // have an indent on every ', new Document' in an array not\n // entirely perfect, but at least makes this more readable/also\n // compiles\n const arr = literal.split(', new').join(`, ${indent}new`)\n\n return `Arrays.asList(${arr})`;\n }\n ArrayTypeArgsTemplate: &ArrayTypeArgsTemplate null\n NullTypeTemplate: &NullTypeTemplate !!js/function >\n () => {\n return 'new BsonNull()';\n }\n UndefinedTypeTemplate: &UndefinedTypeTemplate !!js/function >\n () => {\n return 'new BsonUndefined()';\n }\n ObjectTypeTemplate: &ObjectTypeTemplate !!js/function >\n (literal, depth) => {\n\n if (literal === '') {\n return `new Document()`;\n }\n return literal;\n }\n ObjectTypeArgsTemplate: &ObjectTypeArgsTemplate !!js/function >\n (args, depth) => {\n if (args.length === 0) {\n return 'new Document()';\n }\n depth++;\n const indent = '\\n' + ' '.repeat(depth);\n const doubleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n const start = `new Document(${doubleStringify(args[0][0])}, ${args[0][1]})`;\n\n args = args.slice(1);\n const result = args.reduce((str, pair) => {\n return `${str}${indent}.append(${doubleStringify(pair[0])}, ${pair[1]})`;\n }, start);\n\n return `${result}`;\n }\n DoubleTypeTemplate: &DoubleTypeTemplate !!js/function >\n (literal, type) => {\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n return `${literal}d`;\n }\n return `(double) ${literal}`;\n }\n DoubleTypeArgsTemplate: &DoubleTypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongTypeTemplate: &LongTemplate !!js/function >\n () => {\n return '';\n }\n LongTypeArgsTemplate: &LongSymbolArgsTemplate null\n # BSON Object Method templates\n ObjectIdToStringTemplate: &ObjectIdToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toHexString()`;\n }\n ObjectIdToStringArgsTemplate: &ObjectIdToStringArgsTemplate !!js/function >\n () => {\n return '';\n }\n ObjectIdEqualsTemplate: &ObjectIdEqualsTemplate null\n ObjectIdEqualsArgsTemplate: &ObjectIdEqualsArgsTemplate null\n ObjectIdGetTimestampTemplate: &ObjectIdGetTimestampTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTimestamp()`;\n }\n ObjectIdGetTimestampArgsTemplate: &ObjectIdGetTimestampArgsTemplate !!js/function >\n () => {\n return '';\n }\n CodeCodeTemplate: &CodeCodeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getCode()`;\n }\n CodeCodeArgsTemplate: &CodeCodeArgsTemplate null\n CodeScopeTemplate: &CodeScopeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getScope()`;\n }\n CodeScopeArgsTemplate: &CodeScopeArgsTemplate null\n BinaryValueTemplate: &BinaryValueTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getData`;\n }\n BinaryValueArgsTemplate: &BinaryValueArgsTemplate null\n BinaryLengthTemplate: &BinaryLengthTemplate null\n BinaryLengthArgsTemplate: &BinaryLengthArgsTemplate null\n BinaryToStringTemplate: &BinaryToStringTemplate null\n BinaryToStringArgsTemplate: &BinaryToStringArgsTemplate null\n BinarySubtypeTemplate: &BinarySubtypeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getType()`;\n }\n BinarySubtypeArgsTemplate: &BinarySubtypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetDBTemplate: &DBRefGetDBTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getDatabaseName()`;\n }\n DBRefGetDBArgsTemplate: &DBRefGetDBArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetCollectionTemplate: &DBRefGetCollectionTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getCollectionName()`;\n }\n DBRefGetCollectionArgsTemplate: &DBRefGetCollectionArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetIdTemplate: &DBRefGetIdTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getId()`;\n }\n DBRefGetIdArgsTemplate: &DBRefGetIdArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongEqualsTemplate: &LongEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} ==`;\n }\n LongEqualsArgsTemplate: &LongEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongToStringTemplate: &LongToStringTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongToStringArgsTemplate: &LongToStringArgsTemplate null\n LongToIntTemplate: &LongToIntTemplate !!js/function >\n (lhs) => {\n return `(int) ${lhs}`;\n }\n LongToIntArgsTemplate: &LongToIntArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongToNumberTemplate: &LongToNumberTemplate !!js/function >\n (lhs) => {\n return `(double) ${lhs}`;\n }\n LongToNumberArgsTemplate: &LongToNumberArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongAddTemplate: &LongAddTemplate !!js/function >\n (lhs) => {\n return `${lhs} +`;\n }\n LongAddArgsTemplate: &LongAddArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongSubtractTemplate: &LongSubtractTemplate !!js/function >\n (arg) => {\n return `${arg} -`;\n }\n LongSubtractArgsTemplate: &LongSubtractArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongMultiplyTemplate: &LongMultiplyTemplate !!js/function >\n (arg) => {\n return `${arg} *`;\n }\n LongMultiplyArgsTemplate: &LongMultiplyArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongDivTemplate: &LongDivTemplate !!js/function >\n (lhs) => {\n return `${lhs} /`;\n }\n LongDivArgsTemplate: &LongDivArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongModuloTemplate: &LongModuloTemplate !!js/function >\n (lhs) => {\n return `${lhs} %`;\n }\n LongModuloArgsTemplate: &LongModuloArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongAndTemplate: &LongAndTemplate !!js/function >\n (lhs) => {\n return `${lhs} &`;\n }\n LongAndArgsTemplate: &LongAndArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongOrTemplate: &LongOrTemplate !!js/function >\n (lhs) => {\n return `${lhs} |`;\n }\n LongOrArgsTemplate: &LongOrArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongXorTemplate: &LongXorTemplate !!js/function >\n (lhs) => {\n return `${lhs} ^`;\n }\n LongXorArgsTemplate: &LongXorArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongShiftLeftTemplate: &LongShiftLeftTemplate !!js/function >\n () => {\n return 'Long.rotateLeft';\n }\n LongShiftLeftArgsTemplate: &LongShiftLeftArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${lhs}, ${arg})`;\n }\n LongShiftRightTemplate: &LongShiftRightTemplate !!js/function >\n () => {\n return 'Long.rotateRight';\n }\n LongShiftRightArgsTemplate: &LongShiftRightArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${lhs}, ${arg})`;\n }\n LongCompareTemplate: &LongCompareTemplate !!js/function >\n (lhs) => {\n return `${lhs} -`;\n }\n LongCompareArgsTemplate: &LongCompareArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongIsOddTemplate: &LongIsOddTemplate !!js/function >\n (lhs) => {\n return `(${lhs} % 2) == 1`;\n }\n LongIsOddArgsTemplate: &LongIsOddArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsZeroTemplate: &LongIsZeroTemplate !!js/function >\n (lhs) => {\n return `${lhs} == 0`;\n }\n LongIsZeroArgsTemplate: &LongIsZeroArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsNegativeTemplate: &LongIsNegativeTemplate !!js/function >\n (lhs) => {\n return `${lhs} < 0`;\n }\n LongIsNegativeArgsTemplate: &LongIsNegativeArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongNegateTemplate: &LongNegateTemplate !!js/function >\n () => {\n return '-';\n }\n LongNegateArgsTemplate: &LongNegateArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotTemplate: &LongNotTemplate !!js/function >\n () => {\n return '~';\n }\n LongNotArgsTemplate: &LongNotArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotEqualsTemplate: &LongNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} !=`;\n }\n LongNotEqualsArgsTemplate: &LongNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanTemplate: &LongGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} >`;\n }\n LongGreaterThanArgsTemplate: &LongGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanOrEqualTemplate: &LongGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} >=`;\n }\n LongGreaterThanOrEqualArgsTemplate: &LongGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanTemplate: &LongLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} <`;\n }\n LongLessThanArgsTemplate: &LongLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanOrEqualTemplate: &LongLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} <=`;\n }\n LongLessThanOrEqualArgsTemplate: &LongLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongFloatApproxTemplate: &LongFloatApproxTemplate !!js/function >\n (lhs) => {\n return `(float) ${lhs}`;\n }\n LongTopTemplate: &LongTopTemplate !!js/function >\n (lhs) => {\n return `${lhs} >> 32`;\n }\n LongBottomTemplate: &LongBottomTemplate !!js/function >\n (lhs) => {\n return `${lhs} & 0x0000ffff`;\n }\n TimestampToStringTemplate: &TimestampToStringTemplate null\n TimestampToStringArgsTemplate: &TimestampToStringArgsTemplate null\n TimestampEqualsTemplate: &TimestampEqualsTemplate null\n TimestampEqualsArgsTemplate: &TimestampEqualsArgsTemplate null\n TimestampGetLowBitsTemplate: &TimestampGetLowBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTime`;\n }\n TimestampGetLowBitsArgsTemplate: &TimestampGetLowBitsArgsTemplate null\n TimestampGetHighBitsTemplate: &TimestampGetHighBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getInc`;\n }\n TimestampGetHighBitsArgsTemplate: &TimestampGetHighBitsArgsTemplate null\n TimestampTTemplate: &TimestampTTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTime()`;\n }\n TimestampITemplate: &TimestampITemplate !!js/function >\n (lhs) => {\n return `${lhs}.getInc()`;\n }\n TimestampAsDateTemplate: &TimestampAsDateTemplate !!js/function >\n (lhs) => {\n return `new java.util.Date(${lhs}.getTime())`;\n }\n TimestampAsDateArgsTemplate: &TimestampAsDateArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampCompareTemplate: &TimestampCompareTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampCompareArgsTemplate: &TimestampCompareArgsTemplate null\n TimestampNotEqualsTemplate: &TimestampNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampNotEqualsArgsTemplate: &TimestampNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) != 0`;\n }\n TimestampGreaterThanTemplate: &TimestampGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampGreaterThanArgsTemplate: &TimestampGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) > 0`;\n }\n TimestampGreaterThanOrEqualTemplate: &TimestampGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampGreaterThanOrEqualArgsTemplate: &TimestampGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) >= 0`;\n }\n TimestampLessThanTemplate: &TimestampLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampLessThanArgsTemplate: &TimestampLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) < 0`;\n }\n TimestampLessThanOrEqualTemplate: &TimestampLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs}.compareTo`;\n }\n TimestampLessThanOrEqualArgsTemplate: &TimestampLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg}) <= 0`;\n }\n SymbolValueOfTemplate: &SymbolValueOfTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getSymbol`;\n }\n SymbolValueOfArgsTemplate: &SymbolValueOfArgsTemplate null\n SymbolInspectTemplate: &SymbolInspectTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getSymbol`;\n }\n SymbolInspectArgsTemplate: &SymbolInspectArgsTemplate null\n SymbolToStringTemplate: &SymbolToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toString`;\n }\n SymbolToStringArgsTemplate: &SymbolToStringArgsTemplate null\n # Symbol Templates\n CodeSymbolTemplate: &CodeSymbolTemplate !!js/function > # Also has process method\n () => {\n return 'Code';\n }\n CodeSymbolArgsTemplate: &CodeSymbolArgsTemplate !!js/function > # Also has process method\n (lhs, code, scope) => {\n // Double quote stringify\n let newStr = code === undefined ? '' : code;\n const str = newStr;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n code = `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n return (scope === undefined) ? `(${code})` : `WithScope(${code}, ${scope})`;\n }\n ObjectIdSymbolTemplate: &ObjectIdSymbolTemplate null\n ObjectIdSymbolArgsTemplate: &ObjectIdSymbolArgsTemplate !!js/function >\n (lhs, str) => {\n if (!str || str.length === 0) {\n return '()';\n }\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n BinarySymbolTemplate: &BinarySymbolTemplate null\n BinarySymbolArgsTemplate: &BinarySymbolArgsTemplate !!js/function >\n (lhs, bytes, type) => {\n const str = bytes;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n bytes = `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n\n if (type === null) {\n return `(${bytes}.getBytes(\"UTF-8\"))`;\n }\n return `(${type}, ${bytes}.getBytes(\"UTF-8\"))`;\n }\n BinarySymbolSubtypeDefaultTemplate: &BinarySymbolSubtypeDefaultTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.BINARY';\n }\n BinarySymbolSubtypeFunctionTemplate: &BinarySymbolSubtypeFunctionTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.FUNCTION';\n }\n BinarySymbolSubtypeByteArrayTemplate: &BinarySymbolSubtypeByteArrayTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.BINARY';\n }\n BinarySymbolSubtypeUuidOldTemplate: &BinarySymbolSubtypeUuidOldTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.UUID_LEGACY';\n }\n BinarySymbolSubtypeUuidTemplate: &BinarySymbolSubtypeUuidTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.UUID_STANDARD';\n }\n BinarySymbolSubtypeMd5Template: &BinarySymbolSubtypeMd5Template !!js/function >\n () => {\n return 'BsonBinarySubType.MD5';\n }\n BinarySymbolSubtypeUserDefinedTemplate: &BinarySymbolSubtypeUserDefinedTemplate !!js/function >\n () => {\n return 'BsonBinarySubType.USER_DEFINED';\n }\n DBRefSymbolTemplate: &DBRefSymbolTemplate null\n DBRefSymbolArgsTemplate: &DBRefSymbolArgsTemplate !!js/function >\n (lhs, coll, id, db) => {\n const dbstr = db === undefined ? '' : `${db}, `;\n return `(${dbstr}${coll}, ${id})`;\n }\n DoubleSymbolTemplate: &DoubleSymbolTemplate !!js/function >\n () => {\n return '';\n }\n DoubleSymbolArgsTemplate: &DoubleSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Double.parseDouble(${arg})`;\n }\n if (type === '_integer' || type === '_long' || type === '_double' || type === '_decimal') {\n if (arg.includes('L') || arg.includes('d')) {\n return `${arg.substr(0, arg.length - 1)}d`;\n }\n return `${arg}d`;\n }\n return `(double) ${arg}`;\n }\n Int32SymbolTemplate: &Int32SymbolTemplate !!js/function >\n () => {\n return '';\n }\n Int32SymbolArgsTemplate: &Int32SymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Integer.parseInt(${arg})`;\n }\n if (type === '_integer' || type === '_long') {\n if (arg.includes('L') || arg.includes('d')) {\n return arg.substr(0, arg.length - 1);\n }\n return arg;\n }\n return `(int) ${arg}`;\n }\n LongSymbolTemplate: &LongSymbolTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolArgsTemplate: &LongSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Long.parseLong(${arg})`;\n }\n if (type === '_integer' || type === '_long') {\n if (arg.includes('d') || arg.includes('L')) {\n return `${arg.substr(0, arg.length - 1)}L`;\n }\n return `${arg}L`;\n }\n return `new Long(${arg})`;\n }\n LongSymbolMaxTemplate: &LongSymbolMaxTemplate !!js/function >\n () => {\n return 'Long.MAX_VALUE';\n }\n LongSymbolMaxArgsTemplate: &LongSymbolMaxArgsTemplate null\n LongSymbolMinTemplate: &LongSymbolMinTemplate !!js/function >\n () => {\n return 'Long.MIN_VALUE';\n }\n LongSymbolMinArgsTemplate: &LongSymbolMinArgsTemplate null\n LongSymbolZeroTemplate: &LongSymbolZeroTemplate !!js/function >\n () => {\n return '0L';\n }\n LongSymbolZeroArgsTemplate: &LongSymbolZeroArgsTemplate null\n LongSymbolOneTemplate: &LongSymbolOneTemplate !!js/function >\n () => {\n return '1L';\n }\n LongSymbolOneArgsTemplate: &LongSymbolOneArgsTemplate null\n LongSymbolNegOneTemplate: &LongSymbolNegOneTemplate !!js/function >\n () => {\n return '-1L';\n }\n LongSymbolNegOneArgsTemplate: &LongSymbolNegOneArgsTemplate null\n LongSymbolFromBitsTemplate: &LongSymbolFromBitsTemplate !!js/function > # Also has process method\n () => {\n return '';\n }\n LongSymbolFromBitsArgsTemplate: &LongSymbolFromBitsArgsTemplate null\n LongSymbolFromIntTemplate: &LongSymbolFromIntTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolFromIntArgsTemplate: &LongSymbolFromIntArgsTemplate !!js/function >\n (lhs, arg) => {\n return `${arg}L`;\n }\n LongSymbolFromNumberTemplate: &LongSymbolFromNumberTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolFromNumberArgsTemplate: &LongSymbolFromNumberArgsTemplate !!js/function >\n (lhs, arg) => {\n return `${arg}L`;\n }\n LongSymbolFromStringTemplate: &LongSymbolFromStringTemplate !!js/function >\n (lhs) => {\n return `Long.parseLong`;\n }\n LongSymbolFromStringArgsTemplate: &LongSymbolFromStringArgsTemplate null\n MinKeySymbolTemplate: &MinKeySymbolTemplate null\n MinKeySymbolArgsTemplate: &MinKeySymbolArgsTemplate null\n MaxKeySymbolTemplate: &MaxKeySymbolTemplate null\n MaxKeySymbolArgsTemplate: &MaxKeySymbolArgsTemplate null\n TimestampSymbolTemplate: &TimestampSymbolTemplate !!js/function >\n () => {\n return 'BSONTimestamp';\n }\n TimestampSymbolArgsTemplate: &TimestampSymbolArgsTemplate !!js/function >\n (lhs, arg1, arg2) => {\n return `(${arg1 === undefined ? 0 : arg1}, ${arg2 === undefined ? 0 : arg2})`;\n }\n SymbolSymbolTemplate: &SymbolSymbolTemplate !!js/function >\n () => {\n return 'Symbol';\n }\n SymbolSymbolArgsTemplate: &SymbolSymbolArgsTemplate null\n BSONRegExpSymbolTemplate: &BSONRegExpSymbolTemplate !!js/function >\n () => {\n return 'BsonRegularExpression';\n }\n BSONRegExpSymbolArgsTemplate: &BSONRegExpSymbolArgsTemplate !!js/function >\n (lhs, pattern, flags) => {\n const doubleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\"`;\n }\n return `(${doubleStringify(pattern)}${flags ? ', ' + doubleStringify(flags) : ''})`;\n }\n Decimal128SymbolTemplate: &Decimal128SymbolTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolArgsTemplate: &Decimal128SymbolArgsTemplate !!js/function >\n (_, str) => { // just stringify\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `.parse(\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n Decimal128SymbolFromStringTemplate: &Decimal128SymbolFromStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.parse`;\n }\n Decimal128SymbolFromStringArgsTemplate: &Decimal128SymbolFromStringArgsTemplate null\n Decimal128ToStringTemplate: &Decimal128ToStringTemplate null\n Decimal128ToStringArgsTemplate: &Decimal128ToStringArgsTemplate null\n # BSON Util Templates\n ObjectIdCreateFromHexStringTemplate: &ObjectIdCreateFromHexStringTemplate !!js/function >\n () => {\n return 'new ObjectId';\n }\n ObjectIdCreateFromHexStringArgsTemplate: &ObjectIdCreateFromHexStringArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n ObjectIdCreateFromTimeTemplate: &ObjectIdCreateFromTimeTemplate !!js/function >\n () => {\n return 'new ObjectId';\n }\n ObjectIdCreateFromTimeArgsTemplate: &ObjectIdCreateFromTimeArgsTemplate !!js/function >\n (lhs, arg, isNumber) => {\n if (isNumber) {\n return `(new java.util.Date(${arg}))`;\n }\n return `(${arg})`;\n }\n ObjectIdIsValidTemplate: &ObjectIdIsValidTemplate !!js/function >\n () => {\n return 'ObjectId.isValid';\n }\n ObjectIdIsValidArgsTemplate: &ObjectIdIsValidArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n # JS Symbol Templates\n NumberSymbolTemplate: &NumberSymbolTemplate !!js/function >\n () => {\n return '';\n }\n NumberSymbolArgsTemplate: &NumberSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Double.parseDouble(${arg})`;\n }\n if (type === '_integer' || type === '_long' || type === '_decimal') {\n if (arg.includes('L') || arg.includes('d')) {\n return `${arg.substr(0, arg.length - 1)}d`;\n }\n return `${arg}d`;\n }\n return `(double) ${arg}`;\n }\n DateSymbolTemplate: &DateSymbolTemplate !!js/function >\n () => {\n return 'java.util.Date';\n }\n DateSymbolArgsTemplate: &DateSymbolArgsTemplate !!js/function >\n (lhs, date, isString) => {\n let toStr = (d) => d;\n if (isString) {\n toStr = (d) => `new SimpleDateFormat(\"EEE MMMMM dd yyyy HH:mm:ss\").format(${d})`;\n }\n if (date === null) {\n return toStr(`new ${lhs}()`);\n }\n return toStr(`new ${lhs}(${date.getTime()}L)`);\n }\n DateSymbolNowTemplate: &DateSymbolNowTemplate !!js/function >\n () => {\n return '';\n }\n DateSymbolNowArgsTemplate: &DateSymbolNowArgsTemplate !!js/function >\n () => {\n return 'new java.util.Date().getTime()';\n }\n RegExpSymbolTemplate: &RegExpSymbolTemplate !!js/function >\n () => {\n return 'Pattern';\n }\n RegExpSymbolArgsTemplate: &RegExpSymbolArgsTemplate null\n ImportTemplate: &ImportTemplate null\n 0ImportTemplate: &0ImportTemplate null\n 1ImportTemplate: &1ImportTemplate null\n 2ImportTemplate: &2ImportTemplate null\n 3ImportTemplate: &3ImportTemplate null\n 4ImportTemplate: &4ImportTemplate null\n 5ImportTemplate: &5ImportTemplate null\n 6ImportTemplate: &6ImportTemplate null\n 7ImportTemplate: &7ImportTemplate null\n 8ImportTemplate: &8ImportTemplate !!js/function >\n () => {\n return 'import java.util.regex.Pattern;';\n }\n 9ImportTemplate: &9ImportTemplate !!js/function >\n () => {\n return 'import java.util.Arrays;';\n }\n 10ImportTemplate: &10ImportTemplate !!js/function >\n () => {\n return 'import org.bson.Document;';\n }\n 11ImportTemplate: &11ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonNull;';\n }\n 12ImportTemplate: &12ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonUndefined;';\n }\n 100ImportTemplate: &100ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Code;';\n }\n 113ImportTemplate: &113ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.CodeWithScope;';\n }\n 101ImportTemplate: &101ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.ObjectId;';\n }\n 102ImportTemplate: &102ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Binary;';\n }\n 103ImportTemplate: &103ImportTemplate !!js/function >\n () => {\n return 'import com.mongodb.DBRef;';\n }\n 104ImportTemplate: &104ImportTemplate null\n 105ImportTemplate: &105ImportTemplate null\n 106ImportTemplate: &106ImportTemplate null\n 107ImportTemplate: &107ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.MinKey;';\n }\n 108ImportTemplate: &108ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.MaxKey;';\n }\n 109ImportTemplate: &109ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonRegularExpression;';\n }\n 110ImportTemplate: &110ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.BSONTimestamp;';\n }\n 111ImportTemplate: &111ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Symbol;';\n }\n 112ImportTemplate: &112ImportTemplate !!js/function >\n () => {\n return 'import org.bson.types.Decimal128;';\n }\n 114ImportTemplate: &114ImportTemplate !!js/function >\n () => {\n return 'import org.bson.BsonBinarySubType;';\n }\n 200ImportTemplate: &200ImportTemplate null\n 201ImportTemplate: &201ImportTemplate !!js/function >\n () => {\n return 'import java.text.SimpleDateFormat;';\n }\n 300ImportTemplate: &300ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i && f !== 'options'))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Filters.${c};`;\n }).join('\\n');\n }\n 301ImportTemplate: &301ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Aggregates.${c};`;\n }).join('\\n');\n }\n 302ImportTemplate: &302ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Accumulators.${c};`;\n }).join('\\n');\n }\n 303ImportTemplate: &303ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Projections.${c};`;\n }).join('\\n');\n }\n 304ImportTemplate: &304ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import static com.mongodb.client.model.Sorts.${c};`;\n }).join('\\n');\n }\n 305ImportTemplate: &305ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import com.mongodb.client.model.geojson.${c};`;\n }).join('\\n');\n }\n 306ImportTemplate: &306ImportTemplate !!js/function >\n (classes) => {\n return classes\n .filter((f, i) => (classes.indexOf(f) === i))\n .sort()\n .map((c) => {\n return `import com.mongodb.client.model.${c};`;\n }).join('\\n');\n }\n# Universal types\n# Everything inherits from StringType because we haven't implemented any of them.\nBasicTypes:\n # Universal basic types\n _bool: &BoolType\n <<: *__type\n id: \"_bool\"\n code: 0\n template: *BoolTypeTemplate\n _integer: &IntegerType\n <<: *__type\n id: \"_integer\"\n code: 1\n template: *IntegerTypeTemplate\n _long: &LongBasicType\n <<: *__type\n id: \"_long\"\n code: 2\n template: *LongBasicTypeTemplate\n _decimal: &DecimalType\n <<: *__type\n id: \"_decimal\"\n code: 3\n template: *DecimalTypeTemplate\n _hex: &HexType\n <<: *__type\n id: \"_hex\"\n code: 4\n template: *HexTypeTemplate\n _octal: &OctalType\n <<: *__type\n id: \"_octal\"\n code: 5\n template: *OctalTypeTemplate\n _numeric: &NumericType\n <<: *__type\n id: \"_numeric\"\n code: 6\n template: *NumericTypeTemplate\n _string: &StringType\n <<: *__type\n id: \"_string\"\n code: 7\n template: *StringTypeTemplate\n _regex: &RegexType\n <<: *__type\n id: \"_regex\"\n code: 8\n template: *RegexTypeTemplate\n _array: &ArrayType\n <<: *__type\n id: \"_array\"\n code: 9\n template: *ArrayTypeTemplate\n argsTemplate: *ArrayTypeArgsTemplate\n _object: &ObjectType\n <<: *__type\n id: \"_object\"\n code: 10\n template: *ObjectTypeTemplate\n argsTemplate: *ObjectTypeArgsTemplate\n _null: &NullType\n <<: *__type\n id: \"_null\"\n code: 11\n template: *NullTypeTemplate\n _undefined: &UndefinedType\n <<: *__type\n id: \"_undefined\"\n code: 12\n template: *UndefinedTypeTemplate\n\nSyntax:\n equality:\n template: *EqualitySyntaxTemplate\n in:\n template: *InSyntaxTemplate\n and:\n template: *AndSyntaxTemplate\n or:\n template: *OrSyntaxTemplate\n not:\n template: *NotSyntaxTemplate\n unary:\n template: *UnarySyntaxTemplate\n binary:\n template: *BinarySyntaxTemplate\n parens:\n template: *ParensSyntaxTemplate\n eos:\n template: *EosSyntaxTemplate\n eof:\n template: *EofSyntaxTemplate\n # The new template takes in expr, and an optional skip argument and optional\n # id argument. The skip argument is a boolean that if true then doesn't add\n # new. The code argument is the symbol code being called. The template will check\n # if it is an exception, i.e. a type that is a constructor but may not use new.\n new:\n template: *NewSyntaxTemplate\n # The regex flags that change symbols between languages can be defined here.\n # Flags that aren't defined can be left blank and will be ignored.\n regexFlags: *RegexFlags\n bsonRegexFlags: *BSONRegexFlags\nImports:\n import:\n template: *ImportTemplate\n 0:\n template: *0ImportTemplate\n 1:\n template: *1ImportTemplate\n 2:\n template: *2ImportTemplate\n 3:\n template: *3ImportTemplate\n 4:\n template: *4ImportTemplate\n 5:\n template: *5ImportTemplate\n 6:\n template: *6ImportTemplate\n 7:\n template: *7ImportTemplate\n 8:\n template: *8ImportTemplate\n 9:\n template: *9ImportTemplate\n 10:\n template: *10ImportTemplate\n 11:\n template: *11ImportTemplate\n 12:\n template: *12ImportTemplate\n 100:\n template: *100ImportTemplate\n 101:\n template: *101ImportTemplate\n 102:\n template: *102ImportTemplate\n 103:\n template: *103ImportTemplate\n 104:\n template: *104ImportTemplate\n 105:\n template: *105ImportTemplate\n 106:\n template: *106ImportTemplate\n 107:\n template: *107ImportTemplate\n 108:\n template: *108ImportTemplate\n 109:\n template: *109ImportTemplate\n 110:\n template: *110ImportTemplate\n 111:\n template: *111ImportTemplate\n 112:\n template: *112ImportTemplate\n 113:\n template: *113ImportTemplate\n 114:\n template: *114ImportTemplate\n 200:\n template: *200ImportTemplate\n 201:\n template: *201ImportTemplate\n 300:\n template: *300ImportTemplate\n 301:\n template: *301ImportTemplate\n 302:\n template: *302ImportTemplate\n 303:\n template: *303ImportTemplate\n 304:\n template: *304ImportTemplate\n 305:\n template: *305ImportTemplate\n 306:\n template: *306ImportTemplate\nBsonTypes:\n Code: &CodeType\n <<: *__type\n id: \"Code\"\n code: 100\n type: *ObjectType\n attr:\n code:\n callable: *var\n args: null\n attr: null\n id: \"code\"\n type: *StringType\n template: *CodeCodeTemplate\n argsTemplate: *CodeCodeArgsTemplate\n scope:\n callable: *var\n args: null\n attr: null\n id: \"scope\"\n type: *StringType\n template: *CodeScopeTemplate\n argsTemplate: *CodeScopeArgsTemplate\n ObjectId: &ObjectIdType\n <<: *__type\n id: \"ObjectId\"\n code: 101\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *ObjectIdToStringTemplate\n argsTemplate: *ObjectIdToStringArgsTemplate\n equals:\n <<: *__func\n id: \"equals\"\n args:\n - [ \"ObjectId\" ]\n type: *BoolType\n template: *ObjectIdEqualsTemplate\n argsTemplate: *ObjectIdEqualsArgsTemplate\n getTimestamp:\n <<: *__func\n id: \"getTimestamp\"\n type: *IntegerType\n template: *ObjectIdGetTimestampTemplate\n argsTemplate: *ObjectIdGetTimestampArgsTemplate\n BinData: &BinaryType\n <<: *__type\n id: \"BinData\"\n code: 102\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *BinaryToStringTemplate\n argsTemplate: *BinaryToStringArgsTemplate\n base64:\n <<: *__func\n id: \"base64\"\n type: *StringType\n template: *BinaryValueTemplate\n argsTemplate: *BinaryValueArgsTemplate\n length:\n <<: *__func\n id: \"length\"\n type: *IntegerType\n template: *BinaryLengthTemplate\n argsTemplate: *BinaryLengthArgsTemplate\n subtype:\n <<: *__func\n id: \"subtype\"\n type: *IntegerType\n template: *BinarySubtypeTemplate\n argsTemplate: *BinarySubtypeArgsTemplate\n DBRef: &DBRefType\n <<: *__type\n id: \"DBRef\"\n code: 103\n type: *ObjectType\n attr:\n getDb:\n <<: *__func\n id: \"getDb\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n $db:\n callable: *var\n args: null\n attr: null\n id: \"$db\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n getCollection:\n <<: *__func\n id: \"getCollection\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getRef:\n <<: *__func\n id: \"getRef\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n $ref:\n callable: *var\n args: null\n attr: null\n id: \"$ref\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getId:\n <<: *__func\n id: \"getId\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n $id:\n callable: *var\n args: null\n attr: null\n id: \"$id\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n NumberInt: &Int32Type\n <<: *__type\n id: \"NumberInt\"\n code: 105\n type: *ObjectType\n attr: {}\n NumberLong: &LongType\n <<: *__type\n id: \"NumberLong\"\n code: 106\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"LongtoString\" # Needs process method\n type: *StringType\n top:\n callable: *var\n args: null\n attr: null\n id: \"top\"\n type: *IntegerType\n template: *LongTopTemplate\n argsTemplate: null\n bottom:\n callable: *var\n args: null\n attr: null\n id: \"bottom\"\n type: *IntegerType\n template: *LongBottomTemplate\n argsTemplate: null\n floatApprox:\n callable: *var\n args: null\n attr: null\n id: \"floatApprox\"\n type: *IntegerType\n template: *LongFloatApproxTemplate\n argsTemplate: null\n MinKeyType: &MinKeyType\n <<: *__type\n id: \"MinKey\"\n code: 107\n type: *ObjectType\n MaxKeyType: &MaxKeyType\n <<: *__type\n id: \"MaxKey\"\n code: 108\n type: *ObjectType\n Timestamp: &TimestampType\n <<: *__type\n id: \"TimestampFromShell\"\n code: 110\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *TimestampToStringTemplate\n argsTemplate: *TimestampToStringArgsTemplate\n getTime:\n <<: *__func\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampGetLowBitsTemplate\n argsTemplate: *TimestampGetLowBitsArgsTemplate\n getInc:\n <<: *__func\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampGetHighBitsTemplate\n argsTemplate: *TimestampGetHighBitsArgsTemplate\n t:\n callable: *var\n args: null\n attr: null\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampTTemplate\n argsTemplate: null\n i:\n callable: *var\n args: null\n attr: null\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampITemplate\n argsTemplate: null\n Symbol: &SymbolType\n <<: *__type\n id: \"Symbol\"\n code: 111\n type: *ObjectType\n NumberDecimal: &Decimal128Type\n <<: *__type\n id: \"NumberDecimal\"\n code: 112\n type: *ObjectType\n attr: {}\n SUBTYPE_DEFAULT:\n id: \"SUBTYPE_DEFAULT\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeDefaultTemplate\n SUBTYPE_FUNCTION:\n id: \"SUBTYPE_FUNCTION\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeFunctionTemplate\n SUBTYPE_BYTE_ARRAY:\n id: \"SUBTYPE_BYTE_ARRAY\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeByteArrayTemplate\n SUBTYPE_UUID_OLD:\n id: \"SUBTYPE_UUID_OLD\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidOldTemplate\n SUBTYPE_UUID:\n id: \"SUBTYPE_UUID\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidTemplate\n SUBTYPE_MD5:\n id: \"SUBTYPE_MD5\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeMd5Template\n SUBTYPE_USER_DEFINED:\n id: \"SUBTYPE_USER_DEFINED\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUserDefinedTemplate\nNativeTypes:\n Date: &DateType\n <<: *__type\n id: \"Date\"\n code: 200\n type: *ObjectType\n attr: {} # TODO: no built-in date methods added yet\n RegExp: &RegExpType\n <<: *__type\n id: \"RegExp\"\n code: 8\n type: *ObjectType\n attr: {}\n\n\n\n\nBsonSymbols:\n Code: &CodeSymbol\n id: \"Code\"\n code: 100\n callable: *constructor\n args:\n - [ *StringType, null ]\n - [ *ObjectType, null ]\n type: *CodeType\n attr: {}\n template: *CodeSymbolTemplate\n argsTemplate: *CodeSymbolArgsTemplate\n ObjectId: &ObjectIdSymbol\n id: \"ObjectId\"\n code: 101\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *ObjectIdType\n attr:\n fromDate:\n <<: *__func\n id: \"ObjectIdCreateFromTime\"\n args:\n - [ *DateType ]\n type: *ObjectIdType\n template: *ObjectIdCreateFromTimeTemplate\n argsTemplate: *ObjectIdCreateFromTimeArgsTemplate\n template: *ObjectIdSymbolTemplate\n argsTemplate: *ObjectIdSymbolArgsTemplate\n BinData: &BinarySymbol\n id: \"BinData\"\n code: 102\n callable: *constructor\n args:\n - [ *IntegerType ]\n - [ *StringType ]\n type: *BinaryType\n attr: {}\n template: *BinarySymbolTemplate\n argsTemplate: *BinarySymbolArgsTemplate\n DBRef:\n id: \"DBRef\"\n code: 103\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectIdType ]\n - [ *StringType, null ]\n type: *DBRefType\n attr: {}\n template: *DBRefSymbolTemplate\n argsTemplate: *DBRefSymbolArgsTemplate\n NumberInt:\n id: \"Int32\"\n code: 105\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *Int32Type\n attr: {}\n template: *Int32SymbolTemplate\n argsTemplate: *Int32SymbolArgsTemplate\n NumberLong:\n id: \"NumberLong\"\n code: 106\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *LongType\n attr: {}\n template: *LongSymbolTemplate\n argsTemplate: *LongSymbolArgsTemplate\n MinKey:\n id: \"MinKey\"\n code: 107\n callable: *constructor\n args: []\n type: *MinKeyType\n attr: {}\n template: *MinKeySymbolTemplate\n argsTemplate: *MinKeySymbolArgsTemplate\n MaxKey:\n id: \"MaxKey\"\n code: 108\n callable: *constructor\n args: []\n type: *MaxKeyType\n attr: {}\n template: *MaxKeySymbolTemplate\n argsTemplate: *MaxKeySymbolArgsTemplate\n Timestamp:\n id: \"Timestamp\"\n code: 110\n callable: *constructor\n args:\n - [ *IntegerType, null ]\n - [ *IntegerType, null ]\n type: *TimestampType\n attr: {}\n template: *TimestampSymbolTemplate\n argsTemplate: *TimestampSymbolArgsTemplate\n Symbol:\n id: \"Symbol\"\n code: 111\n callable: *constructor\n args:\n - [ *StringType ]\n type: *SymbolType\n attr: {}\n template: *SymbolSymbolTemplate\n argsTemplate: *SymbolSymbolArgsTemplate\n NumberDecimal:\n id: \"NumberDecimal\"\n code: 112\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n type: *Decimal128Type\n attr: {}\n template: *Decimal128SymbolTemplate\n argsTemplate: *Decimal128SymbolArgsTemplate\n\nNativeSymbols:\n Number:\n id: \"Number\"\n code: 2\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *NumericType\n attr: {} # TODO: no built-in number funcs added yet\n template: *NumberSymbolTemplate\n argsTemplate: *NumberSymbolArgsTemplate\n Date: # Needs emit method\n id: \"Date\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n type: *DateType\n attr: # TODO: add more date funcs?\n now:\n id: \"now\"\n code: 200.1\n callable: *func\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n ISODate: # Needs emit method\n id: \"ISODate\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *DateType\n attr:\n now:\n id: \"now\"\n callable: *constructor\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n RegExp: # Needs process method\n id: \"RegExp\"\n code: 8\n callable: *constructor\n args:\n - [ *StringType, *RegexType ]\n - [ *StringType, null ]\n type: *RegExpType\n attr: {} # TODO: no built-in regex funcs added yet\n template: *RegExpSymbolTemplate\n argsTemplate: *RegExpSymbolArgsTemplate\n\n";

@@ -1,1 +0,1 @@

module.exports="SymbolTypes:\n VAR: &var 0\n CONSTRUCTOR: &constructor 1\n FUNC: &func 2\n# Internal patterns to save typing\n__type: &__type\n id: null\n callable: *var\n args: null\n type: null\n attr: {}\n template: null\n argsTemplate: null\n__func: &__func\n callable: *func\n args: []\n attr: {}\n template: null\n argsTemplate: null\n\n# Javascript Templates\nTemplates:\n # Misc\n RegexFlags: &RegexFlags\n i: 'i'\n m: 'm'\n u: 'u'\n y: 'y'\n g: 'g'\n BSONRegexFlags: &BSONRegexFlags\n i: 'i'\n m: 'm'\n x: 'x'\n s: 's'\n l: 'l'\n u: 'u'\n # Syntax\n EqualitySyntaxTemplate: &EqualitySyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n if (op.includes('!') || op.includes('not')) {\n return `${lhs} !== ${rhs}`;\n } else if (op === '==' || op === '===' || op === 'is') {\n return `${lhs} === ${rhs}`;\n }\n return `${lhs} ${op} ${rhs}`;\n }\n InSyntaxTemplate: &InSyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n let str = '!==';\n if (op.includes('!') || op.includes('not')) {\n str = '===';\n }\n return `${rhs}.indexOf(${lhs}) ${str} -1`\n }\n AndSyntaxTemplate: &AndSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' && ');\n }\n OrSyntaxTemplate: &OrSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' || ');\n }\n NotSyntaxTemplate: &NotSyntaxTemplate !!js/function >\n (arg) => {\n return `!${arg}`;\n }\n UnarySyntaxTemplate: &UnarySyntaxTemplate null\n BinarySyntaxTemplate: &BinarySyntaxTemplate !!js/function >\n (args) => {\n return args.reduce((s, op, i, arr) => {\n if (i % 2 === 0) {\n return s;\n }\n const rhs = arr[i + 1];\n switch(op) {\n case '//':\n return `Math.floor(${s}, ${rhs})`;\n case '**':\n return `Math.pow(${s}, ${rhs})`;\n default:\n return `${s} ${op} ${rhs}`;\n }\n }, args[0]);\n }\n ParensSyntaxTemplate: &ParensSyntaxTemplate null\n EosSyntaxTemplate: &EosSyntaxTemplate null\n EofSyntaxTemplate: &EofSyntaxTemplate null\n NewTemplate: &NewSyntaxTemplate !!js/function >\n (expr, skip, code) => {\n // Add classes that don't use \"new\" to array.\n // So far: [Date.now, Decimal128/NumberDecimal, Long/NumberLong]\n noNew = [200.1, 112, 106];\n if (skip || (code && noNew.indexOf(code) !== -1)) {\n return expr;\n }\n return `new ${expr}`;\n }\n # BSON Object Type templates\n CodeTypeTemplate: &CodeTypeTemplate null\n StringTypeTemplate: &StringTypeTemplate !!js/function >\n (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n }\n RegexTypeTemplate: &RegexTypeTemplate !!js/function >\n (pattern, flags) => {\n const str = pattern;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n pattern = `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n return `RegExp(${pattern}${flags ? ', ' + '\\'' + flags + '\\'': ''})`;\n }\n BoolTypeTemplate: &BoolTypeTemplate !!js/function >\n (literal) => {\n return literal.toLowerCase();\n }\n IntegerTypeTemplate: &IntegerTypeTemplate null\n DecimalTypeTemplate: &DecimalTypeTemplate null\n LongBasicTypeTemplate: &LongBasicTypeTemplate null\n HexTypeTemplate: &HexTypeTemplate null\n OctalTypeTemplate: &OctalTypeTemplate null\n NumericTypeTemplate: &NumericTypeTemplate null\n ArrayTypeTemplate: &ArrayTypeTemplate !!js/function >\n (literal, depth) => {\n depth++;\n if (literal === '') {\n return '[]'\n }\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n\n return `[${indent}${literal}${closingIndent}]`;\n }\n ArrayTypeArgsTemplate: &ArrayTypeArgsTemplate null\n NullTypeTemplate: &NullTypeTemplate !!js/function >\n () => {\n return 'null';\n }\n UndefinedTypeTemplate: &UndefinedTypeTemplate !!js/function >\n () => {\n return 'undefined';\n }\n ObjectTypeTemplate: &ObjectTypeTemplate !!js/function >\n (literal) => {\n if (literal === '') {\n return '{}';\n }\n return literal;\n }\n ObjectTypeArgsTemplate: &ObjectTypeArgsTemplate !!js/function >\n (args, depth) => {\n if (args.length === 0) {\n return '{}';\n }\n depth++;\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n }\n const pairs = args.map((arg) => {\n return `${indent}${singleStringify(arg[0])}: ${arg[1]}`;\n }).join(', ');\n\n return `{${pairs}${closingIndent}}`\n }\n # BSON Object Method templates\n CodeCodeTemplate: &CodeCodeTemplate null\n CodeCodeArgsTemplate: &CodeCodeArgsTemplate null\n CodeScopeTemplate: &CodeScopeTemplate null\n CodeScopeArgsTemplate: &CodeScopeArgsTemplate null\n ObjectIdToStringTemplate: &ObjectIdToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toString()`;\n }\n ObjectIdToStringArgsTemplate: &ObjectIdToStringArgsTemplate !!js/function >\n () => {\n return '';\n }\n ObjectIdEqualsTemplate: &ObjectIdEqualsTemplate null\n ObjectIdEqualsArgsTemplate: &ObjectIdEqualsArgsTemplate null\n ObjectIdGetTimestampTemplate: &ObjectIdGetTimestampTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTimestamp()`;\n }\n ObjectIdGetTimestampArgsTemplate: &ObjectIdGetTimestampArgsTemplate !!js/function >\n () => {\n return '';\n }\n BinaryValueTemplate: &BinaryValueTemplate null\n BinaryValueArgsTemplate: &BinaryValueArgsTemplate null\n BinaryLengthTemplate: &BinaryLengthTemplate null\n BinaryLengthArgsTemplate: &BinaryLengthArgsTemplate null\n BinaryToStringTemplate: &BinaryToStringTemplate null\n BinaryToStringArgsTemplate: &BinaryToStringArgsTemplate null\n BinarySubtypeTemplate: &BinarySubtypeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.sub_type`;\n }\n BinarySubtypeArgsTemplate: &BinarySubtypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetDBTemplate: &DBRefGetDBTemplate !!js/function >\n (lhs) => {\n return `${lhs}.db`;\n }\n DBRefGetCollectionTemplate: &DBRefGetCollectionTemplate !!js/function >\n (lhs) => {\n return `${lhs}.namespace`;\n }\n DBRefGetIdTemplate: &DBRefGetIdTemplate !!js/function >\n (lhs) => {\n return `${lhs}.oid`;\n }\n DBRefGetDBArgsTemplate: &DBRefGetDBArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetCollectionArgsTemplate: &DBRefGetCollectionArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetIdArgsTemplate: &DBRefGetIdArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongEqualsTemplate: &LongEqualsTemplate null\n LongEqualsArgsTemplate: &LongEqualsArgsTemplate null\n LongToStringTemplate: &LongToStringTemplate null\n LongToStringArgsTemplate: &LongToStringArgsTemplate null\n LongToIntTemplate: &LongToIntTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toInt`;\n }\n LongToIntArgsTemplate: &LongToIntArgsTemplate null\n LongToNumberTemplate: &LongToNumberTemplate null\n LongToNumberArgsTemplate: &LongToNumberArgsTemplate null\n LongAddTemplate: &LongAddTemplate null\n LongAddArgsTemplate: &LongAddArgsTemplate null\n LongSubtractTemplate: &LongSubtractTemplate null\n LongSubtractArgsTemplate: &LongSubtractArgsTemplate null\n LongMultiplyTemplate: &LongMultiplyTemplate null\n LongMultiplyArgsTemplate: &LongMultiplyArgsTemplate null\n LongDivTemplate: &LongDivTemplate null\n LongDivArgsTemplate: &LongDivArgsTemplate null\n LongModuloTemplate: &LongModuloTemplate null\n LongModuloArgsTemplate: &LongModuloArgsTemplate null\n LongAndTemplate: &LongAndTemplate null\n LongAndArgsTemplate: &LongAndArgsTemplate null\n LongOrTemplate: &LongOrTemplate null\n LongOrArgsTemplate: &LongOrArgsTemplate null\n LongXorTemplate: &LongXorTemplate null\n LongXorArgsTemplate: &LongXorArgsTemplate null\n LongShiftLeftTemplate: &LongShiftLeftTemplate null\n LongShiftLeftArgsTemplate: &LongShiftLeftArgsTemplate null\n LongShiftRightTemplate: &LongShiftRightTemplate null\n LongShiftRightArgsTemplate: &LongShiftRightArgsTemplate null\n LongCompareTemplate: &LongCompareTemplate null\n LongCompareArgsTemplate: &LongCompareArgsTemplate null\n LongIsOddTemplate: &LongIsOddTemplate null\n LongIsOddArgsTemplate: &LongIsOddArgsTemplate null\n LongIsZeroTemplate: &LongIsZeroTemplate null\n LongIsZeroArgsTemplate: &LongIsZeroArgsTemplate null\n LongIsNegativeTemplate: &LongIsNegativeTemplate null\n LongIsNegativeArgsTemplate: &LongIsNegativeArgsTemplate null\n LongNegateTemplate: &LongNegateTemplate null\n LongNegateArgsTemplate: &LongNegateArgsTemplate null\n LongNotTemplate: &LongNotTemplate null\n LongNotArgsTemplate: &LongNotArgsTemplate null\n LongNotEqualsTemplate: &LongNotEqualsTemplate null\n LongNotEqualsArgsTemplate: &LongNotEqualsArgsTemplate null\n LongGreaterThanTemplate: &LongGreaterThanTemplate null\n LongGreaterThanArgsTemplate: &LongGreaterThanArgsTemplate null\n LongGreaterThanOrEqualTemplate: &LongGreaterThanOrEqualTemplate null\n LongGreaterThanOrEqualArgsTemplate: &LongGreaterThanOrEqualArgsTemplate null\n LongLessThanTemplate: &LongLessThanTemplate null\n LongLessThanArgsTemplate: &LongLessThanArgsTemplate null\n LongLessThanOrEqualTemplate: &LongLessThanOrEqualTemplate null\n LongLessThanOrEqualArgsTemplate: &LongLessThanOrEqualArgsTemplate null\n LongFloatApproxTemplate: &LongFloatApproxTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toNumber()`;\n }\n LongTopTemplate: &LongTopTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits()`;\n }\n LongBottomTemplate: &LongBottomTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits()`;\n }\n TimestampToStringTemplate: &TimestampToStringTemplate null\n TimestampToStringArgsTemplate: &TimestampToStringArgsTemplate null\n TimestampEqualsTemplate: &TimestampEqualsTemplate null\n TimestampEqualsArgsTemplate: &TimestampEqualsArgsTemplate null\n TimestampGetLowBitsTemplate: &TimestampGetLowBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits`;\n }\n TimestampGetLowBitsArgsTemplate: &TimestampGetLowBitsArgsTemplate null\n TimestampGetHighBitsTemplate: &TimestampGetHighBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits`;\n }\n TimestampGetHighBitsArgsTemplate: &TimestampGetHighBitsArgsTemplate null\n TimestampTTemplate: &TimestampTTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits()`;\n }\n TimestampITemplate: &TimestampITemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits()`;\n }\n TimestampAsDateTemplate: &TimestampAsDateTemplate !!js/function >\n (lhs) => {\n return `new Date(${lhs}.getHighBits() * 1000)`;\n }\n TimestampAsDateArgsTemplate: &TimestampAsDateArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampCompareTemplate: &TimestampCompareTemplate null\n TimestampCompareArgsTemplate: &TimestampCompareArgsTemplate null\n TimestampNotEqualsTemplate: &TimestampNotEqualsTemplate null\n TimestampNotEqualsArgsTemplate: &TimestampNotEqualsArgsTemplate null\n TimestampGreaterThanTemplate: &TimestampGreaterThanTemplate null\n TimestampGreaterThanArgsTemplate: &TimestampGreaterThanArgsTemplate null\n TimestampGreaterThanOrEqualTemplate: &TimestampGreaterThanOrEqualTemplate null\n TimestampGreaterThanOrEqualArgsTemplate: &TimestampGreaterThanOrEqualArgsTemplate null\n TimestampLessThanTemplate: &TimestampLessThanTemplate null\n TimestampLessThanArgsTemplate: &TimestampLessThanArgsTemplate null\n TimestampLessThanOrEqualTemplate: &TimestampLessThanOrEqualTemplate null\n TimestampLessThanOrEqualArgsTemplate: &TimestampLessThanOrEqualArgsTemplate null\n SymbolValueOfTemplate: &SymbolValueOfTemplate null\n SymbolValueOfArgsTemplate: &SymbolValueOfArgsTemplate null\n SymbolInspectTemplate: &SymbolInspectTemplate null\n SymbolInspectArgsTemplate: &SymbolInspectArgsTemplate null\n SymbolToStringTemplate: &SymbolToStringTemplate null\n SymbolToStringArgsTemplate: &SymbolToStringArgsTemplate null\n # Symbol Templates\n CodeSymbolTemplate: &CodeSymbolTemplate null\n CodeSymbolArgsTemplate: &CodeSymbolArgsTemplate !!js/function >\n (lhs, code, scope) => {\n code = code === undefined ? '\\'\\'' : code;\n scope = scope === undefined ? '' : `, ${scope}`;\n return `(${code}${scope})`;\n }\n ObjectIdSymbolTemplate: &ObjectIdSymbolTemplate null\n ObjectIdSymbolArgsTemplate: &ObjectIdSymbolArgsTemplate !!js/function >\n (lhs, str) => {\n if (!str || str.length === 0) {\n return '()';\n }\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `('${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}')`;\n }\n BinarySymbolTemplate: &BinarySymbolTemplate !!js/function >\n () => {\n return 'Binary';\n }\n BinarySymbolArgsTemplate: &BinarySymbolArgsTemplate !!js/function >\n (lhs, buffer, subtype) => {\n return `(${buffer.toString('base64')}, '${subtype}')`;\n }\n BinarySymbolSubtypeDefaultTemplate: &BinarySymbolSubtypeDefaultTemplate null\n BinarySymbolSubtypeFunctionTemplate: &BinarySymbolSubtypeFunctionTemplate null\n BinarySymbolSubtypeByteArrayTemplate: &BinarySymbolSubtypeByteArrayTemplate null\n BinarySymbolSubtypeUuidOldTemplate: &BinarySymbolSubtypeUuidOldTemplate null\n BinarySymbolSubtypeUuidTemplate: &BinarySymbolSubtypeUuidTemplate null\n BinarySymbolSubtypeMd5Template: &BinarySymbolSubtypeMd5Template null\n BinarySymbolSubtypeUserDefinedTemplate: &BinarySymbolSubtypeUserDefinedTemplate null\n DBRefSymbolTemplate: &DBRefSymbolTemplate null\n DBRefSymbolArgsTemplate: &DBRefSymbolArgsTemplate null\n DoubleSymbolTemplate: &DoubleSymbolTemplate !!js/function >\n () => {\n return 'Double';\n }\n DoubleSymbolArgsTemplate: &DoubleSymbolArgsTemplate null\n Int32SymbolTemplate: &Int32SymbolTemplate !!js/function >\n () => {\n return 'Int32';\n }\n Int32SymbolArgsTemplate: &Int32SymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? 0 : arg;\n return `(${arg})`;\n }\n LongSymbolTemplate: &LongSymbolTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolArgsTemplate: &LongSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Long.fromString(${arg})`;\n }\n return `Long.fromNumber(${arg})`;\n }\n LongSymbolMaxTemplate: &LongSymbolMaxTemplate null\n LongSymbolMaxArgsTemplate: &LongSymbolMaxArgsTemplate null\n LongSymbolMinTemplate: &LongSymbolMinTemplate null\n LongSymbolMinArgsTemplate: &LongSymbolMinArgsTemplate null\n LongSymbolZeroTemplate: &LongSymbolZeroTemplate null\n LongSymbolZeroArgsTemplate: &LongSymbolZeroArgsTemplate null\n LongSymbolOneTemplate: &LongSymbolOneTemplate null\n LongSymbolOneArgsTemplate: &LongSymbolOneArgsTemplate null\n LongSymbolNegOneTemplate: &LongSymbolNegOneTemplate null\n LongSymbolNegOneArgsTemplate: &LongSymbolNegOneArgsTemplate null\n LongSymbolFromBitsTemplate: &LongSymbolFromBitsTemplate null\n LongSymbolFromBitsArgsTemplate: &LongSymbolFromBitsArgsTemplate null\n LongSymbolFromIntTemplate: &LongSymbolFromIntTemplate null\n LongSymbolFromIntArgsTemplate: &LongSymbolFromIntArgsTemplate null\n LongSymbolFromNumberTemplate: &LongSymbolFromNumberTemplate null\n LongSymbolFromNumberArgsTemplate: &LongSymbolFromNumberArgsTemplate null\n LongSymbolFromStringTemplate: &LongSymbolFromStringTemplate null\n LongSymbolFromStringArgsTemplate: &LongSymbolFromStringArgsTemplate null\n MinKeySymbolTemplate: &MinKeySymbolTemplate null\n MinKeySymbolArgsTemplate: &MinKeySymbolArgsTemplate null\n MaxKeySymbolTemplate: &MaxKeySymbolTemplate null\n MaxKeySymbolArgsTemplate: &MaxKeySymbolArgsTemplate null\n TimestampSymbolTemplate: &TimestampSymbolTemplate null\n TimestampSymbolArgsTemplate: &TimestampSymbolArgsTemplate !!js/function >\n (lhs, arg1, arg2) => {\n return `(${arg1 === undefined ? 0 : arg1}, ${arg2 === undefined ? 0 : arg2})`;\n }\n SymbolSymbolTemplate: &SymbolSymbolTemplate !!js/function >\n () => {\n return 'BSONSymbol';\n }\n SymbolSymbolArgsTemplate: &SymbolSymbolArgsTemplate null\n BSONRegExpSymbolTemplate: &BSONRegExpSymbolTemplate !!js/function >\n () => {\n return 'BSONRegExp';\n }\n BSONRegExpSymbolArgsTemplate: &BSONRegExpSymbolArgsTemplate !!js/function >\n (lhs, pattern, flags) => {\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n }\n return `(${singleStringify(pattern)}${flags ? ', ' + singleStringify(flags) : ''})`;\n }\n Decimal128SymbolTemplate: &Decimal128SymbolTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolArgsTemplate: &Decimal128SymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? '0' : arg.toString();\n if (arg.charAt(0) === '\\'' && arg.charAt(arg.length - 1) === '\\'') {\n return `.fromString(${arg})`;\n }\n return `.fromString('${arg}')`;\n }\n Decimal128SymbolFromStringTemplate: &Decimal128SymbolFromStringTemplate null\n Decimal128SymbolFromStringArgsTemplate: &Decimal128SymbolFromStringArgsTemplate null\n Decimal128ToStringTemplate: &Decimal128ToStringTemplate null\n Decimal128ToStringArgsTemplate: &Decimal128ToStringArgsTemplate null\n # BSON Util Templates\n ObjectIdCreateFromHexStringTemplate: &ObjectIdCreateFromHexStringTemplate null\n ObjectIdCreateFromHexStringArgsTemplate: &ObjectIdCreateFromHexStringArgsTemplate null\n ObjectIdCreateFromTimeTemplate: &ObjectIdCreateFromTimeTemplate !!js/function >\n () => {\n return `ObjectId.createFromTime`;\n }\n ObjectIdCreateFromTimeArgsTemplate: &ObjectIdCreateFromTimeArgsTemplate !!js/function >\n (lhs, arg, isNumber) => {\n if (!isNumber) {\n return `(${arg}.getTime() / 1000)`;\n }\n return `(${arg})`;\n }\n ObjectIdIsValidTemplate: &ObjectIdIsValidTemplate !!js/function >\n (lhs) => {\n return `${lhs}.isValid`;\n }\n ObjectIdIsValidArgsTemplate: &ObjectIdIsValidArgsTemplate null\n # JS Symbol Templates\n NumberSymbolTemplate: &NumberSymbolTemplate !!js/function >\n () => {\n return 'Number';\n }\n NumberSymbolArgsTemplate: &NumberSymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? '0' : arg;\n return `(${arg})`;\n }\n DateSymbolTemplate: &DateSymbolTemplate !!js/function >\n () => {\n return 'Date';\n }\n DateSymbolArgsTemplate: &DateSymbolArgsTemplate null\n DateSymbolNowTemplate: &DateSymbolNowTemplate !!js/function >\n () => {\n return 'Date.now';\n }\n DateSymbolNowArgsTemplate: &DateSymbolNowArgsTemplate null\n RegExpSymbolTemplate: &RegExpSymbolTemplate !!js/function >\n () => {\n return 'RegExp';\n }\n RegExpSymbolArgsTemplate: &RegExpSymbolArgsTemplate null\n ImportTemplate: &ImportTemplate !!js/function >\n (args) => {\n const bson = [];\n const other = [];\n Object.keys(args).map(\n (m) => {\n if (m > 99 && m < 200) {\n bson.push(args[m]);\n } else {\n other.push(args[m]);\n }\n }\n );\n if (bson.length) {\n other.push(`const {\\n ${bson.join(',\\n ')}\\n} = require('mongo');`);\n }\n return other.join('\\n');\n }\n 0ImportTemplate: &0ImportTemplate null\n 1ImportTemplate: &1ImportTemplate null\n 2ImportTemplate: &2ImportTemplate null\n 3ImportTemplate: &3ImportTemplate null\n 4ImportTemplate: &4ImportTemplate null\n 5ImportTemplate: &5ImportTemplate null\n 6ImportTemplate: &6ImportTemplate null\n 7ImportTemplate: &7ImportTemplate null\n 8ImportTemplate: &8ImportTemplate null\n 9ImportTemplate: &9ImportTemplate null\n 10ImportTemplate: &10ImportTemplate null\n 11ImportTemplate: &11ImportTemplate null\n 12ImportTemplate: &12ImportTemplate null\n 100ImportTemplate: &100ImportTemplate !!js/function >\n () => {\n return 'Code';\n }\n 101ImportTemplate: &101ImportTemplate !!js/function >\n () => {\n return 'ObjectId';\n }\n 102ImportTemplate: &102ImportTemplate !!js/function >\n () => {\n return 'Binary';\n }\n 103ImportTemplate: &103ImportTemplate !!js/function >\n () => {\n return 'DBRef';\n }\n 104ImportTemplate: &104ImportTemplate !!js/function >\n () => {\n return 'Double';\n }\n 105ImportTemplate: &105ImportTemplate !!js/function >\n () => {\n return 'Int32';\n }\n 106ImportTemplate: &106ImportTemplate !!js/function >\n () => {\n return 'Long';\n }\n 107ImportTemplate: &107ImportTemplate !!js/function >\n () => {\n return 'MinKey';\n }\n 108ImportTemplate: &108ImportTemplate !!js/function >\n () => {\n return 'MaxKey';\n }\n 109ImportTemplate: &109ImportTemplate !!js/function >\n () => {\n return 'BSONRegExp';\n }\n 110ImportTemplate: &110ImportTemplate !!js/function >\n () => {\n return 'Timestamp';\n }\n 111ImportTemplate: &111ImportTemplate !!js/function >\n () => {\n return 'BSONSymbol';\n }\n 112ImportTemplate: &112ImportTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n 113ImportTemplate: &113ImportTemplate null\n 114ImportTemplate: &114ImportTemplate null\n 200ImportTemplate: &200ImportTemplate null\n 201ImportTemplate: &201ImportTemplate null\n 300ImportTemplate: &300ImportTemplate null\n 301ImportTemplate: &301ImportTemplate null\n 302ImportTemplate: &302ImportTemplate null\n 303ImportTemplate: &303ImportTemplate null\n 304ImportTemplate: &304ImportTemplate null\n 305ImportTemplate: &305ImportTemplate null\n 306ImportTemplate: &306ImportTemplate null\n# Universal types\n# Everything inherits from StringType because we haven't implemented any of them.\nBasicTypes:\n # Universal basic types\n _bool: &BoolType\n <<: *__type\n id: \"_bool\"\n code: 0\n template: *BoolTypeTemplate\n _integer: &IntegerType\n <<: *__type\n id: \"_integer\"\n code: 1\n template: *IntegerTypeTemplate\n _long: &LongBasicType\n <<: *__type\n id: \"_long\"\n code: 2\n template: *LongBasicTypeTemplate\n _decimal: &DecimalType\n <<: *__type\n id: \"_decimal\"\n code: 3\n template: *DecimalTypeTemplate\n _hex: &HexType\n <<: *__type\n id: \"_hex\"\n code: 4\n template: *HexTypeTemplate\n _octal: &OctalType\n <<: *__type\n id: \"_octal\"\n code: 5\n template: *OctalTypeTemplate\n _numeric: &NumericType\n <<: *__type\n id: \"_numeric\"\n code: 6\n template: *NumericTypeTemplate\n _string: &StringType\n <<: *__type\n id: \"_string\"\n code: 7\n template: *StringTypeTemplate\n _regex: &RegexType\n <<: *__type\n id: \"_regex\"\n code: 8\n template: *RegexTypeTemplate\n _array: &ArrayType\n <<: *__type\n id: \"_array\"\n code: 9\n template: *ArrayTypeTemplate\n argsTemplate: *ArrayTypeArgsTemplate\n _object: &ObjectType\n <<: *__type\n id: \"_object\"\n code: 10\n template: *ObjectTypeTemplate\n argsTemplate: *ObjectTypeArgsTemplate\n _null: &NullType\n <<: *__type\n id: \"_null\"\n code: 11\n template: *NullTypeTemplate\n _undefined: &UndefinedType\n <<: *__type\n id: \"_undefined\"\n code: 12\n template: *UndefinedTypeTemplate\n\nSyntax:\n equality:\n template: *EqualitySyntaxTemplate\n in:\n template: *InSyntaxTemplate\n and:\n template: *AndSyntaxTemplate\n or:\n template: *OrSyntaxTemplate\n not:\n template: *NotSyntaxTemplate\n unary:\n template: *UnarySyntaxTemplate\n binary:\n template: *BinarySyntaxTemplate\n parens:\n template: *ParensSyntaxTemplate\n eos:\n template: *EosSyntaxTemplate\n eof:\n template: *EofSyntaxTemplate\n # The new template takes in expr, and an optional skip argument and optional\n # id argument. The skip argument is a boolean that if true then doesn't add\n # new. The code argument is the symbol code being called. The template will check\n # if it is an exception, i.e. a type that is a constructor but may not use new.\n new:\n template: *NewSyntaxTemplate\n # The regex flags that change symbols between languages can be defined here.\n # Flags that aren't defined can be left blank and will be ignored.\n regexFlags: *RegexFlags\n bsonRegexFlags: *BSONRegexFlags\nImports:\n import:\n template: *ImportTemplate\n 0:\n template: *0ImportTemplate\n 1:\n template: *1ImportTemplate\n 2:\n template: *2ImportTemplate\n 3:\n template: *3ImportTemplate\n 4:\n template: *4ImportTemplate\n 5:\n template: *5ImportTemplate\n 6:\n template: *6ImportTemplate\n 7:\n template: *7ImportTemplate\n 8:\n template: *8ImportTemplate\n 9:\n template: *9ImportTemplate\n 10:\n template: *10ImportTemplate\n 11:\n template: *11ImportTemplate\n 12:\n template: *12ImportTemplate\n 100:\n template: *100ImportTemplate\n 101:\n template: *101ImportTemplate\n 102:\n template: *102ImportTemplate\n 103:\n template: *103ImportTemplate\n 104:\n template: *104ImportTemplate\n 105:\n template: *105ImportTemplate\n 106:\n template: *106ImportTemplate\n 107:\n template: *107ImportTemplate\n 108:\n template: *108ImportTemplate\n 109:\n template: *109ImportTemplate\n 110:\n template: *110ImportTemplate\n 111:\n template: *111ImportTemplate\n 112:\n template: *112ImportTemplate\n 113:\n template: *113ImportTemplate\n 114:\n template: *114ImportTemplate\n 200:\n template: *200ImportTemplate\n 201:\n template: *201ImportTemplate\n 300:\n template: *300ImportTemplate\n 301:\n template: *301ImportTemplate\n 302:\n template: *302ImportTemplate\n 303:\n template: *303ImportTemplate\n 304:\n template: *304ImportTemplate\n 305:\n template: *305ImportTemplate\n 306:\n template: *306ImportTemplate\nBsonTypes:\n Code: &CodeType\n <<: *__type\n id: \"Code\"\n code: 100\n type: *ObjectType\n attr:\n code:\n callable: *var\n args: null\n attr: null\n id: \"code\"\n type: *StringType\n template: *CodeCodeTemplate\n argsTemplate: *CodeCodeArgsTemplate\n scope:\n callable: *var\n args: null\n attr: null\n id: \"scope\"\n type: *StringType\n template: *CodeScopeTemplate\n argsTemplate: *CodeScopeArgsTemplate\n ObjectId: &ObjectIdType\n <<: *__type\n id: \"ObjectId\"\n code: 101\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *ObjectIdToStringTemplate\n argsTemplate: *ObjectIdToStringArgsTemplate\n equals:\n <<: *__func\n id: \"equals\"\n args:\n - [ \"ObjectId\" ]\n type: *BoolType\n template: *ObjectIdEqualsTemplate\n argsTemplate: *ObjectIdEqualsArgsTemplate\n getTimestamp:\n <<: *__func\n id: \"getTimestamp\"\n type: *IntegerType\n template: *ObjectIdGetTimestampTemplate\n argsTemplate: *ObjectIdGetTimestampArgsTemplate\n BinData: &BinaryType\n <<: *__type\n id: \"BinData\"\n code: 102\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *BinaryToStringTemplate\n argsTemplate: *BinaryToStringArgsTemplate\n base64:\n <<: *__func\n id: \"base64\"\n type: *StringType\n template: *BinaryValueTemplate\n argsTemplate: *BinaryValueArgsTemplate\n length:\n <<: *__func\n id: \"length\"\n type: *IntegerType\n template: *BinaryLengthTemplate\n argsTemplate: *BinaryLengthArgsTemplate\n subtype:\n <<: *__func\n id: \"subtype\"\n type: *IntegerType\n template: *BinarySubtypeTemplate\n argsTemplate: *BinarySubtypeArgsTemplate\n DBRef: &DBRefType\n <<: *__type\n id: \"DBRef\"\n code: 103\n type: *ObjectType\n attr:\n getDb:\n <<: *__func\n id: \"getDb\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n $db:\n callable: *var\n args: null\n attr: null\n id: \"$db\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n getCollection:\n <<: *__func\n id: \"getCollection\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getRef:\n <<: *__func\n id: \"getRef\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n $ref:\n callable: *var\n args: null\n attr: null\n id: \"$ref\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getId:\n <<: *__func\n id: \"getId\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n $id:\n callable: *var\n args: null\n attr: null\n id: \"$id\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n NumberInt: &Int32Type\n <<: *__type\n id: \"NumberInt\"\n code: 105\n type: *ObjectType\n attr: {}\n NumberLong: &LongType\n <<: *__type\n id: \"NumberLong\"\n code: 106\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"LongtoString\" # Needs process method\n type: *StringType\n top:\n callable: *var\n args: null\n attr: null\n id: \"top\"\n type: *IntegerType\n template: *LongTopTemplate\n argsTemplate: null\n bottom:\n callable: *var\n args: null\n attr: null\n id: \"bottom\"\n type: *IntegerType\n template: *LongBottomTemplate\n argsTemplate: null\n floatApprox:\n callable: *var\n args: null\n attr: null\n id: \"floatApprox\"\n type: *IntegerType\n template: *LongFloatApproxTemplate\n argsTemplate: null\n MinKeyType: &MinKeyType\n <<: *__type\n id: \"MinKey\"\n code: 107\n type: *ObjectType\n MaxKeyType: &MaxKeyType\n <<: *__type\n id: \"MaxKey\"\n code: 108\n type: *ObjectType\n Timestamp: &TimestampType\n <<: *__type\n id: \"TimestampFromShell\"\n code: 110\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *TimestampToStringTemplate\n argsTemplate: *TimestampToStringArgsTemplate\n getTime:\n <<: *__func\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampGetLowBitsTemplate\n argsTemplate: *TimestampGetLowBitsArgsTemplate\n getInc:\n <<: *__func\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampGetHighBitsTemplate\n argsTemplate: *TimestampGetHighBitsArgsTemplate\n t:\n callable: *var\n args: null\n attr: null\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampTTemplate\n argsTemplate: null\n i:\n callable: *var\n args: null\n attr: null\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampITemplate\n argsTemplate: null\n Symbol: &SymbolType\n <<: *__type\n id: \"Symbol\"\n code: 111\n type: *ObjectType\n NumberDecimal: &Decimal128Type\n <<: *__type\n id: \"NumberDecimal\"\n code: 112\n type: *ObjectType\n attr: {}\n SUBTYPE_DEFAULT:\n id: \"SUBTYPE_DEFAULT\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeDefaultTemplate\n SUBTYPE_FUNCTION:\n id: \"SUBTYPE_FUNCTION\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeFunctionTemplate\n SUBTYPE_BYTE_ARRAY:\n id: \"SUBTYPE_BYTE_ARRAY\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeByteArrayTemplate\n SUBTYPE_UUID_OLD:\n id: \"SUBTYPE_UUID_OLD\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidOldTemplate\n SUBTYPE_UUID:\n id: \"SUBTYPE_UUID\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidTemplate\n SUBTYPE_MD5:\n id: \"SUBTYPE_MD5\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeMd5Template\n SUBTYPE_USER_DEFINED:\n id: \"SUBTYPE_USER_DEFINED\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUserDefinedTemplate\nNativeTypes:\n Date: &DateType\n <<: *__type\n id: \"Date\"\n code: 200\n type: *ObjectType\n attr: {} # TODO: no built-in date methods added yet\n RegExp: &RegExpType\n <<: *__type\n id: \"RegExp\"\n code: 8\n type: *ObjectType\n attr: {}\n\n\n\n\nBsonSymbols:\n Code: &CodeSymbol\n id: \"Code\"\n code: 100\n callable: *constructor\n args:\n - [ *StringType, null ]\n - [ *ObjectType, null ]\n type: *CodeType\n attr: {}\n template: *CodeSymbolTemplate\n argsTemplate: *CodeSymbolArgsTemplate\n ObjectId: &ObjectIdSymbol\n id: \"ObjectId\"\n code: 101\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *ObjectIdType\n attr:\n fromDate:\n <<: *__func\n id: \"ObjectIdCreateFromTime\"\n args:\n - [ *DateType ]\n type: *ObjectIdType\n template: *ObjectIdCreateFromTimeTemplate\n argsTemplate: *ObjectIdCreateFromTimeArgsTemplate\n template: *ObjectIdSymbolTemplate\n argsTemplate: *ObjectIdSymbolArgsTemplate\n BinData: &BinarySymbol\n id: \"BinData\"\n code: 102\n callable: *constructor\n args:\n - [ *IntegerType ]\n - [ *StringType ]\n type: *BinaryType\n attr: {}\n template: *BinarySymbolTemplate\n argsTemplate: *BinarySymbolArgsTemplate\n DBRef:\n id: \"DBRef\"\n code: 103\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectIdType ]\n - [ *StringType, null ]\n type: *DBRefType\n attr: {}\n template: *DBRefSymbolTemplate\n argsTemplate: *DBRefSymbolArgsTemplate\n NumberInt:\n id: \"Int32\"\n code: 105\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *Int32Type\n attr: {}\n template: *Int32SymbolTemplate\n argsTemplate: *Int32SymbolArgsTemplate\n NumberLong:\n id: \"NumberLong\"\n code: 106\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *LongType\n attr: {}\n template: *LongSymbolTemplate\n argsTemplate: *LongSymbolArgsTemplate\n MinKey:\n id: \"MinKey\"\n code: 107\n callable: *constructor\n args: []\n type: *MinKeyType\n attr: {}\n template: *MinKeySymbolTemplate\n argsTemplate: *MinKeySymbolArgsTemplate\n MaxKey:\n id: \"MaxKey\"\n code: 108\n callable: *constructor\n args: []\n type: *MaxKeyType\n attr: {}\n template: *MaxKeySymbolTemplate\n argsTemplate: *MaxKeySymbolArgsTemplate\n Timestamp:\n id: \"Timestamp\"\n code: 110\n callable: *constructor\n args:\n - [ *IntegerType, null ]\n - [ *IntegerType, null ]\n type: *TimestampType\n attr: {}\n template: *TimestampSymbolTemplate\n argsTemplate: *TimestampSymbolArgsTemplate\n Symbol:\n id: \"Symbol\"\n code: 111\n callable: *constructor\n args:\n - [ *StringType ]\n type: *SymbolType\n attr: {}\n template: *SymbolSymbolTemplate\n argsTemplate: *SymbolSymbolArgsTemplate\n NumberDecimal:\n id: \"NumberDecimal\"\n code: 112\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n type: *Decimal128Type\n attr: {}\n template: *Decimal128SymbolTemplate\n argsTemplate: *Decimal128SymbolArgsTemplate\n\nNativeSymbols:\n Number:\n id: \"Number\"\n code: 2\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *NumericType\n attr: {} # TODO: no built-in number funcs added yet\n template: *NumberSymbolTemplate\n argsTemplate: *NumberSymbolArgsTemplate\n Date: # Needs emit method\n id: \"Date\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n type: *DateType\n attr: # TODO: add more date funcs?\n now:\n id: \"now\"\n code: 200.1\n callable: *func\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n ISODate: # Needs emit method\n id: \"ISODate\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *DateType\n attr:\n now:\n id: \"now\"\n callable: *constructor\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n RegExp: # Needs process method\n id: \"RegExp\"\n code: 8\n callable: *constructor\n args:\n - [ *StringType, *RegexType ]\n - [ *StringType, null ]\n type: *RegExpType\n attr: {} # TODO: no built-in regex funcs added yet\n template: *RegExpSymbolTemplate\n argsTemplate: *RegExpSymbolArgsTemplate\n\n";
module.exports="SymbolTypes:\n VAR: &var 0\n CONSTRUCTOR: &constructor 1\n FUNC: &func 2\n# Internal patterns to save typing\n__type: &__type\n id: null\n callable: *var\n args: null\n type: null\n attr: {}\n template: null\n argsTemplate: null\n__func: &__func\n callable: *func\n args: []\n attr: {}\n template: null\n argsTemplate: null\n\n# Javascript Templates\nTemplates:\n # Misc\n RegexFlags: &RegexFlags\n i: 'i'\n m: 'm'\n u: 'u'\n y: 'y'\n g: 'g'\n BSONRegexFlags: &BSONRegexFlags\n i: 'i'\n m: 'm'\n x: 'x'\n s: 's'\n l: 'l'\n u: 'u'\n # Syntax\n EqualitySyntaxTemplate: &EqualitySyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n if (op.includes('!') || op.includes('not')) {\n return `${lhs} !== ${rhs}`;\n } else if (op === '==' || op === '===' || op === 'is') {\n return `${lhs} === ${rhs}`;\n }\n return `${lhs} ${op} ${rhs}`;\n }\n InSyntaxTemplate: &InSyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n let str = '!==';\n if (op.includes('!') || op.includes('not')) {\n str = '===';\n }\n return `${rhs}.indexOf(${lhs}) ${str} -1`\n }\n AndSyntaxTemplate: &AndSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' && ');\n }\n OrSyntaxTemplate: &OrSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' || ');\n }\n NotSyntaxTemplate: &NotSyntaxTemplate !!js/function >\n (arg) => {\n return `!${arg}`;\n }\n UnarySyntaxTemplate: &UnarySyntaxTemplate null\n BinarySyntaxTemplate: &BinarySyntaxTemplate !!js/function >\n (args) => {\n return args.reduce((s, op, i, arr) => {\n if (i % 2 === 0) {\n return s;\n }\n const rhs = arr[i + 1];\n switch(op) {\n case '//':\n return `Math.floor(${s}, ${rhs})`;\n case '**':\n return `Math.pow(${s}, ${rhs})`;\n default:\n return `${s} ${op} ${rhs}`;\n }\n }, args[0]);\n }\n ParensSyntaxTemplate: &ParensSyntaxTemplate null\n EosSyntaxTemplate: &EosSyntaxTemplate null\n EofSyntaxTemplate: &EofSyntaxTemplate null\n NewTemplate: &NewSyntaxTemplate !!js/function >\n (expr, skip, code) => {\n // Add classes that don't use \"new\" to array.\n // So far: [Date.now, Decimal128/NumberDecimal, Long/NumberLong]\n noNew = [200.1, 112, 106];\n if (skip || (code && noNew.indexOf(code) !== -1)) {\n return expr;\n }\n return `new ${expr}`;\n }\n # BSON Object Type templates\n CodeTypeTemplate: &CodeTypeTemplate null\n StringTypeTemplate: &StringTypeTemplate !!js/function >\n (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n }\n RegexTypeTemplate: &RegexTypeTemplate !!js/function >\n (pattern, flags) => {\n const str = pattern;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n pattern = `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n return `RegExp(${pattern}${flags ? ', ' + '\\'' + flags + '\\'': ''})`;\n }\n BoolTypeTemplate: &BoolTypeTemplate !!js/function >\n (literal) => {\n return literal.toLowerCase();\n }\n IntegerTypeTemplate: &IntegerTypeTemplate null\n DecimalTypeTemplate: &DecimalTypeTemplate null\n LongBasicTypeTemplate: &LongBasicTypeTemplate null\n HexTypeTemplate: &HexTypeTemplate null\n OctalTypeTemplate: &OctalTypeTemplate null\n NumericTypeTemplate: &NumericTypeTemplate null\n ArrayTypeTemplate: &ArrayTypeTemplate !!js/function >\n (literal, depth) => {\n depth++;\n if (literal === '') {\n return '[]'\n }\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n\n return `[${indent}${literal}${closingIndent}]`;\n }\n ArrayTypeArgsTemplate: &ArrayTypeArgsTemplate null\n NullTypeTemplate: &NullTypeTemplate !!js/function >\n () => {\n return 'null';\n }\n UndefinedTypeTemplate: &UndefinedTypeTemplate !!js/function >\n () => {\n return 'undefined';\n }\n ObjectTypeTemplate: &ObjectTypeTemplate !!js/function >\n (literal) => {\n if (literal === '') {\n return '{}';\n }\n return literal;\n }\n ObjectTypeArgsTemplate: &ObjectTypeArgsTemplate !!js/function >\n (args, depth) => {\n if (args.length === 0) {\n return '{}';\n }\n depth++;\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n }\n const pairs = args.map((arg) => {\n return `${indent}${singleStringify(arg[0])}: ${arg[1]}`;\n }).join(', ');\n\n return `{${pairs}${closingIndent}}`\n }\n # BSON Object Method templates\n CodeCodeTemplate: &CodeCodeTemplate null\n CodeCodeArgsTemplate: &CodeCodeArgsTemplate null\n CodeScopeTemplate: &CodeScopeTemplate null\n CodeScopeArgsTemplate: &CodeScopeArgsTemplate null\n ObjectIdToStringTemplate: &ObjectIdToStringTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toString()`;\n }\n ObjectIdToStringArgsTemplate: &ObjectIdToStringArgsTemplate !!js/function >\n () => {\n return '';\n }\n ObjectIdEqualsTemplate: &ObjectIdEqualsTemplate null\n ObjectIdEqualsArgsTemplate: &ObjectIdEqualsArgsTemplate null\n ObjectIdGetTimestampTemplate: &ObjectIdGetTimestampTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getTimestamp()`;\n }\n ObjectIdGetTimestampArgsTemplate: &ObjectIdGetTimestampArgsTemplate !!js/function >\n () => {\n return '';\n }\n BinaryValueTemplate: &BinaryValueTemplate null\n BinaryValueArgsTemplate: &BinaryValueArgsTemplate null\n BinaryLengthTemplate: &BinaryLengthTemplate null\n BinaryLengthArgsTemplate: &BinaryLengthArgsTemplate null\n BinaryToStringTemplate: &BinaryToStringTemplate null\n BinaryToStringArgsTemplate: &BinaryToStringArgsTemplate null\n BinarySubtypeTemplate: &BinarySubtypeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.sub_type`;\n }\n BinarySubtypeArgsTemplate: &BinarySubtypeArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetDBTemplate: &DBRefGetDBTemplate !!js/function >\n (lhs) => {\n return `${lhs}.db`;\n }\n DBRefGetCollectionTemplate: &DBRefGetCollectionTemplate !!js/function >\n (lhs) => {\n return `${lhs}.namespace`;\n }\n DBRefGetIdTemplate: &DBRefGetIdTemplate !!js/function >\n (lhs) => {\n return `${lhs}.oid`;\n }\n DBRefGetDBArgsTemplate: &DBRefGetDBArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetCollectionArgsTemplate: &DBRefGetCollectionArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetIdArgsTemplate: &DBRefGetIdArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongEqualsTemplate: &LongEqualsTemplate null\n LongEqualsArgsTemplate: &LongEqualsArgsTemplate null\n LongToStringTemplate: &LongToStringTemplate null\n LongToStringArgsTemplate: &LongToStringArgsTemplate null\n LongToIntTemplate: &LongToIntTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toInt`;\n }\n LongToIntArgsTemplate: &LongToIntArgsTemplate null\n LongToNumberTemplate: &LongToNumberTemplate null\n LongToNumberArgsTemplate: &LongToNumberArgsTemplate null\n LongAddTemplate: &LongAddTemplate null\n LongAddArgsTemplate: &LongAddArgsTemplate null\n LongSubtractTemplate: &LongSubtractTemplate null\n LongSubtractArgsTemplate: &LongSubtractArgsTemplate null\n LongMultiplyTemplate: &LongMultiplyTemplate null\n LongMultiplyArgsTemplate: &LongMultiplyArgsTemplate null\n LongDivTemplate: &LongDivTemplate null\n LongDivArgsTemplate: &LongDivArgsTemplate null\n LongModuloTemplate: &LongModuloTemplate null\n LongModuloArgsTemplate: &LongModuloArgsTemplate null\n LongAndTemplate: &LongAndTemplate null\n LongAndArgsTemplate: &LongAndArgsTemplate null\n LongOrTemplate: &LongOrTemplate null\n LongOrArgsTemplate: &LongOrArgsTemplate null\n LongXorTemplate: &LongXorTemplate null\n LongXorArgsTemplate: &LongXorArgsTemplate null\n LongShiftLeftTemplate: &LongShiftLeftTemplate null\n LongShiftLeftArgsTemplate: &LongShiftLeftArgsTemplate null\n LongShiftRightTemplate: &LongShiftRightTemplate null\n LongShiftRightArgsTemplate: &LongShiftRightArgsTemplate null\n LongCompareTemplate: &LongCompareTemplate null\n LongCompareArgsTemplate: &LongCompareArgsTemplate null\n LongIsOddTemplate: &LongIsOddTemplate null\n LongIsOddArgsTemplate: &LongIsOddArgsTemplate null\n LongIsZeroTemplate: &LongIsZeroTemplate null\n LongIsZeroArgsTemplate: &LongIsZeroArgsTemplate null\n LongIsNegativeTemplate: &LongIsNegativeTemplate null\n LongIsNegativeArgsTemplate: &LongIsNegativeArgsTemplate null\n LongNegateTemplate: &LongNegateTemplate null\n LongNegateArgsTemplate: &LongNegateArgsTemplate null\n LongNotTemplate: &LongNotTemplate null\n LongNotArgsTemplate: &LongNotArgsTemplate null\n LongNotEqualsTemplate: &LongNotEqualsTemplate null\n LongNotEqualsArgsTemplate: &LongNotEqualsArgsTemplate null\n LongGreaterThanTemplate: &LongGreaterThanTemplate null\n LongGreaterThanArgsTemplate: &LongGreaterThanArgsTemplate null\n LongGreaterThanOrEqualTemplate: &LongGreaterThanOrEqualTemplate null\n LongGreaterThanOrEqualArgsTemplate: &LongGreaterThanOrEqualArgsTemplate null\n LongLessThanTemplate: &LongLessThanTemplate null\n LongLessThanArgsTemplate: &LongLessThanArgsTemplate null\n LongLessThanOrEqualTemplate: &LongLessThanOrEqualTemplate null\n LongLessThanOrEqualArgsTemplate: &LongLessThanOrEqualArgsTemplate null\n LongFloatApproxTemplate: &LongFloatApproxTemplate !!js/function >\n (lhs) => {\n return `${lhs}.toNumber()`;\n }\n LongTopTemplate: &LongTopTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits()`;\n }\n LongBottomTemplate: &LongBottomTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits()`;\n }\n TimestampToStringTemplate: &TimestampToStringTemplate null\n TimestampToStringArgsTemplate: &TimestampToStringArgsTemplate null\n TimestampEqualsTemplate: &TimestampEqualsTemplate null\n TimestampEqualsArgsTemplate: &TimestampEqualsArgsTemplate null\n TimestampGetLowBitsTemplate: &TimestampGetLowBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits`;\n }\n TimestampGetLowBitsArgsTemplate: &TimestampGetLowBitsArgsTemplate null\n TimestampGetHighBitsTemplate: &TimestampGetHighBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits`;\n }\n TimestampGetHighBitsArgsTemplate: &TimestampGetHighBitsArgsTemplate null\n TimestampTTemplate: &TimestampTTemplate !!js/function >\n (lhs) => {\n return `${lhs}.getLowBits()`;\n }\n TimestampITemplate: &TimestampITemplate !!js/function >\n (lhs) => {\n return `${lhs}.getHighBits()`;\n }\n TimestampAsDateTemplate: &TimestampAsDateTemplate !!js/function >\n (lhs) => {\n return `new Date(${lhs}.getHighBits() * 1000)`;\n }\n TimestampAsDateArgsTemplate: &TimestampAsDateArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampCompareTemplate: &TimestampCompareTemplate null\n TimestampCompareArgsTemplate: &TimestampCompareArgsTemplate null\n TimestampNotEqualsTemplate: &TimestampNotEqualsTemplate null\n TimestampNotEqualsArgsTemplate: &TimestampNotEqualsArgsTemplate null\n TimestampGreaterThanTemplate: &TimestampGreaterThanTemplate null\n TimestampGreaterThanArgsTemplate: &TimestampGreaterThanArgsTemplate null\n TimestampGreaterThanOrEqualTemplate: &TimestampGreaterThanOrEqualTemplate null\n TimestampGreaterThanOrEqualArgsTemplate: &TimestampGreaterThanOrEqualArgsTemplate null\n TimestampLessThanTemplate: &TimestampLessThanTemplate null\n TimestampLessThanArgsTemplate: &TimestampLessThanArgsTemplate null\n TimestampLessThanOrEqualTemplate: &TimestampLessThanOrEqualTemplate null\n TimestampLessThanOrEqualArgsTemplate: &TimestampLessThanOrEqualArgsTemplate null\n SymbolValueOfTemplate: &SymbolValueOfTemplate null\n SymbolValueOfArgsTemplate: &SymbolValueOfArgsTemplate null\n SymbolInspectTemplate: &SymbolInspectTemplate null\n SymbolInspectArgsTemplate: &SymbolInspectArgsTemplate null\n SymbolToStringTemplate: &SymbolToStringTemplate null\n SymbolToStringArgsTemplate: &SymbolToStringArgsTemplate null\n # Symbol Templates\n CodeSymbolTemplate: &CodeSymbolTemplate null\n CodeSymbolArgsTemplate: &CodeSymbolArgsTemplate !!js/function >\n (lhs, code, scope) => {\n code = code === undefined ? '\\'\\'' : code;\n scope = scope === undefined ? '' : `, ${scope}`;\n return `(${code}${scope})`;\n }\n ObjectIdSymbolTemplate: &ObjectIdSymbolTemplate null\n ObjectIdSymbolArgsTemplate: &ObjectIdSymbolArgsTemplate !!js/function >\n (lhs, str) => {\n if (!str || str.length === 0) {\n return '()';\n }\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `('${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}')`;\n }\n BinarySymbolTemplate: &BinarySymbolTemplate !!js/function >\n () => {\n return 'Binary';\n }\n BinarySymbolArgsTemplate: &BinarySymbolArgsTemplate !!js/function >\n (lhs, buffer, subtype) => {\n return `(${buffer.toString('base64')}, '${subtype}')`;\n }\n BinarySymbolSubtypeDefaultTemplate: &BinarySymbolSubtypeDefaultTemplate null\n BinarySymbolSubtypeFunctionTemplate: &BinarySymbolSubtypeFunctionTemplate null\n BinarySymbolSubtypeByteArrayTemplate: &BinarySymbolSubtypeByteArrayTemplate null\n BinarySymbolSubtypeUuidOldTemplate: &BinarySymbolSubtypeUuidOldTemplate null\n BinarySymbolSubtypeUuidTemplate: &BinarySymbolSubtypeUuidTemplate null\n BinarySymbolSubtypeMd5Template: &BinarySymbolSubtypeMd5Template null\n BinarySymbolSubtypeUserDefinedTemplate: &BinarySymbolSubtypeUserDefinedTemplate null\n DBRefSymbolTemplate: &DBRefSymbolTemplate null\n DBRefSymbolArgsTemplate: &DBRefSymbolArgsTemplate null\n DoubleSymbolTemplate: &DoubleSymbolTemplate !!js/function >\n () => {\n return 'Double';\n }\n DoubleSymbolArgsTemplate: &DoubleSymbolArgsTemplate null\n Int32SymbolTemplate: &Int32SymbolTemplate !!js/function >\n () => {\n return 'Int32';\n }\n Int32SymbolArgsTemplate: &Int32SymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? 0 : arg;\n return `(${arg})`;\n }\n LongSymbolTemplate: &LongSymbolTemplate !!js/function >\n () => {\n return '';\n }\n LongSymbolArgsTemplate: &LongSymbolArgsTemplate !!js/function >\n (lhs, arg, type) => {\n arg = arg === undefined ? 0 : arg;\n if (type === '_string') {\n return `Long.fromString(${arg})`;\n }\n return `Long.fromNumber(${arg})`;\n }\n LongSymbolMaxTemplate: &LongSymbolMaxTemplate null\n LongSymbolMaxArgsTemplate: &LongSymbolMaxArgsTemplate null\n LongSymbolMinTemplate: &LongSymbolMinTemplate null\n LongSymbolMinArgsTemplate: &LongSymbolMinArgsTemplate null\n LongSymbolZeroTemplate: &LongSymbolZeroTemplate null\n LongSymbolZeroArgsTemplate: &LongSymbolZeroArgsTemplate null\n LongSymbolOneTemplate: &LongSymbolOneTemplate null\n LongSymbolOneArgsTemplate: &LongSymbolOneArgsTemplate null\n LongSymbolNegOneTemplate: &LongSymbolNegOneTemplate null\n LongSymbolNegOneArgsTemplate: &LongSymbolNegOneArgsTemplate null\n LongSymbolFromBitsTemplate: &LongSymbolFromBitsTemplate null\n LongSymbolFromBitsArgsTemplate: &LongSymbolFromBitsArgsTemplate null\n LongSymbolFromIntTemplate: &LongSymbolFromIntTemplate null\n LongSymbolFromIntArgsTemplate: &LongSymbolFromIntArgsTemplate null\n LongSymbolFromNumberTemplate: &LongSymbolFromNumberTemplate null\n LongSymbolFromNumberArgsTemplate: &LongSymbolFromNumberArgsTemplate null\n LongSymbolFromStringTemplate: &LongSymbolFromStringTemplate null\n LongSymbolFromStringArgsTemplate: &LongSymbolFromStringArgsTemplate null\n MinKeySymbolTemplate: &MinKeySymbolTemplate null\n MinKeySymbolArgsTemplate: &MinKeySymbolArgsTemplate null\n MaxKeySymbolTemplate: &MaxKeySymbolTemplate null\n MaxKeySymbolArgsTemplate: &MaxKeySymbolArgsTemplate null\n TimestampSymbolTemplate: &TimestampSymbolTemplate null\n TimestampSymbolArgsTemplate: &TimestampSymbolArgsTemplate !!js/function >\n (lhs, arg1, arg2) => {\n return `(${arg1 === undefined ? 0 : arg1}, ${arg2 === undefined ? 0 : arg2})`;\n }\n SymbolSymbolTemplate: &SymbolSymbolTemplate !!js/function >\n () => {\n return 'BSONSymbol';\n }\n SymbolSymbolArgsTemplate: &SymbolSymbolArgsTemplate null\n BSONRegExpSymbolTemplate: &BSONRegExpSymbolTemplate !!js/function >\n () => {\n return 'BSONRegExp';\n }\n BSONRegExpSymbolArgsTemplate: &BSONRegExpSymbolArgsTemplate !!js/function >\n (lhs, pattern, flags) => {\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n }\n return `(${singleStringify(pattern)}${flags ? ', ' + singleStringify(flags) : ''})`;\n }\n Decimal128SymbolTemplate: &Decimal128SymbolTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolArgsTemplate: &Decimal128SymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? '0' : arg.toString();\n if (arg.charAt(0) === '\\'' && arg.charAt(arg.length - 1) === '\\'') {\n return `.fromString(${arg})`;\n }\n return `.fromString('${arg}')`;\n }\n Decimal128SymbolFromStringTemplate: &Decimal128SymbolFromStringTemplate null\n Decimal128SymbolFromStringArgsTemplate: &Decimal128SymbolFromStringArgsTemplate null\n Decimal128ToStringTemplate: &Decimal128ToStringTemplate null\n Decimal128ToStringArgsTemplate: &Decimal128ToStringArgsTemplate null\n # BSON Util Templates\n ObjectIdCreateFromHexStringTemplate: &ObjectIdCreateFromHexStringTemplate null\n ObjectIdCreateFromHexStringArgsTemplate: &ObjectIdCreateFromHexStringArgsTemplate null\n ObjectIdCreateFromTimeTemplate: &ObjectIdCreateFromTimeTemplate !!js/function >\n () => {\n return `ObjectId.createFromTime`;\n }\n ObjectIdCreateFromTimeArgsTemplate: &ObjectIdCreateFromTimeArgsTemplate !!js/function >\n (lhs, arg, isNumber) => {\n if (!isNumber) {\n return `(${arg}.getTime() / 1000)`;\n }\n return `(${arg})`;\n }\n ObjectIdIsValidTemplate: &ObjectIdIsValidTemplate !!js/function >\n (lhs) => {\n return `${lhs}.isValid`;\n }\n ObjectIdIsValidArgsTemplate: &ObjectIdIsValidArgsTemplate null\n # JS Symbol Templates\n NumberSymbolTemplate: &NumberSymbolTemplate !!js/function >\n () => {\n return 'Number';\n }\n NumberSymbolArgsTemplate: &NumberSymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? '0' : arg;\n return `(${arg})`;\n }\n DateSymbolTemplate: &DateSymbolTemplate !!js/function >\n () => {\n return 'Date';\n }\n DateSymbolArgsTemplate: &DateSymbolArgsTemplate null\n DateSymbolNowTemplate: &DateSymbolNowTemplate !!js/function >\n () => {\n return 'Date.now';\n }\n DateSymbolNowArgsTemplate: &DateSymbolNowArgsTemplate null\n RegExpSymbolTemplate: &RegExpSymbolTemplate !!js/function >\n () => {\n return 'RegExp';\n }\n RegExpSymbolArgsTemplate: &RegExpSymbolArgsTemplate null\n ImportTemplate: &ImportTemplate !!js/function >\n (args) => {\n const bson = [];\n const other = [];\n Object.keys(args).map(\n (m) => {\n if (m > 99 && m < 200) {\n bson.push(args[m]);\n } else {\n other.push(args[m]);\n }\n }\n );\n if (bson.length) {\n other.push(`const {\\n ${bson.join(',\\n ')}\\n} = require('bson');`);\n }\n return other.join('\\n');\n }\n 0ImportTemplate: &0ImportTemplate null\n 1ImportTemplate: &1ImportTemplate null\n 2ImportTemplate: &2ImportTemplate null\n 3ImportTemplate: &3ImportTemplate null\n 4ImportTemplate: &4ImportTemplate null\n 5ImportTemplate: &5ImportTemplate null\n 6ImportTemplate: &6ImportTemplate null\n 7ImportTemplate: &7ImportTemplate null\n 8ImportTemplate: &8ImportTemplate null\n 9ImportTemplate: &9ImportTemplate null\n 10ImportTemplate: &10ImportTemplate null\n 11ImportTemplate: &11ImportTemplate null\n 12ImportTemplate: &12ImportTemplate null\n 100ImportTemplate: &100ImportTemplate !!js/function >\n () => {\n return 'Code';\n }\n 101ImportTemplate: &101ImportTemplate !!js/function >\n () => {\n return 'ObjectId';\n }\n 102ImportTemplate: &102ImportTemplate !!js/function >\n () => {\n return 'Binary';\n }\n 103ImportTemplate: &103ImportTemplate !!js/function >\n () => {\n return 'DBRef';\n }\n 104ImportTemplate: &104ImportTemplate !!js/function >\n () => {\n return 'Double';\n }\n 105ImportTemplate: &105ImportTemplate !!js/function >\n () => {\n return 'Int32';\n }\n 106ImportTemplate: &106ImportTemplate !!js/function >\n () => {\n return 'Long';\n }\n 107ImportTemplate: &107ImportTemplate !!js/function >\n () => {\n return 'MinKey';\n }\n 108ImportTemplate: &108ImportTemplate !!js/function >\n () => {\n return 'MaxKey';\n }\n 109ImportTemplate: &109ImportTemplate !!js/function >\n () => {\n return 'BSONRegExp';\n }\n 110ImportTemplate: &110ImportTemplate !!js/function >\n () => {\n return 'Timestamp';\n }\n 111ImportTemplate: &111ImportTemplate !!js/function >\n () => {\n return 'BSONSymbol';\n }\n 112ImportTemplate: &112ImportTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n 113ImportTemplate: &113ImportTemplate null\n 114ImportTemplate: &114ImportTemplate null\n 200ImportTemplate: &200ImportTemplate null\n 201ImportTemplate: &201ImportTemplate null\n 300ImportTemplate: &300ImportTemplate null\n 301ImportTemplate: &301ImportTemplate null\n 302ImportTemplate: &302ImportTemplate null\n 303ImportTemplate: &303ImportTemplate null\n 304ImportTemplate: &304ImportTemplate null\n 305ImportTemplate: &305ImportTemplate null\n 306ImportTemplate: &306ImportTemplate null\n# Universal types\n# Everything inherits from StringType because we haven't implemented any of them.\nBasicTypes:\n # Universal basic types\n _bool: &BoolType\n <<: *__type\n id: \"_bool\"\n code: 0\n template: *BoolTypeTemplate\n _integer: &IntegerType\n <<: *__type\n id: \"_integer\"\n code: 1\n template: *IntegerTypeTemplate\n _long: &LongBasicType\n <<: *__type\n id: \"_long\"\n code: 2\n template: *LongBasicTypeTemplate\n _decimal: &DecimalType\n <<: *__type\n id: \"_decimal\"\n code: 3\n template: *DecimalTypeTemplate\n _hex: &HexType\n <<: *__type\n id: \"_hex\"\n code: 4\n template: *HexTypeTemplate\n _octal: &OctalType\n <<: *__type\n id: \"_octal\"\n code: 5\n template: *OctalTypeTemplate\n _numeric: &NumericType\n <<: *__type\n id: \"_numeric\"\n code: 6\n template: *NumericTypeTemplate\n _string: &StringType\n <<: *__type\n id: \"_string\"\n code: 7\n template: *StringTypeTemplate\n _regex: &RegexType\n <<: *__type\n id: \"_regex\"\n code: 8\n template: *RegexTypeTemplate\n _array: &ArrayType\n <<: *__type\n id: \"_array\"\n code: 9\n template: *ArrayTypeTemplate\n argsTemplate: *ArrayTypeArgsTemplate\n _object: &ObjectType\n <<: *__type\n id: \"_object\"\n code: 10\n template: *ObjectTypeTemplate\n argsTemplate: *ObjectTypeArgsTemplate\n _null: &NullType\n <<: *__type\n id: \"_null\"\n code: 11\n template: *NullTypeTemplate\n _undefined: &UndefinedType\n <<: *__type\n id: \"_undefined\"\n code: 12\n template: *UndefinedTypeTemplate\n\nSyntax:\n equality:\n template: *EqualitySyntaxTemplate\n in:\n template: *InSyntaxTemplate\n and:\n template: *AndSyntaxTemplate\n or:\n template: *OrSyntaxTemplate\n not:\n template: *NotSyntaxTemplate\n unary:\n template: *UnarySyntaxTemplate\n binary:\n template: *BinarySyntaxTemplate\n parens:\n template: *ParensSyntaxTemplate\n eos:\n template: *EosSyntaxTemplate\n eof:\n template: *EofSyntaxTemplate\n # The new template takes in expr, and an optional skip argument and optional\n # id argument. The skip argument is a boolean that if true then doesn't add\n # new. The code argument is the symbol code being called. The template will check\n # if it is an exception, i.e. a type that is a constructor but may not use new.\n new:\n template: *NewSyntaxTemplate\n # The regex flags that change symbols between languages can be defined here.\n # Flags that aren't defined can be left blank and will be ignored.\n regexFlags: *RegexFlags\n bsonRegexFlags: *BSONRegexFlags\nImports:\n import:\n template: *ImportTemplate\n 0:\n template: *0ImportTemplate\n 1:\n template: *1ImportTemplate\n 2:\n template: *2ImportTemplate\n 3:\n template: *3ImportTemplate\n 4:\n template: *4ImportTemplate\n 5:\n template: *5ImportTemplate\n 6:\n template: *6ImportTemplate\n 7:\n template: *7ImportTemplate\n 8:\n template: *8ImportTemplate\n 9:\n template: *9ImportTemplate\n 10:\n template: *10ImportTemplate\n 11:\n template: *11ImportTemplate\n 12:\n template: *12ImportTemplate\n 100:\n template: *100ImportTemplate\n 101:\n template: *101ImportTemplate\n 102:\n template: *102ImportTemplate\n 103:\n template: *103ImportTemplate\n 104:\n template: *104ImportTemplate\n 105:\n template: *105ImportTemplate\n 106:\n template: *106ImportTemplate\n 107:\n template: *107ImportTemplate\n 108:\n template: *108ImportTemplate\n 109:\n template: *109ImportTemplate\n 110:\n template: *110ImportTemplate\n 111:\n template: *111ImportTemplate\n 112:\n template: *112ImportTemplate\n 113:\n template: *113ImportTemplate\n 114:\n template: *114ImportTemplate\n 200:\n template: *200ImportTemplate\n 201:\n template: *201ImportTemplate\n 300:\n template: *300ImportTemplate\n 301:\n template: *301ImportTemplate\n 302:\n template: *302ImportTemplate\n 303:\n template: *303ImportTemplate\n 304:\n template: *304ImportTemplate\n 305:\n template: *305ImportTemplate\n 306:\n template: *306ImportTemplate\nBsonTypes:\n Code: &CodeType\n <<: *__type\n id: \"Code\"\n code: 100\n type: *ObjectType\n attr:\n code:\n callable: *var\n args: null\n attr: null\n id: \"code\"\n type: *StringType\n template: *CodeCodeTemplate\n argsTemplate: *CodeCodeArgsTemplate\n scope:\n callable: *var\n args: null\n attr: null\n id: \"scope\"\n type: *StringType\n template: *CodeScopeTemplate\n argsTemplate: *CodeScopeArgsTemplate\n ObjectId: &ObjectIdType\n <<: *__type\n id: \"ObjectId\"\n code: 101\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *ObjectIdToStringTemplate\n argsTemplate: *ObjectIdToStringArgsTemplate\n equals:\n <<: *__func\n id: \"equals\"\n args:\n - [ \"ObjectId\" ]\n type: *BoolType\n template: *ObjectIdEqualsTemplate\n argsTemplate: *ObjectIdEqualsArgsTemplate\n getTimestamp:\n <<: *__func\n id: \"getTimestamp\"\n type: *IntegerType\n template: *ObjectIdGetTimestampTemplate\n argsTemplate: *ObjectIdGetTimestampArgsTemplate\n BinData: &BinaryType\n <<: *__type\n id: \"BinData\"\n code: 102\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *BinaryToStringTemplate\n argsTemplate: *BinaryToStringArgsTemplate\n base64:\n <<: *__func\n id: \"base64\"\n type: *StringType\n template: *BinaryValueTemplate\n argsTemplate: *BinaryValueArgsTemplate\n length:\n <<: *__func\n id: \"length\"\n type: *IntegerType\n template: *BinaryLengthTemplate\n argsTemplate: *BinaryLengthArgsTemplate\n subtype:\n <<: *__func\n id: \"subtype\"\n type: *IntegerType\n template: *BinarySubtypeTemplate\n argsTemplate: *BinarySubtypeArgsTemplate\n DBRef: &DBRefType\n <<: *__type\n id: \"DBRef\"\n code: 103\n type: *ObjectType\n attr:\n getDb:\n <<: *__func\n id: \"getDb\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n $db:\n callable: *var\n args: null\n attr: null\n id: \"$db\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n getCollection:\n <<: *__func\n id: \"getCollection\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getRef:\n <<: *__func\n id: \"getRef\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n $ref:\n callable: *var\n args: null\n attr: null\n id: \"$ref\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getId:\n <<: *__func\n id: \"getId\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n $id:\n callable: *var\n args: null\n attr: null\n id: \"$id\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n NumberInt: &Int32Type\n <<: *__type\n id: \"NumberInt\"\n code: 105\n type: *ObjectType\n attr: {}\n NumberLong: &LongType\n <<: *__type\n id: \"NumberLong\"\n code: 106\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"LongtoString\" # Needs process method\n type: *StringType\n top:\n callable: *var\n args: null\n attr: null\n id: \"top\"\n type: *IntegerType\n template: *LongTopTemplate\n argsTemplate: null\n bottom:\n callable: *var\n args: null\n attr: null\n id: \"bottom\"\n type: *IntegerType\n template: *LongBottomTemplate\n argsTemplate: null\n floatApprox:\n callable: *var\n args: null\n attr: null\n id: \"floatApprox\"\n type: *IntegerType\n template: *LongFloatApproxTemplate\n argsTemplate: null\n MinKeyType: &MinKeyType\n <<: *__type\n id: \"MinKey\"\n code: 107\n type: *ObjectType\n MaxKeyType: &MaxKeyType\n <<: *__type\n id: \"MaxKey\"\n code: 108\n type: *ObjectType\n Timestamp: &TimestampType\n <<: *__type\n id: \"TimestampFromShell\"\n code: 110\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *TimestampToStringTemplate\n argsTemplate: *TimestampToStringArgsTemplate\n getTime:\n <<: *__func\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampGetLowBitsTemplate\n argsTemplate: *TimestampGetLowBitsArgsTemplate\n getInc:\n <<: *__func\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampGetHighBitsTemplate\n argsTemplate: *TimestampGetHighBitsArgsTemplate\n t:\n callable: *var\n args: null\n attr: null\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampTTemplate\n argsTemplate: null\n i:\n callable: *var\n args: null\n attr: null\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampITemplate\n argsTemplate: null\n Symbol: &SymbolType\n <<: *__type\n id: \"Symbol\"\n code: 111\n type: *ObjectType\n NumberDecimal: &Decimal128Type\n <<: *__type\n id: \"NumberDecimal\"\n code: 112\n type: *ObjectType\n attr: {}\n SUBTYPE_DEFAULT:\n id: \"SUBTYPE_DEFAULT\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeDefaultTemplate\n SUBTYPE_FUNCTION:\n id: \"SUBTYPE_FUNCTION\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeFunctionTemplate\n SUBTYPE_BYTE_ARRAY:\n id: \"SUBTYPE_BYTE_ARRAY\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeByteArrayTemplate\n SUBTYPE_UUID_OLD:\n id: \"SUBTYPE_UUID_OLD\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidOldTemplate\n SUBTYPE_UUID:\n id: \"SUBTYPE_UUID\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidTemplate\n SUBTYPE_MD5:\n id: \"SUBTYPE_MD5\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeMd5Template\n SUBTYPE_USER_DEFINED:\n id: \"SUBTYPE_USER_DEFINED\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUserDefinedTemplate\nNativeTypes:\n Date: &DateType\n <<: *__type\n id: \"Date\"\n code: 200\n type: *ObjectType\n attr: {} # TODO: no built-in date methods added yet\n RegExp: &RegExpType\n <<: *__type\n id: \"RegExp\"\n code: 8\n type: *ObjectType\n attr: {}\n\n\n\n\nBsonSymbols:\n Code: &CodeSymbol\n id: \"Code\"\n code: 100\n callable: *constructor\n args:\n - [ *StringType, null ]\n - [ *ObjectType, null ]\n type: *CodeType\n attr: {}\n template: *CodeSymbolTemplate\n argsTemplate: *CodeSymbolArgsTemplate\n ObjectId: &ObjectIdSymbol\n id: \"ObjectId\"\n code: 101\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *ObjectIdType\n attr:\n fromDate:\n <<: *__func\n id: \"ObjectIdCreateFromTime\"\n args:\n - [ *DateType ]\n type: *ObjectIdType\n template: *ObjectIdCreateFromTimeTemplate\n argsTemplate: *ObjectIdCreateFromTimeArgsTemplate\n template: *ObjectIdSymbolTemplate\n argsTemplate: *ObjectIdSymbolArgsTemplate\n BinData: &BinarySymbol\n id: \"BinData\"\n code: 102\n callable: *constructor\n args:\n - [ *IntegerType ]\n - [ *StringType ]\n type: *BinaryType\n attr: {}\n template: *BinarySymbolTemplate\n argsTemplate: *BinarySymbolArgsTemplate\n DBRef:\n id: \"DBRef\"\n code: 103\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectIdType ]\n - [ *StringType, null ]\n type: *DBRefType\n attr: {}\n template: *DBRefSymbolTemplate\n argsTemplate: *DBRefSymbolArgsTemplate\n NumberInt:\n id: \"Int32\"\n code: 105\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *Int32Type\n attr: {}\n template: *Int32SymbolTemplate\n argsTemplate: *Int32SymbolArgsTemplate\n NumberLong:\n id: \"NumberLong\"\n code: 106\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *LongType\n attr: {}\n template: *LongSymbolTemplate\n argsTemplate: *LongSymbolArgsTemplate\n MinKey:\n id: \"MinKey\"\n code: 107\n callable: *constructor\n args: []\n type: *MinKeyType\n attr: {}\n template: *MinKeySymbolTemplate\n argsTemplate: *MinKeySymbolArgsTemplate\n MaxKey:\n id: \"MaxKey\"\n code: 108\n callable: *constructor\n args: []\n type: *MaxKeyType\n attr: {}\n template: *MaxKeySymbolTemplate\n argsTemplate: *MaxKeySymbolArgsTemplate\n Timestamp:\n id: \"Timestamp\"\n code: 110\n callable: *constructor\n args:\n - [ *IntegerType, null ]\n - [ *IntegerType, null ]\n type: *TimestampType\n attr: {}\n template: *TimestampSymbolTemplate\n argsTemplate: *TimestampSymbolArgsTemplate\n Symbol:\n id: \"Symbol\"\n code: 111\n callable: *constructor\n args:\n - [ *StringType ]\n type: *SymbolType\n attr: {}\n template: *SymbolSymbolTemplate\n argsTemplate: *SymbolSymbolArgsTemplate\n NumberDecimal:\n id: \"NumberDecimal\"\n code: 112\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n type: *Decimal128Type\n attr: {}\n template: *Decimal128SymbolTemplate\n argsTemplate: *Decimal128SymbolArgsTemplate\n\nNativeSymbols:\n Number:\n id: \"Number\"\n code: 2\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *NumericType\n attr: {} # TODO: no built-in number funcs added yet\n template: *NumberSymbolTemplate\n argsTemplate: *NumberSymbolArgsTemplate\n Date: # Needs emit method\n id: \"Date\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n type: *DateType\n attr: # TODO: add more date funcs?\n now:\n id: \"now\"\n code: 200.1\n callable: *func\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n ISODate: # Needs emit method\n id: \"ISODate\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *DateType\n attr:\n now:\n id: \"now\"\n callable: *constructor\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n RegExp: # Needs process method\n id: \"RegExp\"\n code: 8\n callable: *constructor\n args:\n - [ *StringType, *RegexType ]\n - [ *StringType, null ]\n type: *RegExpType\n attr: {} # TODO: no built-in regex funcs added yet\n template: *RegExpSymbolTemplate\n argsTemplate: *RegExpSymbolArgsTemplate\n\n";

@@ -1,1 +0,1 @@

module.exports="SymbolTypes:\n VAR: &var 0\n CONSTRUCTOR: &constructor 1\n FUNC: &func 2\n# Internal patterns to save typing\n__type: &__type\n id: null\n callable: *var\n args: null\n type: null\n attr: {}\n template: null\n argsTemplate: null\n__func: &__func\n callable: *func\n args: []\n attr: {}\n template: null\n argsTemplate: null\n\n# Python Templates\nTemplates:\n # Misc\n RegexFlags: &RegexFlags\n i: 'i'\n m: 'm'\n u: 'a'\n y: ''\n g: 's'\n BSONRegexFlags: &BSONRegexFlags\n i: 'i'\n m: 'm'\n x: 'x'\n s: 's'\n l: 'l'\n u: 'u'\n # Syntax\n EqualitySyntaxTemplate: &EqualitySyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n if (op.includes('!')) {\n return `${lhs} != ${rhs}`;\n }\n else if (op === '==' || op === '===' || op === 'is') {\n return `${lhs} == ${rhs}`;\n }\n return `${lhs} ${op} ${rhs}`;\n }\n InSyntaxTemplate: &InSyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n let str = 'in';\n if (op.includes('!') || op.includes('not')) {\n str = 'not in';\n }\n return `${lhs} ${str} ${rhs}`\n }\n AndSyntaxTemplate: &AndSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' and ');\n }\n OrSyntaxTemplate: &OrSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' or ');\n }\n NotSyntaxTemplate: &NotSyntaxTemplate !!js/function >\n (arg) => {\n return `not ${arg}`;\n }\n UnarySyntaxTemplate: &UnarySyntaxTemplate null\n BinarySyntaxTemplate: &BinarySyntaxTemplate !!js/function >\n (args) => {\n return args.reduce((s, op, i, arr) => {\n if (i % 2 === 0) {\n return s;\n }\n const rhs = arr[i + 1];\n switch(op) {\n case '//':\n return `${s} // ${rhs}`;\n case '**':\n return `${s} ** ${rhs}`;\n default:\n return `${s} ${op} ${rhs}`;\n }\n }, args[0]);\n }\n ParensSyntaxTemplate: &ParensSyntaxTemplate null\n EosSyntaxTemplate: &EosSyntaxTemplate null\n EofSyntaxTemplate: &EofSyntaxTemplate null\n NewTemplate: &NewSyntaxTemplate null\n # BSON Object Type templates\n CodeTypeTemplate: &CodeTypeTemplate null\n StringTypeTemplate: &StringTypeTemplate !!js/function >\n (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n }\n RegexTypeTemplate: &RegexTypeTemplate !!js/function >\n (pattern, flags) => {\n flags = flags === '' ? '' : `(?${flags})`;\n const escaped = pattern.replace(/\\\\(?!\\/)/, '\\\\\\\\');\n\n // Double-quote stringify\n const str = escaped + flags;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `re.compile(r\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n BoolTypeTemplate: &BoolTypeTemplate !!js/function >\n (str) => {\n return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;\n }\n IntegerTypeTemplate: &IntegerTypeTemplate null\n DecimalTypeTemplate: &DecimalTypeTemplate null\n LongBasicTypeTemplate: &LongBasicTypeTemplate null\n HexTypeTemplate: &HexTypeTemplate null\n OctalTypeTemplate: &OctalTypeTemplate !!js/function >\n (literal) => {\n let offset = 0;\n\n if (\n literal.charAt(0) === '0' &&\n (literal.charAt(1) === '0' || literal.charAt(1) === 'o' || literal.charAt(1) === 'O')\n ) {\n offset = 2;\n } else if (literal.charAt(0) === '0') {\n offset = 1;\n }\n\n literal = `0o${literal.substr(offset, literal.length - 1)}`;\n\n return literal;\n }\n NumericTypeTemplate: &NumericTypeTemplate null\n ArrayTypeTemplate: &ArrayTypeTemplate !!js/function >\n (literal, depth) => {\n depth++;\n if (literal === '') {\n return '[]'\n }\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n\n return `[${indent}${literal}${closingIndent}]`;\n }\n ArrayTypeArgsTemplate: &ArrayTypeArgsTemplate null\n NullTypeTemplate: &NullTypeTemplate !!js/function >\n () => {\n return 'None';\n }\n UndefinedTypeTemplate: &UndefinedTypeTemplate !!js/function >\n () => {\n return 'None';\n }\n ObjectTypeTemplate: &ObjectTypeTemplate !!js/function >\n (literal, depth) => {\n if (literal === '') {\n return '{}';\n }\n return literal;\n }\n ObjectTypeArgsTemplate: &ObjectTypeArgsTemplate !!js/function >\n (args, depth) => {\n if (args.length === 0) {\n return '{}';\n }\n depth++;\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n }\n\n const pairs = args.map((arg) => {\n return `${indent}${singleStringify(arg[0])}: ${arg[1]}`;\n }).join(', ');\n\n return `{${pairs}${closingIndent}}`;\n }\n # BSON Object Method templates\n CodeCodeTemplate: &CodeCodeTemplate !!js/function >\n (lhs) => {\n return `str(${lhs})`;\n }\n CodeCodeArgsTemplate: &CodeCodeArgsTemplate null\n CodeScopeTemplate: &CodeScopeTemplate null\n CodeScopeArgsTemplate: &CodeScopeArgsTemplate null\n ObjectIdToStringTemplate: &ObjectIdToStringTemplate !!js/function >\n (lhs) => {\n return `str(${lhs})`;\n }\n ObjectIdToStringArgsTemplate: &ObjectIdToStringArgsTemplate !!js/function >\n (lhs) => {\n return '';\n }\n ObjectIdEqualsTemplate: &ObjectIdEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} ==`;\n }\n ObjectIdEqualsArgsTemplate: &ObjectIdEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n ObjectIdGetTimestampTemplate: &ObjectIdGetTimestampTemplate !!js/function >\n (lhs) => {\n return `${lhs}.generation_time`;\n }\n ObjectIdGetTimestampArgsTemplate: &ObjectIdGetTimestampArgsTemplate !!js/function >\n () => {\n return '';\n }\n BinaryValueTemplate: &BinaryValueTemplate !!js/function >\n () => {\n return '';\n }\n BinaryValueArgsTemplate: &BinaryValueArgsTemplate !!js/function >\n (lhs) => {\n return `str(${lhs})`;\n }\n BinaryLengthTemplate: &BinaryLengthTemplate !!js/function >\n () => {\n return '';\n }\n BinaryLengthArgsTemplate: &BinaryLengthArgsTemplate !!js/function >\n (lhs) => {\n return `len(${lhs})`;\n }\n BinaryToStringTemplate: &BinaryToStringTemplate !!js/function >\n () => {\n return '';\n }\n BinaryToStringArgsTemplate: &BinaryToStringArgsTemplate !!js/function >\n (lhs) => {\n return `str(${lhs})`;\n }\n BinarySubtypeTemplate: &BinarySubtypeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.subtype`;\n }\n BinarySubtypeArgsTemplate: &BinarySubtypeArgsTemplate null\n DBRefGetDBTemplate: &DBRefGetDBTemplate !!js/function >\n (lhs) => {\n return `${lhs}.database`;\n }\n DBRefGetCollectionTemplate: &DBRefGetCollectionTemplate !!js/function >\n (lhs) => {\n return `${lhs}.collection`;\n }\n DBRefGetIdTemplate: &DBRefGetIdTemplate !!js/function >\n (lhs) => {\n return `${lhs}.id`;\n }\n DBRefGetIdArgsTemplate: &DBRefGetIdArgsTemplate !!js/function\n () => {\n return '';\n }\n DBRefGetDBArgsTemplate: &DBRefGetDBArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetCollectionArgsTemplate: &DBRefGetCollectionArgsTemplate !!js/function\n () => {\n return '';\n }\n LongEqualsTemplate: &LongEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} ==`;\n }\n LongEqualsArgsTemplate: &LongEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongToIntTemplate: &LongToIntTemplate !!js/function >\n (lhs) => {\n return `int(${lhs})`;\n }\n LongToIntArgsTemplate: &LongToIntArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongToStringTemplate: &LongToStringTemplate !!js/function >\n () => {\n return 'str';\n }\n LongToStringArgsTemplate: &LongToStringArgsTemplate !!js/function >\n (lhs) => {\n return `(${lhs})`;\n }\n LongToNumberTemplate: &LongToNumberTemplate !!js/function >\n (lhs) => {\n return `float(${lhs})`;\n }\n LongToNumberArgsTemplate: &LongToNumberArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongAddTemplate: &LongAddTemplate !!js/function >\n (lhs) => {\n return `${lhs} +`;\n }\n LongAddArgsTemplate: &LongAddArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongSubtractTemplate: &LongSubtractTemplate !!js/function >\n (arg) => {\n return `${arg} -`;\n }\n LongSubtractArgsTemplate: &LongSubtractArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongMultiplyTemplate: &LongMultiplyTemplate !!js/function >\n (arg) => {\n return `${arg} *`;\n }\n LongMultiplyArgsTemplate: &LongMultiplyArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongDivTemplate: &LongDivTemplate !!js/function >\n (lhs) => {\n return `${lhs} /`;\n }\n LongDivArgsTemplate: &LongDivArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongModuloTemplate: &LongModuloTemplate !!js/function >\n (lhs) => {\n return `${lhs} %`;\n }\n LongModuloArgsTemplate: &LongModuloArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongAndTemplate: &LongAndTemplate !!js/function >\n (lhs) => {\n return `${lhs} &`;\n }\n LongAndArgsTemplate: &LongAndArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongOrTemplate: &LongOrTemplate !!js/function >\n (lhs) => {\n return `${lhs} |`;\n }\n LongOrArgsTemplate: &LongOrArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongXorTemplate: &LongXorTemplate !!js/function >\n (lhs) => {\n return `${lhs} ^`;\n }\n LongXorArgsTemplate: &LongXorArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongShiftLeftTemplate: &LongShiftLeftTemplate !!js/function >\n (lhs) => {\n return `${lhs} <<`;\n }\n LongShiftLeftArgsTemplate: &LongShiftLeftArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongShiftRightTemplate: &LongShiftRightTemplate !!js/function >\n (lhs) => {\n return `${lhs} >>`;\n }\n LongShiftRightArgsTemplate: &LongShiftRightArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongCompareTemplate: &LongCompareTemplate !!js/function >\n (lhs) => {\n return `${lhs} -`;\n }\n LongCompareArgsTemplate: &LongCompareArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongIsOddTemplate: &LongIsOddTemplate !!js/function >\n (lhs) => {\n return `(${lhs} % 2) == 1`;\n }\n LongIsOddArgsTemplate: &LongIsOddArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsZeroTemplate: &LongIsZeroTemplate !!js/function >\n (lhs) => {\n return `${lhs} == 0`;\n }\n LongIsZeroArgsTemplate: &LongIsZeroArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsNegativeTemplate: &LongIsNegativeTemplate !!js/function >\n (lhs) => {\n return `${lhs} < 0`;\n }\n LongIsNegativeArgsTemplate: &LongIsNegativeArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongNegateTemplate: &LongNegateTemplate !!js/function >\n () => {\n return '-';\n }\n LongNegateArgsTemplate: &LongNegateArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotTemplate: &LongNotTemplate !!js/function >\n () => {\n return '~';\n }\n LongNotArgsTemplate: &LongNotArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotEqualsTemplate: &LongNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} !=`;\n }\n LongNotEqualsArgsTemplate: &LongNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanTemplate: &LongGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} >`;\n }\n LongGreaterThanArgsTemplate: &LongGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanOrEqualTemplate: &LongGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} >=`;\n }\n LongGreaterThanOrEqualArgsTemplate: &LongGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanTemplate: &LongLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} <`;\n }\n LongLessThanArgsTemplate: &LongLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanOrEqualTemplate: &LongLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} <=`;\n }\n LongLessThanOrEqualArgsTemplate: &LongLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongFloatApproxTemplate: &LongFloatApproxTemplate !!js/function >\n (lhs) => {\n return `float(${lhs})`;\n }\n LongTopTemplate: &LongTopTemplate !!js/function >\n (lhs) => {\n return `${lhs} >> 32`;\n }\n LongBottomTemplate: &LongBottomTemplate !!js/function >\n (lhs) => {\n return `${lhs} & 0x0000ffff`;\n }\n TimestampToStringTemplate: &TimestampToStringTemplate !!js/function >\n () => {\n return 'str';\n }\n TimestampToStringArgsTemplate: &TimestampToStringArgsTemplate !!js/function >\n (lhs) => {\n return `(${lhs})`;\n }\n TimestampEqualsTemplate: &TimestampEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} ==`;\n }\n TimestampEqualsArgsTemplate: &TimestampEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n TimestampGetLowBitsTemplate: &TimestampGetLowBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.time`;\n }\n TimestampGetLowBitsArgsTemplate: &TimestampGetLowBitsArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampGetHighBitsTemplate: &TimestampGetHighBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.inc`;\n }\n TimestampGetHighBitsArgsTemplate: &TimestampGetHighBitsArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampTTemplate: &TimestampTTemplate !!js/function >\n (lhs) => {\n return `${lhs}.time`;\n }\n TimestampITemplate: &TimestampITemplate !!js/function >\n (lhs) => {\n return `${lhs}.inc`;\n }\n TimestampAsDateTemplate: &TimestampAsDateTemplate null\n TimestampAsDateArgsTemplate: &TimestampAsDateArgsTemplate !!js/function >\n () => {\n return '.as_datetime()';\n }\n TimestampCompareTemplate: &TimestampCompareTemplate !!js/function >\n (lhs) => {\n return `(${lhs}.as_datetime() - `;\n }\n TimestampCompareArgsTemplate: &TimestampCompareArgsTemplate !!js/function >\n (lhs, arg) => {\n return `${arg}.as_datetime()).total_seconds()`;\n }\n TimestampNotEqualsTemplate: &TimestampNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} !=`;\n }\n TimestampNotEqualsArgsTemplate: &TimestampNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n TimestampGreaterThanTemplate: &TimestampGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} >`;\n }\n TimestampGreaterThanArgsTemplate: &TimestampGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n TimestampGreaterThanOrEqualTemplate: &TimestampGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} >=`;\n }\n TimestampGreaterThanOrEqualArgsTemplate: &TimestampGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n TimestampLessThanTemplate: &TimestampLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} <`;\n }\n TimestampLessThanArgsTemplate: &TimestampLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n TimestampLessThanOrEqualTemplate: &TimestampLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} <=`;\n }\n TimestampLessThanOrEqualArgsTemplate: &TimestampLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n SymbolValueOfTemplate: &SymbolValueOfTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n SymbolValueOfArgsTemplate: &SymbolValueOfArgsTemplate !!js/function >\n () => {\n return '';\n }\n SymbolInspectTemplate: &SymbolInspectTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n SymbolInspectArgsTemplate: &SymbolInspectArgsTemplate !!js/function >\n () => {\n return '';\n }\n SymbolToStringTemplate: &SymbolToStringTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n SymbolToStringArgsTemplate: &SymbolToStringArgsTemplate !!js/function >\n () => {\n return '';\n }\n # Symbol Templates\n CodeSymbolTemplate: &CodeSymbolTemplate !!js/function > # Also has process method\n () => {\n return 'Code';\n }\n CodeSymbolArgsTemplate: &CodeSymbolArgsTemplate !!js/function > # Also has process method\n (lhs, code, scope) => {\n // Single quote stringify\n const scopestr = scope === undefined ? '' : `, ${scope}`;\n let newStr = code === undefined ? '' : code;\n const str = newStr;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n code = `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n return `(${code}${scopestr})`;\n }\n ObjectIdSymbolTemplate: &ObjectIdSymbolTemplate null\n ObjectIdSymbolArgsTemplate: &ObjectIdSymbolArgsTemplate !!js/function >\n (lhs, str) => {\n if (!str || str.length === 0) {\n return '()';\n }\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `('${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}')`;\n }\n BinarySymbolTemplate: &BinarySymbolTemplate null\n BinarySymbolArgsTemplate: &BinarySymbolArgsTemplate !!js/function >\n (lhs, bytes, type) => {\n const str = bytes;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n bytes = `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n\n if (type === null) {\n return `(b${bytes})`;\n }\n return `(b${bytes}, ${type})`;\n }\n BinarySymbolSubtypeDefaultTemplate: &BinarySymbolSubtypeDefaultTemplate !!js/function >\n () => {\n return 'binary.BINARY_SUBTYPE';\n }\n BinarySymbolSubtypeFunctionTemplate: &BinarySymbolSubtypeFunctionTemplate !!js/function >\n () => {\n return 'binary.FUNCTION_SUBTYPE';\n }\n BinarySymbolSubtypeByteArrayTemplate: &BinarySymbolSubtypeByteArrayTemplate !!js/function >\n () => {\n return 'binary.BINARY_SUBTYPE';\n }\n BinarySymbolSubtypeUuidOldTemplate: &BinarySymbolSubtypeUuidOldTemplate !!js/function >\n () => {\n return 'binary.OLD_UUID_SUBTYPE';\n }\n BinarySymbolSubtypeUuidTemplate: &BinarySymbolSubtypeUuidTemplate !!js/function >\n () => {\n return 'binary.UUID_SUBTYPE';\n }\n BinarySymbolSubtypeMd5Template: &BinarySymbolSubtypeMd5Template !!js/function >\n () => {\n return 'binary.MD5_SUBTYPE';\n }\n BinarySymbolSubtypeUserDefinedTemplate: &BinarySymbolSubtypeUserDefinedTemplate !!js/function >\n () => {\n return 'binary.USER_DEFINED_SUBTYPE';\n }\n DBRefSymbolTemplate: &DBRefSymbolTemplate null\n DBRefSymbolArgsTemplate: &DBRefSymbolArgsTemplate null\n DoubleSymbolTemplate: &DoubleSymbolTemplate !!js/function >\n () => {\n return 'float';\n }\n DoubleSymbolArgsTemplate: &DoubleSymbolArgsTemplate null\n Int32SymbolTemplate: &Int32SymbolTemplate !!js/function >\n () => {\n return 'int';\n }\n Int32SymbolArgsTemplate: &Int32SymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? 0 : arg;\n const str = arg.toString();\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n return `('${newStr}')`;\n } else {\n return `(${newStr})`;\n }\n }\n LongSymbolTemplate: &LongSymbolTemplate !!js/function >\n () => {\n return 'Int64';\n }\n LongSymbolArgsTemplate: &LongSymbolArgsTemplate null\n LongSymbolMaxTemplate: &LongSymbolMaxTemplate !!js/function >\n () => {\n return 'sys.maxsize';\n }\n LongSymbolMaxArgsTemplate: &LongSymbolMaxArgsTemplate null\n LongSymbolMinTemplate: &LongSymbolMinTemplate !!js/function >\n () => {\n return '-sys.maxsize -1';\n }\n LongSymbolMinArgsTemplate: &LongSymbolMinArgsTemplate null\n LongSymbolZeroTemplate: &LongSymbolZeroTemplate !!js/function >\n () => {\n return 'Int64(0)';\n }\n LongSymbolZeroArgsTemplate: &LongSymbolZeroArgsTemplate null\n LongSymbolOneTemplate: &LongSymbolOneTemplate !!js/function >\n () => {\n return 'Int64(1)';\n }\n LongSymbolOneArgsTemplate: &LongSymbolOneArgsTemplate null\n LongSymbolNegOneTemplate: &LongSymbolNegOneTemplate !!js/function >\n () => {\n return 'Int64(-1)';\n }\n LongSymbolNegOneArgsTemplate: &LongSymbolNegOneArgsTemplate null\n LongSymbolFromBitsTemplate: &LongSymbolFromBitsTemplate !!js/function > # Also has process method\n () => {\n return 'Int64';\n }\n LongSymbolFromBitsArgsTemplate: &LongSymbolFromBitsArgsTemplate null\n LongSymbolFromIntTemplate: &LongSymbolFromIntTemplate !!js/function >\n () => {\n return 'Int64';\n }\n LongSymbolFromIntArgsTemplate: &LongSymbolFromIntArgsTemplate null\n LongSymbolFromNumberTemplate: &LongSymbolFromNumberTemplate !!js/function >\n () => {\n return 'Int64';\n }\n LongSymbolFromNumberArgsTemplate: &LongSymbolFromNumberArgsTemplate null\n LongSymbolFromStringTemplate: &LongSymbolFromStringTemplate !!js/function >\n (lhs, arg) => {\n return 'Int64';\n }\n LongSymbolFromStringArgsTemplate: &LongSymbolFromStringArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(int(${arg}))`;\n }\n MinKeySymbolTemplate: &MinKeySymbolTemplate null\n MinKeySymbolArgsTemplate: &MinKeySymbolArgsTemplate null\n MaxKeySymbolTemplate: &MaxKeySymbolTemplate null\n MaxKeySymbolArgsTemplate: &MaxKeySymbolArgsTemplate null\n TimestampSymbolTemplate: &TimestampSymbolTemplate !!js/function >\n () => {\n return 'Timestamp';\n }\n TimestampSymbolArgsTemplate: &TimestampSymbolArgsTemplate !!js/function >\n (lhs, arg1, arg2) => {\n return `(${arg1 === undefined ? 0 : arg1}, ${arg2 === undefined ? 0 : arg2})`;\n }\n SymbolSymbolTemplate: &SymbolSymbolTemplate !!js/function >\n () => {\n return '';\n }\n SymbolSymbolArgsTemplate: &SymbolSymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n return arg;\n }\n BSONRegExpSymbolTemplate: &BSONRegExpSymbolTemplate !!js/function >\n () => {\n return 'Regex';\n }\n BSONRegExpSymbolArgsTemplate: &BSONRegExpSymbolArgsTemplate !!js/function >\n (lhs, pattern, flags) => {\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n }\n return `(${singleStringify(pattern)}${flags ? ', ' + singleStringify(flags) : ''})`;\n }\n Decimal128SymbolTemplate: &Decimal128SymbolTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolArgsTemplate: &Decimal128SymbolArgsTemplate !!js/function >\n (lhs, str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `('${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}')`;\n }\n Decimal128SymbolFromStringTemplate: &Decimal128SymbolFromStringTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolFromStringArgsTemplate: &Decimal128SymbolFromStringArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n Decimal128ToStringTemplate: &Decimal128ToStringTemplate !!js/function >\n () => {\n return 'str';\n }\n Decimal128ToStringArgsTemplate: &Decimal128ToStringArgsTemplate !!js/function >\n (lhs) => {\n return `(${lhs})`;\n }\n # BSON Util Templates\n ObjectIdCreateFromHexStringTemplate: &ObjectIdCreateFromHexStringTemplate !!js/function >\n () => {\n return 'ObjectId';\n }\n ObjectIdCreateFromHexStringArgsTemplate: &ObjectIdCreateFromHexStringArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n ObjectIdCreateFromTimeTemplate: &ObjectIdCreateFromTimeTemplate !!js/function >\n () => {\n return `ObjectId.from_datetime`;\n }\n ObjectIdCreateFromTimeArgsTemplate: &ObjectIdCreateFromTimeArgsTemplate !!js/function >\n (lhs, arg, isNumber) => {\n if (isNumber) {\n return `(datetime.fromtimestamp(${arg}))`;\n }\n return `(${arg})`;\n }\n ObjectIdIsValidTemplate: &ObjectIdIsValidTemplate !!js/function >\n (lhs) => {\n return `${lhs}.is_valid`;\n }\n ObjectIdIsValidArgsTemplate: &ObjectIdIsValidArgsTemplate null\n # JS Symbol Templates\n NumberSymbolTemplate: &NumberSymbolTemplate !!js/function >\n () => {\n return '';\n }\n NumberSymbolArgsTemplate: &NumberSymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? 0 : arg;\n const str = arg.toString();\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n return `float('${newStr}')`;\n } else {\n return `${newStr}`;\n }\n }\n DateSymbolTemplate: &DateSymbolTemplate !!js/function >\n () => {\n return 'datetime';\n }\n DateSymbolArgsTemplate: &DateSymbolArgsTemplate !!js/function >\n (lhs, date, isString) => {\n const toStr = isString ? '.strftime(\\'%a %b %d %Y %H:%M:%S %Z\\')' : '';\n\n if (date === null) {\n return `${lhs}.utcnow()${toStr}`;\n }\n\n const dateStr = [\n date.getUTCFullYear(),\n date.getUTCMonth() + 1,\n date.getUTCDate(),\n date.getUTCHours(),\n date.getUTCMinutes(),\n date.getUTCSeconds()\n ].join(', ');\n\n return `${lhs}(${dateStr}, tzinfo=timezone.utc)${toStr}`;\n }\n DateSymbolNowTemplate: &DateSymbolNowTemplate !!js/function >\n () => {\n return 'datetime.utcnow';\n }\n DateSymbolNowArgsTemplate: &DateSymbolNowArgsTemplate null\n RegExpSymbolTemplate: &RegExpSymbolTemplate !!js/function > # Also has process method\n () => {\n return 're';\n }\n RegExpSymbolArgsTemplate: &RegExpSymbolArgsTemplate null\n ImportTemplate: &ImportTemplate !!js/function >\n (args) => {\n const bson = [];\n const other = [];\n Object.keys(args).map(\n (m) => {\n if (m > 99 && m < 200) {\n bson.push(args[m]);\n } else {\n other.push(args[m]);\n }\n }\n );\n if (bson.length) {\n other.push(`from bson import ${bson.join(', ')}`);\n }\n return other.join('\\n');\n }\n 0ImportTemplate: &0ImportTemplate null\n 1ImportTemplate: &1ImportTemplate null\n 2ImportTemplate: &2ImportTemplate null\n 3ImportTemplate: &3ImportTemplate null\n 4ImportTemplate: &4ImportTemplate null\n 5ImportTemplate: &5ImportTemplate null\n 6ImportTemplate: &6ImportTemplate null\n 7ImportTemplate: &7ImportTemplate null\n 8ImportTemplate: &8ImportTemplate !!js/function >\n () => {\n return 'import re';\n }\n 9ImportTemplate: &9ImportTemplate null\n 10ImportTemplate: &10ImportTemplate null\n 11ImportTemplate: &11ImportTemplate null\n 12ImportTemplate: &12ImportTemplate null\n 100ImportTemplate: &100ImportTemplate !!js/function >\n () => {\n return 'Code';\n }\n 101ImportTemplate: &101ImportTemplate !!js/function >\n () => {\n return 'ObjectId';\n }\n 102ImportTemplate: &102ImportTemplate !!js/function >\n () => {\n return 'Binary';\n }\n 103ImportTemplate: &103ImportTemplate !!js/function >\n () => {\n return 'DBRef';\n }\n 104ImportTemplate: &104ImportTemplate null\n 105ImportTemplate: &105ImportTemplate null\n 106ImportTemplate: &106ImportTemplate !!js/function >\n () => {\n return 'Int64';\n }\n 107ImportTemplate: &107ImportTemplate !!js/function >\n () => {\n return 'MinKey';\n }\n 108ImportTemplate: &108ImportTemplate !!js/function >\n () => {\n return 'MaxKey';\n }\n 109ImportTemplate: &109ImportTemplate !!js/function >\n () => {\n return 'Regex';\n }\n 110ImportTemplate: &110ImportTemplate !!js/function >\n () => {\n return 'Timestamp';\n }\n 111ImportTemplate: &111ImportTemplate null\n 112ImportTemplate: &112ImportTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n 113ImportTemplate: &113ImportTemplate null\n 114ImportTemplate: &114ImportTemplate null\n 200ImportTemplate: &200ImportTemplate !!js/function >\n () => {\n return 'from datetime import datetime, tzinfo';\n }\n 201ImportTemplate: &201ImportTemplate null\n 300ImportTemplate: &300ImportTemplate null\n 301ImportTemplate: &301ImportTemplate null\n 302ImportTemplate: &302ImportTemplate null\n 303ImportTemplate: &303ImportTemplate null\n 304ImportTemplate: &304ImportTemplate null\n 305ImportTemplate: &305ImportTemplate null\n 306ImportTemplate: &306ImportTemplate null\n# Universal types\n# Everything inherits from StringType because we haven't implemented any of them.\nBasicTypes:\n # Universal basic types\n _bool: &BoolType\n <<: *__type\n id: \"_bool\"\n code: 0\n template: *BoolTypeTemplate\n _integer: &IntegerType\n <<: *__type\n id: \"_integer\"\n code: 1\n template: *IntegerTypeTemplate\n _long: &LongBasicType\n <<: *__type\n id: \"_long\"\n code: 2\n template: *LongBasicTypeTemplate\n _decimal: &DecimalType\n <<: *__type\n id: \"_decimal\"\n code: 3\n template: *DecimalTypeTemplate\n _hex: &HexType\n <<: *__type\n id: \"_hex\"\n code: 4\n template: *HexTypeTemplate\n _octal: &OctalType\n <<: *__type\n id: \"_octal\"\n code: 5\n template: *OctalTypeTemplate\n _numeric: &NumericType\n <<: *__type\n id: \"_numeric\"\n code: 6\n template: *NumericTypeTemplate\n _string: &StringType\n <<: *__type\n id: \"_string\"\n code: 7\n template: *StringTypeTemplate\n _regex: &RegexType\n <<: *__type\n id: \"_regex\"\n code: 8\n template: *RegexTypeTemplate\n _array: &ArrayType\n <<: *__type\n id: \"_array\"\n code: 9\n template: *ArrayTypeTemplate\n argsTemplate: *ArrayTypeArgsTemplate\n _object: &ObjectType\n <<: *__type\n id: \"_object\"\n code: 10\n template: *ObjectTypeTemplate\n argsTemplate: *ObjectTypeArgsTemplate\n _null: &NullType\n <<: *__type\n id: \"_null\"\n code: 11\n template: *NullTypeTemplate\n _undefined: &UndefinedType\n <<: *__type\n id: \"_undefined\"\n code: 12\n template: *UndefinedTypeTemplate\n\nSyntax:\n equality:\n template: *EqualitySyntaxTemplate\n in:\n template: *InSyntaxTemplate\n and:\n template: *AndSyntaxTemplate\n or:\n template: *OrSyntaxTemplate\n not:\n template: *NotSyntaxTemplate\n unary:\n template: *UnarySyntaxTemplate\n binary:\n template: *BinarySyntaxTemplate\n parens:\n template: *ParensSyntaxTemplate\n eos:\n template: *EosSyntaxTemplate\n eof:\n template: *EofSyntaxTemplate\n # The new template takes in expr, and an optional skip argument and optional\n # id argument. The skip argument is a boolean that if true then doesn't add\n # new. The code argument is the symbol code being called. The template will check\n # if it is an exception, i.e. a type that is a constructor but may not use new.\n new:\n template: *NewSyntaxTemplate\n # The regex flags that change symbols between languages can be defined here.\n # Flags that aren't defined can be left blank and will be ignored.\n regexFlags: *RegexFlags\n bsonRegexFlags: *BSONRegexFlags\nImports:\n import:\n template: *ImportTemplate\n 0:\n template: *0ImportTemplate\n 1:\n template: *1ImportTemplate\n 2:\n template: *2ImportTemplate\n 3:\n template: *3ImportTemplate\n 4:\n template: *4ImportTemplate\n 5:\n template: *5ImportTemplate\n 6:\n template: *6ImportTemplate\n 7:\n template: *7ImportTemplate\n 8:\n template: *8ImportTemplate\n 9:\n template: *9ImportTemplate\n 10:\n template: *10ImportTemplate\n 11:\n template: *11ImportTemplate\n 12:\n template: *12ImportTemplate\n 100:\n template: *100ImportTemplate\n 101:\n template: *101ImportTemplate\n 102:\n template: *102ImportTemplate\n 103:\n template: *103ImportTemplate\n 104:\n template: *104ImportTemplate\n 105:\n template: *105ImportTemplate\n 106:\n template: *106ImportTemplate\n 107:\n template: *107ImportTemplate\n 108:\n template: *108ImportTemplate\n 109:\n template: *109ImportTemplate\n 110:\n template: *110ImportTemplate\n 111:\n template: *111ImportTemplate\n 112:\n template: *112ImportTemplate\n 113:\n template: *113ImportTemplate\n 114:\n template: *114ImportTemplate\n 200:\n template: *200ImportTemplate\n 201:\n template: *201ImportTemplate\n 300:\n template: *300ImportTemplate\n 301:\n template: *301ImportTemplate\n 302:\n template: *302ImportTemplate\n 303:\n template: *303ImportTemplate\n 304:\n template: *304ImportTemplate\n 305:\n template: *305ImportTemplate\n 306:\n template: *306ImportTemplate\nBsonTypes:\n Code: &CodeType\n <<: *__type\n id: \"Code\"\n code: 100\n type: *ObjectType\n attr:\n code:\n callable: *var\n args: null\n attr: null\n id: \"code\"\n type: *StringType\n template: *CodeCodeTemplate\n argsTemplate: *CodeCodeArgsTemplate\n scope:\n callable: *var\n args: null\n attr: null\n id: \"scope\"\n type: *StringType\n template: *CodeScopeTemplate\n argsTemplate: *CodeScopeArgsTemplate\n ObjectId: &ObjectIdType\n <<: *__type\n id: \"ObjectId\"\n code: 101\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *ObjectIdToStringTemplate\n argsTemplate: *ObjectIdToStringArgsTemplate\n equals:\n <<: *__func\n id: \"equals\"\n args:\n - [ \"ObjectId\" ]\n type: *BoolType\n template: *ObjectIdEqualsTemplate\n argsTemplate: *ObjectIdEqualsArgsTemplate\n getTimestamp:\n <<: *__func\n id: \"getTimestamp\"\n type: *IntegerType\n template: *ObjectIdGetTimestampTemplate\n argsTemplate: *ObjectIdGetTimestampArgsTemplate\n BinData: &BinaryType\n <<: *__type\n id: \"BinData\"\n code: 102\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *BinaryToStringTemplate\n argsTemplate: *BinaryToStringArgsTemplate\n base64:\n <<: *__func\n id: \"base64\"\n type: *StringType\n template: *BinaryValueTemplate\n argsTemplate: *BinaryValueArgsTemplate\n length:\n <<: *__func\n id: \"length\"\n type: *IntegerType\n template: *BinaryLengthTemplate\n argsTemplate: *BinaryLengthArgsTemplate\n subtype:\n <<: *__func\n id: \"subtype\"\n type: *IntegerType\n template: *BinarySubtypeTemplate\n argsTemplate: *BinarySubtypeArgsTemplate\n DBRef: &DBRefType\n <<: *__type\n id: \"DBRef\"\n code: 103\n type: *ObjectType\n attr:\n getDb:\n <<: *__func\n id: \"getDb\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n $db:\n callable: *var\n args: null\n attr: null\n id: \"$db\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n getCollection:\n <<: *__func\n id: \"getCollection\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getRef:\n <<: *__func\n id: \"getRef\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n $ref:\n callable: *var\n args: null\n attr: null\n id: \"$ref\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getId:\n <<: *__func\n id: \"getId\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n $id:\n callable: *var\n args: null\n attr: null\n id: \"$id\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n NumberInt: &Int32Type\n <<: *__type\n id: \"NumberInt\"\n code: 105\n type: *ObjectType\n attr: {}\n NumberLong: &LongType\n <<: *__type\n id: \"NumberLong\"\n code: 106\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"LongtoString\" # Needs process method\n type: *StringType\n top:\n callable: *var\n args: null\n attr: null\n id: \"top\"\n type: *IntegerType\n template: *LongTopTemplate\n argsTemplate: null\n bottom:\n callable: *var\n args: null\n attr: null\n id: \"bottom\"\n type: *IntegerType\n template: *LongBottomTemplate\n argsTemplate: null\n floatApprox:\n callable: *var\n args: null\n attr: null\n id: \"floatApprox\"\n type: *IntegerType\n template: *LongFloatApproxTemplate\n argsTemplate: null\n MinKeyType: &MinKeyType\n <<: *__type\n id: \"MinKey\"\n code: 107\n type: *ObjectType\n MaxKeyType: &MaxKeyType\n <<: *__type\n id: \"MaxKey\"\n code: 108\n type: *ObjectType\n Timestamp: &TimestampType\n <<: *__type\n id: \"TimestampFromShell\"\n code: 110\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *TimestampToStringTemplate\n argsTemplate: *TimestampToStringArgsTemplate\n getTime:\n <<: *__func\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampGetLowBitsTemplate\n argsTemplate: *TimestampGetLowBitsArgsTemplate\n getInc:\n <<: *__func\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampGetHighBitsTemplate\n argsTemplate: *TimestampGetHighBitsArgsTemplate\n t:\n callable: *var\n args: null\n attr: null\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampTTemplate\n argsTemplate: null\n i:\n callable: *var\n args: null\n attr: null\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampITemplate\n argsTemplate: null\n Symbol: &SymbolType\n <<: *__type\n id: \"Symbol\"\n code: 111\n type: *ObjectType\n NumberDecimal: &Decimal128Type\n <<: *__type\n id: \"NumberDecimal\"\n code: 112\n type: *ObjectType\n attr: {}\n SUBTYPE_DEFAULT:\n id: \"SUBTYPE_DEFAULT\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeDefaultTemplate\n SUBTYPE_FUNCTION:\n id: \"SUBTYPE_FUNCTION\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeFunctionTemplate\n SUBTYPE_BYTE_ARRAY:\n id: \"SUBTYPE_BYTE_ARRAY\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeByteArrayTemplate\n SUBTYPE_UUID_OLD:\n id: \"SUBTYPE_UUID_OLD\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidOldTemplate\n SUBTYPE_UUID:\n id: \"SUBTYPE_UUID\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidTemplate\n SUBTYPE_MD5:\n id: \"SUBTYPE_MD5\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeMd5Template\n SUBTYPE_USER_DEFINED:\n id: \"SUBTYPE_USER_DEFINED\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUserDefinedTemplate\nNativeTypes:\n Date: &DateType\n <<: *__type\n id: \"Date\"\n code: 200\n type: *ObjectType\n attr: {} # TODO: no built-in date methods added yet\n RegExp: &RegExpType\n <<: *__type\n id: \"RegExp\"\n code: 8\n type: *ObjectType\n attr: {}\n\n\n\n\nBsonSymbols:\n Code: &CodeSymbol\n id: \"Code\"\n code: 100\n callable: *constructor\n args:\n - [ *StringType, null ]\n - [ *ObjectType, null ]\n type: *CodeType\n attr: {}\n template: *CodeSymbolTemplate\n argsTemplate: *CodeSymbolArgsTemplate\n ObjectId: &ObjectIdSymbol\n id: \"ObjectId\"\n code: 101\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *ObjectIdType\n attr:\n fromDate:\n <<: *__func\n id: \"ObjectIdCreateFromTime\"\n args:\n - [ *DateType ]\n type: *ObjectIdType\n template: *ObjectIdCreateFromTimeTemplate\n argsTemplate: *ObjectIdCreateFromTimeArgsTemplate\n template: *ObjectIdSymbolTemplate\n argsTemplate: *ObjectIdSymbolArgsTemplate\n BinData: &BinarySymbol\n id: \"BinData\"\n code: 102\n callable: *constructor\n args:\n - [ *IntegerType ]\n - [ *StringType ]\n type: *BinaryType\n attr: {}\n template: *BinarySymbolTemplate\n argsTemplate: *BinarySymbolArgsTemplate\n DBRef:\n id: \"DBRef\"\n code: 103\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectIdType ]\n - [ *StringType, null ]\n type: *DBRefType\n attr: {}\n template: *DBRefSymbolTemplate\n argsTemplate: *DBRefSymbolArgsTemplate\n NumberInt:\n id: \"Int32\"\n code: 105\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *Int32Type\n attr: {}\n template: *Int32SymbolTemplate\n argsTemplate: *Int32SymbolArgsTemplate\n NumberLong:\n id: \"NumberLong\"\n code: 106\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *LongType\n attr: {}\n template: *LongSymbolTemplate\n argsTemplate: *LongSymbolArgsTemplate\n MinKey:\n id: \"MinKey\"\n code: 107\n callable: *constructor\n args: []\n type: *MinKeyType\n attr: {}\n template: *MinKeySymbolTemplate\n argsTemplate: *MinKeySymbolArgsTemplate\n MaxKey:\n id: \"MaxKey\"\n code: 108\n callable: *constructor\n args: []\n type: *MaxKeyType\n attr: {}\n template: *MaxKeySymbolTemplate\n argsTemplate: *MaxKeySymbolArgsTemplate\n Timestamp:\n id: \"Timestamp\"\n code: 110\n callable: *constructor\n args:\n - [ *IntegerType, null ]\n - [ *IntegerType, null ]\n type: *TimestampType\n attr: {}\n template: *TimestampSymbolTemplate\n argsTemplate: *TimestampSymbolArgsTemplate\n Symbol:\n id: \"Symbol\"\n code: 111\n callable: *constructor\n args:\n - [ *StringType ]\n type: *SymbolType\n attr: {}\n template: *SymbolSymbolTemplate\n argsTemplate: *SymbolSymbolArgsTemplate\n NumberDecimal:\n id: \"NumberDecimal\"\n code: 112\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n type: *Decimal128Type\n attr: {}\n template: *Decimal128SymbolTemplate\n argsTemplate: *Decimal128SymbolArgsTemplate\n\nNativeSymbols:\n Number:\n id: \"Number\"\n code: 2\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *NumericType\n attr: {} # TODO: no built-in number funcs added yet\n template: *NumberSymbolTemplate\n argsTemplate: *NumberSymbolArgsTemplate\n Date: # Needs emit method\n id: \"Date\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n type: *DateType\n attr: # TODO: add more date funcs?\n now:\n id: \"now\"\n code: 200.1\n callable: *func\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n ISODate: # Needs emit method\n id: \"ISODate\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *DateType\n attr:\n now:\n id: \"now\"\n callable: *constructor\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n RegExp: # Needs process method\n id: \"RegExp\"\n code: 8\n callable: *constructor\n args:\n - [ *StringType, *RegexType ]\n - [ *StringType, null ]\n type: *RegExpType\n attr: {} # TODO: no built-in regex funcs added yet\n template: *RegExpSymbolTemplate\n argsTemplate: *RegExpSymbolArgsTemplate\n\n";
module.exports="SymbolTypes:\n VAR: &var 0\n CONSTRUCTOR: &constructor 1\n FUNC: &func 2\n# Internal patterns to save typing\n__type: &__type\n id: null\n callable: *var\n args: null\n type: null\n attr: {}\n template: null\n argsTemplate: null\n__func: &__func\n callable: *func\n args: []\n attr: {}\n template: null\n argsTemplate: null\n\n# Python Templates\nTemplates:\n # Misc\n RegexFlags: &RegexFlags\n i: 'i'\n m: 'm'\n u: 'a'\n y: ''\n g: 's'\n BSONRegexFlags: &BSONRegexFlags\n i: 'i'\n m: 'm'\n x: 'x'\n s: 's'\n l: 'l'\n u: 'u'\n # Syntax\n EqualitySyntaxTemplate: &EqualitySyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n if (op.includes('!')) {\n return `${lhs} != ${rhs}`;\n }\n else if (op === '==' || op === '===' || op === 'is') {\n return `${lhs} == ${rhs}`;\n }\n return `${lhs} ${op} ${rhs}`;\n }\n InSyntaxTemplate: &InSyntaxTemplate !!js/function >\n (lhs, op, rhs) => {\n let str = 'in';\n if (op.includes('!') || op.includes('not')) {\n str = 'not in';\n }\n return `${lhs} ${str} ${rhs}`\n }\n AndSyntaxTemplate: &AndSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' and ');\n }\n OrSyntaxTemplate: &OrSyntaxTemplate !!js/function >\n (args) => {\n return args.join(' or ');\n }\n NotSyntaxTemplate: &NotSyntaxTemplate !!js/function >\n (arg) => {\n return `not ${arg}`;\n }\n UnarySyntaxTemplate: &UnarySyntaxTemplate null\n BinarySyntaxTemplate: &BinarySyntaxTemplate !!js/function >\n (args) => {\n return args.reduce((s, op, i, arr) => {\n if (i % 2 === 0) {\n return s;\n }\n const rhs = arr[i + 1];\n switch(op) {\n case '//':\n return `${s} // ${rhs}`;\n case '**':\n return `${s} ** ${rhs}`;\n default:\n return `${s} ${op} ${rhs}`;\n }\n }, args[0]);\n }\n ParensSyntaxTemplate: &ParensSyntaxTemplate null\n EosSyntaxTemplate: &EosSyntaxTemplate null\n EofSyntaxTemplate: &EofSyntaxTemplate null\n NewTemplate: &NewSyntaxTemplate null\n # BSON Object Type templates\n CodeTypeTemplate: &CodeTypeTemplate null\n StringTypeTemplate: &StringTypeTemplate !!js/function >\n (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n }\n RegexTypeTemplate: &RegexTypeTemplate !!js/function >\n (pattern, flags) => {\n flags = flags === '' ? '' : `(?${flags})`;\n const escaped = pattern.replace(/\\\\(?!\\/)/, '\\\\\\\\');\n\n // Double-quote stringify\n const str = escaped + flags;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `re.compile(r\"${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}\")`;\n }\n BoolTypeTemplate: &BoolTypeTemplate !!js/function >\n (str) => {\n return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;\n }\n IntegerTypeTemplate: &IntegerTypeTemplate null\n DecimalTypeTemplate: &DecimalTypeTemplate null\n LongBasicTypeTemplate: &LongBasicTypeTemplate null\n HexTypeTemplate: &HexTypeTemplate null\n OctalTypeTemplate: &OctalTypeTemplate !!js/function >\n (literal) => {\n let offset = 0;\n\n if (\n literal.charAt(0) === '0' &&\n (literal.charAt(1) === '0' || literal.charAt(1) === 'o' || literal.charAt(1) === 'O')\n ) {\n offset = 2;\n } else if (literal.charAt(0) === '0') {\n offset = 1;\n }\n\n literal = `0o${literal.substr(offset, literal.length - 1)}`;\n\n return literal;\n }\n NumericTypeTemplate: &NumericTypeTemplate null\n ArrayTypeTemplate: &ArrayTypeTemplate !!js/function >\n (literal, depth) => {\n depth++;\n if (literal === '') {\n return '[]'\n }\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n\n return `[${indent}${literal}${closingIndent}]`;\n }\n ArrayTypeArgsTemplate: &ArrayTypeArgsTemplate null\n NullTypeTemplate: &NullTypeTemplate !!js/function >\n () => {\n return 'None';\n }\n UndefinedTypeTemplate: &UndefinedTypeTemplate !!js/function >\n () => {\n return 'None';\n }\n ObjectTypeTemplate: &ObjectTypeTemplate !!js/function >\n (literal, depth) => {\n if (literal === '') {\n return '{}';\n }\n return literal;\n }\n ObjectTypeArgsTemplate: &ObjectTypeArgsTemplate !!js/function >\n (args, depth) => {\n if (args.length === 0) {\n return '{}';\n }\n depth++;\n const indent = '\\n' + ' '.repeat(depth);\n const closingIndent = '\\n' + ' '.repeat(depth - 1);\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n }\n\n const pairs = args.map((arg) => {\n return `${indent}${singleStringify(arg[0])}: ${arg[1]}`;\n }).join(', ');\n\n return `{${pairs}${closingIndent}}`;\n }\n # BSON Object Method templates\n CodeCodeTemplate: &CodeCodeTemplate !!js/function >\n (lhs) => {\n return `str(${lhs})`;\n }\n CodeCodeArgsTemplate: &CodeCodeArgsTemplate null\n CodeScopeTemplate: &CodeScopeTemplate null\n CodeScopeArgsTemplate: &CodeScopeArgsTemplate null\n ObjectIdToStringTemplate: &ObjectIdToStringTemplate !!js/function >\n (lhs) => {\n return `str(${lhs})`;\n }\n ObjectIdToStringArgsTemplate: &ObjectIdToStringArgsTemplate !!js/function >\n (lhs) => {\n return '';\n }\n ObjectIdEqualsTemplate: &ObjectIdEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} ==`;\n }\n ObjectIdEqualsArgsTemplate: &ObjectIdEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n ObjectIdGetTimestampTemplate: &ObjectIdGetTimestampTemplate !!js/function >\n (lhs) => {\n return `${lhs}.generation_time`;\n }\n ObjectIdGetTimestampArgsTemplate: &ObjectIdGetTimestampArgsTemplate !!js/function >\n () => {\n return '';\n }\n BinaryValueTemplate: &BinaryValueTemplate !!js/function >\n () => {\n return '';\n }\n BinaryValueArgsTemplate: &BinaryValueArgsTemplate !!js/function >\n (lhs) => {\n return `str(${lhs})`;\n }\n BinaryLengthTemplate: &BinaryLengthTemplate !!js/function >\n () => {\n return '';\n }\n BinaryLengthArgsTemplate: &BinaryLengthArgsTemplate !!js/function >\n (lhs) => {\n return `len(${lhs})`;\n }\n BinaryToStringTemplate: &BinaryToStringTemplate !!js/function >\n () => {\n return '';\n }\n BinaryToStringArgsTemplate: &BinaryToStringArgsTemplate !!js/function >\n (lhs) => {\n return `str(${lhs})`;\n }\n BinarySubtypeTemplate: &BinarySubtypeTemplate !!js/function >\n (lhs) => {\n return `${lhs}.subtype`;\n }\n BinarySubtypeArgsTemplate: &BinarySubtypeArgsTemplate null\n DBRefGetDBTemplate: &DBRefGetDBTemplate !!js/function >\n (lhs) => {\n return `${lhs}.database`;\n }\n DBRefGetCollectionTemplate: &DBRefGetCollectionTemplate !!js/function >\n (lhs) => {\n return `${lhs}.collection`;\n }\n DBRefGetIdTemplate: &DBRefGetIdTemplate !!js/function >\n (lhs) => {\n return `${lhs}.id`;\n }\n DBRefGetIdArgsTemplate: &DBRefGetIdArgsTemplate !!js/function\n () => {\n return '';\n }\n DBRefGetDBArgsTemplate: &DBRefGetDBArgsTemplate !!js/function >\n () => {\n return '';\n }\n DBRefGetCollectionArgsTemplate: &DBRefGetCollectionArgsTemplate !!js/function\n () => {\n return '';\n }\n LongEqualsTemplate: &LongEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} ==`;\n }\n LongEqualsArgsTemplate: &LongEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongToIntTemplate: &LongToIntTemplate !!js/function >\n (lhs) => {\n return `int(${lhs})`;\n }\n LongToIntArgsTemplate: &LongToIntArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongToStringTemplate: &LongToStringTemplate !!js/function >\n () => {\n return 'str';\n }\n LongToStringArgsTemplate: &LongToStringArgsTemplate !!js/function >\n (lhs) => {\n return `(${lhs})`;\n }\n LongToNumberTemplate: &LongToNumberTemplate !!js/function >\n (lhs) => {\n return `float(${lhs})`;\n }\n LongToNumberArgsTemplate: &LongToNumberArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongAddTemplate: &LongAddTemplate !!js/function >\n (lhs) => {\n return `${lhs} +`;\n }\n LongAddArgsTemplate: &LongAddArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongSubtractTemplate: &LongSubtractTemplate !!js/function >\n (arg) => {\n return `${arg} -`;\n }\n LongSubtractArgsTemplate: &LongSubtractArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongMultiplyTemplate: &LongMultiplyTemplate !!js/function >\n (arg) => {\n return `${arg} *`;\n }\n LongMultiplyArgsTemplate: &LongMultiplyArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongDivTemplate: &LongDivTemplate !!js/function >\n (lhs) => {\n return `${lhs} /`;\n }\n LongDivArgsTemplate: &LongDivArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongModuloTemplate: &LongModuloTemplate !!js/function >\n (lhs) => {\n return `${lhs} %`;\n }\n LongModuloArgsTemplate: &LongModuloArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongAndTemplate: &LongAndTemplate !!js/function >\n (lhs) => {\n return `${lhs} &`;\n }\n LongAndArgsTemplate: &LongAndArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongOrTemplate: &LongOrTemplate !!js/function >\n (lhs) => {\n return `${lhs} |`;\n }\n LongOrArgsTemplate: &LongOrArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongXorTemplate: &LongXorTemplate !!js/function >\n (lhs) => {\n return `${lhs} ^`;\n }\n LongXorArgsTemplate: &LongXorArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongShiftLeftTemplate: &LongShiftLeftTemplate !!js/function >\n (lhs) => {\n return `${lhs} <<`;\n }\n LongShiftLeftArgsTemplate: &LongShiftLeftArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongShiftRightTemplate: &LongShiftRightTemplate !!js/function >\n (lhs) => {\n return `${lhs} >>`;\n }\n LongShiftRightArgsTemplate: &LongShiftRightArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongCompareTemplate: &LongCompareTemplate !!js/function >\n (lhs) => {\n return `${lhs} -`;\n }\n LongCompareArgsTemplate: &LongCompareArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongIsOddTemplate: &LongIsOddTemplate !!js/function >\n (lhs) => {\n return `(${lhs} % 2) == 1`;\n }\n LongIsOddArgsTemplate: &LongIsOddArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsZeroTemplate: &LongIsZeroTemplate !!js/function >\n (lhs) => {\n return `${lhs} == 0`;\n }\n LongIsZeroArgsTemplate: &LongIsZeroArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongIsNegativeTemplate: &LongIsNegativeTemplate !!js/function >\n (lhs) => {\n return `${lhs} < 0`;\n }\n LongIsNegativeArgsTemplate: &LongIsNegativeArgsTemplate !!js/function >\n () => {\n return '';\n }\n LongNegateTemplate: &LongNegateTemplate !!js/function >\n () => {\n return '-';\n }\n LongNegateArgsTemplate: &LongNegateArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotTemplate: &LongNotTemplate !!js/function >\n () => {\n return '~';\n }\n LongNotArgsTemplate: &LongNotArgsTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n LongNotEqualsTemplate: &LongNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} !=`;\n }\n LongNotEqualsArgsTemplate: &LongNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanTemplate: &LongGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} >`;\n }\n LongGreaterThanArgsTemplate: &LongGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongGreaterThanOrEqualTemplate: &LongGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} >=`;\n }\n LongGreaterThanOrEqualArgsTemplate: &LongGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanTemplate: &LongLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} <`;\n }\n LongLessThanArgsTemplate: &LongLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongLessThanOrEqualTemplate: &LongLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} <=`;\n }\n LongLessThanOrEqualArgsTemplate: &LongLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n LongFloatApproxTemplate: &LongFloatApproxTemplate !!js/function >\n (lhs) => {\n return `float(${lhs})`;\n }\n LongTopTemplate: &LongTopTemplate !!js/function >\n (lhs) => {\n return `${lhs} >> 32`;\n }\n LongBottomTemplate: &LongBottomTemplate !!js/function >\n (lhs) => {\n return `${lhs} & 0x0000ffff`;\n }\n TimestampToStringTemplate: &TimestampToStringTemplate !!js/function >\n () => {\n return 'str';\n }\n TimestampToStringArgsTemplate: &TimestampToStringArgsTemplate !!js/function >\n (lhs) => {\n return `(${lhs})`;\n }\n TimestampEqualsTemplate: &TimestampEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} ==`;\n }\n TimestampEqualsArgsTemplate: &TimestampEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n TimestampGetLowBitsTemplate: &TimestampGetLowBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.time`;\n }\n TimestampGetLowBitsArgsTemplate: &TimestampGetLowBitsArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampGetHighBitsTemplate: &TimestampGetHighBitsTemplate !!js/function >\n (lhs) => {\n return `${lhs}.inc`;\n }\n TimestampGetHighBitsArgsTemplate: &TimestampGetHighBitsArgsTemplate !!js/function >\n () => {\n return '';\n }\n TimestampTTemplate: &TimestampTTemplate !!js/function >\n (lhs) => {\n return `${lhs}.time`;\n }\n TimestampITemplate: &TimestampITemplate !!js/function >\n (lhs) => {\n return `${lhs}.inc`;\n }\n TimestampAsDateTemplate: &TimestampAsDateTemplate null\n TimestampAsDateArgsTemplate: &TimestampAsDateArgsTemplate !!js/function >\n () => {\n return '.as_datetime()';\n }\n TimestampCompareTemplate: &TimestampCompareTemplate !!js/function >\n (lhs) => {\n return `(${lhs}.as_datetime() - `;\n }\n TimestampCompareArgsTemplate: &TimestampCompareArgsTemplate !!js/function >\n (lhs, arg) => {\n return `${arg}.as_datetime()).total_seconds()`;\n }\n TimestampNotEqualsTemplate: &TimestampNotEqualsTemplate !!js/function >\n (lhs) => {\n return `${lhs} !=`;\n }\n TimestampNotEqualsArgsTemplate: &TimestampNotEqualsArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n TimestampGreaterThanTemplate: &TimestampGreaterThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} >`;\n }\n TimestampGreaterThanArgsTemplate: &TimestampGreaterThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n TimestampGreaterThanOrEqualTemplate: &TimestampGreaterThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} >=`;\n }\n TimestampGreaterThanOrEqualArgsTemplate: &TimestampGreaterThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n TimestampLessThanTemplate: &TimestampLessThanTemplate !!js/function >\n (lhs) => {\n return `${lhs} <`;\n }\n TimestampLessThanArgsTemplate: &TimestampLessThanArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n TimestampLessThanOrEqualTemplate: &TimestampLessThanOrEqualTemplate !!js/function >\n (lhs) => {\n return `${lhs} <=`;\n }\n TimestampLessThanOrEqualArgsTemplate: &TimestampLessThanOrEqualArgsTemplate !!js/function >\n (lhs, arg) => {\n return ` ${arg}`;\n }\n SymbolValueOfTemplate: &SymbolValueOfTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n SymbolValueOfArgsTemplate: &SymbolValueOfArgsTemplate !!js/function >\n () => {\n return '';\n }\n SymbolInspectTemplate: &SymbolInspectTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n SymbolInspectArgsTemplate: &SymbolInspectArgsTemplate !!js/function >\n () => {\n return '';\n }\n SymbolToStringTemplate: &SymbolToStringTemplate !!js/function >\n (lhs) => {\n return lhs;\n }\n SymbolToStringArgsTemplate: &SymbolToStringArgsTemplate !!js/function >\n () => {\n return '';\n }\n # Symbol Templates\n CodeSymbolTemplate: &CodeSymbolTemplate !!js/function > # Also has process method\n () => {\n return 'Code';\n }\n CodeSymbolArgsTemplate: &CodeSymbolArgsTemplate !!js/function > # Also has process method\n (lhs, code, scope) => {\n // Single quote stringify\n const scopestr = scope === undefined ? '' : `, ${scope}`;\n let newStr = code === undefined ? '' : code;\n const str = newStr;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n code = `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n return `(${code}${scopestr})`;\n }\n ObjectIdSymbolTemplate: &ObjectIdSymbolTemplate null\n ObjectIdSymbolArgsTemplate: &ObjectIdSymbolArgsTemplate !!js/function >\n (lhs, str) => {\n if (!str || str.length === 0) {\n return '()';\n }\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `('${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}')`;\n }\n BinarySymbolTemplate: &BinarySymbolTemplate null\n BinarySymbolArgsTemplate: &BinarySymbolArgsTemplate !!js/function >\n (lhs, bytes, type) => {\n const str = bytes;\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n bytes = `'${newStr.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2')}'`;\n\n if (type === null) {\n return `(b${bytes})`;\n }\n return `(b${bytes}, ${type})`;\n }\n BinarySymbolSubtypeDefaultTemplate: &BinarySymbolSubtypeDefaultTemplate !!js/function >\n () => {\n return 'binary.BINARY_SUBTYPE';\n }\n BinarySymbolSubtypeFunctionTemplate: &BinarySymbolSubtypeFunctionTemplate !!js/function >\n () => {\n return 'binary.FUNCTION_SUBTYPE';\n }\n BinarySymbolSubtypeByteArrayTemplate: &BinarySymbolSubtypeByteArrayTemplate !!js/function >\n () => {\n return 'binary.BINARY_SUBTYPE';\n }\n BinarySymbolSubtypeUuidOldTemplate: &BinarySymbolSubtypeUuidOldTemplate !!js/function >\n () => {\n return 'binary.OLD_UUID_SUBTYPE';\n }\n BinarySymbolSubtypeUuidTemplate: &BinarySymbolSubtypeUuidTemplate !!js/function >\n () => {\n return 'binary.UUID_SUBTYPE';\n }\n BinarySymbolSubtypeMd5Template: &BinarySymbolSubtypeMd5Template !!js/function >\n () => {\n return 'binary.MD5_SUBTYPE';\n }\n BinarySymbolSubtypeUserDefinedTemplate: &BinarySymbolSubtypeUserDefinedTemplate !!js/function >\n () => {\n return 'binary.USER_DEFINED_SUBTYPE';\n }\n DBRefSymbolTemplate: &DBRefSymbolTemplate null\n DBRefSymbolArgsTemplate: &DBRefSymbolArgsTemplate null\n DoubleSymbolTemplate: &DoubleSymbolTemplate !!js/function >\n () => {\n return 'float';\n }\n DoubleSymbolArgsTemplate: &DoubleSymbolArgsTemplate null\n Int32SymbolTemplate: &Int32SymbolTemplate !!js/function >\n () => {\n return 'int';\n }\n Int32SymbolArgsTemplate: &Int32SymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? 0 : arg;\n const str = arg.toString();\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n return `('${newStr}')`;\n } else {\n return `(${newStr})`;\n }\n }\n LongSymbolTemplate: &LongSymbolTemplate !!js/function >\n () => {\n return 'Int64';\n }\n LongSymbolArgsTemplate: &LongSymbolArgsTemplate null\n LongSymbolMaxTemplate: &LongSymbolMaxTemplate !!js/function >\n () => {\n return 'sys.maxsize';\n }\n LongSymbolMaxArgsTemplate: &LongSymbolMaxArgsTemplate null\n LongSymbolMinTemplate: &LongSymbolMinTemplate !!js/function >\n () => {\n return '-sys.maxsize -1';\n }\n LongSymbolMinArgsTemplate: &LongSymbolMinArgsTemplate null\n LongSymbolZeroTemplate: &LongSymbolZeroTemplate !!js/function >\n () => {\n return 'Int64(0)';\n }\n LongSymbolZeroArgsTemplate: &LongSymbolZeroArgsTemplate null\n LongSymbolOneTemplate: &LongSymbolOneTemplate !!js/function >\n () => {\n return 'Int64(1)';\n }\n LongSymbolOneArgsTemplate: &LongSymbolOneArgsTemplate null\n LongSymbolNegOneTemplate: &LongSymbolNegOneTemplate !!js/function >\n () => {\n return 'Int64(-1)';\n }\n LongSymbolNegOneArgsTemplate: &LongSymbolNegOneArgsTemplate null\n LongSymbolFromBitsTemplate: &LongSymbolFromBitsTemplate !!js/function > # Also has process method\n () => {\n return 'Int64';\n }\n LongSymbolFromBitsArgsTemplate: &LongSymbolFromBitsArgsTemplate null\n LongSymbolFromIntTemplate: &LongSymbolFromIntTemplate !!js/function >\n () => {\n return 'Int64';\n }\n LongSymbolFromIntArgsTemplate: &LongSymbolFromIntArgsTemplate null\n LongSymbolFromNumberTemplate: &LongSymbolFromNumberTemplate !!js/function >\n () => {\n return 'Int64';\n }\n LongSymbolFromNumberArgsTemplate: &LongSymbolFromNumberArgsTemplate null\n LongSymbolFromStringTemplate: &LongSymbolFromStringTemplate !!js/function >\n (lhs, arg) => {\n return 'Int64';\n }\n LongSymbolFromStringArgsTemplate: &LongSymbolFromStringArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(int(${arg}))`;\n }\n MinKeySymbolTemplate: &MinKeySymbolTemplate null\n MinKeySymbolArgsTemplate: &MinKeySymbolArgsTemplate null\n MaxKeySymbolTemplate: &MaxKeySymbolTemplate null\n MaxKeySymbolArgsTemplate: &MaxKeySymbolArgsTemplate null\n TimestampSymbolTemplate: &TimestampSymbolTemplate !!js/function >\n () => {\n return 'Timestamp';\n }\n TimestampSymbolArgsTemplate: &TimestampSymbolArgsTemplate !!js/function >\n (lhs, arg1, arg2) => {\n return `(${arg1 === undefined ? 0 : arg1}, ${arg2 === undefined ? 0 : arg2})`;\n }\n SymbolSymbolTemplate: &SymbolSymbolTemplate !!js/function >\n () => {\n return '';\n }\n SymbolSymbolArgsTemplate: &SymbolSymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n return arg;\n }\n BSONRegExpSymbolTemplate: &BSONRegExpSymbolTemplate !!js/function >\n () => {\n return 'Regex';\n }\n BSONRegExpSymbolArgsTemplate: &BSONRegExpSymbolArgsTemplate !!js/function >\n (lhs, pattern, flags) => {\n const singleStringify = (str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `'${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}'`;\n }\n return `(${singleStringify(pattern)}${flags ? ', ' + singleStringify(flags) : ''})`;\n }\n Decimal128SymbolTemplate: &Decimal128SymbolTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolArgsTemplate: &Decimal128SymbolArgsTemplate !!js/function >\n (lhs, str) => {\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n }\n return `('${newStr.replace(/\\\\([\\s\\S])|(\")/g, '\\\\$1$2')}')`;\n }\n Decimal128SymbolFromStringTemplate: &Decimal128SymbolFromStringTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n Decimal128SymbolFromStringArgsTemplate: &Decimal128SymbolFromStringArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n Decimal128ToStringTemplate: &Decimal128ToStringTemplate !!js/function >\n () => {\n return 'str';\n }\n Decimal128ToStringArgsTemplate: &Decimal128ToStringArgsTemplate !!js/function >\n (lhs) => {\n return `(${lhs})`;\n }\n # BSON Util Templates\n ObjectIdCreateFromHexStringTemplate: &ObjectIdCreateFromHexStringTemplate !!js/function >\n () => {\n return 'ObjectId';\n }\n ObjectIdCreateFromHexStringArgsTemplate: &ObjectIdCreateFromHexStringArgsTemplate !!js/function >\n (lhs, arg) => {\n return `(${arg})`;\n }\n ObjectIdCreateFromTimeTemplate: &ObjectIdCreateFromTimeTemplate !!js/function >\n () => {\n return `ObjectId.from_datetime`;\n }\n ObjectIdCreateFromTimeArgsTemplate: &ObjectIdCreateFromTimeArgsTemplate !!js/function >\n (lhs, arg, isNumber) => {\n if (isNumber) {\n return `(datetime.fromtimestamp(${arg}))`;\n }\n return `(${arg})`;\n }\n ObjectIdIsValidTemplate: &ObjectIdIsValidTemplate !!js/function >\n (lhs) => {\n return `${lhs}.is_valid`;\n }\n ObjectIdIsValidArgsTemplate: &ObjectIdIsValidArgsTemplate null\n # JS Symbol Templates\n NumberSymbolTemplate: &NumberSymbolTemplate !!js/function >\n () => {\n return '';\n }\n NumberSymbolArgsTemplate: &NumberSymbolArgsTemplate !!js/function >\n (lhs, arg) => {\n arg = arg === undefined ? 0 : arg;\n const str = arg.toString();\n let newStr = str;\n if (\n (str.charAt(0) === '\\'' && str.charAt(str.length - 1) === '\\'') ||\n (str.charAt(0) === '\"' && str.charAt(str.length - 1) === '\"')) {\n newStr = str.substr(1, str.length - 2);\n return `float('${newStr}')`;\n } else {\n return `${newStr}`;\n }\n }\n DateSymbolTemplate: &DateSymbolTemplate !!js/function >\n () => {\n return 'datetime';\n }\n DateSymbolArgsTemplate: &DateSymbolArgsTemplate !!js/function >\n (lhs, date, isString) => {\n const toStr = isString ? '.strftime(\\'%a %b %d %Y %H:%M:%S %Z\\')' : '';\n\n if (date === null) {\n return `${lhs}.utcnow()${toStr}`;\n }\n\n const dateStr = [\n date.getUTCFullYear(),\n date.getUTCMonth() + 1,\n date.getUTCDate(),\n date.getUTCHours(),\n date.getUTCMinutes(),\n date.getUTCSeconds()\n ].join(', ');\n\n return `${lhs}(${dateStr}, tzinfo=timezone.utc)${toStr}`;\n }\n DateSymbolNowTemplate: &DateSymbolNowTemplate !!js/function >\n () => {\n return 'datetime.utcnow';\n }\n DateSymbolNowArgsTemplate: &DateSymbolNowArgsTemplate null\n RegExpSymbolTemplate: &RegExpSymbolTemplate !!js/function > # Also has process method\n () => {\n return 're';\n }\n RegExpSymbolArgsTemplate: &RegExpSymbolArgsTemplate null\n ImportTemplate: &ImportTemplate !!js/function >\n (args) => {\n const bson = [];\n const other = [];\n Object.keys(args).map(\n (m) => {\n if (m > 99 && m < 200) {\n bson.push(args[m]);\n } else {\n other.push(args[m]);\n }\n }\n );\n if (bson.length) {\n other.push(`from bson import ${bson.join(', ')}`);\n }\n return other.join('\\n');\n }\n 0ImportTemplate: &0ImportTemplate null\n 1ImportTemplate: &1ImportTemplate null\n 2ImportTemplate: &2ImportTemplate null\n 3ImportTemplate: &3ImportTemplate null\n 4ImportTemplate: &4ImportTemplate null\n 5ImportTemplate: &5ImportTemplate null\n 6ImportTemplate: &6ImportTemplate null\n 7ImportTemplate: &7ImportTemplate null\n 8ImportTemplate: &8ImportTemplate !!js/function >\n () => {\n return 'import re';\n }\n 9ImportTemplate: &9ImportTemplate null\n 10ImportTemplate: &10ImportTemplate null\n 11ImportTemplate: &11ImportTemplate null\n 12ImportTemplate: &12ImportTemplate null\n 100ImportTemplate: &100ImportTemplate !!js/function >\n () => {\n return 'Code';\n }\n 101ImportTemplate: &101ImportTemplate !!js/function >\n () => {\n return 'ObjectId';\n }\n 102ImportTemplate: &102ImportTemplate !!js/function >\n () => {\n return 'Binary';\n }\n 103ImportTemplate: &103ImportTemplate !!js/function >\n () => {\n return 'DBRef';\n }\n 104ImportTemplate: &104ImportTemplate null\n 105ImportTemplate: &105ImportTemplate null\n 106ImportTemplate: &106ImportTemplate !!js/function >\n () => {\n return 'Int64';\n }\n 107ImportTemplate: &107ImportTemplate !!js/function >\n () => {\n return 'MinKey';\n }\n 108ImportTemplate: &108ImportTemplate !!js/function >\n () => {\n return 'MaxKey';\n }\n 109ImportTemplate: &109ImportTemplate !!js/function >\n () => {\n return 'Regex';\n }\n 110ImportTemplate: &110ImportTemplate !!js/function >\n () => {\n return 'Timestamp';\n }\n 111ImportTemplate: &111ImportTemplate null\n 112ImportTemplate: &112ImportTemplate !!js/function >\n () => {\n return 'Decimal128';\n }\n 113ImportTemplate: &113ImportTemplate null\n 114ImportTemplate: &114ImportTemplate null\n 200ImportTemplate: &200ImportTemplate !!js/function >\n () => {\n return 'from datetime import datetime, tzinfo, timezone';\n }\n 201ImportTemplate: &201ImportTemplate null\n 300ImportTemplate: &300ImportTemplate null\n 301ImportTemplate: &301ImportTemplate null\n 302ImportTemplate: &302ImportTemplate null\n 303ImportTemplate: &303ImportTemplate null\n 304ImportTemplate: &304ImportTemplate null\n 305ImportTemplate: &305ImportTemplate null\n 306ImportTemplate: &306ImportTemplate null\n# Universal types\n# Everything inherits from StringType because we haven't implemented any of them.\nBasicTypes:\n # Universal basic types\n _bool: &BoolType\n <<: *__type\n id: \"_bool\"\n code: 0\n template: *BoolTypeTemplate\n _integer: &IntegerType\n <<: *__type\n id: \"_integer\"\n code: 1\n template: *IntegerTypeTemplate\n _long: &LongBasicType\n <<: *__type\n id: \"_long\"\n code: 2\n template: *LongBasicTypeTemplate\n _decimal: &DecimalType\n <<: *__type\n id: \"_decimal\"\n code: 3\n template: *DecimalTypeTemplate\n _hex: &HexType\n <<: *__type\n id: \"_hex\"\n code: 4\n template: *HexTypeTemplate\n _octal: &OctalType\n <<: *__type\n id: \"_octal\"\n code: 5\n template: *OctalTypeTemplate\n _numeric: &NumericType\n <<: *__type\n id: \"_numeric\"\n code: 6\n template: *NumericTypeTemplate\n _string: &StringType\n <<: *__type\n id: \"_string\"\n code: 7\n template: *StringTypeTemplate\n _regex: &RegexType\n <<: *__type\n id: \"_regex\"\n code: 8\n template: *RegexTypeTemplate\n _array: &ArrayType\n <<: *__type\n id: \"_array\"\n code: 9\n template: *ArrayTypeTemplate\n argsTemplate: *ArrayTypeArgsTemplate\n _object: &ObjectType\n <<: *__type\n id: \"_object\"\n code: 10\n template: *ObjectTypeTemplate\n argsTemplate: *ObjectTypeArgsTemplate\n _null: &NullType\n <<: *__type\n id: \"_null\"\n code: 11\n template: *NullTypeTemplate\n _undefined: &UndefinedType\n <<: *__type\n id: \"_undefined\"\n code: 12\n template: *UndefinedTypeTemplate\n\nSyntax:\n equality:\n template: *EqualitySyntaxTemplate\n in:\n template: *InSyntaxTemplate\n and:\n template: *AndSyntaxTemplate\n or:\n template: *OrSyntaxTemplate\n not:\n template: *NotSyntaxTemplate\n unary:\n template: *UnarySyntaxTemplate\n binary:\n template: *BinarySyntaxTemplate\n parens:\n template: *ParensSyntaxTemplate\n eos:\n template: *EosSyntaxTemplate\n eof:\n template: *EofSyntaxTemplate\n # The new template takes in expr, and an optional skip argument and optional\n # id argument. The skip argument is a boolean that if true then doesn't add\n # new. The code argument is the symbol code being called. The template will check\n # if it is an exception, i.e. a type that is a constructor but may not use new.\n new:\n template: *NewSyntaxTemplate\n # The regex flags that change symbols between languages can be defined here.\n # Flags that aren't defined can be left blank and will be ignored.\n regexFlags: *RegexFlags\n bsonRegexFlags: *BSONRegexFlags\nImports:\n import:\n template: *ImportTemplate\n 0:\n template: *0ImportTemplate\n 1:\n template: *1ImportTemplate\n 2:\n template: *2ImportTemplate\n 3:\n template: *3ImportTemplate\n 4:\n template: *4ImportTemplate\n 5:\n template: *5ImportTemplate\n 6:\n template: *6ImportTemplate\n 7:\n template: *7ImportTemplate\n 8:\n template: *8ImportTemplate\n 9:\n template: *9ImportTemplate\n 10:\n template: *10ImportTemplate\n 11:\n template: *11ImportTemplate\n 12:\n template: *12ImportTemplate\n 100:\n template: *100ImportTemplate\n 101:\n template: *101ImportTemplate\n 102:\n template: *102ImportTemplate\n 103:\n template: *103ImportTemplate\n 104:\n template: *104ImportTemplate\n 105:\n template: *105ImportTemplate\n 106:\n template: *106ImportTemplate\n 107:\n template: *107ImportTemplate\n 108:\n template: *108ImportTemplate\n 109:\n template: *109ImportTemplate\n 110:\n template: *110ImportTemplate\n 111:\n template: *111ImportTemplate\n 112:\n template: *112ImportTemplate\n 113:\n template: *113ImportTemplate\n 114:\n template: *114ImportTemplate\n 200:\n template: *200ImportTemplate\n 201:\n template: *201ImportTemplate\n 300:\n template: *300ImportTemplate\n 301:\n template: *301ImportTemplate\n 302:\n template: *302ImportTemplate\n 303:\n template: *303ImportTemplate\n 304:\n template: *304ImportTemplate\n 305:\n template: *305ImportTemplate\n 306:\n template: *306ImportTemplate\nBsonTypes:\n Code: &CodeType\n <<: *__type\n id: \"Code\"\n code: 100\n type: *ObjectType\n attr:\n code:\n callable: *var\n args: null\n attr: null\n id: \"code\"\n type: *StringType\n template: *CodeCodeTemplate\n argsTemplate: *CodeCodeArgsTemplate\n scope:\n callable: *var\n args: null\n attr: null\n id: \"scope\"\n type: *StringType\n template: *CodeScopeTemplate\n argsTemplate: *CodeScopeArgsTemplate\n ObjectId: &ObjectIdType\n <<: *__type\n id: \"ObjectId\"\n code: 101\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *ObjectIdToStringTemplate\n argsTemplate: *ObjectIdToStringArgsTemplate\n equals:\n <<: *__func\n id: \"equals\"\n args:\n - [ \"ObjectId\" ]\n type: *BoolType\n template: *ObjectIdEqualsTemplate\n argsTemplate: *ObjectIdEqualsArgsTemplate\n getTimestamp:\n <<: *__func\n id: \"getTimestamp\"\n type: *IntegerType\n template: *ObjectIdGetTimestampTemplate\n argsTemplate: *ObjectIdGetTimestampArgsTemplate\n BinData: &BinaryType\n <<: *__type\n id: \"BinData\"\n code: 102\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *BinaryToStringTemplate\n argsTemplate: *BinaryToStringArgsTemplate\n base64:\n <<: *__func\n id: \"base64\"\n type: *StringType\n template: *BinaryValueTemplate\n argsTemplate: *BinaryValueArgsTemplate\n length:\n <<: *__func\n id: \"length\"\n type: *IntegerType\n template: *BinaryLengthTemplate\n argsTemplate: *BinaryLengthArgsTemplate\n subtype:\n <<: *__func\n id: \"subtype\"\n type: *IntegerType\n template: *BinarySubtypeTemplate\n argsTemplate: *BinarySubtypeArgsTemplate\n DBRef: &DBRefType\n <<: *__type\n id: \"DBRef\"\n code: 103\n type: *ObjectType\n attr:\n getDb:\n <<: *__func\n id: \"getDb\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n $db:\n callable: *var\n args: null\n attr: null\n id: \"$db\"\n type: *StringType\n template: *DBRefGetDBTemplate\n argsTemplate: *DBRefGetDBArgsTemplate\n getCollection:\n <<: *__func\n id: \"getCollection\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getRef:\n <<: *__func\n id: \"getRef\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n $ref:\n callable: *var\n args: null\n attr: null\n id: \"$ref\"\n type: *StringType\n template: *DBRefGetCollectionTemplate\n argsTemplate: *DBRefGetCollectionArgsTemplate\n getId:\n <<: *__func\n id: \"getId\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n $id:\n callable: *var\n args: null\n attr: null\n id: \"$id\"\n type: *StringType\n template: *DBRefGetIdTemplate\n argsTemplate: *DBRefGetIdArgsTemplate\n NumberInt: &Int32Type\n <<: *__type\n id: \"NumberInt\"\n code: 105\n type: *ObjectType\n attr: {}\n NumberLong: &LongType\n <<: *__type\n id: \"NumberLong\"\n code: 106\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"LongtoString\" # Needs process method\n type: *StringType\n top:\n callable: *var\n args: null\n attr: null\n id: \"top\"\n type: *IntegerType\n template: *LongTopTemplate\n argsTemplate: null\n bottom:\n callable: *var\n args: null\n attr: null\n id: \"bottom\"\n type: *IntegerType\n template: *LongBottomTemplate\n argsTemplate: null\n floatApprox:\n callable: *var\n args: null\n attr: null\n id: \"floatApprox\"\n type: *IntegerType\n template: *LongFloatApproxTemplate\n argsTemplate: null\n MinKeyType: &MinKeyType\n <<: *__type\n id: \"MinKey\"\n code: 107\n type: *ObjectType\n MaxKeyType: &MaxKeyType\n <<: *__type\n id: \"MaxKey\"\n code: 108\n type: *ObjectType\n Timestamp: &TimestampType\n <<: *__type\n id: \"TimestampFromShell\"\n code: 110\n type: *ObjectType\n attr:\n toString:\n <<: *__func\n id: \"toString\"\n type: *StringType\n template: *TimestampToStringTemplate\n argsTemplate: *TimestampToStringArgsTemplate\n getTime:\n <<: *__func\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampGetLowBitsTemplate\n argsTemplate: *TimestampGetLowBitsArgsTemplate\n getInc:\n <<: *__func\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampGetHighBitsTemplate\n argsTemplate: *TimestampGetHighBitsArgsTemplate\n t:\n callable: *var\n args: null\n attr: null\n id: \"getTime\"\n type: *IntegerType\n template: *TimestampTTemplate\n argsTemplate: null\n i:\n callable: *var\n args: null\n attr: null\n id: \"getInc\"\n type: *IntegerType\n template: *TimestampITemplate\n argsTemplate: null\n Symbol: &SymbolType\n <<: *__type\n id: \"Symbol\"\n code: 111\n type: *ObjectType\n NumberDecimal: &Decimal128Type\n <<: *__type\n id: \"NumberDecimal\"\n code: 112\n type: *ObjectType\n attr: {}\n SUBTYPE_DEFAULT:\n id: \"SUBTYPE_DEFAULT\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeDefaultTemplate\n SUBTYPE_FUNCTION:\n id: \"SUBTYPE_FUNCTION\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeFunctionTemplate\n SUBTYPE_BYTE_ARRAY:\n id: \"SUBTYPE_BYTE_ARRAY\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeByteArrayTemplate\n SUBTYPE_UUID_OLD:\n id: \"SUBTYPE_UUID_OLD\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidOldTemplate\n SUBTYPE_UUID:\n id: \"SUBTYPE_UUID\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUuidTemplate\n SUBTYPE_MD5:\n id: \"SUBTYPE_MD5\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeMd5Template\n SUBTYPE_USER_DEFINED:\n id: \"SUBTYPE_USER_DEFINED\"\n callable: *var\n args: null\n code: 113\n type: *IntegerType\n template: *BinarySymbolSubtypeUserDefinedTemplate\nNativeTypes:\n Date: &DateType\n <<: *__type\n id: \"Date\"\n code: 200\n type: *ObjectType\n attr: {} # TODO: no built-in date methods added yet\n RegExp: &RegExpType\n <<: *__type\n id: \"RegExp\"\n code: 8\n type: *ObjectType\n attr: {}\n\n\n\n\nBsonSymbols:\n Code: &CodeSymbol\n id: \"Code\"\n code: 100\n callable: *constructor\n args:\n - [ *StringType, null ]\n - [ *ObjectType, null ]\n type: *CodeType\n attr: {}\n template: *CodeSymbolTemplate\n argsTemplate: *CodeSymbolArgsTemplate\n ObjectId: &ObjectIdSymbol\n id: \"ObjectId\"\n code: 101\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *ObjectIdType\n attr:\n fromDate:\n <<: *__func\n id: \"ObjectIdCreateFromTime\"\n args:\n - [ *DateType ]\n type: *ObjectIdType\n template: *ObjectIdCreateFromTimeTemplate\n argsTemplate: *ObjectIdCreateFromTimeArgsTemplate\n template: *ObjectIdSymbolTemplate\n argsTemplate: *ObjectIdSymbolArgsTemplate\n BinData: &BinarySymbol\n id: \"BinData\"\n code: 102\n callable: *constructor\n args:\n - [ *IntegerType ]\n - [ *StringType ]\n type: *BinaryType\n attr: {}\n template: *BinarySymbolTemplate\n argsTemplate: *BinarySymbolArgsTemplate\n DBRef:\n id: \"DBRef\"\n code: 103\n callable: *constructor\n args:\n - [ *StringType ]\n - [ *ObjectIdType ]\n - [ *StringType, null ]\n type: *DBRefType\n attr: {}\n template: *DBRefSymbolTemplate\n argsTemplate: *DBRefSymbolArgsTemplate\n NumberInt:\n id: \"Int32\"\n code: 105\n callable: *constructor\n args:\n - [ *NumericType, *StringType, null ]\n type: *Int32Type\n attr: {}\n template: *Int32SymbolTemplate\n argsTemplate: *Int32SymbolArgsTemplate\n NumberLong:\n id: \"NumberLong\"\n code: 106\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *LongType\n attr: {}\n template: *LongSymbolTemplate\n argsTemplate: *LongSymbolArgsTemplate\n MinKey:\n id: \"MinKey\"\n code: 107\n callable: *constructor\n args: []\n type: *MinKeyType\n attr: {}\n template: *MinKeySymbolTemplate\n argsTemplate: *MinKeySymbolArgsTemplate\n MaxKey:\n id: \"MaxKey\"\n code: 108\n callable: *constructor\n args: []\n type: *MaxKeyType\n attr: {}\n template: *MaxKeySymbolTemplate\n argsTemplate: *MaxKeySymbolArgsTemplate\n Timestamp:\n id: \"Timestamp\"\n code: 110\n callable: *constructor\n args:\n - [ *IntegerType, null ]\n - [ *IntegerType, null ]\n type: *TimestampType\n attr: {}\n template: *TimestampSymbolTemplate\n argsTemplate: *TimestampSymbolArgsTemplate\n Symbol:\n id: \"Symbol\"\n code: 111\n callable: *constructor\n args:\n - [ *StringType ]\n type: *SymbolType\n attr: {}\n template: *SymbolSymbolTemplate\n argsTemplate: *SymbolSymbolArgsTemplate\n NumberDecimal:\n id: \"NumberDecimal\"\n code: 112\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n type: *Decimal128Type\n attr: {}\n template: *Decimal128SymbolTemplate\n argsTemplate: *Decimal128SymbolArgsTemplate\n\nNativeSymbols:\n Number:\n id: \"Number\"\n code: 2\n callable: *constructor\n args:\n - [ *IntegerType, *StringType, null ]\n type: *NumericType\n attr: {} # TODO: no built-in number funcs added yet\n template: *NumberSymbolTemplate\n argsTemplate: *NumberSymbolArgsTemplate\n Date: # Needs emit method\n id: \"Date\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n - [ *NumericType, null ]\n type: *DateType\n attr: # TODO: add more date funcs?\n now:\n id: \"now\"\n code: 200.1\n callable: *func\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n ISODate: # Needs emit method\n id: \"ISODate\"\n code: 200\n callable: *constructor\n args:\n - [ *StringType, null ]\n type: *DateType\n attr:\n now:\n id: \"now\"\n callable: *constructor\n args: []\n type: *DateType\n attr: {}\n template: *DateSymbolNowTemplate\n argsTemplate: *DateSymbolNowArgsTemplate\n template: *DateSymbolTemplate\n argsTemplate: *DateSymbolArgsTemplate\n RegExp: # Needs process method\n id: \"RegExp\"\n code: 8\n callable: *constructor\n args:\n - [ *StringType, *RegexType ]\n - [ *StringType, null ]\n type: *RegExpType\n attr: {} # TODO: no built-in regex funcs added yet\n template: *RegExpSymbolTemplate\n argsTemplate: *RegExpSymbolArgsTemplate\n\n";
#!/usr/bin/env node
const fs = require('fs');
const parse = require('fast-json-parse');
const yaml = require('js-yaml');
const path = require('path');
const pSuccess = path.join(__dirname, 'test', 'json', 'success');
const testpath = path.join(__dirname, 'test', 'yaml');
const { singleQuoteStringify, doubleQuoteStringify } = require('./helper/format');
const imports = {python: '', java: '', csharp: '', javascript: ''}; // TODO
if (process.argv.length !== 3) {
console.log('Usage: <outputLanguage>');
console.log('Usage: <outputLanguage> | pbcopy (or > testfile)');
process.exit();

@@ -20,4 +19,22 @@ }

const readYAML = (filename) => {
let parseResult;
try {
parseResult = yaml.load(fs.readFileSync(filename));
} catch (err) {
err.message = `${filename}: ${err.message}`;
throw err;
}
return parseResult;
};
const getAllImports = () => {
const importtests = readYAML(path.join(testpath, 'imports.yaml'));
return importtests.tests.every[0].output[output];
};
const imports = getAllImports();
const javaFileTemplate = (code) => {
return `${imports.java}
return `${imports}

@@ -51,3 +68,3 @@ public class Test {

const pythonFileTemplate = (code) => {
return `${imports.python}
return `${imports}
x = {

@@ -69,3 +86,3 @@ ${code}

const csharpFileTemplate = (code) => {
return `${imports.csharp}
return `${imports}
namespace csharp_test

@@ -94,3 +111,3 @@ {

const jsFileTemplate = (code) => {
return `${imports.javascript}
return `${imports}
x = {

@@ -133,37 +150,46 @@ ${code}

const readJSON = (filename) => {
const parseResult = parse(fs.readFileSync(filename));
if (parseResult.err) {
throw new Error(parseResult.err.message);
}
return parseResult.value;
};
const makeFile = (input) => {
return templates[output].file(fs.readdirSync(path.join(pSuccess, input)).reduce(
const makeFile = (side) => {
return templates[output].file(fs.readdirSync(testpath).reduce(
(str0, file) => {
const tests = readJSON(path.join(pSuccess, input, file)).tests;
return str0 + Object.keys(tests).reduce(
(str, key) => {
return str + templates[output].doc(file.replace(/-/g, '').slice(0, -5) + key, tests[key].reduce(
(str2, test) => {
return str2 + templates[output].line(test.description, test[output]);
}, ''));
}, '');
if (!file.startsWith('error') && !file.startsWith('edge') && !file.startsWith('imports') && !file.startsWith('partial') && !file.startsWith('builders')) {
const tests = readYAML(path.join(testpath, file)).tests;
return str0 + Object.keys(tests).reduce(
(str, key) => {
let name = file.slice(0, -5) + key;
name = name.replace(/\/|-|\s/g, '');
return str + templates[output].doc(name, tests[key].reduce(
(str2, test) => {
if (output in test[side] && test[side][output] !== '') {
const desc = 'description' in test ? test.description : 'x';
const line = templates[output].line(desc, test[side][output]);
return str2 + line;
}
return str2;
}, ''));
}, '');
}
return str0;
}, ''));
};
const makeList = (input) => {
return fs.readdirSync(path.join(pSuccess, input)).reduce(
const makeList = (side) => {
return fs.readdirSync(testpath).reduce(
(str0, file) => {
const tests = readJSON(path.join(pSuccess, input, file)).tests;
return str0 + Object.keys(tests).reduce(
(str, key) => {
return str + tests[key].reduce(
(str2, test) => {
return str2 + test[output] + '\n';
}, '');
}, '');
if (!file.startsWith('error') && !file.startsWith('edge')) {
const tests = readYAML(path.join(testpath, file)).tests;
return str0 + Object.keys(tests).reduce(
(str, key) => {
return str + tests[key].reduce(
(str2, test) => {
if (output in test[side]) {
const line = test[side][output];
return str2 + line + '\n';
}
return str2;
}, '');
}, '');
}
return str0;
}, '');
};
console.log(makeList('python'));
console.log(makeFile('output'));
{
"name": "bson-transpilers",
"version": "0.11.5",
"version": "0.11.6",
"apiVersion": "0.0.1",

@@ -5,0 +5,0 @@ "productName": "BSON Transpilers",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc