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

lc2

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lc2 - npm Package Compare versions

Comparing version 1.5.7 to 1.5.8

0

dist/executionUnit.js

@@ -0,0 +0,0 @@ (function webpackUniversalModuleDefinition(root, factory) {

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.LC=e():t.LC=e()}(this,function(){return function(t){function e(s){if(i[s])return i[s].exports;var r=i[s]={exports:{},id:s,loaded:!1};return t[s].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";var s=i(14),r={Case:i(11),Instruction:i(3),type:i(4).type,parse:s.parse,parseAt:s.parseFragment};"undefined"!=typeof t&&t.exports?t.exports=r:window.LC=r},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return new n(t,{beforeGen:!0,binop:e})}function r(t,e){e=e||{},e.keyword=t,u[t]=h["_"+t]=new n(t,e)}var n=function c(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];i(this,c),this.label=t,this.keyword=e.keyword,this.beforeGen=Boolean(e.beforeGen),this.beforeExpr=Boolean(e.beforeExpr),this.isAssign=Boolean(e.isAssign),this.prefix=Boolean(e.prefix),this.postfix=Boolean(e.postfix),this.binop=e.binop||null,this.macro=Boolean(e.macro)},o={beforeGen:!0},a={macro:!0},h={num:new n("num"),regexp:new n("regexp"),string:new n("string"),name:new n("name"),eof:new n("eof"),bracketL:new n("[",o),bracketR:new n("]"),braceL:new n("{",o),braceR:new n("}"),parenL:new n("(",o),parenR:new n(")"),comma:new n(",",o),semi:new n(";",o),colon:new n(":",o),tagNumL:new n("CountExpr",o),tagAtL:new n("TextExpr",o),tagFacL:new n("VisibilityExpr",o),tagR:new n("/>"),eq:new n("=",{beforeGen:!0,isAssign:!0}),assign:new n("_=",{beforeGen:!0,isAssign:!0}),incDec:new n("++/--",{prefix:!0,postfix:!0}),prefix:new n("prefix",{beforeGen:!0,prefix:!0}),logicalOR:s("||",1),logicalAND:s("&&",2),equality:s("==/!=",6),relational:s("</>",7),plusMin:new n("+/-",{beforeGen:!0,binop:9,prefix:!0}),modulo:s("%",10),star:s("*",10),slash:s("/",10),match:new n("~~",{beforeExpr:!0,binop:6})},u={};r("in"),r("by",o),r("to",o),r("click",o),r("input",o),r("rclick",o),r("dblclick",o),r("movein",o),r("moveout",o),r("scroll",o),r("select",o),r("TIMES",a),r("INTERVAL",a),r("SCREEN",a),r("AUTOWAIT",a),r("AUTOCAPTURE",a),r("wait",o),r("assert",o),r("log",o),r("console",o),r("var"),r("process"),r("return",o),r("true"),r("false"),r("jumpto"),r("refresh"),r("check"),r("uncheck"),t.exports={TokenType:n,types:h,keywordTypes:u}},,function(t,e,i){"use strict";var s=[],r=i(9).EventEmitter,n=new r,o=function(t,e){function i(t){this.$body=t.BODY,this.$line=t.LINE}var r=arguments.length<=2||void 0===arguments[2]?!1:arguments[2];if(1===arguments.length){var o=s[t];if(!o)throw new Error("TYPE:"+t+" instruction is not existed.");return o}if(s[t]&&!r)throw new Error("The instruction factory: TYPE="+t+" is existed.");return s[t]=i,i.prototype.$type=t,i.prototype.execute=function(t){if(!t)throw new Error("No case instance specified.");var i="INS["+this.$type+"]";return n.emit(i,this.$body,t,this.$line),e.call(this,t)},i.prototype.body=function(t){return this.$body[t]},i};o.createInstance=function(t,e){return new s[t]({body:e})},o.setupGuest=function(){var t=arguments.length<=0||void 0===arguments[0]?function(){}:arguments[0];n.removeAllListeners(),t(n)},t.exports=o},function(t,e,i){"use strict";var s=i(3),r={CALL:0,RETURN:1,EXPRESSION:16,WAIT:17,TRIGGER:18,ASSERT:19,JUMPTO:20,REFRESH:21,LOG:32,PROCESS:255},n=r.CALL,o=r.RETURN,a=r.EXPRESSION,h=r.WAIT,u=r.TRIGGER,c=r.ASSERT,p=r.JUMPTO,f=r.REFRESH,l=r.LOG;s(n,function(t){var e=this.body("identifier");t.$pushScope(e)}),s(o,function(t){t.$popScope()}),s(a,function(){return function(){}}),s(h,function(){return function(){}}),s(u,function(){return function(){}}),s(c,function(){return function(){}}),s(p,function(){return function(){}}),s(f,function(){return function(){}}),s(l,function(){return function(){}}),e.type=r,e.callMain=new(s(n))({BODY:{identifier:"main"}}),e.ret=new(s(o))({BODY:{}})},function(t,e){"use strict";function i(t){return 65>t?36===t:91>t?!0:97>t?95===t:123>t}function s(t){return 48>t?36===t:58>t?!0:65>t?!1:91>t?!0:97>t?95===t:123>t}var r=["in","by","to"],n=["click","input","rclick","dblclick","movein","moveout","scroll","select","check","uncheck","jumpto","refresh"],o=["TIMES","INTERVAL","SCREEN","AUTOWAIT","AUTOCAPTURE"],a=["wait","assert","log","console","var","process","return","true","false"].concat(r).concat(n),h=new RegExp("^("+a.join("|")+")$"),u=new RegExp("^("+o.join("|")+")$");t.exports={keywordRegexp:h,macroRegexp:u,isIdentifierStart:i,isIdentifierChar:s}},,function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var i=1,s=0;;){c.lastIndex=s;var r=c.exec(t);if(!(r&&r.index<e))return new p(i,e-s);++i,s=r.index+r[0].length}}function n(t,e,i){var s=t.split(c)[e.line-1],r=s.substr(0,e.column),n=h(r),u=o(n),p=a(i,n);return"\n"+s+"\n"+u+"\n"+p}function o(t){var e=" ".repeat(t)+"↑";return e+"\n"+e}function a(t,e){if(t.length/2>e)return t;for(var i=-1,s=e-Math.floor(t.length/2),r="";++i<s;)r+=" ";return r+=t}function h(t){for(var e=t.length,i=0,s=0,r="";e>s;s++)switch(r=t.charCodeAt(s)){case 9:i+=4;break;default:i+=1}return i}var u=function(){function t(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(e,i,s){return i&&t(e.prototype,i),s&&t(e,s),e}}(),c=i(8).lineBreakG,p=function(){function t(e,i){s(this,t),this.line=e,this.column=i}return u(t,[{key:"offset",value:function(e){return new t(this.line,this.column+e)}}]),t}();t.exports={getLineInfo:r,empowerErrMsg:n,Position:p}},function(t,e){"use strict";var i=/\r\n?|\n|\u2028|\u2029/;t.exports={lineBreak:i,lineBreakG:new RegExp(i.source,"g"),isNewLine:function(t){return 10===t||13===t||8232===t||8233===t}}},function(t,e){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function s(t){return"function"==typeof t}function r(t){return"number"==typeof t}function n(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if(!r(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,i,r,a,h,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(i=this._events[t],o(i))return!1;if(s(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(n(i))for(a=Array.prototype.slice.call(arguments,1),u=i.slice(),r=u.length,h=0;r>h;h++)u[h].apply(this,a);return!0},i.prototype.addListener=function(t,e){var r;if(!s(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,s(e.listener)?e.listener:e),this._events[t]?n(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,n(this._events[t])&&!this._events[t].warned&&(r=o(this._maxListeners)?i.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){function i(){this.removeListener(t,i),r||(r=!0,e.apply(this,arguments))}if(!s(e))throw TypeError("listener must be a function");var r=!1;return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var i,r,o,a;if(!s(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(i=this._events[t],o=i.length,r=-1,i===e||s(i.listener)&&i.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(n(i)){for(a=o;a-- >0;)if(i[a]===e||i[a].listener&&i[a].listener===e){r=a;break}if(0>r)return this;1===i.length?(i.length=0,delete this._events[t]):i.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[t],s(i))this.removeListener(t,i);else if(i)for(;i.length;)this.removeListener(t,i[i.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?s(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(s(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},,function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(e,i,s){return i&&t(e.prototype,i),s&&t(e,s),e}}(),a=i(9),h=i(3),u=i(4),c=u.callMain,p=u.ret,f=function(){},l=function(t){function e(){s(this,e);var t=r(this,Object.getPrototypeOf(e).call(this));return t.$$executionTree=null,t.$$config={times:1,interval:1e3,screen:null,autocapture:!1,autowait:!1},t.$$state="ready",t.$$exceptionFlag=!1,t.$$currentLoop=0,t.$$vars={},t.$$blockStack=[],t.$$scopeStack=[],t.$$instructionBuffer=null,t.$$tempInstruction=void 0,t.$$continueBuffer=null,t.on("$$block",function(){if("blocked"===t.state)throw new Error("The last instruction has not been executed.");t.state="blocked"}),t.on("$continue",function(e){if("running"===t.state)throw new Error("Look forward to a new instruction.");(t.$$continueBuffer||f)(e),t.$$exceptionFlag?(t.$clearScope().$exit(!1),t.$$exceptionFlag=!1):t.$$blockStack.length?t.$$run():t.$exit()}),t.on("$error",function(){t.$$exceptionFlag=!0,t.$$continueBuffer=null,t.emit("$continue")}),t}return n(e,t),o(e,[{key:"link",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?function(){}:arguments[1],i={process:{},config:{}},s=t.PROCESSES;return Object.keys(s).forEach(function(t){var e=i.process[t]=[],r=s[t];r.BODY.segment.forEach(function(t){var i=h(t.TYPE);e.push(new i(t))})}),Object.assign(this.$$config,t.CONFIG),this.$$executionTree=i,e(this),this}},{key:"config",value:function(t,e){if(!this.$$config.hasOwnProperty(t))throw new Error("Invalid configuration item: "+t+".");return e&&(this.$$config[t]=e),this.$$config[t]}},{key:"$$reset",value:function(){return this.$$currentLoop=0,this.$$vars={},this.$$blockStack=[],this.$$scopeStack=[],this.$$instructionBuffer=null,this.$tempInstruction=null,this}},{key:"$$bootstrap",value:function(){var t=this;return this.emit("bootstrap"),this.$$reset(),this.state="running",this.$$tempInstruction=c,setTimeout(function(){return t.$$run()},this.config("interval")),this}},{key:"$$popInstruction",value:function(){var t=this.$$tempInstruction,e=this.$currentBlock;return t?(this.$$tempInstruction=null,t):e?(this.$$instructionBuffer=e.segment[e.counter++],this.$$instructionBuffer):p}},{key:"$$run",value:function(){if("ready"!==this.state){this.state="running";var t=this.$$popInstruction();return this.$$continueBuffer=t.execute(this),this.emit("run",t),this.emit("$$block"),this.$$continueBuffer||this.emit("$continue"),this}}},{key:"$pushBlock",value:function(t){return this.$$blockStack.push({counter:0,segment:t}),this}},{key:"$popBlock",value:function(){return this.$$blockStack.pop(),this}},{key:"$pushScope",value:function(t){return this.$$scopeStack.push({blockIndex:this.$$blockStack.length}),this.$pushBlock(this.$$executionTree.process[t]),this}},{key:"$popScope",value:function(){return this.$$blockStack.length=this.$$scopeStack.pop().blockIndex,this}},{key:"$clearScope",value:function(){for(;this.$$scopeStack.length;)this.$popScope();return this}},{key:"$exit",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];return this.emit("end-loop",e),(this.$$currentLoop+=1)<this.config("times")?setTimeout(function(){t.$$tempInstruction=c,t.$$run()},this.config("interval")):(this.state="ready",this.emit("end")),this}},{key:"start",value:function(){return this.$$bootstrap(),this}},{key:"pause",value:function(){return this.state="ready",this}},{key:"resume",value:function(){return this.state="running",this.$$run(),this}},{key:"stop",value:function(){return this.pause().$$reset(),this}},{key:"state",get:function(){return this.$$state},set:function(t){var e=["ready","running","blocked"];if(-1===e.indexOf(t))throw new Error("Invalid symbol:"+t+", must be "+e.join(", ")+".");return this.$$state=t,t}},{key:"$currentBlock",get:function(){var t=this.$$blockStack.length-1;return this.$$blockStack[t]}},{key:"$currentLoop",get:function(){return this.$$currentLoop}},{key:"line",get:function(){return this.$$instructionBuffer.$line}}]),e}(a);t.exports=l},,function(t,e,i){"use strict";var s=i(1).types;t.exports=function(t){var e=t.prototype;e.parseExpression=function(){var t=this.parseMaybeAssign();if(this.type===s.comma){var e={type:"SequenceExpr"};for(e.expressions=[t];this.eat(s.comma);){var i=this.parseMaybeAssign();e.expressions.push(i)}return e}return t},e.parseMaybeAssign=function(){var t=this.parseMaybeConditional();if(this.type.isAssign){var e={type:"AssignmentExpr",left:t,operator:this.value};return this.next(),e.right=this.parseMaybeAssign(),e}return t},e.parseMaybeConditional=function(){return this.parseExprOps()},e.parseExprOps=function(){var t=this.start,e=this.parseMaybeUnary(!1);return this.parseExprOp(e,t,-1)},e.parseExprOp=function(t,e,i){var s=this.type.binop;if(null!=s&&s>i){var r=this.type,n=this.value;this.next();var o=this.start,a=this.parseExprOp(this.parseMaybeUnary(!1),o,s),h=this.buildBinary(e,t,a,n,r);return this.parseExprOp(h,e,i)}return t},e.buildBinary=function(t,e,i,r,n){var o={left:e,operator:r,right:i};return n===s.logicalAND||n===s.logicalOR?o.type="LogicalExpr":n===s.match?o.type="MatchExpr":o.type="BinaryExpr",o},e.parseMaybeUnary=function(){var t;if(this.type.prefix){var e={},i=this.type===s.incDec;e.operator=this.value,e.prefix=!0,this.next(),e.argument=this.parseMaybeUnary(!1),e.type=i?"UpdateExpr":"UnaryExpr",t=e}else for(t=this.parseExprSubscripts();this.type.postfix;){var r={};r.operator=this.value,r.prefix=!1,r.argument=t,this.next(),r.type="UpdateExpr",t=r}return t},e.parseExprSubscripts=function(){var t=this.parseExprAtom();return this.parseSubscripts(t)},e.parseSubscripts=function(t){for(;;){if(this.eat(s.parenL)){var e={type:"CallExpr",callee:t};return this.expect(s.parenR),e}return t}},e.parseExprAtom=function(){var t;switch(this.type){case s.name:return this.parseIndent(this.type!==s.name);case s.regexp:var e=this.value;return t=this.parseLiteral("regexp"),t.regexp=e,t;case s.num:case s.string:return this.parseLiteral("literal",this.value);case s._true:case s._false:return this.parseLiteral("literal",this.value);case s.objectAt:case s.dict:return this.parseExtLiteral(this.type);case s.parenL:return this.parseParenExpression();case s.tagAtL:case s.tagNumL:case s.tagFacL:return this.parseTagExpression();case s.bracketL:return this.parseElmAttr();case s.braceL:return this.parseElmStyle();default:this.inTag?this.raise(this.lastTokStart,"(missing `/` before `>` ?) Unexpected token"):this.unexpected()}},e.parseLiteral=function(t,e){var i={type:t,value:e,raw:this.input.slice(this.start,this.end)};return this.next(),i},e.parseExtLiteral=function(t){var e={type:t.label,value:this.value};return this.next(),e},e.parseParenExpression=function(){this.expect(s.parenL);var t=this.parseExpression();return this.expect(s.parenR),{type:"ParenthesizedExpr",expression:t}},e.parseTagExpression=function(){var t={type:this.type.label};return this.inTag=!0,this.next(),t.val=this.parseExpression(),this.expect(s.tagR),this.inTag=!1,t},e.parseIndent=function(){var t;return this.type===s.name?t=this.value:this.unexpected(),this.next(),{type:"Identifier",name:t}},e.parseElmAttr=function(){var t={type:"Attribute"};return this.next(),t.val=this.parseMaybeAssign(),this.expect(s.colon),t.key=this.type===s.string||s.number?this.parseExprAtom():this.parseIndent(),this.expect(s.bracketR),t},e.parseElmStyle=function(){var t={type:"Style"};return this.next(),t.val=this.parseMaybeAssign(),this.expect(s.colon),t.key=this.type===s.string||s.number?this.parseExprAtom():this.parseIndent(),this.expect(s.braceR),t}}},function(t,e,i){"use strict";var s=i(19);t.exports={parse:function(t,e){return new s(e,t).parse()},tokenizer:function(t,e){return new s(e,t)},parseFragment:function(t,e){var i=new s(e,t);return i.nextToken(),i.parseStatement()},keywordRegexp:i(5).keywordRegexp}},function(t,e,i){"use strict";var s=i(7),r=s.getLineInfo,n=s.empowerErrMsg;t.exports=function(t){var e=t.prototype;e.raise=function(t,e){var i=r(this.input,t);e+=" ("+i.line+":"+i.column+")";var s=this.options.left,o=this.options.right;e=s||o?s+e+o:n(this.input,i,e);var a=new SyntaxError(e);throw a.pos=t,a.loc=i,a.raisedAt=this.pos,a}}},function(t,e,i){"use strict";var s=i(1).types;t.exports=function(t){var e=t.prototype;e.parseBindingList=function(t,e,i){for(var r=[],n=!0;!this.eat(t);)if(n?n=!1:this.expect(s.comma),e&&this.type===s.comma)r.push(null);else{if(i)break;var o=this.parseIndent();r.push(o)}return r}}},function(t,e){"use strict";function i(t){var e={};for(var i in r)e[i]=t&&s(t,i)?t[i]:r[i];return e}var s=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={insertReturn:!0,onComment:function(){},left:"",right:"",plugins:{}};t.exports={defaultOptions:r,getOptions:i}},function(t,e,i){"use strict";var s=i(1).types;t.exports=function(t){var e=t.prototype;e.eat=function(t){return this.type===t?(this.next(),!0):!1},e.semicolon=function(){this.eat(s.semi)||this.expected(s.semi)},e.expect=function(t){this.eat(t)||this.expected(t)},e.unexpected=function(){var t=arguments.length<=0||void 0===arguments[0]?this.start:arguments[0];this.raise(t,"Unexpected token")},e.expected=function(t){this.raise(this.lastTokEnd,'Expect a "'+t.label+'" after')},e.UID=function(t){return t+this.nextID++}}},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(e,i,s){return i&&t(e.prototype,i),s&&t(e,s),e}}(),n=i(17).getOptions,o=i(5),a=o.keywordRegexp,h=o.macroRegexp,u=i(1).types,c=function(){function t(e,i){s(this,t),this.options=n(e),this.keywords=a,this.macros=h,this.input=String(i),this.pos=0,this.type=u.eof,this.value=null,this.start=this.end=this.pos,this.lastTokStart=this.lastTokEnd=this.pos,this.exprAllowed=!1,this.genAllowed=!1,this.labels=[],this.conf={},this.keys={},this.nextID=0,this.pcs={},this.pcsTable={},this.inTag=!1}return r(t,[{key:"parse",value:function(){this.nextToken();var t={CONFIG:this.conf,DATA_KEYS:this.keys,PROCESSES:this.pcs};return this.parseTopLevel(t)}}]),t}();i(15)(c),i(21)(c),i(20)(c),i(18)(c),i(13)(c),i(16)(c),t.exports=c},function(t,e,i){"use strict";var s=i(1).types,r=i(7).getLineInfo,n=i(22),o=i(4).type;t.exports=function(t){var e=t.prototype;e.parseTopLevel=function(t){var e=this.pcsTable;for(e.main={pos:0};this.type!==s.eof;)this.parseStructure();for(var i in e)e[i]&&this.raise(e[i].pos,"Invalid process call at");return t},e.parseStructure=function(){var t=this.type;return t.macro?this.parseSet():t===s._process?this.parseProcess():void this.raise(this.start,"Expect a macro or process")},e.parseSet=function(){var t=this.type;t.macro||this.unexpected();var e=t.label.toLowerCase();this.writeConfig(e),this.next()},e.writeConfig=function(t){var e=void 0,i=this.conf;i[t]&&this.raise(this.start,this.type.keyword+" was defined already");var s=void 0,r=void 0,n=this.value.split(",");switch(t){case"screen":2!==n.length&&this.raise("Invalid arguments"),s=~~parseInt(n[0],10),r=~~parseInt(n[1],10),e={width:s,height:r};break;case"autoscroll":case"autocapture":case"autowait":e=!0;break;default:e=parseInt(this.value,10)}i[t]=e},e.parseProcess=function(){var t={LINE:r(this.input,this.start),TYPE:o.PROCESS,BODY:{}},e=this.pcs,i=this.pcsTable;this.next();var s=this.parseIndent().name;e[s]&&this.raise(this.start,s+" process was defined already"),e[s]=t,i[s]=!1,this.parsePcParam(t),this.parsePcBlock(t)},e.parsePcParam=function(t){this.eat(s.parenL)&&(t.BODY.params=this.parseBindingList(s.parenR,!1,!1))},e.parsePcBlock=function(t){var e=this.parseBlock();e.push({LINE:-1,TYPE:o.RETURN}),t.BODY.segment=e},e.parseBlock=function(){this.expect(s.braceL);for(var t=[];!this.eat(s.braceR);){var e=this.parseStatement(!0);t.push(e)}return t},e.parseStatement=function(){var t=this.type,e=this.startNode();switch(t){case s._click:case s._rclick:case s._dblclick:case s._movein:case s._moveout:return this.parseMouseAction(e,t.keyword);case s._select:return this.parseSelectAction(e);case s._scroll:return this.parseScrollAction(e,t.keyword);case s._input:return this.parseInputAction(e,t.keyword);case s._check:case s._uncheck:return this.parseCheck(e,t.keyword);case s._return:return this.parseReturnStatement(e);case s._wait:return this.parseWaitStatement(e);case s._assert:return this.parseAssertStatement(e);case s._log:case s._console:return this.parseLogStatement(e,o.LOG);case s._jumpto:return this.parseGotoStatement(e);case s._refresh:return this.parseRefreshStatement(e);case s._var:return this.parseVarStatement(e);case s.name:return this.parseExprStatement(e);default:return this.parseEvaluation(e)}},e.parseReturnStatement=function(t){return this.next(),this.eat(s.semi),this.finishNode(t,o.RETURN)},e.parseVarStatement=function(t){return this.next(),this.parseVar(t),t.BODY.exp=n(t.BODY.raw),this.semicolon(),this.finishNode(t,o.EXPRESSION)},e.parseVar=function(t){for(var e=[];;){var i={};if(i.id=this.parseIndent().name,this.eat(s.eq)?i.init=this.parseMaybeAssign():i.init=null,e.push(i),!this.eat(s.comma))break}t.BODY.raw={declarations:e,type:"varDecl"}},e.parseExprStatement=function(t){var e=this.parseExpression();if(this.semicolon(),"CallExpr"===e.type){var i=e.callee.name;return this.pcsTable[i]!==!1&&(this.pcsTable[i]={pos:this.lastTokStart}),t.BODY.identifier=i,this.finishNode(t,o.CALL)}var s=n(e);return t.BODY.raw=e,t.BODY.exp=s,this.finishNode(t,o.EXPRESSION)},e.parseEvaluation=function(t){var e=this.parseExpression();this.semicolon();var i=n(e);return t.BODY.raw=e,t.BODY.exp=i,this.finishNode(t,o.EXPRESSION)},e.parseWaitStatement=function(t){return this.next(),t.BODY.raw=this.parseExpression(),t.BODY.delay=n(t.BODY.raw),this.semicolon(),this.finishNode(t,o.WAIT)},e.parseMouseAction=function(t,e){if(this.next(),t.BODY.raw=this.parseExpression(),t.BODY.object=n(t.BODY.raw),t.BODY.action=e,this.eat(s._to)){var i=void 0,r=void 0;i=this.parseMaybeAssign(),this.expect(s.comma),r=this.parseMaybeAssign(),t.BODY.posX=i,t.BODY.posY=r}return this.semicolon(),this.finishNode(t,o.TRIGGER)},e.parseScrollAction=function(t,e){return this.next(),t.BODY.raw=this.parseExpression(),t.BODY.object=n(t.BODY.raw),this.expect(s._by),t.BODY.raw1=this.parseExpression(),t.BODY.param=n(t.BODY.raw1),t.BODY.action=e,this.finishNode(t,o.TRIGGER)},e.parseSelectAction=function(t){return this.next(),t.BODY.raw=this.parseExpression(),t.BODY.object=n(t.BODY.raw),this.expect(s._by),t.BODY.raw1=this.parseExpression(),t.BODY.param=n(t.BODY.raw1),t.BODY.action="select",this.semicolon(),this.finishNode(t,o.TRIGGER)},e.parseInputAction=function(t,e){return this.next(),t.BODY.raw=this.parseExpression(),t.BODY.object=n(t.BODY.raw),this.expect(s._by),t.BODY.raw1=this.parseExpression(),t.BODY.param=n(t.BODY.raw1),t.BODY.action=e,this.semicolon(),this.finishNode(t,o.TRIGGER)},e.parseCheck=function(t,e){return this.next(),t.BODY.raw=this.parseExpression(),t.BODY.object=n(t.BODY.raw),t.BODY.action=e,this.semicolon(),this.finishNode(t,o.TRIGGER)},e.parseAssertStatement=function(t){return this.next(),t.BODY.raw=this.parseExpression(),t.BODY.exp=n(t.BODY.raw),this.eat(s._in)&&(this.type===s.num?t.BODY.timeout=this.value:this.unexpected(),this.next()),this.semicolon(),t.BODY.key=this.UID("#"),this.keys[t.BODY.key]=!!t.BODY.timeout,this.finishNode(t,o.ASSERT)},e.parseGotoStatement=function(t){return this.next(),t.BODY.raw=this.parseExpression(),t.BODY.url=n(t.BODY.raw),this.semicolon(),this.finishNode(t,o.JUMPTO)},e.parseRefreshStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,o.REFRESH)},e.parseLogStatement=function(t,e){return this.next(),t.BODY.raw=this.parseExpression(),t.BODY.msg=n(t.BODY.raw),this.semicolon(),this.finishNode(t,e)},e.startNode=function(){return{LINE:r(this.input,this.start).line,TYPE:0,BODY:{},start:this.start,end:0}},e.finishNode=function(t,e){return t.TYPE=e,t.end=this.lastTokEnd,t}}},function(t,e,i){"use strict";var s=i(5),r=s.isIdentifierStart,n=s.isIdentifierChar,o=i(1).types,a=i(1).keywordTypes,h=i(8),u=h.isNewLine,c=h.lineBreak;t.exports=function(t){var e=t.prototype;e.next=function(){this.lastTokEnd=this.end,this.lastTokStart=this.start,this.nextToken()},e.nextToken=function(){return this.skipSpace(),this.start=this.pos,this.pos>=this.input.length?this.finishToken(o.eof):void this.readToken(this.fullCharCodeAtPos())},e.readToken=function(t){return r(t)?this.readWord():this.getTokenFromCode(t)},e.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(55295>=t||t>=57344)return t;var e=this.input.charCodeAt(this.pos+1);return(t<<10)+e-56613888},e.skipBlockComment=function(){var t=this.pos,e=this.input.indexOf("*/",this.pos+=2);-1===e&&this.raise(this.pos-2,"unterminated comment"),this.pos=e+2,this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,e),t,this.pos)},e.skipLineComment=function(t){for(var e=this.pos,i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&10!==i&&13!==i&&8232!==i&&8233!==i;)++this.pos,i=this.input.charCodeAt(this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+=t,this.pos),e,this.pos)},e.skipSpace=function(){t:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos;break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break t}break;default:if(!(t>8&&14>t))break t;++this.pos}}},e.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed||this.genAllowed?(++this.pos,this.readRegexp(this.genAllowed)):61===t?this.finishOp(o.assign,2):62===t?this.finishOp(o.tagR,2):this.finishOp(o.slash,1)},e.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),i=1,s=42===t?o.star:o.modulo;return 61===e?this.finishOp(o.assign,i+1):this.finishOp(s,i)},e.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?this.finishOp(124===t?o.logicalOR:o.logicalAND,2):void this.raise(this.pos,"bitwise operator is not allowed")},e.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?this.finishOp(o.incDec,2):61===e?this.finishOp(o.assign,2):this.finishOp(o.plusMin,1)},e.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),i=1;if(e===t&&this.raise(this.pos,"bitwise operator is not allowed"),60===t){if(35===e)return this.finishOp(o.tagNumL,2);if(64===e)return this.finishOp(o.tagAtL,2);if(33===e)return this.finishOp(o.tagFacL,2)}return 61===e&&(i=2),this.finishOp(o.relational,i)},e.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return 126===e&&33===t?this.finishOp(o.match,2):61===e?this.finishOp(o.equality,61===this.input.charCodeAt(this.pos+2)?3:2):this.finishOp(61===t?o.eq:o.prefix,1)},e.getTokenFromCode=function(t){switch(t){case 35:return++this.pos,this.readMacro();case 40:return++this.pos,this.finishToken(o.parenL);case 41:return++this.pos,this.finishToken(o.parenR);case 59:return++this.pos,this.finishToken(o.semi);case 44:return++this.pos,this.finishToken(o.comma);case 91:return++this.pos,this.finishToken(o.bracketL);case 93:return++this.pos,this.finishToken(o.bracketR);case 123:return++this.pos,this.finishToken(o.braceL);case 125:return++this.pos,this.finishToken(o.braceR);case 58:return++this.pos,this.finishToken(o.colon);case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 126:var e=this.input.charCodeAt(this.pos+1);return 126!==e&&this.raise(this.pos,"bitwise operator is not allowed"),this.finishOp(o.match,2);default:this.raise(this.pos,'Unexpected character "'+this.input[this.pos]+'"')}},e.finishOp=function(t,e){var i=this.input.slice(this.pos,this.pos+=e);return this.finishToken(t,i)},e.finishToken=function(t,e){this.end=this.pos,this.type=t,this.value=e,this.genAllowed=t.beforeGen,this.exprAllowed=t.beforeExpr},e.readRegexp=function(t){for(var e=void 0,i=void 0,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(c.test(r)&&this.raise(s,"Unterminated regular expression"),e)e=!1;else{if("["===r)i=!0;else if("]"===r&&i)i=!1;else if("/"===r&&!i)break;e="\\"===r}++this.pos}var n=this.input.slice(s,this.pos);++this.pos;var a=this.readWord1();if(a){var h=/^[gim]*$/;h.test(a)||this.raise(s,"Invalid regular expression flag")}var u={pattern:n,flags:a,isGenerate:t};return this.finishToken(o.regexp,u)},e.readInt=function(t,e){for(var i=this.pos,s=0,r=0,n=null==e?1/0:e;n>r;++r){var o=this.fullCharCodeAtPos(),a=void 0;if(a=o>=97?o-97+10:o>=65?o-65+10:o>=48&&57>=o?o-48:1/0,a>=t)break;++this.pos,s=s*t+a}return this.pos===i||null!=e&&this.pos-i!==e?null:s},e.readNumber=function(t){var e=this.pos,i=!1;t||null!==this.readInt(10)||this.raise(e,"Invalid Number");var s=this.fullCharCodeAtPos();46===s&&(++this.pos,this.readInt(10),i=!0,s=this.fullCharCodeAtPos()),69!==s&&101!==s||(s=this.input.charCodeAt(++this.pos),43!==s&&45!==s||++this.pos,null===this.readInt(10)&&this.raise(e,"Invalid number"),i=!0),r(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=this.input.slice(e,this.pos),a=void 0;return a=i?parseFloat(n):parseInt(n,10),this.finishToken(o.num,a)},e.readString=function(t){
for(var e="",i=this.start,s=++this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated string");var r=this.fullCharCodeAtPos();if(r===t)break;92===r?(e+=this.input.slice(s,this.pos),e+=this.readEscapedChar(),s=this.pos):(u(r)&&this.raise(i,"Unterminated string"),++this.pos)}return e+=this.input.slice(s,this.pos++),this.finishToken(o.string,e)},e.readEscapedChar=function(){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 116:return" ";case 98:return"\b";case 118:return"\x0B";case 102:return"\f";case 13:10===this.fullCharCodeAtPos()&&++this.pos;case 10:return"";default:return String.fromCharCode(t)}},e.readWord1=function(){for(var t="",e=this.pos;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(!n(i))break;++this.pos}return t+=this.input.slice(e,this.pos)},e.readWord=function(){var t=this.readWord1(),e=this.keywords.test(t)?a[t]:o.name;return this.finishToken(e,t)},e.readMacro=function(){var t=this.pos,e=this.readWord1();this.macros.test(e)||this.raise(t,"invalid macros");for(var i=a[e],s=this.pos,r=this.fullCharCodeAtPos();this.pos<this.input.length&&10!==r&&13!==r&&8232!==r&&8233!==r;)++this.pos,r=this.input.charCodeAt(this.pos);var n=this.input.slice(s,this.pos).trim();return this.finishToken(i,n)}}},function(t,e){"use strict";var i={varDecl:function(t,e){var i="",s=!0;return t.declarations.forEach(function(t){t.init&&(s||(i+=","),i+="$."+t.id+" = "+e(t.init),s=!1)}),"("+i+")"},SequenceExpr:function(t,e){var i="",s=!0;return t.expressions.forEach(function(t){s||(i+=","),i+=e(t),s=!1}),"("+i+")"},literal:function(t){return t.raw},regexp:function(t){if(t.regexp.isGenerate){var e=t.regexp;return"gen(/"+e.pattern+"/"+e.flags+")"}return"("+t.raw+")"},Identifier:function(t){return"$."+t.name},LogicalExpr:function(t,e){return e(t.left)+t.operator+e(t.right)},BinaryExpr:function(t,e){return e(t.left)+t.operator+e(t.right)},MatchExpr:function(t,e){var i="";return"~~"===t.operator&&(i+="!"),i+"!m("+e(t.left)+","+e(t.right)+")"},UpdateExpr:function(t){var e="$."+t.argument;return t.prefix?t.operator+e:e+t.operator},UnaryExpr:function(t,e){return t.operator+"("+e(t.argument)+")"},AssignmentExpr:function(t,e){return e(t.left)+t.operator+e(t.right)},ParenthesizedExpr:function(t,e){return"("+e(t.expression)+")"},Attribute:function(t,e){var i=e(t.val);return"d("+e(t.key)+","+i+")"},Style:function(t,e){var i=e(t.val);return"o("+e(t.key)+","+i+")"},TextExpr:function(t,e){var i="String("+e(t.val)+")";return"t("+i+")"},CountExpr:function(t,e){var i="String("+e(t.val)+")";return"c("+i+")"},VisibilityExpr:function(t,e){var i="String("+e(t.val)+")";return"v("+i+")"}};t.exports=function(t){var e=function s(t){var e=t.type;return i[e](t,s)}(t).replace("\\","\\\\");return"return "+e+";"}}])});

2

package.json
{
"name": "lc2",
"version": "1.5.7",
"version": "1.5.8",
"description": "browser automation library",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -37,3 +37,3 @@ // walk a javascript style tree and transform it into a function

literal: function (node) {
return node.raw;
return node.raw.replace('\\', '\\\\');
},

@@ -127,5 +127,5 @@ regexp: function (node) {

return visitors[type](node, c);
})(node).replace('\\', '\\\\');
})(node);
return 'return ' + string + ';';
};

Sorry, the diff of this file is too big to display

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