rip-lang 2.9.1 → 2.9.2

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": "2.9.1",
3
+ "version": "2.9.2",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
@@ -4,7 +4,7 @@
4
4
 
5
5
  o = (pattern, action, options) ->
6
6
  pattern = pattern.trim().replace /\s{2,}/g, ' '
7
- [pattern, action ? 1, options]
7
+ [pattern, action ?? 1, options]
8
8
 
9
9
  mode = 'sexp'
10
10
 
@@ -105,7 +105,7 @@ class Generator
105
105
 
106
106
  dedent: (s, indent) ->
107
107
  m = s.match /^[ \t]+(?=\S)/gm
108
- i = Math.min ...(m ? []).map (x) => x.length
108
+ i = Math.min ...(m ?? []).map (x) => x.length
109
109
  s = s.replace(///^[ \t]{#{i}}///gm, '').trim()
110
110
  s = s.replace /^/gm, indent if indent
111
111
  s
package/src/lexer.js CHANGED
@@ -2062,7 +2062,6 @@ Rewriter = (function() {
2062
2062
  this.closeOpenCalls();
2063
2063
  this.closeOpenIndexes();
2064
2064
  this.normalizeLines();
2065
- this.convertLegacyExistential();
2066
2065
  this.convertPostfixSpreadRest();
2067
2066
  this.tagPostfixConditionals();
2068
2067
  this.addImplicitBracesAndParens();
@@ -3030,64 +3029,6 @@ Rewriter = (function() {
3030
3029
  });
3031
3030
  }
3032
3031
 
3033
- // =========================================================================
3034
- // BACKWARDS COMPATIBILITY / TRANSITION SUPPORT
3035
- // =========================================================================
3036
- // Convert legacy CoffeeScript existential operator syntax to Rip's nullish
3037
- // coalescing operator. In CoffeeScript, "SPACE?" (a question mark with a
3038
- // space before it, e.g., "x ? y") was used as an existential operator.
3039
- // Rip uses ES6's "??" for this purpose instead.
3040
- //
3041
- // This rewriter converts standalone "SPACE?" tokens (those NOT part of
3042
- // ternary expressions) into "??" operators to ease migration of old code.
3043
- //
3044
- // Examples:
3045
- // x ? y → x ?? y (legacy existential, converted)
3046
- // x ? y : z → x ? y : z (ternary, left unchanged)
3047
- //
3048
- // NOTE: This is for COMPATIBILITY and TRANSITION purposes only.
3049
- // New code should use "??" explicitly instead of relying on this conversion.
3050
- // =========================================================================
3051
- convertLegacyExistential() {
3052
- return this.scanTokens(function(token, i, tokens) {
3053
- var colonFound, j, nestLevel, ref, tag;
3054
- // Only process SPACE? tokens
3055
- if (token[0] !== 'SPACE?') {
3056
- return 1;
3057
- }
3058
- // Look ahead to determine if this is part of a ternary expression
3059
- // A ternary has the pattern: Expression SPACE? Expression : Expression
3060
- // If we find a ':' at the same nesting level, it's a ternary
3061
- colonFound = false;
3062
- nestLevel = 0;
3063
- for (j = i + 1; j < tokens.length; j++) {
3064
- tag = tokens[j][0];
3065
- // Track nesting level (parentheses, brackets, braces)
3066
- if (ref = tag, indexOf.call(EXPRESSION_START, ref) >= 0) {
3067
- nestLevel++;
3068
- } else if (ref = tag, indexOf.call(EXPRESSION_END, ref) >= 0) {
3069
- nestLevel--;
3070
- }
3071
- // Found colon at same level = it's a ternary operator
3072
- if (tag === ':' && nestLevel === 0) {
3073
- colonFound = true;
3074
- break;
3075
- }
3076
- // Hit statement boundary without finding colon = not a ternary
3077
- if (nestLevel === 0 && (tag === 'TERMINATOR' || tag === 'INDENT' || tag === 'OUTDENT')) {
3078
- break;
3079
- }
3080
- }
3081
- // No colon found = legacy existential operator, convert to ??
3082
- if (!colonFound) {
3083
- token[0] = '??';
3084
- token[1] = '??';
3085
- }
3086
- // Otherwise leave as SPACE? for ternary handling
3087
- return 1;
3088
- });
3089
- }
3090
-
3091
3032
  // =========================================================================
3092
3033
  // BACKWARDS COMPATIBILITY / TRANSITION SUPPORT
3093
3034
  // =========================================================================