New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.1.7 to 0.1.8

2

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

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

@@ -102,3 +102,3 @@ var Class = require('../util/Class');

}
//如果有未匹配的,说明规则不完整,加入other类型并抛出警告
//如果有未匹配的,说明规则不完整,抛出错误
this.error('unknow token');

@@ -105,0 +105,0 @@ }

@@ -54,4 +54,4 @@ var Rule = require('./Rule');

}).statics({
KEYWORDS: 'boolean break case catch class const continue debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw throws true try typeof var void while with'.split(' ')
KEYWORDS: 'boolean break case catch class const continue debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield'.split(' ')
});
module.exports = EcmascriptRule;

@@ -18,14 +18,29 @@ define(function(require, exports, module) {

if(this.begin == code.substr(--index, this.begin.length)) {
var i = code.indexOf(this.end, index + this.begin.length);
if(i == -1) {
if(this.contain) {
this.msg = 'SyntaxError: unterminated ' + Token.type(this.type).toLowerCase();
//支持多个end匹配时不支持包含选项
if(!this.contain && Array.isArray(this.end)) {
for(var j = 0, len = this.end.length; j < len; j++) {
var i = code.indexOf(this.end[j], index + this.begin.length);
if(i != -1) {
this.result = code.slice(index, i);
return true;
}
}
i = code.length;
//都不匹配时到末尾
this.result = code.slice(index);
return true;
}
else if(this.contain) {
i += this.end.length;
else {
var i = code.indexOf(this.end, index + this.begin.length);
if(i == -1) {
if(this.contain) {
this.msg = 'SyntaxError: unterminated ' + Token.type(this.type).toLowerCase();
}
i = code.length;
}
else if(this.contain) {
i += this.end.length;
}
this.result = code.slice(index, i);
return true;
}
this.result = code.slice(index, i);
return true;
}

@@ -32,0 +47,0 @@ return false;

@@ -17,6 +17,7 @@ define(function(require, exports, module) {

self.addMatch(new CompleteEqual(Token.TAB, character.TAB));
self.addMatch(new CompleteEqual(Token.ENTER, character.ENTER));
self.addMatch(new CompleteEqual(Token.LINE, character.ENTER + character.LINE));
self.addMatch(new CompleteEqual(Token.LINE, character.ENTER));
self.addMatch(new CompleteEqual(Token.LINE, character.LINE));
self.addMatch(new LineSearch(Token.COMMENT, '//', '\n'));
self.addMatch(new LineSearch(Token.COMMENT, '//', [character.ENTER + character.LINE, character.ENTER, character.LINE]));
self.addMatch(new LineSearch(Token.COMMENT, '/*', '*/', true));

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

['*=', '/=', '+=', '-=', '%=', '^=', '&=', '|=', '&&', '--', '++', '===', '==', '!==', '!=', '||', '>>>=', '<<<=', '<<<', '>>>', '>>=', '<<=', '<<', '>>', '>=', '<=', '...', '?:'].forEach(function(o) {
['*=', '/=', '+=', '-=', '%=', '^=', '&=', '|=', '&&', '--', '++', '===', '==', '!==', '!=', '||', '>>>=', '<<<=', '<<<', '>>>', '>>=', '<<=', '<<', '>>', '>=', '<=', '...', '?:', '=>'].forEach(function(o) {
self.addMatch(new CompleteEqual(Token.SIGN, o, Lexer.IS_REG));

@@ -52,7 +53,9 @@ });

self.addMatch(new CharacterSet(Token.BLANK, '\u00a0\f\u000b\u200b\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'));
self.addMatch(new CompleteEqual(Token.LINE, '\u2028'));
self.addMatch(new CompleteEqual(Token.LINE, '\u2029'));
self.addMatch(new CharacterSet(Token.BLANK, '\f\u000b\u00A0\uFEFF\u200b\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'));
}).statics({
KEYWORDS: 'abstract boolean break byte case catch class const continue debugger default delete do double else enum export extends false final finally float for function goto if implements import in instanceof int interface let long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with'.split(' ')
KEYWORDS: 'boolean break case catch class const continue debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw throws true try typeof var void while with'.split(' ')
});
module.exports = EcmascriptRule;
});

@@ -309,2 +309,5 @@ define(function(require, exports, module) {

}
else {
child.setThis(undefined);
}
}

@@ -348,7 +351,9 @@ }

child.setThis(params.leaves()[0]);
params.leaves()[2].leaves()[0].leaves().forEach(function(leaf, i) {
if(i % 2 == 1) {
child.addAParam(leaf);
}
});
if(params.leaves()[2]) {
params.leaves()[2].leaves()[0].leaves().forEach(function(leaf, i) {
if(i % 2 == 1) {
child.addAParam(leaf);
}
});
}
}

@@ -355,0 +360,0 @@ function prmrexpr(node, context) {

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