rip-lang 1.5.2 → 1.5.3
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/CHANGELOG.md +14 -0
- package/README.md +2 -2
- package/docs/dist/rip.browser.js +1 -1
- package/docs/dist/rip.browser.min.js +1 -1
- package/docs/dist/rip.browser.min.js.br +0 -0
- package/docs/repl.html +22 -2
- package/package.json +1 -1
- package/src/grammar/solar.rip +2 -3
- package/src/parser.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ All notable changes to Rip will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.5.3] - 2025-11-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Keyboard shortcuts for Run button in browser REPL** (repl.html)
|
|
12
|
+
- **F5** - Execute code (all platforms)
|
|
13
|
+
- **Cmd+Enter** - Execute code (Mac)
|
|
14
|
+
- **Ctrl+Enter** - Execute code (Windows/Linux)
|
|
15
|
+
- Refactored Run button handler into reusable `runCode()` function
|
|
16
|
+
- Added global keyboard event listener with preventDefault to avoid conflicts
|
|
17
|
+
- Updated Run button tooltip to show available shortcuts
|
|
18
|
+
- Improves workflow for quick code execution without mouse clicks
|
|
19
|
+
|
|
20
|
+
All 962 tests passing (100%) ✅
|
|
21
|
+
|
|
8
22
|
## [1.5.2] - 2025-11-09
|
|
9
23
|
|
|
10
24
|
### Fixed
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-1.5.
|
|
12
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-1.5.3-blue.svg" alt="Version"></a>
|
|
13
13
|
<a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
|
|
14
14
|
<a href="#status"><img src="https://img.shields.io/badge/tests-962%2F962-brightgreen.svg" alt="Tests"></a>
|
|
15
15
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
|
|
@@ -32,7 +32,7 @@ A clean-room **CoffeeScript-inspired compiler** that produces modern JavaScript
|
|
|
32
32
|
|
|
33
33
|
## Status
|
|
34
34
|
|
|
35
|
-
**Version 1.5.
|
|
35
|
+
**Version 1.5.3** - **PRODUCTION READY** 🚀
|
|
36
36
|
|
|
37
37
|
**Quality metrics:**
|
|
38
38
|
- ✅ **962/962 tests passing** (100% coverage)
|
package/docs/dist/rip.browser.js
CHANGED
|
@@ -7079,7 +7079,7 @@ function compileToJS(source, options = {}) {
|
|
|
7079
7079
|
}
|
|
7080
7080
|
// src/browser.js
|
|
7081
7081
|
var VERSION = "1.5.2";
|
|
7082
|
-
var BUILD_DATE = "2025-11-09@
|
|
7082
|
+
var BUILD_DATE = "2025-11-09@09:58:56GMT";
|
|
7083
7083
|
var dedent = (s) => {
|
|
7084
7084
|
const m = s.match(/^[ \t]*(?=\S)/gm);
|
|
7085
7085
|
const i = Math.min(...(m || []).map((x) => x.length));
|
|
@@ -260,4 +260,4 @@ ${this.indent()}}`}return`{ if (${this.generate(_,"value")}) ${this.generate(Y,"
|
|
|
260
260
|
`:"",Y=X.slice(0,M).join(`
|
|
261
261
|
`)}let U=new k1().tokenize(Y);if(this.options.showTokens)U.forEach((D)=>{console.log(`${D[0].padEnd(12)} ${JSON.stringify(D[1])}`)}),console.log();_1.lexer={tokens:U,pos:0,setInput:function(D,G){},lex:function(){if(this.pos>=this.tokens.length)return 1;let D=this.tokens[this.pos++];return this.yytext=D[1],this.yylloc=D[2],D[0]}};let R;try{R=_1.parse(Y)}catch(D){if(/\?\s*\([^)]*\?[^)]*:[^)]*\)\s*:/.test(Y)||/\?\s+\w+\s+\?\s+/.test(Y))throw Error(`Nested ternary operators are not supported. Use if/else statements instead:
|
|
262
262
|
Instead of: x ? (y ? a : b) : c
|
|
263
|
-
Use: if x then (if y then a else b) else c`);throw D}if(this.options.showSExpr)console.log(a(R,0,!0)),console.log();let A=new k({dataSection:_}).compile(R);return{tokens:U,sexpr:R,code:A,data:_}}compileToJS(Y){return this.compile(Y).code}compileToSExpr(Y){return this.compile(Y).sexpr}}function o2(Y,_={}){return new N1(_).compile(Y)}function q1(Y,_={}){return new N1(_).compileToJS(Y)}var D3="1.5.2",G3="2025-11-09@
|
|
263
|
+
Use: if x then (if y then a else b) else c`);throw D}if(this.options.showSExpr)console.log(a(R,0,!0)),console.log();let A=new k({dataSection:_}).compile(R);return{tokens:U,sexpr:R,code:A,data:_}}compileToJS(Y){return this.compile(Y).code}compileToSExpr(Y){return this.compile(Y).sexpr}}function o2(Y,_={}){return new N1(_).compile(Y)}function q1(Y,_={}){return new N1(_).compileToJS(Y)}var D3="1.5.2",G3="2025-11-09@09:58:56GMT",t2=(Y)=>{let _=Y.match(/^[ \t]*(?=\S)/gm),X=Math.min(...(_||[]).map((M)=>M.length));return Y.replace(RegExp(`^[ ]{${X}}`,"gm"),"").trim()};async function C2(){let Y=document.querySelectorAll('script[type="text/rip"]');for(let _ of Y){if(_.hasAttribute("data-rip-processed"))continue;try{let X=t2(_.textContent),M=q1(X);(0,eval)(M),_.setAttribute("data-rip-processed","true")}catch(X){console.error("Error compiling Rip script:",X),console.error("Script content:",_.textContent)}}}if(typeof document<"u")if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",C2);else C2();function e2(Y){try{let X=q1(Y).replace(/^let\s+[^;]+;\s*\n\s*/m,"");X=X.replace(/^const\s+/gm,"var ");let M=(0,eval)(X);if(M!==void 0)globalThis._=M;return M}catch(_){console.error("Rip compilation error:",_.message);return}}if(typeof globalThis<"u")globalThis.rip=e2;export{e2 as rip,C2 as processRipScripts,_1 as parser,a as formatSExpr,q1 as compileToJS,o2 as compile,D3 as VERSION,k1 as Lexer,N1 as Compiler,k as CodeGenerator,G3 as BUILD_DATE};
|
|
Binary file
|
package/docs/repl.html
CHANGED
|
@@ -380,7 +380,7 @@
|
|
|
380
380
|
<span>Rip Source</span>
|
|
381
381
|
<div class="pane-header-buttons">
|
|
382
382
|
<button id="clear-btn" title="Clear the editor">Clear</button>
|
|
383
|
-
<button class="active" id="run-btn" title="Execute code and output to browser console">Run</button>
|
|
383
|
+
<button class="active" id="run-btn" title="Execute code and output to browser console (F5, Cmd+Enter, Ctrl+Enter)">Run</button>
|
|
384
384
|
</div>
|
|
385
385
|
</div>
|
|
386
386
|
<textarea class="editor" id="editor" spellcheck="false"># Rip code - edit me!
|
|
@@ -818,7 +818,7 @@ console.log "Domain:", domain</textarea>
|
|
|
818
818
|
});
|
|
819
819
|
|
|
820
820
|
// Run button - executes the Rip code and outputs to console
|
|
821
|
-
|
|
821
|
+
function runCode() {
|
|
822
822
|
try {
|
|
823
823
|
const source = editor.value;
|
|
824
824
|
const result = compile(source);
|
|
@@ -832,6 +832,26 @@ console.log "Domain:", domain</textarea>
|
|
|
832
832
|
} catch (error) {
|
|
833
833
|
console.error('Execution Error:', error);
|
|
834
834
|
}
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
document.getElementById('run-btn').addEventListener('click', runCode);
|
|
838
|
+
|
|
839
|
+
// Keyboard shortcuts for Run button
|
|
840
|
+
// F5, Cmd+Enter (Mac), Ctrl+Enter (Windows/Linux)
|
|
841
|
+
document.addEventListener('keydown', (e) => {
|
|
842
|
+
// F5 - Run code
|
|
843
|
+
if (e.key === 'F5') {
|
|
844
|
+
e.preventDefault();
|
|
845
|
+
runCode();
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// Cmd+Enter (Mac) or Ctrl+Enter (Windows/Linux) - Run code
|
|
850
|
+
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
|
851
|
+
e.preventDefault();
|
|
852
|
+
runCode();
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
835
855
|
});
|
|
836
856
|
|
|
837
857
|
// Initial compile
|
package/package.json
CHANGED
package/src/grammar/solar.rip
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
# readability, efficiency, and maintainability.
|
|
8
8
|
#
|
|
9
9
|
# Author: Steve Shreeve <steve.shreeve@gmail.com>
|
|
10
|
-
# Date: November
|
|
10
|
+
# Date: November 9, 2025
|
|
11
11
|
# ==============================================================================
|
|
12
12
|
|
|
13
13
|
import * as fs from 'fs'
|
|
14
14
|
import * as path from 'path'
|
|
15
15
|
import { fileURLToPath, pathToFileURL } from 'url'
|
|
16
16
|
|
|
17
|
-
VERSION = '1.
|
|
17
|
+
VERSION = '1.4.0'
|
|
18
18
|
|
|
19
19
|
# Token: A terminal symbol that cannot be broken down further
|
|
20
20
|
class Token
|
|
@@ -865,7 +865,6 @@ if isRunAsScript
|
|
|
865
865
|
do ->
|
|
866
866
|
showVersion = ->
|
|
867
867
|
console.log """
|
|
868
|
-
|
|
869
868
|
Solar #{VERSION} - SLR(1) Parser Generator
|
|
870
869
|
"""
|
|
871
870
|
|
package/src/parser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ES6 Parser generated by Solar 1.
|
|
1
|
+
// ES6 Parser generated by Solar 1.4.0
|
|
2
2
|
|
|
3
3
|
const parserInstance = {
|
|
4
4
|
symbolIds: {"$accept":0,"$end":1,"error":2,"Root":3,"Body":4,"Line":5,"TERMINATOR":6,"Expression":7,"ExpressionLine":8,"Statement":9,"Return":10,"STATEMENT":11,"Import":12,"Export":13,"Value":14,"Code":15,"Operation":16,"Assign":17,"If":18,"Try":19,"While":20,"For":21,"Switch":22,"Class":23,"Throw":24,"Yield":25,"Def":26,"DEF":27,"Identifier":28,"CALL_START":29,"ParamList":30,"CALL_END":31,"Block":32,"CodeLine":33,"OperationLine":34,"YIELD":35,"INDENT":36,"Object":37,"OUTDENT":38,"FROM":39,"IDENTIFIER":40,"Property":41,"PROPERTY":42,"AlphaNumeric":43,"NUMBER":44,"String":45,"STRING":46,"STRING_START":47,"Interpolations":48,"STRING_END":49,"InterpolationChunk":50,"INTERPOLATION_START":51,"INTERPOLATION_END":52,"Regex":53,"REGEX":54,"REGEX_START":55,"Invocation":56,"REGEX_END":57,"RegexWithIndex":58,",":59,"Literal":60,"JS":61,"UNDEFINED":62,"NULL":63,"BOOL":64,"INFINITY":65,"NAN":66,"Assignable":67,"=":68,"AssignObj":69,"ObjAssignable":70,"ObjRestValue":71,":":72,"SimpleObjAssignable":73,"ThisProperty":74,"[":75,"]":76,"@":77,"...":78,"ObjSpreadExpr":79,"Parenthetical":80,"Super":81,"This":82,"SUPER":83,"OptFuncExist":84,"Arguments":85,"DYNAMIC_IMPORT":86,".":87,"?.":88,"::":89,"?::":90,"INDEX_START":91,"INDEX_END":92,"INDEX_SOAK":93,"RETURN":94,"PARAM_START":95,"PARAM_END":96,"FuncGlyph":97,"->":98,"=>":99,"OptComma":100,"Param":101,"ParamVar":102,"Array":103,"Splat":104,"SimpleAssignable":105,"Slice":106,"ES6_OPTIONAL_INDEX":107,"Range":108,"DoIife":109,"MetaProperty":110,"NEW_TARGET":111,"IMPORT_META":112,"{":113,"FOR":114,"ForVariables":115,"FOROF":116,"}":117,"WHEN":118,"OWN":119,"AssignList":120,"CLASS":121,"EXTENDS":122,"IMPORT":123,"ImportDefaultSpecifier":124,"ImportNamespaceSpecifier":125,"ImportSpecifierList":126,"ImportSpecifier":127,"AS":128,"DEFAULT":129,"IMPORT_ALL":130,"EXPORT":131,"ExportSpecifierList":132,"EXPORT_ALL":133,"ExportSpecifier":134,"ES6_OPTIONAL_CALL":135,"FUNC_EXIST":136,"ArgList":137,"THIS":138,"Elisions":139,"ArgElisionList":140,"OptElisions":141,"RangeDots":142,"..":143,"Arg":144,"ArgElision":145,"Elision":146,"SimpleArgs":147,"TRY":148,"Catch":149,"FINALLY":150,"CATCH":151,"THROW":152,"(":153,")":154,"WhileSource":155,"WHILE":156,"UNTIL":157,"Loop":158,"LOOP":159,"FORIN":160,"BY":161,"FORFROM":162,"AWAIT":163,"ForValue":164,"ForVar":165,"SWITCH":166,"Whens":167,"ELSE":168,"When":169,"LEADING_WHEN":170,"IfBlock":171,"IF":172,"UnlessBlock":173,"UNLESS":174,"POST_IF":175,"POST_UNLESS":176,"UNARY":177,"DO":178,"DO_IIFE":179,"UNARY_MATH":180,"-":181,"+":182,"--":183,"++":184,"?":185,"MATH":186,"**":187,"SHIFT":188,"COMPARE":189,"&":190,"^":191,"|":192,"&&":193,"||":194,"??":195,"!?":196,"RELATION":197,"SPACE?":198,"COMPOUND_ASSIGN":199},
|