homunculus
Advanced tools
Comparing version 0.8.5 to 0.8.6
{ | ||
"name": "homunculus", | ||
"version": "0.8.5", | ||
"version": "0.8.6", | ||
"description": "A lexer&parser by Javascript", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -464,3 +464,3 @@ var Lexer = require('./Lexer'); | ||
case '~': | ||
if(!this.value) { | ||
if(!this.value && ['"', "'"].indexOf(this.code.charAt(this.index)) == -1) { | ||
token.type(Token.HACK); | ||
@@ -467,0 +467,0 @@ } |
@@ -595,3 +595,3 @@ var IParser = require('../Parser'); | ||
else { | ||
node.add(this.match([Token.SELECTOR, Token.PSEUDO, Token.HACK])); | ||
node.add(this.match([Token.SELECTOR, Token.PSEUDO, Token.HACK, Token.VARS])); | ||
} | ||
@@ -607,3 +607,3 @@ while(this.look && [',', ';', '{', '}'].indexOf(this.look.content()) == -1) { | ||
else { | ||
node.add(this.match([Token.SELECTOR, Token.PSEUDO, Token.SIGN, Token.HACK])); | ||
node.add(this.match([Token.SELECTOR, Token.PSEUDO, Token.SIGN, Token.HACK, Token.VARS])); | ||
} | ||
@@ -610,0 +610,0 @@ } |
@@ -38,2 +38,3 @@ define(function(require, exports, module) {var Lexer = require('./Lexer'); | ||
var count = 0; | ||
this.colNum = length ? 1 : 0; | ||
outer: | ||
@@ -464,3 +465,3 @@ while(this.index < length) { | ||
case '~': | ||
if(!this.value) { | ||
if(!this.value && ['"', "'"].indexOf(this.code.charAt(this.index)) == -1) { | ||
token.type(Token.HACK); | ||
@@ -524,2 +525,4 @@ } | ||
this.index += matchLen - 1; | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
var n = character.count(token.val(), character.LINE); | ||
@@ -561,3 +564,7 @@ count += n; | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
this.index = j; | ||
this.colNum += this.index - s.length; | ||
this.colMax = Math.max(this.colMax, this.colNum); | ||
} | ||
@@ -573,2 +580,4 @@ return this; | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
this.index = this.code.length; | ||
@@ -605,2 +614,4 @@ var n = character.count(token.val(), character.LINE); | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
this.index += s.length - 1; | ||
@@ -607,0 +618,0 @@ this.parenthese = false; |
@@ -40,2 +40,3 @@ define(function(require, exports, module) {var Class = require('../util/Class'); | ||
var count = 0; | ||
this.colNum = length ? 1 : 0; | ||
outer: | ||
@@ -54,3 +55,7 @@ while(this.index < length) { | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
this.index2 = ++this.index; | ||
this.colNum += 2; | ||
this.colMax = Math.max(this.colMax, this.colNum); | ||
continue; | ||
@@ -67,3 +72,7 @@ } | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
this.index2 = this.index; | ||
this.colNum++; | ||
this.colMax = Math.max(this.colMax, this.colNum); | ||
continue; | ||
@@ -98,2 +107,4 @@ } | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
this.index2 = this.index += matchLen - 1; | ||
@@ -152,2 +163,4 @@ var n = character.count(token.val(), character.LINE); | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
this.index2 = this.index = end; | ||
@@ -166,2 +179,4 @@ } | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
this.index2 = this.index = idx + 2; | ||
@@ -185,2 +200,4 @@ } | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
this.index2 = this.index = idx + 1; | ||
@@ -214,2 +231,16 @@ } | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
var n = character.count(token.val(), character.LINE); | ||
this.totalLine += n; | ||
if(n) { | ||
var j = s.indexOf(character.LINE); | ||
var k = s.lastIndexOf(character.LINE); | ||
this.colMax = Math.max(this.colMax, this.colNum + j); | ||
this.colNum = s.length - k; | ||
} | ||
else { | ||
this.colNum += s.length; | ||
} | ||
this.colMax = Math.max(this.colMax, this.colNum); | ||
}, | ||
@@ -216,0 +247,0 @@ readch: function() { |
@@ -44,2 +44,3 @@ define(function(require, exports, module) {var Class = require('../util/Class'); | ||
var count = 0; | ||
this.colNum = length ? 1 : 0; | ||
outer: | ||
@@ -93,2 +94,4 @@ while(this.index < length) { | ||
this.index += matchLen - 1; | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
var n = character.count(token.val(), character.LINE); | ||
@@ -208,2 +211,4 @@ count += n; | ||
this.tokenList.push(token); | ||
token.line(this.totalLine); | ||
token.col(this.colNum); | ||
this.colNum += this.index - lastIndex; | ||
@@ -210,0 +215,0 @@ this.colMax = Math.max(this.colMax, this.colNum); |
@@ -10,2 +10,4 @@ define(function(require, exports, module) {var Class = require('../util/Class'); | ||
this.ne = null; | ||
this.li = -1; | ||
this.co = -1; | ||
if(character.isNumber(val)) { | ||
@@ -76,2 +78,14 @@ sIndex = val; | ||
return this.t == Token.VIRTUAL; | ||
}, | ||
line: function(i) { | ||
if(i !== undefined) { | ||
this.li = i; | ||
} | ||
return this.li; | ||
}, | ||
col: function(i) { | ||
if(i !== undefined) { | ||
this.co = i; | ||
} | ||
return this.co; | ||
} | ||
@@ -78,0 +92,0 @@ }).statics({ |
@@ -595,3 +595,3 @@ define(function(require, exports, module) {var IParser = require('../Parser'); | ||
else { | ||
node.add(this.match([Token.SELECTOR, Token.PSEUDO, Token.HACK])); | ||
node.add(this.match([Token.SELECTOR, Token.PSEUDO, Token.HACK, Token.VARS])); | ||
} | ||
@@ -607,3 +607,3 @@ while(this.look && [',', ';', '{', '}'].indexOf(this.look.content()) == -1) { | ||
else { | ||
node.add(this.match([Token.SELECTOR, Token.PSEUDO, Token.SIGN, Token.HACK])); | ||
node.add(this.match([Token.SELECTOR, Token.PSEUDO, Token.SIGN, Token.HACK, Token.VARS])); | ||
} | ||
@@ -610,0 +610,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
1244492
17939