From bb0a91b6874ef808e288692b49bd223df9ad8bd7 Mon Sep 17 00:00:00 2001 From: nisstyre56 Date: Fri, 28 Mar 2014 17:01:32 -0400 Subject: [PATCH] tweaks for identifier generation --- test.js | 17 ++++++++++++----- tokenize.js | 4 +++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/test.js b/test.js index 63c4e41..3507792 100755 --- a/test.js +++ b/test.js @@ -35,15 +35,22 @@ function arbChar(max, min) { function arbCharRanges(ranges, max) { return function() { return _.flatten( - _.map(ranges, + _.shuffle( + _.map(ranges, function(bound) { - return arbChars(max, bound[0], bound[1])(); - })).join(""); + return _.sample(arbChars(max, bound[0], bound[1])(), + bound[1] - bound[0]); + }))).join(""); }; } - +var arbName = arbCharRanges([[33, 33], + [35, 39], + [42,43], + [45, 122], + [124, 126]], + 200); var arbCapital = arbChar(65, 90); @@ -138,5 +145,5 @@ function toolsTests() { //assert.equal(true, qc.forAll(opMatchProp, arbStrings)); } - +console.log(arbName()); //toolsTests(); diff --git a/tokenize.js b/tokenize.js index 744d71f..3789446 100755 --- a/tokenize.js +++ b/tokenize.js @@ -43,7 +43,9 @@ function isIdentifier(c) { code !== 123 && code !== 93 && code !== 91 && - code !== 44); + code !== 44 && + code !== 34 && + code > 32); } function isUpper(c) {