@bbob/parser
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -6,2 +6,18 @@ # Change Log | ||
<a name="2.5.1"></a> | ||
## [2.5.1](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.1) (2019-06-18) | ||
### Bug Fixes | ||
* **parser:** fix issue with escaping backslashes when enableEscapeTags is set ([#20](https://github.com/JiLiZART/bbob/issues/20)) ([8a9e930](https://github.com/JiLiZART/bbob/commit/8a9e930)) | ||
### Features | ||
* **parse:** allow tags to be escaped with backslash ([#17](https://github.com/JiLiZART/bbob/issues/17)) ([c4f78c1](https://github.com/JiLiZART/bbob/commit/c4f78c1)) | ||
<a name="2.5.0"></a> | ||
@@ -8,0 +24,0 @@ # [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17) |
@@ -599,3 +599,3 @@ (function (global, factory) { | ||
var RESERVED_CHARS = [closeTag, openTag, char_7, char_14, char_8, char_5, char_6, char_2, EM]; | ||
var NOT_CHAR_TOKENS = [].concat(options.enableEscapeTags ? [char_14] : [], [openTag, char_8, char_5, char_2, char_14]); | ||
var NOT_CHAR_TOKENS = [].concat(options.enableEscapeTags ? [char_14] : [], [openTag, char_8, char_5, char_2]); | ||
var WHITESPACES = [char_8, char_5]; | ||
@@ -716,2 +716,6 @@ var SPECIAL_CHARS = [char_6, char_8, char_5]; | ||
emitToken(createToken(TYPE_WORD, nextChar, row, col)); | ||
} else if (options.enableEscapeTags && currChar === char_14 && nextChar === char_14) { | ||
bufferGrabber.skip(); // skip the first \ without emitting anything | ||
bufferGrabber.skip(); // skip past the second \ and emit it | ||
emitToken(createToken(TYPE_WORD, nextChar, row, col)); | ||
} else if (currChar === openTag) { | ||
@@ -718,0 +722,0 @@ bufferGrabber.skip(); // skip openTag |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.BbobParser={})}(this,function(t){"use strict";function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,n){return t(n={exports:{}},n.exports),n.exports}var a=e(function(t,n){n.__esModule=!0;n.N="\n",n.F="\f",n.R="\r",n.TAB="\t",n.EQ="=",n.QUOTEMARK='"',n.SPACE=" ",n.OPEN_BRAKET="[",n.CLOSE_BRAKET="]",n.SLASH="/",n.PLACEHOLDER_SPACE_TAB=" ",n.PLACEHOLDER_SPACE=" ",n.BACKSLASH="\\"});n(a);var E=a.N,u=a.TAB,N=a.EQ,b=a.QUOTEMARK,L=a.SPACE,O=a.OPEN_BRAKET,S=a.CLOSE_BRAKET,x=a.SLASH,k=a.BACKSLASH,o=e(function(t,n){n.__esModule=!0,n.isEOL=n.isStringNode=n.isTagNode=n.getNodeLength=n.appendToNode=n.attrValue=n.attrsToString=void 0;var r=function(t){return"object"==typeof t&&!!t.tag},o=function(t){return"string"==typeof t},i=function(t){return t.replace(/"/g,""")},u=function(t,n){var e=typeof n,r={boolean:function(){return n?""+t:""},number:function(){return t+'="'+n+'"'},string:function(){return t+'="'+i(n)+'"'},object:function(){return t+'="'+i(JSON.stringify(n))+'"'}};return r[e]?r[e]():""};n.attrsToString=function(e){return Object.keys(e).reduce(function(t,n){return[].concat(t,[u(n,e[n])])},[""]).join(" ")},n.attrValue=u,n.appendToNode=function(t,n){t.content.push(n)},n.getNodeLength=function e(t){return r(t)?t.content.reduce(function(t,n){return t+e(n)},0):o(t)?t.length:0},n.isTagNode=r,n.isStringNode=o,n.isEOL=function(t){return t===a.N}});n(o);var r=e(function(t,n){n.__esModule=!0,n.TagNode=void 0;var e=function(){function r(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,n,e){return n&&r(t.prototype,n),e&&r(t,e),t}}();var r=function(){function r(t,n,e){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,r),this.tag=t,this.attrs=n,this.content=[].concat(e)}return r.prototype.attr=function(t,n){return void 0!==n&&(this.attrs[t]=n),this.attrs[t]},r.prototype.append=function(t){return(0,o.appendToNode)(this,t)},r.prototype.toString=function(){var t=a.OPEN_BRAKET,n=a.CLOSE_BRAKET;return t+this.tag+n+this.content.reduce(function(t,n){return t+""+n},"")+t+a.SLASH+this.tag+n},e(r,[{key:"length",get:function(){return(0,o.getNodeLength)(this)}}]),r}();r.create=function(t){return new r(t,1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},2<arguments.length&&void 0!==arguments[2]?arguments[2]:[])},r.isOf=function(t,n){return t.tag===n},n.TagNode=r,n.default=r}),h=n(r),i=r.TagNode,s="type",f="value",c="line",l="word",g="attr-name",p="attr-value",d="space",v="new-line",T=function(t){return t[f]},y=function(t){return T(t).charCodeAt(0)==x.charCodeAt(0)},A=function(){function o(t,n,e,r){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,o),this[s]=t+"",this[f]=n+"",this[c]=+e,this.row=+r}return o.prototype.isEmpty=function(){return!!this[s]},o.prototype.isText=function(){return(t=this)[s]===d||t[s]===v||t[s]===l;var t},o.prototype.isTag=function(){return"tag"===this[s]},o.prototype.isAttrName=function(){return this[s]===g},o.prototype.isAttrValue=function(){return this[s]===p},o.prototype.isStart=function(){return!y(this)},o.prototype.isEnd=function(){return y(this)},o.prototype.getName=function(){return n=T(t=this),y(t)?n.slice(1):n;var t,n},o.prototype.getValue=function(){return T(this)},o.prototype.getLine=function(){return this[c]},o.prototype.getColumn=function(){return this.row},o.prototype.toString=function(){return t=O,t+=T(this),t+=S;var t},o}(),C=l,m=function(e){var t=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).onSkip,r=0,o=function(){r+=1,t&&t()},i=function(){return r<e.length},u=function(){return e.substr(r)},a=function(){return e[r]};return{skip:o,hasNext:i,isLast:function(){return r===e.length},grabWhile:function(t){for(var n=r;i()&&t(a());)o();return e.substr(n,r-n)},getNext:function(){return e[r+1]},getPrev:function(){return e[r-1]},getCurr:a,getRest:u,substrUntilChar:function(t){var n=u(),e=n.indexOf(t);return e<0?"":n.substr(0,e)}}},_=function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return{getLast:function(){return n.length?n[n.length-1]:null},flushLast:function(){return!!n.length&&n.pop()},push:function(t){return n.push(t)},toArray:function(){return n}}},w=function(t,n){return new A(t,n,2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,3<arguments.length&&void 0!==arguments[3]?arguments[3]:0)};function P(e){var s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},f=0,c=0,n=-1,r=Array(Math.floor(e.length)),l=s.openTag||O,g=s.closeTag||S,p=[g,l,b,k,L,u,N,E,"!"],o=[].concat(s.enableEscapeTags?[k]:[],[l,L,u,E,k]),i=[L,u],h=[N,L,u],d=function(t){return 0<=i.indexOf(t)},v=function(t){return-1==o.indexOf(t)},T=function(t){s.onToken&&s.onToken(t),r[n+=1]=t},y=function(t){for(var u=null,a=!1,r=[],s=m(t),o=function(t){var n=t===N,e=d(t),r=s.getPrev(),o=s.getNext(),i=r===k;return null===u?!1===(n||e||s.isLast()):!(!a||h.indexOf(t)<0)||!!(t!==b||i||(a=!a)||o===N||d(o))&&!1===(n||e)},n=function(){var t=s.grabWhile(o),n=s.getCurr();if(null===u)u=t;else if(d(n)||n===b||!s.hasNext()){var e=function(t,n){for(;t.charAt(0)===n;)t=t.substring(1);for(;t.charAt(t.length-1)===n;)t=t.substring(0,t.length-1);return t}(t,b).replace(k+b,b);r.push(w("attr-value",e,f,c))}else r.push(w("attr-name",t,f,c));s.skip()};s.hasNext();)n();return{tag:u,attrs:r}},A=m(e,{onSkip:function(){c++}}),t=function(){var t=A.getCurr(),n=A.getNext();if(t===E)A.skip(),T(w("new-line",t,++f,c=0));else if(d(t)){var e=A.grabWhile(d);T(w("space",e,f,c))}else if(!s.enableEscapeTags||t!==k||n!==l&&n!==g){if(t===l){A.skip();var r=A.substrUntilChar(g),o=0===r.length||0<=r.indexOf(l);if(0<=p.indexOf(n)||o||A.isLast())T(w(C,t,f,c));else{var i=A.grabWhile(function(t){return t!==g});if(A.skip(),-1==i.indexOf(N)||i[0]===x)T(w("tag",i,f,c));else{var u=y(i);T(w("tag",u.tag,f,c)),u.attrs.map(T)}}}else if(t===g)A.skip(),T(w(C,t,f,c));else if(v(t)){var a=A.grabWhile(v);T(w(C,a,f,c))}}else A.skip(),A.skip(),T(w(C,n,f,c))};return{tokenize:function(){for(;A.hasNext();)t();return r.length=n+1,r},isTokenNested:function(t){var n=l+x+t.getValue();return-1<e.indexOf(n)}}}var B=function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=n,o=null,e=_(),u=_(),a=_(),s=_(),f={},c=function(){a.flushLast()&&s.flushLast()},l=function(t){var n;(n=u.getLast(),n?n.content:e.toArray()).push(t)},r=function(t){c();var n,e=h.create(t.getValue()),r=(void 0===f[(n=t).getValue()]&&(f[n.getValue()]=o.isTokenNested(n)),f[n.getValue()]);a.push(e),r?u.push(e):l(e)},g=function(t){t.isStart()&&r(t),t.isEnd()&&function(t){c();var n=u.flushLast();if(n)l(n);else if(i.onError){var e=t.getValue(),r=t.getLine(),o=t.getColumn();i.onError({message:"Inconsistent tag '"+e+"' on line "+r+" and column "+o,tagName:e,lineNumber:r,columnNumber:o})}}(t)},p=function(t){var n=a.getLast(),e=t.getValue(),r=!!f[t];if(n)if(t.isAttrName())s.push(e),n.attr(s.getLast(),"");else if(t.isAttrValue()){var o=s.getLast();o?(n.attr(o,e),s.flushLast()):n.attr(e,e)}else t.isText()?r?n.append(e):l(e):t.isTag()&&l(""+t);else t.isText()?l(e):t.isTag()&&l(""+t)};(o=(n.createTokenizer?n.createTokenizer:P)(t,{onToken:function(t){var n;!t.isTag()||(n=t.getName(),i.onlyAllowTags&&i.onlyAllowTags.length&&i.onlyAllowTags.indexOf(n)<0)?p(t):g(t)},onlyAllowTags:i.onlyAllowTags,openTag:i.openTag,closeTag:i.closeTag,enableEscapeTags:i.enableEscapeTags})).tokenize();return e.toArray()};t.default=B,t.parse=B,t.TagNode=i,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.BbobParser={})}(this,function(t){"use strict";function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,n){return t(n={exports:{}},n.exports),n.exports}var a=e(function(t,n){n.__esModule=!0;n.N="\n",n.F="\f",n.R="\r",n.TAB="\t",n.EQ="=",n.QUOTEMARK='"',n.SPACE=" ",n.OPEN_BRAKET="[",n.CLOSE_BRAKET="]",n.SLASH="/",n.PLACEHOLDER_SPACE_TAB=" ",n.PLACEHOLDER_SPACE=" ",n.BACKSLASH="\\"});n(a);var E=a.N,u=a.TAB,N=a.EQ,b=a.QUOTEMARK,L=a.SPACE,O=a.OPEN_BRAKET,S=a.CLOSE_BRAKET,x=a.SLASH,k=a.BACKSLASH,o=e(function(t,n){n.__esModule=!0,n.isEOL=n.isStringNode=n.isTagNode=n.getNodeLength=n.appendToNode=n.attrValue=n.attrsToString=void 0;var r=function(t){return"object"==typeof t&&!!t.tag},o=function(t){return"string"==typeof t},i=function(t){return t.replace(/"/g,""")},u=function(t,n){var e=typeof n,r={boolean:function(){return n?""+t:""},number:function(){return t+'="'+n+'"'},string:function(){return t+'="'+i(n)+'"'},object:function(){return t+'="'+i(JSON.stringify(n))+'"'}};return r[e]?r[e]():""};n.attrsToString=function(e){return Object.keys(e).reduce(function(t,n){return[].concat(t,[u(n,e[n])])},[""]).join(" ")},n.attrValue=u,n.appendToNode=function(t,n){t.content.push(n)},n.getNodeLength=function e(t){return r(t)?t.content.reduce(function(t,n){return t+e(n)},0):o(t)?t.length:0},n.isTagNode=r,n.isStringNode=o,n.isEOL=function(t){return t===a.N}});n(o);var r=e(function(t,n){n.__esModule=!0,n.TagNode=void 0;var e=function(){function r(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,n,e){return n&&r(t.prototype,n),e&&r(t,e),t}}();var r=function(){function r(t,n,e){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,r),this.tag=t,this.attrs=n,this.content=[].concat(e)}return r.prototype.attr=function(t,n){return void 0!==n&&(this.attrs[t]=n),this.attrs[t]},r.prototype.append=function(t){return(0,o.appendToNode)(this,t)},r.prototype.toString=function(){var t=a.OPEN_BRAKET,n=a.CLOSE_BRAKET;return t+this.tag+n+this.content.reduce(function(t,n){return t+""+n},"")+t+a.SLASH+this.tag+n},e(r,[{key:"length",get:function(){return(0,o.getNodeLength)(this)}}]),r}();r.create=function(t){return new r(t,1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},2<arguments.length&&void 0!==arguments[2]?arguments[2]:[])},r.isOf=function(t,n){return t.tag===n},n.TagNode=r,n.default=r}),h=n(r),i=r.TagNode,s="type",f="value",c="line",l="word",g="attr-name",p="attr-value",d="space",v="new-line",T=function(t){return t[f]},y=function(t){return T(t).charCodeAt(0)==x.charCodeAt(0)},A=function(){function o(t,n,e,r){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,o),this[s]=t+"",this[f]=n+"",this[c]=+e,this.row=+r}return o.prototype.isEmpty=function(){return!!this[s]},o.prototype.isText=function(){return(t=this)[s]===d||t[s]===v||t[s]===l;var t},o.prototype.isTag=function(){return"tag"===this[s]},o.prototype.isAttrName=function(){return this[s]===g},o.prototype.isAttrValue=function(){return this[s]===p},o.prototype.isStart=function(){return!y(this)},o.prototype.isEnd=function(){return y(this)},o.prototype.getName=function(){return n=T(t=this),y(t)?n.slice(1):n;var t,n},o.prototype.getValue=function(){return T(this)},o.prototype.getLine=function(){return this[c]},o.prototype.getColumn=function(){return this.row},o.prototype.toString=function(){return t=O,t+=T(this),t+=S;var t},o}(),C=l,m=function(e){var t=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).onSkip,r=0,o=function(){r+=1,t&&t()},i=function(){return r<e.length},u=function(){return e.substr(r)},a=function(){return e[r]};return{skip:o,hasNext:i,isLast:function(){return r===e.length},grabWhile:function(t){for(var n=r;i()&&t(a());)o();return e.substr(n,r-n)},getNext:function(){return e[r+1]},getPrev:function(){return e[r-1]},getCurr:a,getRest:u,substrUntilChar:function(t){var n=u(),e=n.indexOf(t);return e<0?"":n.substr(0,e)}}},_=function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return{getLast:function(){return n.length?n[n.length-1]:null},flushLast:function(){return!!n.length&&n.pop()},push:function(t){return n.push(t)},toArray:function(){return n}}},w=function(t,n){return new A(t,n,2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,3<arguments.length&&void 0!==arguments[3]?arguments[3]:0)};function P(e){var s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},f=0,c=0,n=-1,r=Array(Math.floor(e.length)),l=s.openTag||O,g=s.closeTag||S,p=[g,l,b,k,L,u,N,E,"!"],o=[].concat(s.enableEscapeTags?[k]:[],[l,L,u,E]),i=[L,u],h=[N,L,u],d=function(t){return 0<=i.indexOf(t)},v=function(t){return-1==o.indexOf(t)},T=function(t){s.onToken&&s.onToken(t),r[n+=1]=t},y=function(t){for(var u=null,a=!1,r=[],s=m(t),o=function(t){var n=t===N,e=d(t),r=s.getPrev(),o=s.getNext(),i=r===k;return null===u?!1===(n||e||s.isLast()):!(!a||h.indexOf(t)<0)||!!(t!==b||i||(a=!a)||o===N||d(o))&&!1===(n||e)},n=function(){var t=s.grabWhile(o),n=s.getCurr();if(null===u)u=t;else if(d(n)||n===b||!s.hasNext()){var e=function(t,n){for(;t.charAt(0)===n;)t=t.substring(1);for(;t.charAt(t.length-1)===n;)t=t.substring(0,t.length-1);return t}(t,b).replace(k+b,b);r.push(w("attr-value",e,f,c))}else r.push(w("attr-name",t,f,c));s.skip()};s.hasNext();)n();return{tag:u,attrs:r}},A=m(e,{onSkip:function(){c++}}),t=function(){var t=A.getCurr(),n=A.getNext();if(t===E)A.skip(),T(w("new-line",t,++f,c=0));else if(d(t)){var e=A.grabWhile(d);T(w("space",e,f,c))}else if(!s.enableEscapeTags||t!==k||n!==l&&n!==g){if(s.enableEscapeTags&&t===k&&n===k)A.skip(),A.skip(),T(w(C,n,f,c));else if(t===l){A.skip();var r=A.substrUntilChar(g),o=0===r.length||0<=r.indexOf(l);if(0<=p.indexOf(n)||o||A.isLast())T(w(C,t,f,c));else{var i=A.grabWhile(function(t){return t!==g});if(A.skip(),-1==i.indexOf(N)||i[0]===x)T(w("tag",i,f,c));else{var u=y(i);T(w("tag",u.tag,f,c)),u.attrs.map(T)}}}else if(t===g)A.skip(),T(w(C,t,f,c));else if(v(t)){var a=A.grabWhile(v);T(w(C,a,f,c))}}else A.skip(),A.skip(),T(w(C,n,f,c))};return{tokenize:function(){for(;A.hasNext();)t();return r.length=n+1,r},isTokenNested:function(t){var n=l+x+t.getValue();return-1<e.indexOf(n)}}}var B=function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=n,o=null,e=_(),u=_(),a=_(),s=_(),f={},c=function(){a.flushLast()&&s.flushLast()},l=function(t){var n;(n=u.getLast(),n?n.content:e.toArray()).push(t)},r=function(t){c();var n,e=h.create(t.getValue()),r=(void 0===f[(n=t).getValue()]&&(f[n.getValue()]=o.isTokenNested(n)),f[n.getValue()]);a.push(e),r?u.push(e):l(e)},g=function(t){t.isStart()&&r(t),t.isEnd()&&function(t){c();var n=u.flushLast();if(n)l(n);else if(i.onError){var e=t.getValue(),r=t.getLine(),o=t.getColumn();i.onError({message:"Inconsistent tag '"+e+"' on line "+r+" and column "+o,tagName:e,lineNumber:r,columnNumber:o})}}(t)},p=function(t){var n=a.getLast(),e=t.getValue(),r=!!f[t];if(n)if(t.isAttrName())s.push(e),n.attr(s.getLast(),"");else if(t.isAttrValue()){var o=s.getLast();o?(n.attr(o,e),s.flushLast()):n.attr(e,e)}else t.isText()?r?n.append(e):l(e):t.isTag()&&l(""+t);else t.isText()?l(e):t.isTag()&&l(""+t)};(o=(n.createTokenizer?n.createTokenizer:P)(t,{onToken:function(t){var n;!t.isTag()||(n=t.getName(),i.onlyAllowTags&&i.onlyAllowTags.length&&i.onlyAllowTags.indexOf(n)<0)?p(t):g(t)},onlyAllowTags:i.onlyAllowTags,openTag:i.openTag,closeTag:i.closeTag,enableEscapeTags:i.enableEscapeTags})).tokenize();return e.toArray()};t.default=B,t.parse=B,t.TagNode=i,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -50,3 +50,3 @@ /* eslint-disable no-plusplus,no-param-reassign */ | ||
var RESERVED_CHARS = [closeTag, openTag, QUOTEMARK, BACKSLASH, SPACE, TAB, EQ, N, EM]; | ||
var NOT_CHAR_TOKENS = [].concat(options.enableEscapeTags ? [BACKSLASH] : [], [openTag, SPACE, TAB, N, BACKSLASH]); | ||
var NOT_CHAR_TOKENS = [].concat(options.enableEscapeTags ? [BACKSLASH] : [], [openTag, SPACE, TAB, N]); | ||
var WHITESPACES = [SPACE, TAB]; | ||
@@ -167,2 +167,6 @@ var SPECIAL_CHARS = [EQ, SPACE, TAB]; | ||
emitToken(createToken(TYPE_WORD, nextChar, row, col)); | ||
} else if (options.enableEscapeTags && currChar === BACKSLASH && nextChar === BACKSLASH) { | ||
bufferGrabber.skip(); // skip the first \ without emitting anything | ||
bufferGrabber.skip(); // skip past the second \ and emit it | ||
emitToken(createToken(TYPE_WORD, nextChar, row, col)); | ||
} else if (currChar === openTag) { | ||
@@ -169,0 +173,0 @@ bufferGrabber.skip(); // skip openTag |
@@ -56,3 +56,3 @@ 'use strict'; | ||
var RESERVED_CHARS = [closeTag, openTag, _char.QUOTEMARK, _char.BACKSLASH, _char.SPACE, _char.TAB, _char.EQ, _char.N, EM]; | ||
var NOT_CHAR_TOKENS = [].concat(options.enableEscapeTags ? [_char.BACKSLASH] : [], [openTag, _char.SPACE, _char.TAB, _char.N, _char.BACKSLASH]); | ||
var NOT_CHAR_TOKENS = [].concat(options.enableEscapeTags ? [_char.BACKSLASH] : [], [openTag, _char.SPACE, _char.TAB, _char.N]); | ||
var WHITESPACES = [_char.SPACE, _char.TAB]; | ||
@@ -173,2 +173,6 @@ var SPECIAL_CHARS = [_char.EQ, _char.SPACE, _char.TAB]; | ||
emitToken(createToken(_Token.TYPE_WORD, nextChar, row, col)); | ||
} else if (options.enableEscapeTags && currChar === _char.BACKSLASH && nextChar === _char.BACKSLASH) { | ||
bufferGrabber.skip(); // skip the first \ without emitting anything | ||
bufferGrabber.skip(); // skip past the second \ and emit it | ||
emitToken(createToken(_Token.TYPE_WORD, nextChar, row, col)); | ||
} else if (currChar === openTag) { | ||
@@ -175,0 +179,0 @@ bufferGrabber.skip(); // skip openTag |
{ | ||
"name": "@bbob/parser", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "Just parses BBcode to AST array. Part of @bbob bbcode parser", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -56,3 +56,3 @@ /* eslint-disable no-plusplus,no-param-reassign */ | ||
...(options.enableEscapeTags ? [BACKSLASH] : []), | ||
openTag, SPACE, TAB, N, BACKSLASH, | ||
openTag, SPACE, TAB, N, | ||
]; | ||
@@ -167,2 +167,6 @@ const WHITESPACES = [SPACE, TAB]; | ||
emitToken(createToken(TYPE_WORD, nextChar, row, col)); | ||
} else if (options.enableEscapeTags && currChar === BACKSLASH && nextChar === BACKSLASH) { | ||
bufferGrabber.skip(); // skip the first \ without emitting anything | ||
bufferGrabber.skip(); // skip past the second \ and emit it | ||
emitToken(createToken(TYPE_WORD, nextChar, row, col)); | ||
} else if (currChar === openTag) { | ||
@@ -169,0 +173,0 @@ bufferGrabber.skip(); // skip openTag |
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
146179
2856