homunculus
Advanced tools
Comparing version 1.3.1 to 1.3.2
{ | ||
"name": "homunculus", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "A lexer&parser by Javascript", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
var character = require('../util/character'); | ||
var JSXToken = require('./JSXToken'); | ||
var Lexer = require('./Lexer'); | ||
var EcmascriptLexer = require('./EcmascriptLexer'); | ||
@@ -45,7 +45,7 @@ var RegMatch = require('./match/RegMatch'); | ||
var JSXLexer = Lexer.extend(function(rule) { | ||
Lexer.call(this, rule); | ||
var JSXLexer = EcmascriptLexer.extend(function(rule) { | ||
EcmascriptLexer.call(this, rule); | ||
}).methods({ | ||
init: function() { | ||
Lexer.prototype.init.call(this); | ||
EcmascriptLexer.prototype.init.call(this); | ||
this.html = false; //目前是否为解析html状态 | ||
@@ -232,2 +232,11 @@ this.state = false; //是否在<>中 | ||
} | ||
//template特殊语法 | ||
else if(this.peek == character.GRAVE) { | ||
this.dealGrave(temp, length); | ||
this.isReg = EcmascriptLexer.NOT_REG; | ||
} | ||
//递归解析template中的expr时结束跳出 | ||
else if(this.inTemplate && this.peek == '}') { | ||
return this; | ||
} | ||
//依次遍历匹配规则,命中则继续 | ||
@@ -264,3 +273,3 @@ else { | ||
//支持perl正则需判断关键字、圆括号对除号语义的影响 | ||
if(perlReg && match.perlReg() != Lexer.IGNORE) { | ||
if(perlReg && match.perlReg() != EcmascriptLexer.IGNORE) { | ||
this.stateReg(match); | ||
@@ -267,0 +276,0 @@ } |
define(function(require, exports, module) {var character = require('../util/character'); | ||
var JSXToken = require('./JSXToken'); | ||
var Lexer = require('./Lexer'); | ||
var EcmascriptLexer = require('./EcmascriptLexer'); | ||
@@ -45,7 +45,7 @@ var RegMatch = require('./match/RegMatch'); | ||
var JSXLexer = Lexer.extend(function(rule) { | ||
Lexer.call(this, rule); | ||
var JSXLexer = EcmascriptLexer.extend(function(rule) { | ||
EcmascriptLexer.call(this, rule); | ||
}).methods({ | ||
init: function() { | ||
Lexer.prototype.init.call(this); | ||
EcmascriptLexer.prototype.init.call(this); | ||
this.html = false; //目前是否为解析html状态 | ||
@@ -232,2 +232,11 @@ this.state = false; //是否在<>中 | ||
} | ||
//template特殊语法 | ||
else if(this.peek == character.GRAVE) { | ||
this.dealGrave(temp, length); | ||
this.isReg = EcmascriptLexer.NOT_REG; | ||
} | ||
//递归解析template中的expr时结束跳出 | ||
else if(this.inTemplate && this.peek == '}') { | ||
return this; | ||
} | ||
//依次遍历匹配规则,命中则继续 | ||
@@ -264,3 +273,3 @@ else { | ||
//支持perl正则需判断关键字、圆括号对除号语义的影响 | ||
if(perlReg && match.perlReg() != Lexer.IGNORE) { | ||
if(perlReg && match.perlReg() != EcmascriptLexer.IGNORE) { | ||
this.stateReg(match); | ||
@@ -267,0 +276,0 @@ } |
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
20063
661995
89