rip-lang 3.13.18 → 3.13.21

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.18",
3
+ "version": "3.13.21",
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
@@ -397,7 +397,7 @@ export function installComponentSupport(CodeGenerator, Lexer) {
397
397
  // ─────────────────────────────────────────────────────────────────────
398
398
  // Implicit nesting (inject -> before INDENT)
399
399
  // ─────────────────────────────────────────────────────────────────────
400
- if (nextToken && nextToken[0] === 'INDENT') {
400
+ if (nextToken && nextToken[0] === 'INDENT' && !nextToken.fromThen) {
401
401
  if (tag === '->' || tag === '=>' || tag === 'CALL_START' || tag === '(') {
402
402
  return 1;
403
403
  }
@@ -427,7 +427,7 @@ export function installComponentSupport(CodeGenerator, Lexer) {
427
427
  isTemplateElement = true;
428
428
  } else if (tag === 'IDENTIFIER' && isTemplateTag(token[1]) && !isAfterControlFlow) {
429
429
  isTemplateElement = true;
430
- } else if (tag === 'PROPERTY' || tag === 'STRING' || tag === 'STRING_END' || tag === 'CALL_END' || tag === ')') {
430
+ } else if (tag === 'PROPERTY' || tag === 'STRING' || tag === 'STRING_END' || tag === 'IDENTIFIER' || tag === 'NUMBER' || tag === 'BOOL' || tag === 'CALL_END' || tag === ')') {
431
431
  isTemplateElement = startsWithTag(tokens, i);
432
432
  }
433
433
  else if (tag === 'IDENTIFIER' && i > 1 && tokens[i - 1][0] === '...') {
@@ -565,6 +565,7 @@ grammar =
565
565
  o 'Statement POST_IF Expression' , '["if", 3, [1]]'
566
566
  o 'Expression POST_IF Expression' , '["if", 3, [1]]'
567
567
  o 'Expression POST_IF Expression ELSE INDENT Expression OUTDENT', '["?:", 3, 1, 6]'
568
+ o 'Expression POST_IF Expression ELSE Expression', '["?:", 3, 1, 5]'
568
569
  o 'Statement POST_UNLESS Expression' , '["if", ["!", 3], [1]]'
569
570
  o 'Expression POST_UNLESS Expression', '["if", ["!", 3], [1]]'
570
571
  ]
package/src/lexer.js CHANGED
@@ -1393,7 +1393,8 @@ export class Lexer {
1393
1393
  }
1394
1394
 
1395
1395
  if (SINGLE_LINERS.has(tag) && this.tokens[i + 1]?.[0] !== 'INDENT' &&
1396
- !(tag === 'ELSE' && this.tokens[i + 1]?.[0] === 'IF')) {
1396
+ !(tag === 'ELSE' && this.tokens[i + 1]?.[0] === 'IF') &&
1397
+ !(tag === 'ELSE' && this.tokens[i - 1]?.[0] !== 'OUTDENT')) {
1397
1398
  starter = tag;
1398
1399
  [indent, outdent] = this.makeIndentation();
1399
1400
  if (tag === 'THEN') indent.fromThen = true;
@@ -1423,6 +1424,7 @@ export class Lexer {
1423
1424
 
1424
1425
  this.scanTokens((token, i) => {
1425
1426
  if (token[0] !== 'IF' && token[0] !== 'UNLESS') return 1;
1427
+ if (this.tokens[i - 1]?.[0] === 'INTERPOLATION_START') return 1;
1426
1428
  original = token;
1427
1429
  this.detectEnd(i + 1, condition, action);
1428
1430
  return 1;