Skip to content

Commit

Permalink
fix to backrefs
Browse files Browse the repository at this point in the history
  • Loading branch information
dhowe committed Jan 24, 2024
1 parent e8d83bb commit bf42b4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { RiScriptVisitor } from './visitor.js' // 12/13/2023
*/
class RiGrammar {

static RiScript = null; // assigned in riscript.js

/**
* Creates an instance of RiGrammar.
* @param {Object<string, string>|string} [rules] - an object (or JSON string) containing the rules
Expand Down Expand Up @@ -266,6 +268,4 @@ function parseJSON(json) {
}
}

RiGrammar.RiScript = RiScript; // backref for version

export { RiGrammar };
17 changes: 3 additions & 14 deletions src/riscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,21 +574,10 @@ class RiScript {
}
}

// let _randi = (a,b) => {
// let crand = Math.random();
// if (typeof a === ' ') return crand;
// if (Array.isArray(arguments[0])) {
// let arr = arguments[0];
// return arr[Math.floor(crand * arr.length)];
// }
// return arguments.length === 1 ? crand * arguments[0] :
// crand * (arguments[1] - arguments[0]) + arguments[0];
// }

// Class ref hack for testing
RiGrammar.RiScript = RiGrammar; // backref

// Class ref hacks for testing
RiScript.Visitor = RiScriptVisitor;
RiScript.Util = Util;
// RiScript.Grammar = RiGrammar;


export { RiScript };

0 comments on commit bf42b4c

Please sign in to comment.