homunculus
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -2129,5 +2129,3 @@ (function(factory) { | ||
} | ||
if(this.look.content() != ')') { | ||
node.add(this.arglist()); | ||
} | ||
node.add(this.arglist()); | ||
node.add(this.match(')')); | ||
@@ -2134,0 +2132,0 @@ return node; |
@@ -11,2 +11,3 @@ (function(factory) { | ||
var character = require('../util/character'); | ||
var nid = 0; | ||
var Node = Class(function(type, children) { | ||
@@ -26,4 +27,8 @@ this.type = type; | ||
this.ne = null; | ||
this.id = nid++; | ||
return this; | ||
}).methods({ | ||
nid: function() { | ||
return this.id; | ||
}, | ||
name: function(t) { | ||
@@ -30,0 +35,0 @@ if(!character.isUndefined(t)) { |
{ | ||
"name": "homunculus", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "A lexer&parser by Javascript", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -14,3 +14,3 @@ # A lexer&parser by Javascript | ||
## 使用说明 | ||
* 解析语法并返回语法树和此法单元序列。、 | ||
* 解析语法并返回语法树和此法单元序列。 | ||
* CommonJS/AMD/CMD自适应。 | ||
@@ -17,0 +17,0 @@ |
@@ -2121,5 +2121,3 @@ var IParser = require('../Parser'); | ||
} | ||
if(this.look.content() != ')') { | ||
node.add(this.arglist()); | ||
} | ||
node.add(this.arglist()); | ||
node.add(this.match(')')); | ||
@@ -2126,0 +2124,0 @@ return node; |
var Class = require('../util/Class'); | ||
var character = require('../util/character'); | ||
var nid = 0; | ||
var Node = Class(function(type, children) { | ||
@@ -17,4 +18,8 @@ this.type = type; | ||
this.ne = null; | ||
this.id = nid++; | ||
return this; | ||
}).methods({ | ||
nid: function() { | ||
return this.id; | ||
}, | ||
name: function(t) { | ||
@@ -21,0 +26,0 @@ if(!character.isUndefined(t)) { |
@@ -998,3 +998,9 @@ var homunculus = require('../'); | ||
expect(varstmt.size()).to.be(3); | ||
expect(varstmt.leaves().length).to.be(3); | ||
}); | ||
it('node #nid', function() { | ||
var parser = homunculus.getParser('js'); | ||
var node = parser.parse('var a'); | ||
expect(node.nid()).to.be.a('number'); | ||
}); | ||
it('#ast should return as parse return', function() { | ||
@@ -1001,0 +1007,0 @@ var parser = homunculus.getParser('js'); |
Sorry, the diff of this file is too big to display
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
1287037
32964