dolphindb 2.0.1016 → 2.0.1017
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs.en.json +7 -3
- package/docs.zh.json +6 -4
- package/language.js +2 -2
- package/language.js.map +1 -1
- package/package.json +2 -2
- package/test.d.ts +1 -1
- package/test.js +1 -2
- package/test.js.map +1 -1
package/docs.en.json
CHANGED
|
@@ -60609,12 +60609,14 @@
|
|
|
60609
60609
|
{
|
|
60610
60610
|
"title": "Arguments",
|
|
60611
60611
|
"type": "parameters",
|
|
60612
|
+
"children": []
|
|
60613
|
+
},
|
|
60614
|
+
{
|
|
60615
|
+
"title": "Note",
|
|
60612
60616
|
"children": [
|
|
60613
60617
|
{
|
|
60614
60618
|
"type": "text",
|
|
60615
60619
|
"value": [
|
|
60616
|
-
"`func` is an aggregate function.",
|
|
60617
|
-
"",
|
|
60618
60620
|
"`funcArgs` are the parameters of `func`. They can be vectors/dictionaries/tables. It is a tuple if there are more than one parameter of `func`, and all parameters must have the same size.",
|
|
60619
60621
|
"",
|
|
60620
60622
|
"`window` is the moving window size.",
|
|
@@ -94110,8 +94112,10 @@
|
|
|
94110
94112
|
{
|
|
94111
94113
|
"type": "text",
|
|
94112
94114
|
"value": [
|
|
94113
|
-
"
|
|
94115
|
+
"Regarding the NULL value handling, the differences between DolphinDB's built-in moving functions and Python TA-lib lie in:",
|
|
94114
94116
|
"",
|
|
94117
|
+
"- DolphinDB moving functions: The calculation in the sliding window starts from the first element.",
|
|
94118
|
+
"- Python TA-lib: Keep the NULL values at the beginning of data in the output. The calculation in the sliding window starts from the first non-NULL value.",
|
|
94115
94119
|
"",
|
|
94116
94120
|
"To process data starting with consecutive NULL values in the same way as Python TA-Lib, you can call DolphinDB built-in functions with the higher-order function ``talib``. "
|
|
94117
94121
|
]
|
package/docs.zh.json
CHANGED
|
@@ -63844,12 +63844,14 @@
|
|
|
63844
63844
|
{
|
|
63845
63845
|
"title": "参数",
|
|
63846
63846
|
"type": "parameters",
|
|
63847
|
+
"children": []
|
|
63848
|
+
},
|
|
63849
|
+
{
|
|
63850
|
+
"title": "注意",
|
|
63847
63851
|
"children": [
|
|
63848
63852
|
{
|
|
63849
63853
|
"type": "text",
|
|
63850
63854
|
"value": [
|
|
63851
|
-
"`func` 是一个聚合函数。",
|
|
63852
|
-
"",
|
|
63853
63855
|
"`funcArgs` 是函数func的参数。可为向量、字典或表。如果有多个参数,则用元组表示,并且每个参数的长度(向量/字典的元素个数或表的行数)必须相同。",
|
|
63854
63856
|
"",
|
|
63855
63857
|
"`window` 是正整型 或 DURATION 标量。",
|
|
@@ -63874,7 +63876,7 @@
|
|
|
63874
63876
|
"value": [
|
|
63875
63877
|
"应用函数/运算符到给定对象的一个滚动窗口上。",
|
|
63876
63878
|
"",
|
|
63877
|
-
"``moving``
|
|
63879
|
+
"``moving`` 高阶函数总是返回一个向量,长度与输入参数的长度相同。当第一个滑动窗口出现时高阶函数开始计算,每计算一次,滑动窗口向右移动一个元素。",
|
|
63878
63880
|
"",
|
|
63879
63881
|
"内置函数 :doc:`/FunctionsandCommands/FunctionReferences/m/msum`, :doc:`/FunctionsandCommands/FunctionReferences/m/mcount` 和 :doc:`/FunctionsandCommands/FunctionReferences/m/mavg` 为各自的计算场景进行了优化,因此比 ``moving`` 高阶函数有更好的性能。"
|
|
63880
63882
|
]
|
|
@@ -88965,7 +88967,7 @@
|
|
|
88965
88967
|
{
|
|
88966
88968
|
"type": "text",
|
|
88967
88969
|
"value": [
|
|
88968
|
-
"`memSize` 一个数值型标量,且必须大于0且小于 *maxMemSize* * 0.75。"
|
|
88970
|
+
"`memSize` 一个数值型标量,且必须大于0且小于 *maxMemSize* * 0.75。单位为 GB。"
|
|
88969
88971
|
]
|
|
88970
88972
|
}
|
|
88971
88973
|
]
|
package/language.js
CHANGED
|
@@ -558,11 +558,11 @@ function get_tm_language(python = false) {
|
|
|
558
558
|
function_name: {
|
|
559
559
|
patterns: [
|
|
560
560
|
{
|
|
561
|
-
match: '[a-zA-Z_
|
|
561
|
+
match: '[a-zA-Z_\\u4e00-\\u9fa5][\\w\\u4e00-\\u9fa5]*',
|
|
562
562
|
name: 'entity.name.function.dolphindb'
|
|
563
563
|
},
|
|
564
564
|
{
|
|
565
|
-
match: '\\d[\\w
|
|
565
|
+
match: '\\d[\\w]*',
|
|
566
566
|
name: 'invalid.illegal.identifier.dolphindb'
|
|
567
567
|
}
|
|
568
568
|
]
|
package/language.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language.js","sourceRoot":"","sources":["language.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG;IACjB,cAAc;IACd,YAAY;IACZ,WAAW;IACX,cAAc;IAEd,QAAQ;IACR,MAAM;IACN,QAAQ;IAER,QAAQ;IACR,aAAa;IAEb,cAAc;IACd,iBAAiB;IAEjB,aAAa;IAEb,2CAA2C;IAC3C,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,MAAM;IAGN,YAAY;IACZ,eAAe;IAEf,QAAQ;IAER,aAAa;IAEb,MAAM;IACN,YAAY;IACZ,WAAW;IACX,iBAAiB;IACjB,WAAW;IACX,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,kBAAkB;IAClB,eAAe;IACf,YAAY;IAEZ,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,UAAU;IACV,UAAU;IACV,WAAW;IACX,cAAc;IAEd,OAAO;IACP,OAAO;IACP,KAAK;IAEL,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,MAAM;IACN,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,UAAU;IACV,KAAK;IAGL,SAAS,EAAE,KAAK;IAEhB,SAAS,EAAE,aAAa;IAExB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,K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AsC;6BAC/C;yBACJ;qBACJ;iBACJ;aACJ;SACJ;KACK,CAAA;AACd,CAAC;AAGD,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;AAEjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC,IAAI,CAAC,CAAA","sourcesContent":["const sql_keywords = [\n // 不要单独算关键字比较好\n // 'column',\n // 'table',\n // 'database',\n \n 'select',\n 'exec',\n 'update',\n \n 'insert',\n 'insert into',\n \n 'create table',\n 'create database',\n \n 'alter table',\n \n // alter table ... add column_name datatype\n 'add',\n 'rename',\n 'to',\n 'drop',\n \n \n 'drop table',\n 'drop database',\n \n 'delete',\n \n 'transaction',\n \n 'join',\n 'inner join',\n 'full join',\n 'full outer join',\n 'left join',\n 'left outer join',\n 'left semi join',\n 'right join',\n 'right outer join',\n 'left semijoin',\n 'cross join',\n \n 'context by',\n 'partitioned by',\n 'group by',\n 'pivot by',\n 'order by',\n 'cgroup by',\n 'partition by',\n \n 'csort',\n 'limit',\n 'top',\n \n 'into',\n 'from',\n 'where',\n 'having',\n 'with',\n 'set',\n 'as',\n 'in',\n 'or',\n 'not',\n 'on',\n 'like',\n 'values',\n 'if',\n 'exists',\n 'distinct',\n 'map',\n \n \n 'between', 'and', // between ... and ...\n \n 'is null', 'is not null',\n \n // case when ... then ... end\n 'case', 'when', 'then', 'else', 'end',\n \n 'union', 'union all',\n \n 'nulls first', 'nulls last',\n \n 'asc', 'desc',\n]\n\n\nexport const keywords = [\n 'assert',\n \n 'const',\n 'mutable',\n \n 'def',\n 'defg',\n \n // 'map',\n 'mapr',\n \n 'timer',\n \n // 流程控制\n // 'if',\n // 'else',\n 'do',\n 'for',\n 'while',\n 'return',\n 'continue',\n 'break',\n 'try',\n 'catch',\n 'throw',\n 'go',\n \n // 模块\n 'use',\n 'module',\n \n \n // 仅 Python 有的\n 'async',\n 'await',\n 'class',\n 'del',\n 'elif',\n 'except',\n 'finally',\n 'global',\n 'import',\n 'is',\n 'lambda',\n 'nonlocal',\n 'pass',\n 'raise',\n 'yield',\n \n \n // --- SQL\n ... sql_keywords,\n ... sql_keywords.map(keyword => keyword.toUpperCase())\n].sort((l, r) => { // 长的在前面,正则表达式先匹配全部,而不是部分单词,防止高亮显示不正确\n const delta_len = l.length - r.length\n if (delta_len !== 0)\n return -delta_len\n \n return 0 // 否则保留原本顺序\n})\n\n\nexport const constants = [\n 'NULL',\n 'true',\n 'false',\n 'pi',\n 'e',\n \n // --- form\n 'SCALAR',\n 'VECTOR',\n 'PAIR',\n 'MATRIX',\n 'SET',\n 'DICT',\n 'TABLE',\n // 'CHART',\n // 'CHUNK',\n \n // --- type\n 'VOID',\n 'BOOL',\n 'CHAR',\n 'SHORT',\n 'INT', 'INDEX',\n 'LONG',\n 'DATE',\n 'MONTH',\n 'TIME',\n 'MINUTE',\n 'SECOND',\n 'DATETIME',\n 'TIMESTAMP',\n 'NANOTIME',\n 'NANOTIMESTAMP',\n 'FLOAT',\n 'DOUBLE',\n 'SYMBOL',\n 'STRING',\n 'UUID',\n 'FUNCTIONDEF',\n 'HANDLE',\n 'CODE',\n 'DATASOURCE',\n 'RESOURCE',\n 'ANY',\n // 'COMPRESS',\n 'DICTIONARY',\n 'DATEHOUR',\n 'IPADDR',\n 'INT128',\n 'BLOB',\n 'COMPLEX',\n 'POINT',\n 'DURATION',\n 'OBJECT',\n 'DECIMAL32',\n 'DECIMAL64',\n 'DECIMAL128',\n \n // partition type\n 'SEQ',\n 'RANGE',\n 'HASH',\n 'VALUE',\n 'LIST',\n 'COMPO',\n \n \n // defined\n // https://www.dolphindb.cn/cn/help/FunctionsandCommands/FunctionReferences/d/defined.html\n 'VAR',\n 'SHARED',\n 'DEF',\n 'GLOBAL',\n \n \n // 用户权限管理\n // https://www.dolphindb.cn/cn/help/200/SystemManagement/UserAccessControl.html\n // https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/CommandsReferences/d/deny.html\n 'TABLE_READ',\n 'TABLE_WRITE',\n 'TABLE_INSERT',\n 'TABLE_UPDATE',\n 'TABLE_DELETE',\n \n 'DBOBJ_CREATE',\n 'DBOBJ_DELETE',\n \n 'DB_DELETE',\n 'DB_INSERT',\n 'DB_MANAGE',\n 'DB_OWNER',\n 'DB_READ',\n 'DB_UPDATE',\n 'DB_WRITE',\n \n 'SCRIPT_EXEC',\n 'TASK_GROUP_MEM_LIMIT',\n 'TEST_EXEC',\n 'VIEW_EXEC',\n 'QUERY_RESULT_MEM_LIMIT',\n \n \n // hint\n // https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/FunctionReferences/s/sql.html\n 'HINT_HASH',\n 'HINT_SNAPSHOT',\n 'HINT_KEEPORDER',\n 'HINT_SEQ',\n 'HINT_EXPLAIN',\n 'HINT_VECTORIZED',\n \n \n // --- seek mode\n 'HEAD',\n 'CURRENT',\n 'TAIL',\n \n // --- chart type\n // https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/FunctionReferences/p/plot.html\n 'LINE',\n 'PIE',\n 'COLUMN',\n 'BAR',\n 'AREA',\n 'SCATTER',\n 'HISTOGRAM',\n 'KLINE',\n \n \n // --- log level\n 'DEBUG',\n 'INFO',\n 'WARNING',\n 'ERROR',\n \n // keep duplicates\n // https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/FunctionReferences/c/createPartitionedTable.html?highlight=first\n 'FIRST',\n 'LAST',\n 'ALL',\n \n // keep\n // https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/FunctionReferences/i/isDuplicated.html?highlight=none\n 'NONE',\n \n 'HASH_PTN',\n \n // 仅 Python 有的\n 'True',\n 'False',\n 'None',\n \n] as const\n\n\n\nfunction get_tm_language (python = false) {\n return {\n $schema: 'https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json',\n \n name: python ? 'DolphinDB Python' : 'DolphinDB',\n \n scopeName: python ? 'source.dolphindb-python' : 'source.dolphindb',\n \n patterns: [\n {\n match: '\\\\.\\\\.\\\\.',\n name: 'invalid.ellipsis.dolphindb'\n },\n {\n include: '#keyword'\n },\n {\n include: '#literal'\n },\n {\n include: '#comment'\n },\n {\n include: '#decorator'\n },\n {\n include: '#variable'\n },\n {\n include: '#operator'\n },\n {\n include: '#method_call'\n },\n {\n include: '#function_call'\n },\n {\n include: '#property'\n },\n {\n match: ';',\n name: 'punctuation.terminator.statement.dolphindb'\n },\n {\n match: ',',\n name: 'punctuation.separator.commma.dolphindb'\n }\n ],\n \n \n repository: {\n keyword: {\n // \\b: word boundary\n // (?<![.$]): boundary 不是 . 或 $\n // ?!\\s*: 不是 label\n match: `\\\\b(?<![.$])(${keywords.join('|')})(?!(\\\\s*:|\\\\())\\\\b`,\n name: 'keyword.control.dolphindb'\n },\n \n literal: {\n patterns: [\n { include: '#constant' },\n { include: '#datetime' },\n { include: '#string' },\n { include: '#number' },\n ]\n },\n \n constant: {\n match: `\\\\b(?<![.$])(${constants.join('|')})(?!\\\\s*:)\\\\b`,\n name: 'constant.language.int.dolphindb'\n },\n \n decorator: {\n match: '^@testing',\n name: 'meta.decorator.dolphindb',\n },\n \n datetime: {\n patterns: [\n {\n match: '\\\\b[0-9]{4}[.][0-9]{2}[.][0-9]{2}[T ][0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{3,9})?\\\\b',\n name: 'constant.numeric.datetime.datetime.dolphindb',\n },\n {\n match: '\\\\b[0-9]{4}\\\\.[0-9]{2}M\\\\b',\n name: 'constant.numeric.datetime.month.dolphindb',\n },\n {\n match: '\\\\b[0-9]{4}\\\\.[0-9]{2}\\\\.[0-9]{2}\\\\b',\n name: 'constant.numeric.datetime.date.dolphindb',\n },\n {\n match: '\\\\b[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{3,9})?\\\\b',\n name: 'constant.numeric.datetime.time.dolphindb',\n },\n {\n match: '\\\\b[0-9]{2}:[0-9]{2}m\\\\b',\n name: 'constant.numeric.datetime.minute.dolphindb',\n },\n ]\n },\n \n string: {\n patterns: [\n {\n include: '#string_single_quoted'\n },\n {\n include: '#string_double_quoted'\n },\n {\n begin: \"'''\",\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.string.begin.dolphindb'\n }\n },\n end: \"'''\",\n endCaptures: {\n 0: {\n name: 'punctuation.definition.string.end.dolphindb'\n }\n },\n name: 'string.quoted.single.heredoc.dolphindb',\n patterns: [\n {\n captures: {\n 1: {\n name: 'punctuation.definition.escape.backslash.dolphindb'\n }\n },\n match: '(\\\\\\\\).',\n name: 'constant.character.escape.backslash.dolphindb'\n }\n ]\n },\n {\n begin: '\"\"\"',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.string.begin.dolphindb'\n }\n },\n end: '\"\"\"',\n endCaptures: {\n 0: {\n name: 'punctuation.definition.string.end.dolphindb'\n }\n },\n name: 'string.quoted.double.heredoc.dolphindb',\n patterns: [\n {\n captures: {\n 1: {\n name: 'punctuation.definition.escape.backslash.dolphindb'\n }\n },\n match: '(\\\\\\\\).',\n name: 'constant.character.escape.backslash.dolphindb'\n },\n {\n include: '#interpolated_dolphindb'\n }\n ]\n },\n {\n match: '`[\\\\w\\\\.]*',\n name: 'string.quoted.other.dolphindb'\n }\n ]\n },\n \n number: {\n patterns: [\n {\n match: '\\\\b[01]+[bB]\\\\b',\n name: 'constant.numeric.binary.dolphindb'\n },\n {\n // 97c\n match: '\\\\b[0-9]+([clhsmyM]|ms)\\\\b',\n name: 'constant.numeric.dolphindb'\n },\n {\n // 1.2f, 1f\n match: '\\\\b[0-9]+(\\\\.[0-9]+)?f\\\\b',\n name: 'constant.numeric.dolphindb'\n },\n {\n match: \n '(?x)\\n' +\n '(?:\\n' +\n ' (?:\\\\b[0-9]+(\\\\.)[0-9]+[eE][+-]?[0-9]+\\\\b)| # 1.1E+3\\n' +\n ' (?:\\\\b[0-9]+(\\\\.)[eE][+-]?[0-9]+\\\\b)| # 1.E+3\\n' +\n ' (?:\\\\b(\\\\.)[0-9]+[eE][+-]?[0-9]+\\\\b)| # .1E+3\\n' +\n ' (?:\\\\b[0-9]+[eE][+-]?[0-9]+\\\\b)| # 1E+3\\n' +\n ' (?:\\\\b[0-9]+(\\\\.)[0-9]+\\\\b)| # 1.1\\n' +\n ' (?:\\\\b[0-9]+(?=\\\\.{2,3}))| # 1 followed by a slice\\n' +\n ' (?:\\\\b[0-9]+(\\\\.)\\\\b)| # 1.\\n' +\n ' (?:\\\\b(\\\\.)[0-9]+\\\\b)| # .1\\n' +\n ' (?:\\\\b[0-9]+\\\\b(?!\\\\.)) # 1\\n' +\n ')\\n',\n \n captures: {\n 0: {\n name: 'constant.numeric.decimal.dolphindb'\n },\n 1: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n },\n 2: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n },\n 3: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n },\n 4: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n },\n 5: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n },\n 6: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n }\n }\n },\n ]\n },\n \n string_single_quoted: {\n patterns: [\n {\n begin: \"'\",\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.string.begin.dolphindb'\n }\n },\n end: \"'\",\n endCaptures: {\n 0: {\n name: 'punctuation.definition.string.end.dolphindb'\n }\n },\n name: 'string.quoted.single.dolphindb',\n patterns: [\n {\n captures: {\n 1: {\n name: 'punctuation.definition.escape.backslash.dolphindb'\n }\n },\n match: '(\\\\\\\\)(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)',\n name: 'constant.character.escape.backslash.dolphindb'\n }\n ]\n }\n ]\n },\n \n string_double_quoted: {\n patterns: [\n {\n begin: '\"',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.string.begin.dolphindb'\n }\n },\n end: '\"',\n endCaptures: {\n 0: {\n name: 'punctuation.definition.string.end.dolphindb'\n }\n },\n name: 'string.quoted.double.dolphindb',\n patterns: [\n {\n captures: {\n 1: {\n name: 'punctuation.definition.escape.backslash.dolphindb'\n }\n },\n match: '(\\\\\\\\)(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)',\n name: 'constant.character.escape.backslash.dolphindb'\n },\n {\n include: '#interpolated_dolphindb'\n }\n ]\n }\n ]\n },\n \n function_call: {\n patterns: [\n {\n begin: '(@)?([\\\\w$]+!?)\\\\s*(?=\\\\()',\n beginCaptures: {\n 1: {\n name: 'variable.other.readwrite.instance.dolphindb'\n },\n 2: {\n patterns: [\n {\n include: '#function_name'\n }\n ]\n }\n },\n end: '(?<=\\\\))',\n name: 'meta.function-call.dolphindb',\n patterns: [\n {\n include: '#arguments'\n }\n ]\n }\n ]\n },\n \n function_name: {\n patterns: [\n {\n match: '[a-zA-Z_$][\\\\w$]*',\n name: 'entity.name.function.dolphindb'\n },\n {\n match: '\\\\d[\\\\w$]*',\n name: 'invalid.illegal.identifier.dolphindb'\n }\n ]\n },\n \n function_params: {\n patterns: [\n {\n begin: '\\\\(',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.parameters.begin.bracket.round.dolphindb'\n }\n },\n end: '\\\\)',\n endCaptures: {\n 0: {\n name: 'punctuation.definition.parameters.end.bracket.round.dolphindb'\n }\n },\n name: 'meta.parameters.dolphindb',\n patterns: [\n {\n include: '#variable'\n },\n {\n match: '(@(?:[a-zA-Z_$][\\\\w$]*)?)(\\\\.\\\\.\\\\.)?',\n captures: {\n 1: {\n name: 'variable.parameter.function.readwrite.instance.dolphindb'\n },\n 2: {\n name: 'keyword.operator.splat.dolphindb'\n }\n }\n },\n {\n include: '$self'\n }\n ]\n }\n ]\n },\n \n comment: {\n patterns: python ? [\n {\n begin: '#',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.comment.dolphindb'\n }\n },\n end: '$',\n name: 'comment.line.number-sign.dolphindb'\n }\n ] : [\n {\n begin: '/\\\\*',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.comment.dolphindb'\n }\n },\n end: '\\\\*/',\n endCaptures: {\n 0: {\n name: 'punctuation.definition.comment.dolphindb'\n }\n },\n name: 'comment.block.dolphindb'\n },\n {\n begin: '//',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.comment.dolphindb'\n }\n },\n end: '$',\n name: 'comment.line.number-sign.dolphindb'\n },\n ]\n },\n \n arguments: {\n patterns: [\n {\n begin: '\\\\(',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.arguments.begin.bracket.round.dolphindb'\n }\n },\n end: '\\\\)',\n endCaptures: {\n 0: {\n name: 'punctuation.definition.arguments.end.bracket.round.dolphindb'\n }\n },\n name: 'meta.arguments.dolphindb',\n patterns: [\n {\n include: '$self'\n },\n {\n include: '#literal'\n },\n {\n include: '#variable'\n }\n ]\n }\n ]\n },\n \n variable: {\n patterns: [\n {\n match: '(@)([a-zA-Z_\\\\$]\\\\w*)?',\n name: 'variable.other.readwrite.instance.dolphindb'\n }\n ]\n },\n \n interpolated_dolphindb: {\n patterns: [\n {\n begin: '\\\\#\\\\{',\n captures: {\n 0: {\n name: 'punctuation.section.embedded.dolphindb'\n }\n },\n end: '\\\\}',\n name: 'source.dolphindb.embedded.source',\n patterns: [\n {\n include: '$self'\n }\n ]\n }\n ]\n },\n \n method_call: {\n patterns: [\n {\n begin: '(?:(\\\\.)|(::))\\\\s*([\\\\w$]+!?)(?=\\\\()',\n beginCaptures: {\n 1: {\n name: 'punctuation.separator.method.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n patterns: [\n {\n include: '#method_name'\n }\n ]\n }\n },\n end: '(?<=\\\\))',\n name: 'meta.method-call.dolphindb',\n patterns: [\n {\n include: '#arguments'\n }\n ]\n }\n ]\n },\n \n method_name: {\n patterns: [\n {\n match: '[a-zA-Z_$][\\\\w$]*',\n name: 'entity.name.function.dolphindb'\n },\n {\n match: '\\\\d[\\\\w$]*',\n name: 'invalid.illegal.identifier.dolphindb'\n }\n ]\n },\n \n operator: {\n patterns: [\n {\n match: '<<|>>',\n name: 'keyword.operator.bitwise.shift.dolphindb'\n },\n {\n match: '!=|<=|>=|==|>|<',\n name: 'keyword.operator.comparison.dolphindb'\n },\n {\n match: '<-|->',\n name: 'keyword.operator.join.dolphindb'\n },\n {\n match: '&&|!|\\\\|\\\\|',\n name: 'keyword.operator.logical.dolphindb'\n },\n {\n match: '&|\\\\||\\\\^',\n name: 'keyword.operator.bitwise.dolphindb'\n },\n {\n match: '\\\\.\\\\.',\n name: 'keyword.operator.splat.dolphindb'\n },\n {\n match: '\\\\?',\n name: 'keyword.operator.existential.dolphindb'\n },\n {\n match: '/|<-|%|\\\\*|/|-|\\\\$|\\\\+',\n name: 'keyword.operator.dolphindb'\n },\n {\n match: '([a-zA-Z$_][\\\\w$]*)?\\\\s*(=|:(?!:))(?![>=])',\n captures: {\n 1: {\n name: 'variable.assignment.dolphindb'\n },\n 2: {\n name: 'keyword.operator.assignment.dolphindb'\n }\n }\n }\n ]\n },\n \n property: {\n patterns: [\n {\n match: '(?:(\\\\.)|(::))\\\\s*([A-Z][A-Z0-9_$]*\\\\b\\\\$*)(?=\\\\s*\\\\??(\\\\.\\\\s*[a-zA-Z_$]\\\\w*|::))',\n captures: {\n 1: {\n name: 'punctuation.separator.property.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n name: 'constant.other.object.property.dolphindb'\n }\n }\n },\n {\n match: '(?:(\\\\.)|(::))\\\\s*(\\\\$*[a-zA-Z_$][\\\\w$]*)(?=\\\\s*\\\\??(\\\\.\\\\s*[a-zA-Z_$]\\\\w*|::))',\n captures: {\n 1: {\n name: 'punctuation.separator.property.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n name: 'variable.other.object.property.dolphindb'\n }\n }\n },\n {\n match: '(?:(\\\\.)|(::))\\\\s*([A-Z][A-Z0-9_$]*\\\\b\\\\$*)',\n captures: {\n 1: {\n name: 'punctuation.separator.property.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n name: 'constant.other.property.dolphindb'\n }\n }\n },\n {\n match: '(?:(\\\\.)|(::))\\\\s*(\\\\$*[a-zA-Z_$][\\\\w$]*)',\n captures: {\n 1: {\n name: 'punctuation.separator.property.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n name: 'variable.other.property.dolphindb'\n }\n }\n },\n {\n match: '(?:(\\\\.)|(::))\\\\s*([0-9][\\\\w$]*)',\n captures: {\n 1: {\n name: 'punctuation.separator.property.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n name: 'invalid.illegal.identifier.dolphindb'\n }\n }\n }\n ]\n }\n }\n } as Block\n}\n\n\nexport const tm_language = get_tm_language(false)\n\nexport const tm_language_python = get_tm_language(true)\n\n\ninterface Block {\n patterns: Pattern[]\n repository?: Record<string, Pattern | Block>\n}\n\ntype Pattern = Match | Include | Block\n\ntype Match = MatchOne | MatchBeginEnd\n\ninterface MatchOne {\n /** a single-line regular expression */\n match: RegExp | string\n \n /** This is the scope that will be applied to the matched text */\n name?: string\n \n /** This use of the captures > patterns structure is extremely important. \n Without it, a stretch of text matched by a match rule is considered finished, and \n TextMate’s search proceeds to the rest of the line after the matched text. \n With it, the stretch of matched text itself becomes a candidate for further matches. \n */\n captures?: Captures\n}\n\ninterface MatchBeginEnd {\n begin: RegExp | string\n \n end: RegExp | string\n \n /** This is the scope (or an expression evaluating to a scope) to be applied to \n the entire matched stretch(es) of text starting at the start of the begin match.\n */\n name?: string\n \n /** This is the scope to be applied to what’s between the begin match and the end match (or the end of the document). */\n contentName?: string\n \n /** it applies to the region between the begin and end matches. */\n patterns?: Pattern[]\n \n beginCaptures?: Captures\n \n endCaptures?: Captures\n \n whileCaptures?: Captures\n \n /** If the name or number of the matched group happens to be the same for both the begin pattern and the other pattern, \n you can (if appropriate) use captures as a shorthand to avoid saying the same thing twice.\n */\n captures?: Captures\n \n applyEndPatternLast?: 1\n}\n\ninterface Include {\n include: string\n}\n\ntype Captures = Record<string | number, {\n /** This is the scope that will be assigned to the matched group text. */\n name?: string\n \n /** This is a list of match rules to be sought within the matched group text \n — thus permitting the search for matches to continue inside the matched text.\n */\n patterns?: Pattern[]\n}>\n\n"]}
|
|
1
|
+
{"version":3,"file":"language.js","sourceRoot":"","sources":["language.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG;IACjB,cAAc;IACd,YAAY;IACZ,WAAW;IACX,cAAc;IAEd,QAAQ;IACR,MAAM;IACN,QAAQ;IAER,QAAQ;IACR,aAAa;IAEb,cAAc;IACd,iBAAiB;IAEjB,aAAa;IAEb,2CAA2C;IAC3C,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,MAAM;IAGN,YAAY;IACZ,eAAe;IAEf,QAAQ;IAER,aAAa;IAEb,MAAM;IACN,YAAY;IACZ,WAAW;IACX,iBAAiB;IACjB,WAAW;IACX,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,kBAAkB;IAClB,eAAe;IACf,YAAY;IAEZ,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,UAAU;IACV,UAAU;IACV,WAAW;IACX,cAAc;IAEd,OAAO;IACP,OAAO;IACP,KAAK;IAEL,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,MAAM;IACN,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,UAAU;IACV,KAAK;IAGL,SAAS,EAAE,KAAK;IAEhB,SAAS,EAAE,aAAa;IAExB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;IAErC,OAAO,EAAE,WAAW;IAEpB,aAAa,EAAE,YAAY;IAE3B,KAAK,EAAE,MAAM;CAChB,C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AAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;AAEjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC,IAAI,CAAC,CAAA","sourcesContent":["const sql_keywords = [\n // 不要单独算关键字比较好\n // 'column',\n // 'table',\n // 'database',\n \n 'select',\n 'exec',\n 'update',\n \n 'insert',\n 'insert into',\n \n 'create table',\n 'create database',\n \n 'alter table',\n \n // alter table ... add column_name datatype\n 'add',\n 'rename',\n 'to',\n 'drop',\n \n \n 'drop table',\n 'drop database',\n \n 'delete',\n \n 'transaction',\n \n 'join',\n 'inner join',\n 'full join',\n 'full outer join',\n 'left join',\n 'left outer join',\n 'left semi join',\n 'right join',\n 'right outer join',\n 'left semijoin',\n 'cross join',\n \n 'context by',\n 'partitioned by',\n 'group by',\n 'pivot by',\n 'order by',\n 'cgroup by',\n 'partition by',\n \n 'csort',\n 'limit',\n 'top',\n \n 'into',\n 'from',\n 'where',\n 'having',\n 'with',\n 'set',\n 'as',\n 'in',\n 'or',\n 'not',\n 'on',\n 'like',\n 'values',\n 'if',\n 'exists',\n 'distinct',\n 'map',\n \n \n 'between', 'and', // between ... and ...\n \n 'is null', 'is not null',\n \n // case when ... then ... end\n 'case', 'when', 'then', 'else', 'end',\n \n 'union', 'union all',\n \n 'nulls first', 'nulls last',\n \n 'asc', 'desc',\n]\n\n\nexport const keywords = [\n 'assert',\n \n 'const',\n 'mutable',\n \n 'def',\n 'defg',\n \n // 'map',\n 'mapr',\n \n 'timer',\n \n // 流程控制\n // 'if',\n // 'else',\n 'do',\n 'for',\n 'while',\n 'return',\n 'continue',\n 'break',\n 'try',\n 'catch',\n 'throw',\n 'go',\n \n // 模块\n 'use',\n 'module',\n \n \n // 仅 Python 有的\n 'async',\n 'await',\n 'class',\n 'del',\n 'elif',\n 'except',\n 'finally',\n 'global',\n 'import',\n 'is',\n 'lambda',\n 'nonlocal',\n 'pass',\n 'raise',\n 'yield',\n \n \n // --- SQL\n ... sql_keywords,\n ... sql_keywords.map(keyword => keyword.toUpperCase())\n].sort((l, r) => { // 长的在前面,正则表达式先匹配全部,而不是部分单词,防止高亮显示不正确\n const delta_len = l.length - r.length\n if (delta_len !== 0)\n return -delta_len\n \n return 0 // 否则保留原本顺序\n})\n\n\nexport const constants = [\n 'NULL',\n 'true',\n 'false',\n 'pi',\n 'e',\n \n // --- form\n 'SCALAR',\n 'VECTOR',\n 'PAIR',\n 'MATRIX',\n 'SET',\n 'DICT',\n 'TABLE',\n // 'CHART',\n // 'CHUNK',\n \n // --- type\n 'VOID',\n 'BOOL',\n 'CHAR',\n 'SHORT',\n 'INT', 'INDEX',\n 'LONG',\n 'DATE',\n 'MONTH',\n 'TIME',\n 'MINUTE',\n 'SECOND',\n 'DATETIME',\n 'TIMESTAMP',\n 'NANOTIME',\n 'NANOTIMESTAMP',\n 'FLOAT',\n 'DOUBLE',\n 'SYMBOL',\n 'STRING',\n 'UUID',\n 'FUNCTIONDEF',\n 'HANDLE',\n 'CODE',\n 'DATASOURCE',\n 'RESOURCE',\n 'ANY',\n // 'COMPRESS',\n 'DICTIONARY',\n 'DATEHOUR',\n 'IPADDR',\n 'INT128',\n 'BLOB',\n 'COMPLEX',\n 'POINT',\n 'DURATION',\n 'OBJECT',\n 'DECIMAL32',\n 'DECIMAL64',\n 'DECIMAL128',\n \n // partition type\n 'SEQ',\n 'RANGE',\n 'HASH',\n 'VALUE',\n 'LIST',\n 'COMPO',\n \n \n // defined\n // https://www.dolphindb.cn/cn/help/FunctionsandCommands/FunctionReferences/d/defined.html\n 'VAR',\n 'SHARED',\n 'DEF',\n 'GLOBAL',\n \n \n // 用户权限管理\n // https://www.dolphindb.cn/cn/help/200/SystemManagement/UserAccessControl.html\n // https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/CommandsReferences/d/deny.html\n 'TABLE_READ',\n 'TABLE_WRITE',\n 'TABLE_INSERT',\n 'TABLE_UPDATE',\n 'TABLE_DELETE',\n \n 'DBOBJ_CREATE',\n 'DBOBJ_DELETE',\n \n 'DB_DELETE',\n 'DB_INSERT',\n 'DB_MANAGE',\n 'DB_OWNER',\n 'DB_READ',\n 'DB_UPDATE',\n 'DB_WRITE',\n \n 'SCRIPT_EXEC',\n 'TASK_GROUP_MEM_LIMIT',\n 'TEST_EXEC',\n 'VIEW_EXEC',\n 'QUERY_RESULT_MEM_LIMIT',\n \n \n // hint\n // https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/FunctionReferences/s/sql.html\n 'HINT_HASH',\n 'HINT_SNAPSHOT',\n 'HINT_KEEPORDER',\n 'HINT_SEQ',\n 'HINT_EXPLAIN',\n 'HINT_VECTORIZED',\n \n \n // --- seek mode\n 'HEAD',\n 'CURRENT',\n 'TAIL',\n \n // --- chart type\n // https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/FunctionReferences/p/plot.html\n 'LINE',\n 'PIE',\n 'COLUMN',\n 'BAR',\n 'AREA',\n 'SCATTER',\n 'HISTOGRAM',\n 'KLINE',\n \n \n // --- log level\n 'DEBUG',\n 'INFO',\n 'WARNING',\n 'ERROR',\n \n // keep duplicates\n // https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/FunctionReferences/c/createPartitionedTable.html?highlight=first\n 'FIRST',\n 'LAST',\n 'ALL',\n \n // keep\n // https://www.dolphindb.cn/cn/help/200/FunctionsandCommands/FunctionReferences/i/isDuplicated.html?highlight=none\n 'NONE',\n \n 'HASH_PTN',\n \n // 仅 Python 有的\n 'True',\n 'False',\n 'None',\n \n] as const\n\n\n\nfunction get_tm_language (python = false) {\n return {\n $schema: 'https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json',\n \n name: python ? 'DolphinDB Python' : 'DolphinDB',\n \n scopeName: python ? 'source.dolphindb-python' : 'source.dolphindb',\n \n patterns: [\n {\n match: '\\\\.\\\\.\\\\.',\n name: 'invalid.ellipsis.dolphindb'\n },\n {\n include: '#keyword'\n },\n {\n include: '#literal'\n },\n {\n include: '#comment'\n },\n {\n include: '#decorator'\n },\n {\n include: '#variable'\n },\n {\n include: '#operator'\n },\n {\n include: '#method_call'\n },\n {\n include: '#function_call'\n },\n {\n include: '#property'\n },\n {\n match: ';',\n name: 'punctuation.terminator.statement.dolphindb'\n },\n {\n match: ',',\n name: 'punctuation.separator.commma.dolphindb'\n }\n ],\n \n \n repository: {\n keyword: {\n // \\b: word boundary\n // (?<![.$]): boundary 不是 . 或 $\n // ?!\\s*: 不是 label\n match: `\\\\b(?<![.$])(${keywords.join('|')})(?!(\\\\s*:|\\\\())\\\\b`,\n name: 'keyword.control.dolphindb'\n },\n \n literal: {\n patterns: [\n { include: '#constant' },\n { include: '#datetime' },\n { include: '#string' },\n { include: '#number' },\n ]\n },\n \n constant: {\n match: `\\\\b(?<![.$])(${constants.join('|')})(?!\\\\s*:)\\\\b`,\n name: 'constant.language.int.dolphindb'\n },\n \n decorator: {\n match: '^@testing',\n name: 'meta.decorator.dolphindb',\n },\n \n datetime: {\n patterns: [\n {\n match: '\\\\b[0-9]{4}[.][0-9]{2}[.][0-9]{2}[T ][0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{3,9})?\\\\b',\n name: 'constant.numeric.datetime.datetime.dolphindb',\n },\n {\n match: '\\\\b[0-9]{4}\\\\.[0-9]{2}M\\\\b',\n name: 'constant.numeric.datetime.month.dolphindb',\n },\n {\n match: '\\\\b[0-9]{4}\\\\.[0-9]{2}\\\\.[0-9]{2}\\\\b',\n name: 'constant.numeric.datetime.date.dolphindb',\n },\n {\n match: '\\\\b[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{3,9})?\\\\b',\n name: 'constant.numeric.datetime.time.dolphindb',\n },\n {\n match: '\\\\b[0-9]{2}:[0-9]{2}m\\\\b',\n name: 'constant.numeric.datetime.minute.dolphindb',\n },\n ]\n },\n \n string: {\n patterns: [\n {\n include: '#string_single_quoted'\n },\n {\n include: '#string_double_quoted'\n },\n {\n begin: \"'''\",\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.string.begin.dolphindb'\n }\n },\n end: \"'''\",\n endCaptures: {\n 0: {\n name: 'punctuation.definition.string.end.dolphindb'\n }\n },\n name: 'string.quoted.single.heredoc.dolphindb',\n patterns: [\n {\n captures: {\n 1: {\n name: 'punctuation.definition.escape.backslash.dolphindb'\n }\n },\n match: '(\\\\\\\\).',\n name: 'constant.character.escape.backslash.dolphindb'\n }\n ]\n },\n {\n begin: '\"\"\"',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.string.begin.dolphindb'\n }\n },\n end: '\"\"\"',\n endCaptures: {\n 0: {\n name: 'punctuation.definition.string.end.dolphindb'\n }\n },\n name: 'string.quoted.double.heredoc.dolphindb',\n patterns: [\n {\n captures: {\n 1: {\n name: 'punctuation.definition.escape.backslash.dolphindb'\n }\n },\n match: '(\\\\\\\\).',\n name: 'constant.character.escape.backslash.dolphindb'\n },\n {\n include: '#interpolated_dolphindb'\n }\n ]\n },\n {\n match: '`[\\\\w\\\\.]*',\n name: 'string.quoted.other.dolphindb'\n }\n ]\n },\n \n number: {\n patterns: [\n {\n match: '\\\\b[01]+[bB]\\\\b',\n name: 'constant.numeric.binary.dolphindb'\n },\n {\n // 97c\n match: '\\\\b[0-9]+([clhsmyM]|ms)\\\\b',\n name: 'constant.numeric.dolphindb'\n },\n {\n // 1.2f, 1f\n match: '\\\\b[0-9]+(\\\\.[0-9]+)?f\\\\b',\n name: 'constant.numeric.dolphindb'\n },\n {\n match: \n '(?x)\\n' +\n '(?:\\n' +\n ' (?:\\\\b[0-9]+(\\\\.)[0-9]+[eE][+-]?[0-9]+\\\\b)| # 1.1E+3\\n' +\n ' (?:\\\\b[0-9]+(\\\\.)[eE][+-]?[0-9]+\\\\b)| # 1.E+3\\n' +\n ' (?:\\\\b(\\\\.)[0-9]+[eE][+-]?[0-9]+\\\\b)| # .1E+3\\n' +\n ' (?:\\\\b[0-9]+[eE][+-]?[0-9]+\\\\b)| # 1E+3\\n' +\n ' (?:\\\\b[0-9]+(\\\\.)[0-9]+\\\\b)| # 1.1\\n' +\n ' (?:\\\\b[0-9]+(?=\\\\.{2,3}))| # 1 followed by a slice\\n' +\n ' (?:\\\\b[0-9]+(\\\\.)\\\\b)| # 1.\\n' +\n ' (?:\\\\b(\\\\.)[0-9]+\\\\b)| # .1\\n' +\n ' (?:\\\\b[0-9]+\\\\b(?!\\\\.)) # 1\\n' +\n ')\\n',\n \n captures: {\n 0: {\n name: 'constant.numeric.decimal.dolphindb'\n },\n 1: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n },\n 2: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n },\n 3: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n },\n 4: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n },\n 5: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n },\n 6: {\n name: 'punctuation.separator.decimal.period.dolphindb'\n }\n }\n },\n ]\n },\n \n string_single_quoted: {\n patterns: [\n {\n begin: \"'\",\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.string.begin.dolphindb'\n }\n },\n end: \"'\",\n endCaptures: {\n 0: {\n name: 'punctuation.definition.string.end.dolphindb'\n }\n },\n name: 'string.quoted.single.dolphindb',\n patterns: [\n {\n captures: {\n 1: {\n name: 'punctuation.definition.escape.backslash.dolphindb'\n }\n },\n match: '(\\\\\\\\)(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)',\n name: 'constant.character.escape.backslash.dolphindb'\n }\n ]\n }\n ]\n },\n \n string_double_quoted: {\n patterns: [\n {\n begin: '\"',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.string.begin.dolphindb'\n }\n },\n end: '\"',\n endCaptures: {\n 0: {\n name: 'punctuation.definition.string.end.dolphindb'\n }\n },\n name: 'string.quoted.double.dolphindb',\n patterns: [\n {\n captures: {\n 1: {\n name: 'punctuation.definition.escape.backslash.dolphindb'\n }\n },\n match: '(\\\\\\\\)(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)',\n name: 'constant.character.escape.backslash.dolphindb'\n },\n {\n include: '#interpolated_dolphindb'\n }\n ]\n }\n ]\n },\n \n function_call: {\n patterns: [\n {\n begin: '(@)?([\\\\w$]+!?)\\\\s*(?=\\\\()',\n beginCaptures: {\n 1: {\n name: 'variable.other.readwrite.instance.dolphindb'\n },\n 2: {\n patterns: [\n {\n include: '#function_name'\n }\n ]\n }\n },\n end: '(?<=\\\\))',\n name: 'meta.function-call.dolphindb',\n patterns: [\n {\n include: '#arguments'\n }\n ]\n }\n ]\n },\n \n function_name: {\n patterns: [\n {\n match: '[a-zA-Z_\\\\u4e00-\\\\u9fa5][\\\\w\\\\u4e00-\\\\u9fa5]*',\n name: 'entity.name.function.dolphindb'\n },\n {\n match: '\\\\d[\\\\w]*',\n name: 'invalid.illegal.identifier.dolphindb'\n }\n ]\n },\n \n function_params: {\n patterns: [\n {\n begin: '\\\\(',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.parameters.begin.bracket.round.dolphindb'\n }\n },\n end: '\\\\)',\n endCaptures: {\n 0: {\n name: 'punctuation.definition.parameters.end.bracket.round.dolphindb'\n }\n },\n name: 'meta.parameters.dolphindb',\n patterns: [\n {\n include: '#variable'\n },\n {\n match: '(@(?:[a-zA-Z_$][\\\\w$]*)?)(\\\\.\\\\.\\\\.)?',\n captures: {\n 1: {\n name: 'variable.parameter.function.readwrite.instance.dolphindb'\n },\n 2: {\n name: 'keyword.operator.splat.dolphindb'\n }\n }\n },\n {\n include: '$self'\n }\n ]\n }\n ]\n },\n \n comment: {\n patterns: python ? [\n {\n begin: '#',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.comment.dolphindb'\n }\n },\n end: '$',\n name: 'comment.line.number-sign.dolphindb'\n }\n ] : [\n {\n begin: '/\\\\*',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.comment.dolphindb'\n }\n },\n end: '\\\\*/',\n endCaptures: {\n 0: {\n name: 'punctuation.definition.comment.dolphindb'\n }\n },\n name: 'comment.block.dolphindb'\n },\n {\n begin: '//',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.comment.dolphindb'\n }\n },\n end: '$',\n name: 'comment.line.number-sign.dolphindb'\n },\n ]\n },\n \n arguments: {\n patterns: [\n {\n begin: '\\\\(',\n beginCaptures: {\n 0: {\n name: 'punctuation.definition.arguments.begin.bracket.round.dolphindb'\n }\n },\n end: '\\\\)',\n endCaptures: {\n 0: {\n name: 'punctuation.definition.arguments.end.bracket.round.dolphindb'\n }\n },\n name: 'meta.arguments.dolphindb',\n patterns: [\n {\n include: '$self'\n },\n {\n include: '#literal'\n },\n {\n include: '#variable'\n }\n ]\n }\n ]\n },\n \n variable: {\n patterns: [\n {\n match: '(@)([a-zA-Z_\\\\$]\\\\w*)?',\n name: 'variable.other.readwrite.instance.dolphindb'\n }\n ]\n },\n \n interpolated_dolphindb: {\n patterns: [\n {\n begin: '\\\\#\\\\{',\n captures: {\n 0: {\n name: 'punctuation.section.embedded.dolphindb'\n }\n },\n end: '\\\\}',\n name: 'source.dolphindb.embedded.source',\n patterns: [\n {\n include: '$self'\n }\n ]\n }\n ]\n },\n \n method_call: {\n patterns: [\n {\n begin: '(?:(\\\\.)|(::))\\\\s*([\\\\w$]+!?)(?=\\\\()',\n beginCaptures: {\n 1: {\n name: 'punctuation.separator.method.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n patterns: [\n {\n include: '#method_name'\n }\n ]\n }\n },\n end: '(?<=\\\\))',\n name: 'meta.method-call.dolphindb',\n patterns: [\n {\n include: '#arguments'\n }\n ]\n }\n ]\n },\n \n method_name: {\n patterns: [\n {\n match: '[a-zA-Z_$][\\\\w$]*',\n name: 'entity.name.function.dolphindb'\n },\n {\n match: '\\\\d[\\\\w$]*',\n name: 'invalid.illegal.identifier.dolphindb'\n }\n ]\n },\n \n operator: {\n patterns: [\n {\n match: '<<|>>',\n name: 'keyword.operator.bitwise.shift.dolphindb'\n },\n {\n match: '!=|<=|>=|==|>|<',\n name: 'keyword.operator.comparison.dolphindb'\n },\n {\n match: '<-|->',\n name: 'keyword.operator.join.dolphindb'\n },\n {\n match: '&&|!|\\\\|\\\\|',\n name: 'keyword.operator.logical.dolphindb'\n },\n {\n match: '&|\\\\||\\\\^',\n name: 'keyword.operator.bitwise.dolphindb'\n },\n {\n match: '\\\\.\\\\.',\n name: 'keyword.operator.splat.dolphindb'\n },\n {\n match: '\\\\?',\n name: 'keyword.operator.existential.dolphindb'\n },\n {\n match: '/|<-|%|\\\\*|/|-|\\\\$|\\\\+',\n name: 'keyword.operator.dolphindb'\n },\n {\n match: '([a-zA-Z$_][\\\\w$]*)?\\\\s*(=|:(?!:))(?![>=])',\n captures: {\n 1: {\n name: 'variable.assignment.dolphindb'\n },\n 2: {\n name: 'keyword.operator.assignment.dolphindb'\n }\n }\n }\n ]\n },\n \n property: {\n patterns: [\n {\n match: '(?:(\\\\.)|(::))\\\\s*([A-Z][A-Z0-9_$]*\\\\b\\\\$*)(?=\\\\s*\\\\??(\\\\.\\\\s*[a-zA-Z_$]\\\\w*|::))',\n captures: {\n 1: {\n name: 'punctuation.separator.property.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n name: 'constant.other.object.property.dolphindb'\n }\n }\n },\n {\n match: '(?:(\\\\.)|(::))\\\\s*(\\\\$*[a-zA-Z_$][\\\\w$]*)(?=\\\\s*\\\\??(\\\\.\\\\s*[a-zA-Z_$]\\\\w*|::))',\n captures: {\n 1: {\n name: 'punctuation.separator.property.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n name: 'variable.other.object.property.dolphindb'\n }\n }\n },\n {\n match: '(?:(\\\\.)|(::))\\\\s*([A-Z][A-Z0-9_$]*\\\\b\\\\$*)',\n captures: {\n 1: {\n name: 'punctuation.separator.property.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n name: 'constant.other.property.dolphindb'\n }\n }\n },\n {\n match: '(?:(\\\\.)|(::))\\\\s*(\\\\$*[a-zA-Z_$][\\\\w$]*)',\n captures: {\n 1: {\n name: 'punctuation.separator.property.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n name: 'variable.other.property.dolphindb'\n }\n }\n },\n {\n match: '(?:(\\\\.)|(::))\\\\s*([0-9][\\\\w$]*)',\n captures: {\n 1: {\n name: 'punctuation.separator.property.period.dolphindb'\n },\n 2: {\n name: 'keyword.operator.prototype.dolphindb'\n },\n 3: {\n name: 'invalid.illegal.identifier.dolphindb'\n }\n }\n }\n ]\n }\n }\n } as Block\n}\n\n\nexport const tm_language = get_tm_language(false)\n\nexport const tm_language_python = get_tm_language(true)\n\n\ninterface Block {\n patterns: Pattern[]\n repository?: Record<string, Pattern | Block>\n}\n\ntype Pattern = Match | Include | Block\n\ntype Match = MatchOne | MatchBeginEnd\n\ninterface MatchOne {\n /** a single-line regular expression */\n match: RegExp | string\n \n /** This is the scope that will be applied to the matched text */\n name?: string\n \n /** This use of the captures > patterns structure is extremely important. \n Without it, a stretch of text matched by a match rule is considered finished, and \n TextMate’s search proceeds to the rest of the line after the matched text. \n With it, the stretch of matched text itself becomes a candidate for further matches. \n */\n captures?: Captures\n}\n\ninterface MatchBeginEnd {\n begin: RegExp | string\n \n end: RegExp | string\n \n /** This is the scope (or an expression evaluating to a scope) to be applied to \n the entire matched stretch(es) of text starting at the start of the begin match.\n */\n name?: string\n \n /** This is the scope to be applied to what’s between the begin match and the end match (or the end of the document). */\n contentName?: string\n \n /** it applies to the region between the begin and end matches. */\n patterns?: Pattern[]\n \n beginCaptures?: Captures\n \n endCaptures?: Captures\n \n whileCaptures?: Captures\n \n /** If the name or number of the matched group happens to be the same for both the begin pattern and the other pattern, \n you can (if appropriate) use captures as a shorthand to avoid saying the same thing twice.\n */\n captures?: Captures\n \n applyEndPatternLast?: 1\n}\n\ninterface Include {\n include: string\n}\n\ntype Captures = Record<string | number, {\n /** This is the scope that will be assigned to the matched group text. */\n name?: string\n \n /** This is a list of match rules to be sought within the matched group text \n — thus permitting the search for matches to continue inside the matched text.\n */\n patterns?: Pattern[]\n}>\n\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dolphindb",
|
|
3
3
|
"description": "DolphinDB JavaScript API",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1017",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"browser": "./browser.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"JavaScript"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/node": "^20.5.
|
|
28
|
+
"@types/node": "^20.5.4",
|
|
29
29
|
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
30
30
|
"@typescript-eslint/parser": "^6.4.1",
|
|
31
31
|
"eslint": "^8.47.0",
|
package/test.d.ts
CHANGED
package/test.js
CHANGED
|
@@ -4,8 +4,7 @@ import { keywords } from './language.js';
|
|
|
4
4
|
import { DDB, DdbConnectionError, DdbDatabaseError, DdbForm, DdbInt, DdbLong, DdbObj, DdbType, DdbVectorAny, DdbVectorDouble, DdbVectorSymbol, month2ms, DdbDurationUnit } from './index.js';
|
|
5
5
|
set_inspect_options();
|
|
6
6
|
// linux
|
|
7
|
-
|
|
8
|
-
export const url = 'ws://192.168.0.200:20023';
|
|
7
|
+
export const url = 'ws://115.239.209.123:8892';
|
|
9
8
|
(async function test() {
|
|
10
9
|
console.log('--- 测试开始 ---'.green);
|
|
11
10
|
let ddb = new DDB(url);
|
package/test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,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Q,EAAE,qBAAqB,CAAC,CAAA;IAC3D,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC,EAAE,8BAA8B,CAAC,CAAA;IAEzG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;IAC7B,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,IAAI,CAAc,gDAAgD,CAAC,CAAA;IAC3F,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,CAAA;IAEtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAClB,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAA;IACrE,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE,yBAAyB,CAAC,CAAA;IACtD,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,EAAE,wBAAwB,CAAC,CAAA;IAEtD,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;AAC5C,CAAC","sourcesContent":["import { deepEqual } from 'assert/strict'\n\nimport { assert, defer, inspect, set_inspect_options, WebSocketConnectionError } from 'xshell'\n\nimport { keywords } from './language.js'\nimport { DDB, DdbConnectionError, DdbDatabaseError, DdbForm, DdbInt, DdbLong, DdbObj, DdbType, DdbVectorAny, DdbVectorDouble, DdbVectorSymbol, month2ms, type DdbStringObj, type DdbVectorAnyObj, type DdbDurationVectorValue, DdbDurationUnit, type DdbVectorObj, type DdbTableObj } from './index.js'\n\n\nset_inspect_options()\n\n\n// linux\n// export const url = 'ws://115.239.209.123:8892' as const\nexport const url = 'ws://192.168.0.200:20023' as const\n// export const url = 'ws://192.168.0.29:9002' as const\n\n// windows\n// export const url = 'ws://192.168.0.29:9002' as const\n\n// local 8848\n// export const url = 'ws://127.0.0.1:8848' as const\n\n\n;(async function test () {\n console.log('--- 测试开始 ---'.green)\n \n let ddb = new DDB(url)\n \n const tests = [\n test_repl,\n \n test_keywords,\n test_types,\n test_reconnection,\n test_connection_error,\n test_print,\n test_time,\n test_streaming,\n test_error,\n ]\n \n for (const fn_test of tests)\n await fn_test(ddb)\n \n ddb.disconnect()\n \n console.log('--- 测试通过 ---'.green)\n})()\n\n\n\nfunction test_keywords () {\n assert(new Set(keywords).size === keywords.length, 'keywords 中不能有重复的项')\n}\n\n\nasync function get_printed (ddb: DDB, code: string) {\n return new Promise<string>(async (resolve, reject) => {\n try {\n let resolved = false\n await ddb.eval(\n `print(${code})`,\n {\n listener ({ type, data }) {\n if (type === 'print' && !resolved) {\n resolved = true\n resolve(data)\n }\n }\n }\n )\n if (!resolved)\n reject(new Error('未输出 print 消息'))\n } catch (error) {\n reject(error)\n }\n })\n}\n\n\nasync function test_repl (ddb: DDB) {\n \n}\n\n\nasync function test_reconnection (ddb: DDB) {\n let _ddb = new DDB(url)\n \n await _ddb.connect()\n _ddb.disconnect()\n \n let error: DdbConnectionError\n \n try {\n await _ddb.connect()\n } catch (_error) {\n error = _error\n }\n \n assert(error && error instanceof DdbConnectionError)\n}\n\n\nasync function test_connection_error (ddb: DDB) {\n let _ddb = new DDB(url)\n \n await _ddb.connect()\n _ddb.disconnect()\n \n let error: DdbConnectionError\n \n try {\n await _ddb.eval('1 + 1')\n } catch (_error) {\n error = _error\n }\n \n assert(error && error instanceof DdbConnectionError)\n}\n\n\nasync function test_error (ddb: DDB) {\n console.log('测试 DdbDatabaseError 和 DdbConnectionError')\n \n const error_message = '错误消息'\n const error_script = `throw ${error_message.quote()}`\n \n let database_error: DdbDatabaseError\n \n try {\n await ddb.eval(error_script)\n } catch (error) {\n database_error = error\n }\n \n assert(database_error)\n assert(database_error instanceof DdbDatabaseError)\n assert(database_error.message === `throw ${error_message.quote('double')} => ${error_message}`)\n assert(database_error.name === 'DdbDatabaseError')\n assert(database_error.ddb === ddb)\n assert(database_error.type === 'script')\n assert(database_error.options.script === error_script)\n assert(database_error.stack.includes('test_error'))\n \n \n let ddbtest = new DDB(url)\n let connection_error: DdbConnectionError\n try {\n await ddbtest.connect()\n ddbtest.disconnect()\n await ddbtest.eval('1')\n } catch (error) {\n connection_error = error\n }\n \n assert(connection_error)\n assert(connection_error instanceof DdbConnectionError)\n assert(connection_error.ddb === ddbtest)\n \n \n // --- 首次连接失败也会抛出 DdbConnectionError\n let ddbtest2 = new DDB('ws://dolphindb.com/')\n let connection_error2: DdbConnectionError\n try {\n await ddbtest2.connect()\n } catch (error) {\n connection_error2 = error\n }\n \n assert(connection_error2)\n assert(connection_error2 instanceof DdbConnectionError)\n assert(connection_error2.cause && connection_error2.cause instanceof WebSocketConnectionError)\n}\n\n\nasync function test_print (ddb: DDB) {\n console.log('测试 print message')\n \n const str = 'test print message\\n中文'\n \n assert(await get_printed(ddb, str.quote()) === str)\n \n console.log('测试 verbose 输出')\n \n let vddb = new DDB(url, { verbose: true })\n \n await vddb.call('typestr', [\n new DdbVectorAny([\n new DdbVectorSymbol(['a', 'b', 'a', 'b', 'a', 'b']),\n new DdbLong(3n)\n ])\n ])\n \n vddb.disconnect()\n}\n\n\nasync function test_streaming (ddb: DDB) {\n console.log('测试流数据')\n \n await ddb.eval(\n 'try {\\n' +\n \" if (!defined('prices', SHARED)) {\\n\" +\n ' share(\\n' +\n ' streamTable(\\n' +\n ' 10000:0,\\n' +\n \" ['time', 'stock', 'price'],\\n\" +\n ' [TIMESTAMP, SYMBOL, DOUBLE]\\n' +\n ' ),\\n' +\n \" 'prices'\\n\" +\n ' )\\n' +\n \" print('prices 流表创建成功')\\n\" +\n ' } else\\n' +\n \" print('prices 流表已存在')\\n\" +\n '} catch (error) {\\n' +\n \" print('prices 流表创建失败')\\n\" +\n ' print(error)\\n' +\n '}\\n'\n )\n \n let total_rows = 0\n \n let promise = defer<void>()\n \n let sddb = new DDB(url, {\n streaming: {\n table: 'prices',\n handler ({ rows, error, colnames, data, time, id, window, schema }) {\n if (error)\n throw error\n \n if (total_rows === 0 && schema) {\n console.log('流订阅返回了 table schema')\n console.log(schema)\n }\n \n // console.log(data)\n \n deepEqual(colnames, ['time', 'stock', 'price'])\n \n assert(data.form === DdbForm.vector)\n assert(data.rows === 3)\n assert(id)\n assert(time)\n assert(window.rows)\n \n total_rows += rows\n \n if (total_rows === 50)\n promise.resolve()\n },\n }\n })\n \n await sddb.connect()\n \n await ddb.eval(\n 'n = 5\\n' +\n '\\n' +\n 'for (i in 0..9)\\n' +\n ' append!(\\n' +\n ' prices,\\n' +\n ' table([\\n' +\n ' (now() + 0..(n-1)) as time,\\n' +\n \" take(['MSFT', 'FUTU'], n) as stock,\\n\" +\n ' (0..(n-1) \\\\ 10) as price\\n' +\n ' ])\\n' +\n ' )\\n'\n )\n \n await promise\n console.log('流数据已全部收齐')\n \n sddb.disconnect()\n}\n\n\nasync function test_time (ddb: DDB) {\n console.log('测试时间显示')\n \n await time2str_equal(ddb, '2022-09-01T14:30:01.095')\n await time2str_equal(ddb, '2022-07-01T00:00:00.000')\n await time2str_equal(ddb, '2022-07-02T00:00:00.000')\n await time2str_equal(ddb, '2022-06-30T00:00:00.000')\n await time2str_equal(ddb, '2022-12-22T16:57:30.248')\n \n \n console.log('测试 month2ms')\n assert(\n month2ms(\n (\n await ddb.eval<DdbObj<number>>('2022.12M')\n ).value\n ) === new Date('2022.12.01').valueOf()\n )\n}\n\n\nasync function time2str_equal (ddb: DDB, timestr: string) {\n const code = `temporalParse('${timestr}', 'yyyy-MM-ddTHH:mm:sss.SSS')`\n \n assert(\n inspect(\n await ddb.eval(code),\n { colors: false }\n ).slice('timestamp('.length, -1) === \n (\n await get_printed(ddb, code)\n ).replace('T', ' ')\n )\n}\n\n\nexport async function test_types (ddb: DDB) {\n console.log('测试通过 ddb.call 调用 getNodeAlias 函数')\n console.log(await ddb.call('getNodeAlias'))\n \n console.log('测试 ddb.call 上传不同类型的变量')\n const result0 = await ddb.call('typestr', [new DdbInt(1)])\n console.log(result0)\n assert(result0.form === DdbForm.scalar)\n assert(result0.type === DdbType.string)\n assert(result0.value === 'INT')\n \n console.log('测试 ddb.call 上传不同类型的变量')\n const result1 = await ddb.call('typestr', [new DdbVectorDouble([0.1, 0.2, 0.3])])\n console.log(result1)\n assert(result1.form === DdbForm.scalar)\n assert(result1.type === DdbType.string)\n assert(result1.value === 'FAST DOUBLE VECTOR')\n \n console.log('测试 array vector')\n const av = await ddb.eval(\n 'av = array(INT[], 0, 3)\\n' +\n 'append!(av, [1..4])\\n' +\n 'append!(av, [1..70000])\\n' +\n 'av\\n'\n )\n \n console.log(av)\n assert(av.form === DdbForm.vector)\n assert(av.type === DdbType.int + 64) // array vector 的 type 比较特殊,需要偏移 64\n assert(av.rows === 2)\n \n \n console.log('测试大数据')\n let bigarr = new Float64Array(10)\n bigarr.fill(0.5)\n \n await ddb.call<DdbStringObj>('typestr', [\n new DdbObj({\n form: DdbForm.vector,\n type: DdbType.double,\n length: 0,\n rows: bigarr.length,\n cols: 1,\n value: bigarr\n })\n ])\n \n await ddb.upload(['a'], [\n new DdbObj({\n form: DdbForm.vector,\n type: DdbType.double,\n length: 0,\n rows: bigarr.length,\n cols: 1,\n value: bigarr\n })\n ])\n \n assert((\n await ddb.eval<DdbVectorDouble>('a')\n ).rows === bigarr.length)\n \n \n console.log('测试 datasource')\n \n const ds = (await ddb.eval<DdbVectorAnyObj>(\n 'db_path = \"dfs://test-datasource\"\\n' + \n 'tb_name = \"db\"\\n' + \n 'if (!existsTable(db_path, tb_name))\\n' + \n ' createTable(\\n' + \n ' database(db_path, VALUE , [1]),\\n' +\n ' table(1:0,`id`name, [INT, STRING]),\\n' +\n ' tb_name\\n' +\n ' ).append!(table(1 2 as id, `str1`str2 as name))\\n' +\n '\\n' +\n 'tb = loadTable(db_path, tb_name)\\n' +\n 'sqlDS(<select * from tb where id = 1>)\\n'\n )).value[0] as DdbStringObj\n \n const { type, form, value } = ds\n \n assert(type === DdbType.datasource && form === DdbForm.scalar, '返回的 DdbObj 具有正确的 type 和 form')\n \n assert(value === 'DataSource< select [7] * from tb where id == 1 >')\n \n // 如果直接构造 DdbObj Datasource,将其送入 ddb.call, ddb将仍然认为送入的是一个 STRING \n assert(\n (await ddb.call<DdbStringObj>('typestr', [ds])).value === 'STRING', \n '从 js 构建的 Datasource DdbObj 会被识别为 STRING'\n )\n \n console.log('测试 pair<duration>')\n const dp = await ddb.eval<DdbVectorObj<DdbDurationVectorValue>>(\n 'pair(duration(\"20d\"), duration(\"2H\"))'\n ) \n \n console.log(dp)\n assert(dp.type === DdbType.duration, 'dp 的返回值应该为 Duration')\n assert(dp.value[0].data === 20 && dp.value[0].unit === DdbDurationUnit.d, 'pair<duration> 的 value 应该已解析')\n \n console.log('测试 void vector')\n const table = await ddb.eval<DdbTableObj>('select *, NULL as val from table(1..100 as id)')\n const { value: [ints, voids] } = table\n \n console.log(voids)\n assert(voids.rows === ints.rows, 'void vector 应该具有正常的 vector length')\n assert(voids.length === 10, 'void vector 应该具有正确的数据长度')\n assert(voids.value === null, 'void vector 的值应该为 null')\n \n await ddb.upload(['voidtable'], [table])\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAA;AAE9F,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,GAAG,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAwE,eAAe,EAAuC,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E,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,CAAA;IAEtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAClB,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAA;IACrE,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE,yBAAyB,CAAC,CAAA;IACtD,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,EAAE,wBAAwB,CAAC,CAAA;IAEtD,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;AAC5C,CAAC","sourcesContent":["import { deepEqual } from 'assert/strict'\n\nimport { assert, defer, inspect, set_inspect_options, WebSocketConnectionError } from 'xshell'\n\nimport { keywords } from './language.js'\nimport { DDB, DdbConnectionError, DdbDatabaseError, DdbForm, DdbInt, DdbLong, DdbObj, DdbType, DdbVectorAny, DdbVectorDouble, DdbVectorSymbol, month2ms, type DdbStringObj, type DdbVectorAnyObj, type DdbDurationVectorValue, DdbDurationUnit, type DdbVectorObj, type DdbTableObj } from './index.js'\n\n\nset_inspect_options()\n\n\n// linux\nexport const url = 'ws://115.239.209.123:8892' as const\n// export const url = 'ws://192.168.0.200:20023' as const\n// export const url = 'ws://192.168.0.29:9002' as const\n\n// windows\n// export const url = 'ws://192.168.0.29:9002' as const\n\n// local 8848\n// export const url = 'ws://127.0.0.1:8848' as const\n\n\n;(async function test () {\n console.log('--- 测试开始 ---'.green)\n \n let ddb = new DDB(url)\n \n const tests = [\n test_repl,\n \n test_keywords,\n test_types,\n test_reconnection,\n test_connection_error,\n test_print,\n test_time,\n test_streaming,\n test_error,\n ]\n \n for (const fn_test of tests)\n await fn_test(ddb)\n \n ddb.disconnect()\n \n console.log('--- 测试通过 ---'.green)\n})()\n\n\n\nfunction test_keywords () {\n assert(new Set(keywords).size === keywords.length, 'keywords 中不能有重复的项')\n}\n\n\nasync function get_printed (ddb: DDB, code: string) {\n return new Promise<string>(async (resolve, reject) => {\n try {\n let resolved = false\n await ddb.eval(\n `print(${code})`,\n {\n listener ({ type, data }) {\n if (type === 'print' && !resolved) {\n resolved = true\n resolve(data)\n }\n }\n }\n )\n if (!resolved)\n reject(new Error('未输出 print 消息'))\n } catch (error) {\n reject(error)\n }\n })\n}\n\n\nasync function test_repl (ddb: DDB) {\n \n}\n\n\nasync function test_reconnection (ddb: DDB) {\n let _ddb = new DDB(url)\n \n await _ddb.connect()\n _ddb.disconnect()\n \n let error: DdbConnectionError\n \n try {\n await _ddb.connect()\n } catch (_error) {\n error = _error\n }\n \n assert(error && error instanceof DdbConnectionError)\n}\n\n\nasync function test_connection_error (ddb: DDB) {\n let _ddb = new DDB(url)\n \n await _ddb.connect()\n _ddb.disconnect()\n \n let error: DdbConnectionError\n \n try {\n await _ddb.eval('1 + 1')\n } catch (_error) {\n error = _error\n }\n \n assert(error && error instanceof DdbConnectionError)\n}\n\n\nasync function test_error (ddb: DDB) {\n console.log('测试 DdbDatabaseError 和 DdbConnectionError')\n \n const error_message = '错误消息'\n const error_script = `throw ${error_message.quote()}`\n \n let database_error: DdbDatabaseError\n \n try {\n await ddb.eval(error_script)\n } catch (error) {\n database_error = error\n }\n \n assert(database_error)\n assert(database_error instanceof DdbDatabaseError)\n assert(database_error.message === `throw ${error_message.quote('double')} => ${error_message}`)\n assert(database_error.name === 'DdbDatabaseError')\n assert(database_error.ddb === ddb)\n assert(database_error.type === 'script')\n assert(database_error.options.script === error_script)\n assert(database_error.stack.includes('test_error'))\n \n \n let ddbtest = new DDB(url)\n let connection_error: DdbConnectionError\n try {\n await ddbtest.connect()\n ddbtest.disconnect()\n await ddbtest.eval('1')\n } catch (error) {\n connection_error = error\n }\n \n assert(connection_error)\n assert(connection_error instanceof DdbConnectionError)\n assert(connection_error.ddb === ddbtest)\n \n \n // --- 首次连接失败也会抛出 DdbConnectionError\n let ddbtest2 = new DDB('ws://dolphindb.com/')\n let connection_error2: DdbConnectionError\n try {\n await ddbtest2.connect()\n } catch (error) {\n connection_error2 = error\n }\n \n assert(connection_error2)\n assert(connection_error2 instanceof DdbConnectionError)\n assert(connection_error2.cause && connection_error2.cause instanceof WebSocketConnectionError)\n}\n\n\nasync function test_print (ddb: DDB) {\n console.log('测试 print message')\n \n const str = 'test print message\\n中文'\n \n assert(await get_printed(ddb, str.quote()) === str)\n \n console.log('测试 verbose 输出')\n \n let vddb = new DDB(url, { verbose: true })\n \n await vddb.call('typestr', [\n new DdbVectorAny([\n new DdbVectorSymbol(['a', 'b', 'a', 'b', 'a', 'b']),\n new DdbLong(3n)\n ])\n ])\n \n vddb.disconnect()\n}\n\n\nasync function test_streaming (ddb: DDB) {\n console.log('测试流数据')\n \n await ddb.eval(\n 'try {\\n' +\n \" if (!defined('prices', SHARED)) {\\n\" +\n ' share(\\n' +\n ' streamTable(\\n' +\n ' 10000:0,\\n' +\n \" ['time', 'stock', 'price'],\\n\" +\n ' [TIMESTAMP, SYMBOL, DOUBLE]\\n' +\n ' ),\\n' +\n \" 'prices'\\n\" +\n ' )\\n' +\n \" print('prices 流表创建成功')\\n\" +\n ' } else\\n' +\n \" print('prices 流表已存在')\\n\" +\n '} catch (error) {\\n' +\n \" print('prices 流表创建失败')\\n\" +\n ' print(error)\\n' +\n '}\\n'\n )\n \n let total_rows = 0\n \n let promise = defer<void>()\n \n let sddb = new DDB(url, {\n streaming: {\n table: 'prices',\n handler ({ rows, error, colnames, data, time, id, window, schema }) {\n if (error)\n throw error\n \n if (total_rows === 0 && schema) {\n console.log('流订阅返回了 table schema')\n console.log(schema)\n }\n \n // console.log(data)\n \n deepEqual(colnames, ['time', 'stock', 'price'])\n \n assert(data.form === DdbForm.vector)\n assert(data.rows === 3)\n assert(id)\n assert(time)\n assert(window.rows)\n \n total_rows += rows\n \n if (total_rows === 50)\n promise.resolve()\n },\n }\n })\n \n await sddb.connect()\n \n await ddb.eval(\n 'n = 5\\n' +\n '\\n' +\n 'for (i in 0..9)\\n' +\n ' append!(\\n' +\n ' prices,\\n' +\n ' table([\\n' +\n ' (now() + 0..(n-1)) as time,\\n' +\n \" take(['MSFT', 'FUTU'], n) as stock,\\n\" +\n ' (0..(n-1) \\\\ 10) as price\\n' +\n ' ])\\n' +\n ' )\\n'\n )\n \n await promise\n console.log('流数据已全部收齐')\n \n sddb.disconnect()\n}\n\n\nasync function test_time (ddb: DDB) {\n console.log('测试时间显示')\n \n await time2str_equal(ddb, '2022-09-01T14:30:01.095')\n await time2str_equal(ddb, '2022-07-01T00:00:00.000')\n await time2str_equal(ddb, '2022-07-02T00:00:00.000')\n await time2str_equal(ddb, '2022-06-30T00:00:00.000')\n await time2str_equal(ddb, '2022-12-22T16:57:30.248')\n \n \n console.log('测试 month2ms')\n assert(\n month2ms(\n (\n await ddb.eval<DdbObj<number>>('2022.12M')\n ).value\n ) === new Date('2022.12.01').valueOf()\n )\n}\n\n\nasync function time2str_equal (ddb: DDB, timestr: string) {\n const code = `temporalParse('${timestr}', 'yyyy-MM-ddTHH:mm:sss.SSS')`\n \n assert(\n inspect(\n await ddb.eval(code),\n { colors: false }\n ).slice('timestamp('.length, -1) === \n (\n await get_printed(ddb, code)\n ).replace('T', ' ')\n )\n}\n\n\nexport async function test_types (ddb: DDB) {\n console.log('测试通过 ddb.call 调用 getNodeAlias 函数')\n console.log(await ddb.call('getNodeAlias'))\n \n console.log('测试 ddb.call 上传不同类型的变量')\n const result0 = await ddb.call('typestr', [new DdbInt(1)])\n console.log(result0)\n assert(result0.form === DdbForm.scalar)\n assert(result0.type === DdbType.string)\n assert(result0.value === 'INT')\n \n console.log('测试 ddb.call 上传不同类型的变量')\n const result1 = await ddb.call('typestr', [new DdbVectorDouble([0.1, 0.2, 0.3])])\n console.log(result1)\n assert(result1.form === DdbForm.scalar)\n assert(result1.type === DdbType.string)\n assert(result1.value === 'FAST DOUBLE VECTOR')\n \n console.log('测试 array vector')\n const av = await ddb.eval(\n 'av = array(INT[], 0, 3)\\n' +\n 'append!(av, [1..4])\\n' +\n 'append!(av, [1..70000])\\n' +\n 'av\\n'\n )\n \n console.log(av)\n assert(av.form === DdbForm.vector)\n assert(av.type === DdbType.int + 64) // array vector 的 type 比较特殊,需要偏移 64\n assert(av.rows === 2)\n \n \n console.log('测试大数据')\n let bigarr = new Float64Array(10)\n bigarr.fill(0.5)\n \n await ddb.call<DdbStringObj>('typestr', [\n new DdbObj({\n form: DdbForm.vector,\n type: DdbType.double,\n length: 0,\n rows: bigarr.length,\n cols: 1,\n value: bigarr\n })\n ])\n \n await ddb.upload(['a'], [\n new DdbObj({\n form: DdbForm.vector,\n type: DdbType.double,\n length: 0,\n rows: bigarr.length,\n cols: 1,\n value: bigarr\n })\n ])\n \n assert((\n await ddb.eval<DdbVectorDouble>('a')\n ).rows === bigarr.length)\n \n \n console.log('测试 datasource')\n \n const ds = (await ddb.eval<DdbVectorAnyObj>(\n 'db_path = \"dfs://test-datasource\"\\n' + \n 'tb_name = \"db\"\\n' + \n 'if (!existsTable(db_path, tb_name))\\n' + \n ' createTable(\\n' + \n ' database(db_path, VALUE , [1]),\\n' +\n ' table(1:0,`id`name, [INT, STRING]),\\n' +\n ' tb_name\\n' +\n ' ).append!(table(1 2 as id, `str1`str2 as name))\\n' +\n '\\n' +\n 'tb = loadTable(db_path, tb_name)\\n' +\n 'sqlDS(<select * from tb where id = 1>)\\n'\n )).value[0] as DdbStringObj\n \n const { type, form, value } = ds\n \n assert(type === DdbType.datasource && form === DdbForm.scalar, '返回的 DdbObj 具有正确的 type 和 form')\n \n assert(value === 'DataSource< select [7] * from tb where id == 1 >')\n \n // 如果直接构造 DdbObj Datasource,将其送入 ddb.call, ddb将仍然认为送入的是一个 STRING \n assert(\n (await ddb.call<DdbStringObj>('typestr', [ds])).value === 'STRING', \n '从 js 构建的 Datasource DdbObj 会被识别为 STRING'\n )\n \n console.log('测试 pair<duration>')\n const dp = await ddb.eval<DdbVectorObj<DdbDurationVectorValue>>(\n 'pair(duration(\"20d\"), duration(\"2H\"))'\n ) \n \n console.log(dp)\n assert(dp.type === DdbType.duration, 'dp 的返回值应该为 Duration')\n assert(dp.value[0].data === 20 && dp.value[0].unit === DdbDurationUnit.d, 'pair<duration> 的 value 应该已解析')\n \n console.log('测试 void vector')\n const table = await ddb.eval<DdbTableObj>('select *, NULL as val from table(1..100 as id)')\n const { value: [ints, voids] } = table\n \n console.log(voids)\n assert(voids.rows === ints.rows, 'void vector 应该具有正常的 vector length')\n assert(voids.length === 10, 'void vector 应该具有正确的数据长度')\n assert(voids.value === null, 'void vector 的值应该为 null')\n \n await ddb.upload(['voidtable'], [table])\n}\n\n"]}
|