rip-lang 3.13.53 → 3.13.55
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/README.md +1 -1
- package/docs/dist/rip.js +19 -4
- package/docs/dist/rip.min.js +182 -182
- package/docs/dist/rip.min.js.br +0 -0
- package/package.json +1 -1
- package/src/components.js +19 -0
- package/src/lexer.js +1 -1
package/docs/dist/rip.min.js.br
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/components.js
CHANGED
|
@@ -112,6 +112,25 @@ function isPublicProp(target) {
|
|
|
112
112
|
|
|
113
113
|
export function installComponentSupport(CodeGenerator, Lexer) {
|
|
114
114
|
|
|
115
|
+
// ==========================================================================
|
|
116
|
+
// Lexer: Context-sensitive 'offer'/'accept' (only inside component bodies)
|
|
117
|
+
// ==========================================================================
|
|
118
|
+
|
|
119
|
+
const origClassify = Lexer.prototype.classifyKeyword;
|
|
120
|
+
Lexer.prototype.classifyKeyword = function(id, fallback, data) {
|
|
121
|
+
if (id === 'offer' || id === 'accept') {
|
|
122
|
+
let depth = 0;
|
|
123
|
+
for (let i = this.tokens.length - 1; i >= 0; i--) {
|
|
124
|
+
const tag = this.tokens[i][0];
|
|
125
|
+
if (tag === 'OUTDENT') depth++;
|
|
126
|
+
else if (tag === 'INDENT') depth--;
|
|
127
|
+
if (depth < 0 && this.tokens[i - 1]?.[0] === 'COMPONENT') return id.toUpperCase();
|
|
128
|
+
}
|
|
129
|
+
return fallback;
|
|
130
|
+
}
|
|
131
|
+
return origClassify.call(this, id, fallback, data);
|
|
132
|
+
};
|
|
133
|
+
|
|
115
134
|
// ==========================================================================
|
|
116
135
|
// Lexer: Render block rewriter
|
|
117
136
|
// ==========================================================================
|
package/src/lexer.js
CHANGED
|
@@ -61,7 +61,7 @@ let JS_KEYWORDS = new Set([
|
|
|
61
61
|
let RIP_KEYWORDS = new Set([
|
|
62
62
|
'undefined', 'Infinity', 'NaN',
|
|
63
63
|
'then', 'unless', 'until', 'loop', 'of', 'by', 'when', 'def',
|
|
64
|
-
'component', 'render',
|
|
64
|
+
'component', 'render',
|
|
65
65
|
'enum', 'interface',
|
|
66
66
|
]);
|
|
67
67
|
|