lc2-compiler
Advanced tools
Comparing version 2.2.4 to 2.2.6
@@ -58,3 +58,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LCP = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
keyup: 'ACTION::KEYUP', | ||
keypress: 'ACTION::KEYPRESS' | ||
keypress: 'ACTION::KEYPRESS', | ||
EMBED: 'EMBED' | ||
}; | ||
@@ -393,2 +394,13 @@ | ||
readEmbed() { | ||
var start = this.pos; | ||
var end = this.input.indexOf('?>', start + 2); | ||
if (end === -1) { | ||
this.raise(start, 'unterminated embeded JavaScript'); | ||
} | ||
this.pos = end + 2; | ||
return this.finishToken(tt.embed, this.input.slice(start + 2, end)); | ||
} | ||
readTokenLt() { | ||
@@ -406,17 +418,8 @@ var next = this.input.charCodeAt(this.pos + 1); | ||
return this.finishOp(tt.tagFacL, 2); | ||
case 45: | ||
// '-' | ||
return this.finishOp(tt.tagMinues, 2); | ||
case 124: | ||
// '|' | ||
return this.finishOp(tt.tagPipe, 2); | ||
case 94: | ||
// '^' | ||
return this.finishOp(tt.tagXor, 2); | ||
case 60: | ||
// '<' | ||
return this.finishOp(tt.tagShift, 2); | ||
case 61: | ||
// '=' | ||
return this.finishOp(tt.relational, 2); | ||
case 63: | ||
// '?' | ||
return this.readEmbed(); | ||
default: | ||
@@ -1531,6 +1534,7 @@ return this.finishOp(tt.relational, 1); | ||
case tt.tagAtL:case tt.tagNumL:case tt.tagFacL: | ||
case tt.tagMinues:case tt.tagPipe: | ||
case tt.tagXor:case tt.tagShift: | ||
return this.parseTagExpression(); | ||
case tt.embed: | ||
return this.parseLiteral(astType.EMBED, this.value); | ||
case tt.bracketL: | ||
@@ -1743,13 +1747,17 @@ return this.parseArray(); | ||
exports.mapCharCount = function (input) { | ||
var lines = input.split(lineBreakG); | ||
var charsOnEachLine = lines.map(str => str.length + 1); | ||
var len = charsOnEachLine.length; | ||
var charCountSoFar = new Array(len); | ||
for (var i = 0; i < len; i++) { | ||
if (i > 0) { | ||
charCountSoFar[i] = charsOnEachLine[i] + charCountSoFar[i - 1]; | ||
var charCountSoFar = []; | ||
var match = void 0, | ||
cur = 0; | ||
do { | ||
lineBreakG.lastIndex = cur; | ||
match = lineBreakG.exec(input); | ||
if (match) { | ||
var idx = match.index + match[0].length; | ||
cur = idx; | ||
charCountSoFar.push(idx); | ||
} else { | ||
charCountSoFar[i] = charsOnEachLine[i]; | ||
charCountSoFar.push(input.length); | ||
} | ||
} | ||
} while (match); | ||
@@ -2045,7 +2053,4 @@ return charCountSoFar; | ||
tagFacL: new TokenType('<!', lcTag), // <! | ||
tagMinues: new TokenType('<-', lcTag), // <- | ||
tagPipe: new TokenType('<|', lcTag), // <| | ||
tagXor: new TokenType('<^', lcTag), // <^ | ||
tagShift: new TokenType('<<', lcTag), // << | ||
tagR: new TokenType('/>'), | ||
embed: new TokenType('<?'), | ||
pipe: new TokenType('|'), | ||
@@ -2052,0 +2057,0 @@ question: new TokenType('?', beforeExpr), |
{ | ||
"name": "lc2-compiler", | ||
"version": "2.2.4", | ||
"version": "2.2.6", | ||
"description": "lemoncase2 parser", | ||
@@ -5,0 +5,0 @@ "main": "dist/bundle.js", |
Sorry, the diff of this file is too big to display
3958
140473