@malloydata/malloy 0.0.54 → 0.0.55-dev230707164317
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/dist/lang/ast/expressions/expr-string.js +1 -3
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +138 -138
- package/dist/lang/lib/Malloy/MalloyLexer.js +1074 -1068
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +197 -255
- package/dist/lang/lib/Malloy/MalloyParser.js +1617 -2029
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +22 -66
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +14 -42
- package/dist/lang/malloy-to-ast.d.ts +5 -6
- package/dist/lang/malloy-to-ast.js +64 -71
- package/dist/lang/parse-tree-walkers/document-highlight-walker.js +3 -3
- package/dist/lang/parse-tree-walkers/find-external-references.js +1 -1
- package/dist/lang/string-parser.d.ts +11 -0
- package/dist/lang/string-parser.js +105 -0
- package/dist/lang/test/parse.spec.js +4 -1
- package/dist/lang/test/strings.spec.d.ts +1 -0
- package/dist/lang/test/strings.spec.js +60 -0
- package/package.json +1 -1
|
@@ -1106,7 +1106,10 @@ describe('literals', () => {
|
|
|
1106
1106
|
expect((0, test_translator_1.expr) `42`).toTranslate();
|
|
1107
1107
|
});
|
|
1108
1108
|
test('string', () => {
|
|
1109
|
-
|
|
1109
|
+
const m = new test_translator_1.BetaExpression("'forty two'");
|
|
1110
|
+
expect(m).toTranslate();
|
|
1111
|
+
const m42 = m.generated().value[0];
|
|
1112
|
+
expect(m42).toMatchObject({ literal: 'forty two' });
|
|
1110
1113
|
});
|
|
1111
1114
|
test('string with quoted quote', () => {
|
|
1112
1115
|
const str = "'Isn" + '\\' + "'t this nice'";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './parse-expects';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
require("./parse-expects");
|
|
26
|
+
const string_parser_1 = require("../string-parser");
|
|
27
|
+
describe('test internal string parsing', () => {
|
|
28
|
+
test('\\b', () => {
|
|
29
|
+
expect((0, string_parser_1.parseString)('\\b')).toEqual('\b');
|
|
30
|
+
});
|
|
31
|
+
test('\\f', () => {
|
|
32
|
+
expect((0, string_parser_1.parseString)('\\f')).toEqual('\f');
|
|
33
|
+
});
|
|
34
|
+
test('\\n', () => {
|
|
35
|
+
expect((0, string_parser_1.parseString)('\\n')).toEqual('\n');
|
|
36
|
+
});
|
|
37
|
+
test('\\r', () => {
|
|
38
|
+
expect((0, string_parser_1.parseString)('\\r')).toEqual('\r');
|
|
39
|
+
});
|
|
40
|
+
test('\\t', () => {
|
|
41
|
+
expect((0, string_parser_1.parseString)('\\t')).toEqual('\t');
|
|
42
|
+
});
|
|
43
|
+
test('unicode ?', () => {
|
|
44
|
+
expect((0, string_parser_1.parseString)('\\u003f')).toEqual('?');
|
|
45
|
+
expect((0, string_parser_1.parseString)('\\u003F')).toEqual('?');
|
|
46
|
+
});
|
|
47
|
+
test('normal stuff', () => {
|
|
48
|
+
expect((0, string_parser_1.parseString)('normal stuff')).toEqual('normal stuff');
|
|
49
|
+
});
|
|
50
|
+
test('stuff & nonsense', () => {
|
|
51
|
+
expect((0, string_parser_1.parseString)('stuff \\u0026 nonsense')).toEqual('stuff & nonsense');
|
|
52
|
+
});
|
|
53
|
+
test('one thing\\nnext thing', () => {
|
|
54
|
+
expect((0, string_parser_1.parseString)('one thing\\nnext thing')).toEqual('one thing\nnext thing');
|
|
55
|
+
});
|
|
56
|
+
test('quote stripping works', () => {
|
|
57
|
+
expect((0, string_parser_1.parseString)('|42|', '|')).toEqual('42');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=strings.spec.js.map
|