@aeriajs/compiler 0.0.60 → 0.0.62
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/ast.d.ts +1 -0
- package/dist/ast.js +1 -0
- package/dist/ast.mjs +1 -0
- package/dist/parser.js +21 -3
- package/dist/parser.mjs +17 -3
- package/package.json +1 -1
package/dist/ast.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const PropertyType: {
|
|
|
9
9
|
readonly enum: "enum";
|
|
10
10
|
readonly date: "string";
|
|
11
11
|
readonly datetime: "string";
|
|
12
|
+
readonly objectid: "string";
|
|
12
13
|
readonly const: "const";
|
|
13
14
|
};
|
|
14
15
|
export declare const PropertyModifiers: Record<'Error' | 'Result', ExportSymbol>;
|
package/dist/ast.js
CHANGED
package/dist/ast.mjs
CHANGED
package/dist/parser.js
CHANGED
|
@@ -144,9 +144,16 @@ const parse = (tokens) => {
|
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
const parseArray = (types) => {
|
|
147
|
-
const { location: openingLocation } = consume(token_js_1.TokenType.LeftSquareBracket);
|
|
148
147
|
const array = [];
|
|
149
148
|
const symbols = [];
|
|
149
|
+
const { location: openingLocation } = consume(token_js_1.TokenType.LeftSquareBracket);
|
|
150
|
+
if (match(token_js_1.TokenType.RightSquareBracket)) {
|
|
151
|
+
consume(token_js_1.TokenType.RightSquareBracket);
|
|
152
|
+
return {
|
|
153
|
+
value: [],
|
|
154
|
+
symbols: [],
|
|
155
|
+
};
|
|
156
|
+
}
|
|
150
157
|
let type;
|
|
151
158
|
for (const typeCandidate of types) {
|
|
152
159
|
if (match(typeCandidate)) {
|
|
@@ -535,6 +542,13 @@ const parse = (tokens) => {
|
|
|
535
542
|
};
|
|
536
543
|
break;
|
|
537
544
|
}
|
|
545
|
+
case 'objectid': {
|
|
546
|
+
property = {
|
|
547
|
+
type: 'string',
|
|
548
|
+
format: 'objectid',
|
|
549
|
+
};
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
538
552
|
default:
|
|
539
553
|
property = {
|
|
540
554
|
type: AST.PropertyType[identifier],
|
|
@@ -681,7 +695,9 @@ const parse = (tokens) => {
|
|
|
681
695
|
};
|
|
682
696
|
if (match(token_js_1.TokenType.Keyword, 'extends')) {
|
|
683
697
|
consume(token_js_1.TokenType.Keyword);
|
|
684
|
-
const { value: packageName } =
|
|
698
|
+
const { value: packageName } = match(token_js_1.TokenType.QuotedString)
|
|
699
|
+
? consume(token_js_1.TokenType.QuotedString)
|
|
700
|
+
: consume(token_js_1.TokenType.Identifier);
|
|
685
701
|
consume(token_js_1.TokenType.Dot);
|
|
686
702
|
const { value: symbolName } = consume(token_js_1.TokenType.Identifier);
|
|
687
703
|
node.extends = {
|
|
@@ -856,7 +872,9 @@ const parse = (tokens) => {
|
|
|
856
872
|
}
|
|
857
873
|
let functionNode;
|
|
858
874
|
if (current().type === token_js_1.TokenType.Identifier && next().type === token_js_1.TokenType.Dot) {
|
|
859
|
-
const { value: packageName } =
|
|
875
|
+
const { value: packageName } = match(token_js_1.TokenType.QuotedString)
|
|
876
|
+
? consume(token_js_1.TokenType.QuotedString)
|
|
877
|
+
: consume(token_js_1.TokenType.Identifier);
|
|
860
878
|
consume(token_js_1.TokenType.Dot);
|
|
861
879
|
const { value: symbolName } = consume(token_js_1.TokenType.Identifier);
|
|
862
880
|
functionNode = {
|
package/dist/parser.mjs
CHANGED
|
@@ -106,9 +106,16 @@ export const parse = (tokens) => {
|
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
const parseArray = (types) => {
|
|
109
|
-
const { location: openingLocation } = consume(TokenType.LeftSquareBracket);
|
|
110
109
|
const array = [];
|
|
111
110
|
const symbols = [];
|
|
111
|
+
const { location: openingLocation } = consume(TokenType.LeftSquareBracket);
|
|
112
|
+
if (match(TokenType.RightSquareBracket)) {
|
|
113
|
+
consume(TokenType.RightSquareBracket);
|
|
114
|
+
return {
|
|
115
|
+
value: [],
|
|
116
|
+
symbols: []
|
|
117
|
+
};
|
|
118
|
+
}
|
|
112
119
|
let type;
|
|
113
120
|
for (const typeCandidate of types) {
|
|
114
121
|
if (match(typeCandidate)) {
|
|
@@ -490,6 +497,13 @@ export const parse = (tokens) => {
|
|
|
490
497
|
};
|
|
491
498
|
break;
|
|
492
499
|
}
|
|
500
|
+
case "objectid": {
|
|
501
|
+
property = {
|
|
502
|
+
type: "string",
|
|
503
|
+
format: "objectid"
|
|
504
|
+
};
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
493
507
|
default:
|
|
494
508
|
property = {
|
|
495
509
|
type: AST.PropertyType[identifier]
|
|
@@ -628,7 +642,7 @@ export const parse = (tokens) => {
|
|
|
628
642
|
};
|
|
629
643
|
if (match(TokenType.Keyword, "extends")) {
|
|
630
644
|
consume(TokenType.Keyword);
|
|
631
|
-
const { value: packageName } = consume(TokenType.Identifier);
|
|
645
|
+
const { value: packageName } = match(TokenType.QuotedString) ? consume(TokenType.QuotedString) : consume(TokenType.Identifier);
|
|
632
646
|
consume(TokenType.Dot);
|
|
633
647
|
const { value: symbolName } = consume(TokenType.Identifier);
|
|
634
648
|
node.extends = {
|
|
@@ -801,7 +815,7 @@ export const parse = (tokens) => {
|
|
|
801
815
|
}
|
|
802
816
|
let functionNode;
|
|
803
817
|
if (current().type === TokenType.Identifier && next().type === TokenType.Dot) {
|
|
804
|
-
const { value: packageName } = consume(TokenType.Identifier);
|
|
818
|
+
const { value: packageName } = match(TokenType.QuotedString) ? consume(TokenType.QuotedString) : consume(TokenType.Identifier);
|
|
805
819
|
consume(TokenType.Dot);
|
|
806
820
|
const { value: symbolName } = consume(TokenType.Identifier);
|
|
807
821
|
functionNode = {
|