@jhlagado/azm 0.2.4 → 0.2.5
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.
|
@@ -86,13 +86,6 @@ function withLineComment(line, result) {
|
|
|
86
86
|
}
|
|
87
87
|
function parseEquItem(line, name, expressionText, span) {
|
|
88
88
|
const stringValue = parseWholeQuotedString(expressionText.trim());
|
|
89
|
-
const quotePolicyError = parseEquQuotePolicyError(expressionText.trim());
|
|
90
|
-
if (quotePolicyError) {
|
|
91
|
-
return {
|
|
92
|
-
items: [],
|
|
93
|
-
diagnostics: [parseError(line, quotePolicyError)],
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
89
|
const expression = stringValue !== undefined && stringValue.length > 1
|
|
97
90
|
? { kind: 'number', value: 0 }
|
|
98
91
|
: parseExpression(expressionText);
|
|
@@ -152,10 +145,9 @@ function parseCanonicalStatement(line, text, span) {
|
|
|
152
145
|
? parts.map(parseDataValue).filter((value) => value !== undefined)
|
|
153
146
|
: parts.map(parseExpression).filter((value) => value !== undefined);
|
|
154
147
|
if (values.length !== parts.length) {
|
|
155
|
-
const quotePolicyError = parts.map(parseDataQuotePolicyError).find(Boolean);
|
|
156
148
|
return {
|
|
157
149
|
items: [],
|
|
158
|
-
diagnostics: [parseError(line,
|
|
150
|
+
diagnostics: [parseError(line, `invalid .${directive} value list`)],
|
|
159
151
|
};
|
|
160
152
|
}
|
|
161
153
|
return {
|
|
@@ -362,7 +354,7 @@ function parseDataValue(text) {
|
|
|
362
354
|
function parseWholeQuotedString(text) {
|
|
363
355
|
const input = text.trim();
|
|
364
356
|
const quote = input[0];
|
|
365
|
-
if (quote !== '"' || input[input.length - 1] !== quote) {
|
|
357
|
+
if ((quote !== '"' && quote !== "'") || input[input.length - 1] !== quote) {
|
|
366
358
|
return undefined;
|
|
367
359
|
}
|
|
368
360
|
let value = '';
|
|
@@ -383,22 +375,6 @@ function parseWholeQuotedString(text) {
|
|
|
383
375
|
}
|
|
384
376
|
return value;
|
|
385
377
|
}
|
|
386
|
-
function parseEquQuotePolicyError(text) {
|
|
387
|
-
if (!text.startsWith('"') || !text.endsWith('"')) {
|
|
388
|
-
return undefined;
|
|
389
|
-
}
|
|
390
|
-
const stringValue = parseWholeQuotedString(text);
|
|
391
|
-
return stringValue !== undefined && stringValue.length === 1
|
|
392
|
-
? 'double-quoted values are strings; use single quotes for character literals'
|
|
393
|
-
: undefined;
|
|
394
|
-
}
|
|
395
|
-
function parseDataQuotePolicyError(text) {
|
|
396
|
-
const input = text.trim();
|
|
397
|
-
if (!input.startsWith("'") || !input.endsWith("'")) {
|
|
398
|
-
return undefined;
|
|
399
|
-
}
|
|
400
|
-
return 'single quotes are for one character literal; use double quotes for strings';
|
|
401
|
-
}
|
|
402
378
|
function normalizeEntryLabelName(raw) {
|
|
403
379
|
return raw.startsWith('@') ? raw.slice(1) : raw;
|
|
404
380
|
}
|