rip-lang 3.13.63 → 3.13.64

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.13.63",
3
+ "version": "3.13.64",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/components.js CHANGED
@@ -112,6 +112,8 @@ function isPublicProp(target) {
112
112
 
113
113
  export function installComponentSupport(CodeGenerator, Lexer) {
114
114
 
115
+ let meta = (node, key) => node instanceof String ? node[key] : undefined;
116
+
115
117
  // ==========================================================================
116
118
  // Lexer: Context-sensitive 'offer'/'accept' (only inside component bodies)
117
119
  // ==========================================================================
@@ -261,16 +263,18 @@ export function installComponentSupport(CodeGenerator, Lexer) {
261
263
  if (!inRender) return 1;
262
264
 
263
265
  // ─────────────────────────────────────────────────────────────────────
264
- // Expression output: = expr → "#{expr}" (text node, never a tag)
266
+ // Expression output: = expr → text node (stamp .text, skip tag detection)
265
267
  // ─────────────────────────────────────────────────────────────────────
266
268
  if (tag === '=' && i > 0) {
267
269
  let prev = tokens[i - 1][0];
268
270
  if (prev === 'TERMINATOR' || prev === 'INDENT' || prev === 'RENDER') {
269
- let end = i + 1;
270
- while (end < tokens.length && tokens[end][0] !== 'TERMINATOR' && tokens[end][0] !== 'INDENT' && tokens[end][0] !== 'OUTDENT') end++;
271
- tokens.splice(end, 0, gen('INTERPOLATION_END', ')', token), gen('STRING', '""', token), gen('STRING_END', ')', token));
272
- tokens.splice(i, 1, gen('STRING_START', '(', token), gen('STRING', '""', token), gen('INTERPOLATION_START', '(', token));
273
- return 3;
271
+ tokens.splice(i, 1);
272
+ if (tokens[i] && tokens[i][0] === 'IDENTIFIER') {
273
+ let val = tokens[i][1];
274
+ if (typeof val === 'string') { val = new String(val); tokens[i][1] = val; }
275
+ val.text = true;
276
+ }
277
+ return 0;
274
278
  }
275
279
  }
276
280
 
@@ -560,11 +564,11 @@ export function installComponentSupport(CodeGenerator, Lexer) {
560
564
  current = current[1];
561
565
  }
562
566
  let raw = typeof current === 'string' ? current : (current instanceof String ? current.valueOf() : null);
563
- if (raw === null) return { tag: null, classes, id: undefined };
567
+ if (raw === null) return { tag: null, classes, id: undefined, base: current };
564
568
  // Split tag#id — e.g. "div#content" → tag: "div", id: "content"
565
569
  let [tag, id] = raw.split('#');
566
570
  if (!tag) tag = 'div'; // bare #id → div
567
- return { tag, classes, id };
571
+ return { tag, classes, id, base: current };
568
572
  };
569
573
 
570
574
  // ==========================================================================
@@ -1061,7 +1065,7 @@ export function installComponentSupport(CodeGenerator, Lexer) {
1061
1065
  }
1062
1066
 
1063
1067
  // HTML tag (possibly with #id, e.g. div#content)
1064
- if (headStr && this.isHtmlTag(headStr)) {
1068
+ if (headStr && this.isHtmlTag(headStr) && !meta(head, 'text')) {
1065
1069
  let [tagName, id] = headStr.split('#');
1066
1070
  return this.generateTag(tagName || 'div', [], rest, id);
1067
1071
  }
@@ -1084,9 +1088,9 @@ export function installComponentSupport(CodeGenerator, Lexer) {
1084
1088
  return slotVar;
1085
1089
  }
1086
1090
 
1087
- // HTML tag with classes (div.class) and optional #id
1088
- const { tag, classes, id } = this.collectTemplateClasses(sexpr);
1089
- if (tag && this.isHtmlTag(tag)) {
1091
+ // HTML tag with classes (div.class) skip if base is marked .text by = prefix
1092
+ const { tag, classes, id, base } = this.collectTemplateClasses(sexpr);
1093
+ if (!meta(base, 'text') && tag && this.isHtmlTag(tag)) {
1090
1094
  return this.generateTag(tag, classes, [], id);
1091
1095
  }
1092
1096