js2 0.3.19 → 0.3.20

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.
Files changed (4) hide show
  1. data/CHANGELOG +3 -0
  2. data/lib/js2/browser.js +1 -1
  3. data/lib/js2/js2.js +14 -3
  4. metadata +4 -4
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 0.3.20
2
+ * SYNTAX: fixed keyword "module" to only be triggered in proper context.
3
+
1
4
  0.3.19
2
5
  * SYNTAX: added private closure block support "private { var foo = 'bar' }" within classes
3
6
 
data/lib/js2/browser.js CHANGED
@@ -19,7 +19,7 @@ function mainFunction (arg) {
19
19
 
20
20
  var JS2 = root.JS2 = mainFunction;
21
21
  var js2 = root.js2 = JS2;
22
- js2.VERSION = "0.3.19";
22
+ js2.VERSION = "0.3.20";
23
23
 
24
24
  JS2.ROOT = JS2;
25
25
 
data/lib/js2/js2.js CHANGED
@@ -14,7 +14,7 @@ function mainFunction (arg) {
14
14
 
15
15
  var JS2 = root.JS2 = mainFunction;
16
16
  var js2 = root.js2 = JS2;
17
- js2.VERSION = "0.3.19";
17
+ js2.VERSION = "0.3.20";
18
18
 
19
19
  JS2.ROOT = JS2;
20
20
 
@@ -242,6 +242,17 @@ function mainFunction (arg) {
242
242
  return true;
243
243
  }
244
244
 
245
+ // module hack
246
+ if (m[0] == 'module') {
247
+ if (this.tokens.match(/^module\s+\w/)) {
248
+ this.tokens.push([ '{module}', this.IDS.MODULE ]);
249
+ } else {
250
+ this.tokens.push([ 'module', this.IDS.IDENT ]);
251
+ }
252
+ this.tokens.chomp(6);
253
+ return true;
254
+ }
255
+
245
256
  for (var i=0,tokenDef;tokenDef=this.TOKENS[i];i++) {
246
257
  if (m[0] == m[i+2]) {
247
258
  var klass = JS2.Lexer[tokenDef[0]];
@@ -601,7 +612,7 @@ function mainFunction (arg) {
601
612
  }
602
613
  };
603
614
 
604
- var KEYWORDS = { 'var': null, 'class': null, 'function': null, 'in': null, 'with': null, 'curry': null, 'static': null, 'module':null, 'private':null };
615
+ var KEYWORDS = { 'var': null, 'class': null, 'function': null, 'in': null, 'with': null, 'curry': null, 'static': null, '{module}':null, 'private':null };
605
616
  var IDS = JS2.Lexer.IDS;
606
617
  IDS['NODE'] = -1;
607
618
 
@@ -758,7 +769,7 @@ function mainFunction (arg) {
758
769
  var Module = Klass.extend({
759
770
  name: 'Module',
760
771
  toString: function() {
761
- var v = this.validate(/(module)(\s+)/);
772
+ var v = this.validate(/(\{module\})(\s+)/);
762
773
  var last = v.last;
763
774
  var m = last.match(/^([\w$]+(\.[\w$]+)*)/);
764
775
  if (m) {
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: js2
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.19
5
+ version: 0.3.20
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeff Su
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-02 00:00:00 +08:00
13
+ date: 2011-07-14 00:00:00 +08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -36,11 +36,11 @@ extra_rdoc_files: []
36
36
  files:
37
37
  - bin/js2
38
38
  - bin/js2-ruby
39
+ - lib/js2.rb
39
40
  - lib/js2/command.rb
40
- - lib/js2/context.rb
41
41
  - lib/js2/fs.rb
42
42
  - lib/js2/rack.rb
43
- - lib/js2.rb
43
+ - lib/js2/context.rb
44
44
  - lib/js2/browser.js
45
45
  - lib/js2/js2.js
46
46
  - CHANGELOG