homunculus
Advanced tools
Comparing version 0.0.17 to 0.0.18
{ | ||
"name": "homunculus", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "A lexer&parser by Javascript", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -143,9 +143,10 @@ var Class = require('../../util/Class'); | ||
}, | ||
getVid: function(v) { | ||
return this.vidsMap[v]; | ||
}, | ||
addVid: function(node) { | ||
var v = node.token().content(); | ||
if(this.vidsMap.hasOwnProperty(v)) { | ||
return; | ||
} | ||
this.vids.push(node); | ||
this.vidsMap[v] = node; | ||
this.vidsMap[v] = this.vidsMap[v] || []; | ||
this.vidsMap[v].push(node); | ||
return this; | ||
@@ -152,0 +153,0 @@ }, |
@@ -120,2 +120,7 @@ var homunculus = require('../homunculus'); | ||
}); | ||
it('#getVid', function() { | ||
var context = homunculus.getContext('js'); | ||
context.parse('a = 1'); | ||
expect(context.getVid('a')[0]).to.be(context.getVids()[0]); | ||
}); | ||
it('return 1', function() { | ||
@@ -173,5 +178,5 @@ var context = homunculus.getContext('js'); | ||
context.parse('a.b = 1;a = 2;'); | ||
expect(context.getVids().length).to.be(1); | ||
expect(context.getVids().length).to.be(2); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1340183
25472