@aeriajs/compiler 0.0.30 → 0.0.31
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/lexer.js +31 -1
- package/dist/lexer.mjs +32 -2
- package/dist/semantic.js +1 -0
- package/dist/semantic.mjs +1 -0
- package/package.json +1 -1
package/dist/lexer.js
CHANGED
|
@@ -176,11 +176,12 @@ const TOKENS = [
|
|
|
176
176
|
type: token_js_1.TokenType.Keyword,
|
|
177
177
|
matcher: Array.from(keywordsSet),
|
|
178
178
|
condition: (state, lastToken) => {
|
|
179
|
-
if (state.variableScopeStack.at(-1)) {
|
|
179
|
+
if (state.variableScopeStack.at(-1) || state.variableExpressionStack.at(-1)) {
|
|
180
180
|
return false;
|
|
181
181
|
}
|
|
182
182
|
if (lastToken && lastToken.type === token_js_1.TokenType.Keyword) {
|
|
183
183
|
switch (lastToken.value) {
|
|
184
|
+
case 'if':
|
|
184
185
|
case 'badge':
|
|
185
186
|
case 'title': {
|
|
186
187
|
return false;
|
|
@@ -217,6 +218,7 @@ const tokenize = function (rawInput) {
|
|
|
217
218
|
const errors = [];
|
|
218
219
|
const state = {
|
|
219
220
|
variableScopeStack: [],
|
|
221
|
+
variableExpressionStack: [],
|
|
220
222
|
};
|
|
221
223
|
while (index < input.length) {
|
|
222
224
|
let hasMatch = false;
|
|
@@ -307,12 +309,40 @@ const tokenize = function (rawInput) {
|
|
|
307
309
|
state.variableScopeStack.push(variableScope);
|
|
308
310
|
break;
|
|
309
311
|
}
|
|
312
|
+
case token_js_1.TokenType.LeftParens: {
|
|
313
|
+
let variableExpression = false;
|
|
314
|
+
if (lastToken) {
|
|
315
|
+
switch (lastToken.type) {
|
|
316
|
+
case token_js_1.TokenType.Keyword: {
|
|
317
|
+
switch (lastToken.value) {
|
|
318
|
+
case 'if': {
|
|
319
|
+
variableExpression = true;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
case token_js_1.TokenType.Operator: {
|
|
326
|
+
variableExpression = true;
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
state.variableExpressionStack.push(variableExpression);
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
310
334
|
case token_js_1.TokenType.RightBracket: {
|
|
311
335
|
if (state.variableScopeStack.length > 0) {
|
|
312
336
|
state.variableScopeStack.pop();
|
|
313
337
|
}
|
|
314
338
|
break;
|
|
315
339
|
}
|
|
340
|
+
case token_js_1.TokenType.RightParens: {
|
|
341
|
+
if (state.variableScopeStack.length > 0) {
|
|
342
|
+
state.variableExpressionStack.pop();
|
|
343
|
+
}
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
316
346
|
}
|
|
317
347
|
tokens.push(token);
|
|
318
348
|
}
|
package/dist/lexer.mjs
CHANGED
|
@@ -184,11 +184,12 @@ const TOKENS = [
|
|
|
184
184
|
type: TokenType.Keyword,
|
|
185
185
|
matcher: Array.from(keywordsSet),
|
|
186
186
|
condition: (state, lastToken) => {
|
|
187
|
-
if (state.variableScopeStack.at(-1)) {
|
|
187
|
+
if (state.variableScopeStack.at(-1) || state.variableExpressionStack.at(-1)) {
|
|
188
188
|
return false;
|
|
189
189
|
}
|
|
190
190
|
if (lastToken && lastToken.type === TokenType.Keyword) {
|
|
191
191
|
switch (lastToken.value) {
|
|
192
|
+
case "if":
|
|
192
193
|
case "badge":
|
|
193
194
|
case "title": {
|
|
194
195
|
return false;
|
|
@@ -224,7 +225,8 @@ export const tokenize = function(rawInput) {
|
|
|
224
225
|
const tokens = [];
|
|
225
226
|
const errors = [];
|
|
226
227
|
const state = {
|
|
227
|
-
variableScopeStack: []
|
|
228
|
+
variableScopeStack: [],
|
|
229
|
+
variableExpressionStack: []
|
|
228
230
|
};
|
|
229
231
|
while (index < input.length) {
|
|
230
232
|
let hasMatch = false;
|
|
@@ -310,12 +312,40 @@ export const tokenize = function(rawInput) {
|
|
|
310
312
|
state.variableScopeStack.push(variableScope);
|
|
311
313
|
break;
|
|
312
314
|
}
|
|
315
|
+
case TokenType.LeftParens: {
|
|
316
|
+
let variableExpression = false;
|
|
317
|
+
if (lastToken) {
|
|
318
|
+
switch (lastToken.type) {
|
|
319
|
+
case TokenType.Keyword: {
|
|
320
|
+
switch (lastToken.value) {
|
|
321
|
+
case "if": {
|
|
322
|
+
variableExpression = true;
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
case TokenType.Operator: {
|
|
329
|
+
variableExpression = true;
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
state.variableExpressionStack.push(variableExpression);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
313
337
|
case TokenType.RightBracket: {
|
|
314
338
|
if (state.variableScopeStack.length > 0) {
|
|
315
339
|
state.variableScopeStack.pop();
|
|
316
340
|
}
|
|
317
341
|
break;
|
|
318
342
|
}
|
|
343
|
+
case TokenType.RightParens: {
|
|
344
|
+
if (state.variableScopeStack.length > 0) {
|
|
345
|
+
state.variableExpressionStack.pop();
|
|
346
|
+
}
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
319
349
|
}
|
|
320
350
|
tokens.push(token);
|
|
321
351
|
}
|
package/dist/semantic.js
CHANGED
|
@@ -135,6 +135,7 @@ const analyze = async (ast, options, errors = []) => {
|
|
|
135
135
|
await checkCollectionLocalProperties(node, 'filters');
|
|
136
136
|
await checkCollectionLocalProperties(node, 'form');
|
|
137
137
|
await checkCollectionLocalProperties(node, 'table');
|
|
138
|
+
await checkCollectionLocalProperties(node, 'tableMeta');
|
|
138
139
|
for (const propName in node.properties) {
|
|
139
140
|
const subNode = node.properties[propName];
|
|
140
141
|
await recurseProperty(subNode);
|
package/dist/semantic.mjs
CHANGED
|
@@ -98,6 +98,7 @@ export const analyze = async (ast, options, errors = []) => {
|
|
|
98
98
|
await checkCollectionLocalProperties(node, "filters");
|
|
99
99
|
await checkCollectionLocalProperties(node, "form");
|
|
100
100
|
await checkCollectionLocalProperties(node, "table");
|
|
101
|
+
await checkCollectionLocalProperties(node, "tableMeta");
|
|
101
102
|
for (const propName in node.properties) {
|
|
102
103
|
const subNode = node.properties[propName];
|
|
103
104
|
await recurseProperty(subNode);
|