Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

homunculus

Package Overview
Dependencies
Maintainers
2
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homunculus - npm Package Compare versions

Comparing version 0.6.6 to 0.6.7

2

package.json
{
"name": "homunculus",
"version": "0.6.6",
"version": "0.6.7",
"description": "A lexer&parser by Javascript",

@@ -5,0 +5,0 @@ "maintainers": [

@@ -72,4 +72,9 @@ var Class = require('../util/Class');

if(match.callback) {
match.callback(token);
match.callback.call(match, token, this.tokenList);
}
//回调特殊处理忽略掉此次匹配
if(match.cancel) {
token.cancel();
continue;
}

@@ -76,0 +81,0 @@ if(this.last) {

@@ -22,2 +22,17 @@ var Rule = require('./Rule');

self.addMatch(new LineSearch(Token.COMMENT, '//', [character.ENTER + character.LINE, character.ENTER, character.LINE]));
self.addMatch(new LineSearch(Token.COMMENT, '<!--', [character.ENTER + character.LINE, character.ENTER, character.LINE]));
var htmlEndComment = new LineSearch(Token.COMMENT, '-->', [character.ENTER + character.LINE, character.ENTER, character.LINE]);
htmlEndComment.callback = function(token, tokenList) {
for(var i = tokenList.length - 1; i >= 0; i--) {
var t = tokenList[i];
if([Token.LINE, Token.ENTER].indexOf(t.type()) > -1) {
return;
}
else if([Token.COMMENT, Token.BLANK, Token.TAB].indexOf(t.type()) == -1) {
this.cancel = true;
return;
}
}
};
self.addMatch(htmlEndComment);
self.addMatch(new LineSearch(Token.COMMENT, '/*', '*/', true));

@@ -24,0 +39,0 @@ self.addMatch(new LineParse(Token.STRING, '"', '"', false, Lexer.IS_REG));

@@ -72,4 +72,9 @@ define(function(require, exports, module) {var Class = require('../util/Class');

if(match.callback) {
match.callback(token);
match.callback.call(match, token, this.tokenList);
}
//回调特殊处理忽略掉此次匹配
if(match.cancel) {
token.cancel();
continue;
}

@@ -76,0 +81,0 @@ if(this.last) {

@@ -22,2 +22,17 @@ define(function(require, exports, module) {var Rule = require('./Rule');

self.addMatch(new LineSearch(Token.COMMENT, '//', [character.ENTER + character.LINE, character.ENTER, character.LINE]));
self.addMatch(new LineSearch(Token.COMMENT, '<!--', [character.ENTER + character.LINE, character.ENTER, character.LINE]));
var htmlEndComment = new LineSearch(Token.COMMENT, '-->', [character.ENTER + character.LINE, character.ENTER, character.LINE]);
htmlEndComment.callback = function(token, tokenList) {
for(var i = tokenList.length - 1; i >= 0; i--) {
var t = tokenList[i];
if([Token.LINE, Token.ENTER].indexOf(t.type()) > -1) {
return;
}
else if([Token.COMMENT, Token.BLANK, Token.TAB].indexOf(t.type()) == -1) {
this.cancel = true;
return;
}
}
};
self.addMatch(htmlEndComment);
self.addMatch(new LineSearch(Token.COMMENT, '/*', '*/', true));

@@ -24,0 +39,0 @@ self.addMatch(new LineParse(Token.STRING, '"', '"', false, Lexer.IS_REG));

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc