xml-tokenizer 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/selector/TokenSelectState.js +1 -1
  3. package/dist/cjs/selector/TokenSelectStateMachine.js +1 -1
  4. package/dist/cjs/token-to-xml.js +1 -0
  5. package/dist/cjs/tokenizer/XmlStream.js +1 -1
  6. package/dist/cjs/tokenizer/ascii-constants.js +1 -0
  7. package/dist/cjs/tokenizer/tokenize.js +1 -1
  8. package/dist/cjs/tokenizer/utils.js +1 -1
  9. package/dist/cjs/tokens-to-xml.js +1 -1
  10. package/dist/esm/index.js +1 -1
  11. package/dist/esm/selector/TokenSelectState.js +1 -1
  12. package/dist/esm/selector/TokenSelectStateMachine.js +1 -1
  13. package/dist/esm/token-to-xml.js +1 -0
  14. package/dist/esm/tokenizer/XmlStream.js +1 -1
  15. package/dist/esm/tokenizer/ascii-constants.js +1 -0
  16. package/dist/esm/tokenizer/tokenize.js +1 -1
  17. package/dist/esm/tokenizer/utils.js +1 -1
  18. package/dist/esm/tokens-to-xml.js +1 -1
  19. package/dist/types/get-q-name.d.ts +5 -0
  20. package/dist/types/get-q-name.d.ts.map +1 -1
  21. package/dist/types/index.d.ts +1 -0
  22. package/dist/types/index.d.ts.map +1 -1
  23. package/dist/types/selector/TokenSelectState.d.ts +3 -3
  24. package/dist/types/selector/TokenSelectState.d.ts.map +1 -1
  25. package/dist/types/selector/TokenSelectStateMachine.d.ts +1 -2
  26. package/dist/types/selector/TokenSelectStateMachine.d.ts.map +1 -1
  27. package/dist/types/selector/types.d.ts +40 -30
  28. package/dist/types/selector/types.d.ts.map +1 -1
  29. package/dist/types/token-to-xml.d.ts +3 -0
  30. package/dist/types/token-to-xml.d.ts.map +1 -0
  31. package/dist/types/tokenizer/XmlStream.d.ts +1 -1
  32. package/dist/types/tokenizer/XmlStream.d.ts.map +1 -1
  33. package/dist/types/tokenizer/ascii-constants.d.ts +33 -0
  34. package/dist/types/tokenizer/ascii-constants.d.ts.map +1 -0
  35. package/dist/types/tokenizer/index.d.ts +1 -0
  36. package/dist/types/tokenizer/index.d.ts.map +1 -1
  37. package/dist/types/tokenizer/tokenize.d.ts.map +1 -1
  38. package/dist/types/tokenizer/utils.d.ts +0 -32
  39. package/dist/types/tokenizer/utils.d.ts.map +1 -1
  40. package/dist/types/tokens-to-xml.d.ts +0 -1
  41. package/dist/types/tokens-to-xml.d.ts.map +1 -1
  42. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("./selector/select.js"),r=require("./selector/TokenSelector.js"),E=require("./selector/TokenSelectState.js"),R=require("./selector/TokenSelectStateMachine.js"),S=require("./tokenizer/tokenize.js"),e=require("./tokenizer/utils.js"),T=require("./tokenizer/XmlError.js"),i=require("./tokenizer/XmlStream.js"),A=require("./tokens-to-xml.js"),a=require("./xml-to-object.js");exports.select=t.select,exports.TokenSelector=r.TokenSelector,exports.EToCacheNodeProps=E.EToCacheNodeProps,exports.ETokenMatchCriteria=E.ETokenMatchCriteria,exports.TokenSelectState=E.TokenSelectState,exports.TokenSelectStateMachine=R.TokenSelectStateMachine,exports.tokenize=S.tokenize,exports.tokenizeXmlStream=S.tokenizeXmlStream,exports.AMPERSAND=e.AMPERSAND,exports.CARRIAGE_RETURN=e.CARRIAGE_RETURN,exports.COLON=e.COLON,exports.DOUBLE_QUOTE=e.DOUBLE_QUOTE,exports.EQUALS=e.EQUALS,exports.EXCLAMATION_MARK=e.EXCLAMATION_MARK,exports.GREATER_THAN=e.GREATER_THAN,exports.HASH=e.HASH,exports.HORIZONTAL_TAB=e.HORIZONTAL_TAB,exports.HYPHEN=e.HYPHEN,exports.LESS_THAN=e.LESS_THAN,exports.LINE_FEED=e.LINE_FEED,exports.LOWERCASE_A=e.LOWERCASE_A,exports.LOWERCASE_F=e.LOWERCASE_F,exports.LOWERCASE_X=e.LOWERCASE_X,exports.LOWERCASE_Z=e.LOWERCASE_Z,exports.NINE=e.NINE,exports.OPEN_BRACKET=e.OPEN_BRACKET,exports.PERCENT=e.PERCENT,exports.PERIOD=e.PERIOD,exports.QUESTION_MARK=e.QUESTION_MARK,exports.SEMICOLON=e.SEMICOLON,exports.SINGLE_QUOTE=e.SINGLE_QUOTE,exports.SLASH=e.SLASH,exports.SPACE=e.SPACE,exports.UNDERSCORE=e.UNDERSCORE,exports.UPPERCASE_A=e.UPPERCASE_A,exports.UPPERCASE_F=e.UPPERCASE_F,exports.UPPERCASE_P=e.UPPERCASE_P,exports.UPPERCASE_S=e.UPPERCASE_S,exports.UPPERCASE_Z=e.UPPERCASE_Z,exports.ZERO=e.ZERO,exports.isAsciiDigit=e.isAsciiDigit,exports.isXmlChar=e.isXmlChar,exports.isXmlName=e.isXmlName,exports.isXmlNameByte=e.isXmlNameByte,exports.isXmlNameStart=e.isXmlNameStart,exports.isXmlSpaceByte=e.isXmlSpaceByte,exports.XmlError=T.XmlError,exports.XmlStream=i.XmlStream,exports.tokenToXml=A.tokenToXml,exports.tokensToXml=A.tokensToXml,exports.xmlToObject=a.xmlToObject;
1
+ "use strict";var t=require("./selector/select.js"),A=require("./selector/TokenSelector.js"),S=require("./selector/TokenSelectState.js"),R=require("./selector/TokenSelectStateMachine.js"),i=require("./token-to-xml.js"),e=require("./tokenizer/ascii-constants.js"),r=require("./tokenizer/tokenize.js"),E=require("./tokenizer/utils.js"),a=require("./tokenizer/XmlError.js"),T=require("./tokenizer/XmlStream.js"),o=require("./tokens-to-xml.js"),N=require("./xml-to-object.js");exports.select=t.select,exports.TokenSelector=A.TokenSelector,exports.EToCacheNodeProps=S.EToCacheNodeProps,exports.ETokenMatchCriteria=S.ETokenMatchCriteria,exports.TokenSelectState=S.TokenSelectState,exports.TokenSelectStateMachine=R.TokenSelectStateMachine,exports.tokenToXml=i.tokenToXml,exports.AMPERSAND=e.AMPERSAND,exports.CARRIAGE_RETURN=e.CARRIAGE_RETURN,exports.COLON=e.COLON,exports.DOUBLE_QUOTE=e.DOUBLE_QUOTE,exports.EQUALS=e.EQUALS,exports.EXCLAMATION_MARK=e.EXCLAMATION_MARK,exports.GREATER_THAN=e.GREATER_THAN,exports.HASH=e.HASH,exports.HORIZONTAL_TAB=e.HORIZONTAL_TAB,exports.HYPHEN=e.HYPHEN,exports.LESS_THAN=e.LESS_THAN,exports.LINE_FEED=e.LINE_FEED,exports.LOWERCASE_A=e.LOWERCASE_A,exports.LOWERCASE_F=e.LOWERCASE_F,exports.LOWERCASE_X=e.LOWERCASE_X,exports.LOWERCASE_Z=e.LOWERCASE_Z,exports.NINE=e.NINE,exports.OPEN_BRACKET=e.OPEN_BRACKET,exports.PERCENT=e.PERCENT,exports.PERIOD=e.PERIOD,exports.QUESTION_MARK=e.QUESTION_MARK,exports.SEMICOLON=e.SEMICOLON,exports.SINGLE_QUOTE=e.SINGLE_QUOTE,exports.SLASH=e.SLASH,exports.SPACE=e.SPACE,exports.UNDERSCORE=e.UNDERSCORE,exports.UPPERCASE_A=e.UPPERCASE_A,exports.UPPERCASE_F=e.UPPERCASE_F,exports.UPPERCASE_P=e.UPPERCASE_P,exports.UPPERCASE_S=e.UPPERCASE_S,exports.UPPERCASE_Z=e.UPPERCASE_Z,exports.ZERO=e.ZERO,exports.tokenize=r.tokenize,exports.tokenizeXmlStream=r.tokenizeXmlStream,exports.isAsciiDigit=E.isAsciiDigit,exports.isXmlChar=E.isXmlChar,exports.isXmlName=E.isXmlName,exports.isXmlNameByte=E.isXmlNameByte,exports.isXmlNameStart=E.isXmlNameStart,exports.isXmlSpaceByte=E.isXmlSpaceByte,exports.XmlError=a.XmlError,exports.XmlStream=T.XmlStream,exports.tokensToXml=o.tokensToXml,exports.xmlToObject=N.xmlToObject;
@@ -1 +1 @@
1
- "use strict";var l=require("../get-q-name.js"),n=Object.defineProperty,o=(t,e,a)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,r=(t,e,a)=>o(t,typeof e!="symbol"?e+"":e,a);class c{constructor(e){r(this,"_part"),r(this,"_matchCriteria",0),r(this,"_toCacheNodeProps",0),r(this,"_enteredDepth",null),this._part=e,this.applyLevels()}get matchCriteria(){return this._matchCriteria}get toCacheNodeProps(){return this._toCacheNodeProps}get enteredDepth(){return this._enteredDepth}applyLevels(){let e=0,a=0;(this._part.local!=null||this._part.prefix!=null)&&(e|=1),this._part.attributes!=null&&(e|=2,a|=2),this._part.textContains!=null&&(e|=4),this._part.predicate!=null&&(e|=8,a|=7),this._matchCriteria=e,this._toCacheNodeProps=a}matchesName(e,a){return(this._part.local==null||this._part.local==="*"||this._part.local===e)&&(this._part.prefix==null||this._part.prefix===a)}matchesAttributes(e){if(this._part.attributes!=null)for(const a of this._part.attributes){const s=l.getQName(a.local,a.prefix);if(!(s in e)||a.value!=null&&e[s]!==a.value)return!1}return!0}matchesText(e){return this._part.textContains==null||e.includes(this._part.textContains)}matchesDepth(e,a){switch(this._part.axis){case"child":return e===a+1;case"self-or-descendant":return e>=a}}match(e){this._enteredDepth=e}unmatch(){this._enteredDepth=null}}var i=(t=>(t[t.None=0]="None",t[t.Name=1]="Name",t[t.Attributes=2]="Attributes",t[t.Text=4]="Text",t))(i||{}),h=(t=>(t[t.None=0]="None",t[t.Name=1]="Name",t[t.Attributes=2]="Attributes",t[t.Text=4]="Text",t[t.Node=8]="Node",t))(h||{});exports.EToCacheNodeProps=i,exports.ETokenMatchCriteria=h,exports.TokenSelectState=c;
1
+ "use strict";var h=require("../get-q-name.js"),l=Object.defineProperty,o=(e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,r=(e,t,s)=>o(e,typeof t!="symbol"?t+"":t,s);class c{constructor(t){r(this,"_segment"),r(this,"_matchCriteria",0),r(this,"_toCacheNodeProps",0),r(this,"_enteredDepth",null),this._segment=t,this.applyLevels()}get matchCriteria(){return this._matchCriteria}get toCacheNodeProps(){return this._toCacheNodeProps}get enteredDepth(){return this._enteredDepth}applyLevels(){let t=0,s=0;(this._segment.local!=null||this._segment.prefix!=null)&&(t|=1),this._segment.attributes!=null&&(t|=2,s|=2),this._segment.containsText!=null&&(t|=4),this._segment.predicate!=null&&(t|=8,s|=7),this._matchCriteria=t,this._toCacheNodeProps=s}matchesName(t,s){return(this._segment.local==null||this._segment.local==="*"||this._segment.local===t)&&(this._segment.prefix==null||this._segment.prefix===s)}matchesAttributes(t){if(this._segment.attributes!=null)for(const s of this._segment.attributes){const i=h.getQName(s.local,s.prefix);if(!(i in t)||s.value!=null&&t[i]!==s.value)return!1}return!0}matchesText(t){return this._segment.containsText==null||t.includes(this._segment.containsText)}matchesDepth(t,s){switch(this._segment.axis){case"child":return t===s+1;case"self-or-descendant":return t>=s}}match(t){this._enteredDepth=t}unmatch(){this._enteredDepth=null}}var a=(e=>(e[e.None=0]="None",e[e.Name=1]="Name",e[e.Attributes=2]="Attributes",e[e.Text=4]="Text",e))(a||{}),n=(e=>(e[e.None=0]="None",e[e.Name=1]="Name",e[e.Attributes=2]="Attributes",e[e.Text=4]="Text",e[e.Node=8]="Node",e))(n||{});exports.EToCacheNodeProps=a,exports.ETokenMatchCriteria=n,exports.TokenSelectState=c;
@@ -1 +1 @@
1
- "use strict";var d=require("../get-q-name.js"),s=require("./TokenSelectState.js"),_=Object.defineProperty,C=(o,t,e)=>t in o?_(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,i=(o,t,e)=>C(o,typeof t!="symbol"?t+"":t,e);class p{constructor(t){i(this,"_states"),i(this,"_currentState",null),i(this,"_hasActiveCache",!1),i(this,"_toCacheNodeProps",s.EToCacheNodeProps.None),i(this,"_cachedNodeProps",{prefix:null,local:null,attributes:null,text:null}),i(this,"_cachedTokens",[]),i(this,"_toRecordTokens",[]),this._states=t.map(e=>new s.TokenSelectState(e))}getNextState(){var t;const e=this._currentState!=null?this._currentState+1:0;return e<this._states.length&&(t=this._states[e])!=null?t:null}getCurrentState(){var t;return this._currentState!=null&&this._currentState<this._states.length&&(t=this._states[this._currentState])!=null?t:null}record(t){this._hasActiveCache&&this._cachedTokens.push(t)}takeRecordedTokens(){if(this._toRecordTokens.length>0){const t=this._toRecordTokens;return this._toRecordTokens=[],t}return null}transitionIfNameMatch(t,e,r){var a;const h=this.getNextState(),n=this.getCurrentState();return h!=null&&h.matchesName(t,e)&&h.matchesDepth(r,(a=n==null?void 0:n.enteredDepth)!=null?a:0)?h.matchCriteria&(s.ETokenMatchCriteria.Attributes|s.ETokenMatchCriteria.Text|s.ETokenMatchCriteria.Node)?(this._hasActiveCache=!0,this._toCacheNodeProps|=h.toCacheNodeProps,this._toCacheNodeProps&s.EToCacheNodeProps.Name&&(this._cachedNodeProps.local=t,this._cachedNodeProps.prefix=e),!1):(this.transitionForward(r),!0):!1}transitionIfAttributesMatch(t,e,r,a){var h,n;const c=this.getNextState(),u=this.getCurrentState(),l=(h=this._cachedNodeProps.attributes)!=null?h:{};return l[d.getQName(t,e)]=r,c!=null&&c.matchesAttributes(l)&&c.matchesDepth(a,(n=u==null?void 0:u.enteredDepth)!=null?n:0)?c.matchCriteria&(s.ETokenMatchCriteria.Text|s.ETokenMatchCriteria.Node)?(this._hasActiveCache=!0,this._toCacheNodeProps|=c.toCacheNodeProps,this._toCacheNodeProps&s.EToCacheNodeProps.Attributes&&(this._cachedNodeProps.attributes=l),!1):(this.transitionForward(a),!0):!1}transitionIfTextMatch(t,e){var r;const a=this.getNextState(),h=this.getCurrentState();return a!=null&&a.matchesText(t)&&a.matchesDepth(e,(r=h==null?void 0:h.enteredDepth)!=null?r:0)?a.matchCriteria&s.ETokenMatchCriteria.Node?(this._hasActiveCache=!0,this._toCacheNodeProps|=a.toCacheNodeProps,this._toCacheNodeProps&s.EToCacheNodeProps.Text&&(this._cachedNodeProps.text=t),!1):(this.transitionForward(e),!0):!1}transitionForward(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState+1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.isFinalState()&&(this._toRecordTokens=this._cachedTokens),this.resetCurrentStateCache()}transitionBack(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState-1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.resetCurrentStateCache()}isFinalState(){return this._currentState!=null&&this._currentState>=this._states.length-1}resetCurrentStateCache(){this._hasActiveCache=!1,this._toCacheNodeProps=s.EToCacheNodeProps.None,this._cachedNodeProps.prefix=null,this._cachedNodeProps.local=null,this._cachedNodeProps.attributes=null,this._cachedNodeProps.text=null,this._cachedTokens=[]}}exports.TokenSelectStateMachine=p;
1
+ "use strict";var d=require("../get-q-name.js"),n=require("./TokenSelectState.js"),_=Object.defineProperty,S=(i,t,e)=>t in i?_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,c=(i,t,e)=>S(i,typeof t!="symbol"?t+"":t,e);class p{constructor(t){c(this,"_states"),c(this,"_currentState",null),c(this,"_cachedNodeProps",{prefix:null,local:null,attributes:null,text:null}),c(this,"_cachedTokens",[]),c(this,"_toRecordTokens",[]),this._states=t.map(e=>new n.TokenSelectState(e))}getNextState(){var t;const e=this._currentState!=null?this._currentState+1:0;return e<this._states.length&&(t=this._states[e])!=null?t:null}getCurrentState(){var t;return this._currentState!=null&&this._currentState<this._states.length&&(t=this._states[this._currentState])!=null?t:null}record(t){this.getOffsetToFinal()<=1&&this._cachedTokens.push(t)}takeRecordedTokens(){if(this._toRecordTokens.length>0){const t=this._toRecordTokens;return this._toRecordTokens=[],t}return null}transitionIfNameMatch(t,e,r){var s;const a=this.getNextState(),h=this.getCurrentState();return a==null?!1:(a.toCacheNodeProps&n.EToCacheNodeProps.Name&&(this._cachedNodeProps.local=t,this._cachedNodeProps.prefix=e),a.matchesName(t,e)&&a.matchesDepth(r,(s=h==null?void 0:h.enteredDepth)!=null?s:0)&&!(a.matchCriteria&(n.ETokenMatchCriteria.Attributes|n.ETokenMatchCriteria.Text|n.ETokenMatchCriteria.Node))?(this.transitionForward(r),!0):!1)}transitionIfAttributesMatch(t,e,r,s){var a,h;const o=this.getNextState(),u=this.getCurrentState();if(o==null)return!1;const l=(a=this._cachedNodeProps.attributes)!=null?a:{};return l[d.getQName(t,e)]=r,o.toCacheNodeProps&n.EToCacheNodeProps.Attributes&&(this._cachedNodeProps.attributes=l),o.matchesAttributes(l)&&o.matchesDepth(s,(h=u==null?void 0:u.enteredDepth)!=null?h:0)&&!(o.matchCriteria&(n.ETokenMatchCriteria.Text|n.ETokenMatchCriteria.Node))?(this.transitionForward(s),!0):!1}transitionIfTextMatch(t,e){var r;const s=this.getNextState(),a=this.getCurrentState();return s==null?!1:(s.toCacheNodeProps&n.EToCacheNodeProps.Text&&(this._cachedNodeProps.text=t),s.matchesText(t)&&s.matchesDepth(e,(r=a==null?void 0:a.enteredDepth)!=null?r:0)&&!(s.matchCriteria&n.ETokenMatchCriteria.Node)?(this.transitionForward(e),!0):!1)}transitionForward(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState+1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.isFinalState()&&(this._toRecordTokens=this._cachedTokens),this.resetCurrentStateCache()}transitionBack(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState-1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.resetCurrentStateCache()}isFinalState(){return this._currentState!=null&&this._currentState>=this._states.length-1}getOffsetToFinal(){return this._currentState==null?this._states.length:this._states.length-1-this._currentState}resetCurrentStateCache(){this._cachedNodeProps.prefix=null,this._cachedNodeProps.local=null,this._cachedNodeProps.attributes=null,this._cachedNodeProps.text=null,this._cachedTokens=[]}}exports.TokenSelectStateMachine=p;
@@ -0,0 +1 @@
1
+ "use strict";function n(t){let e="";switch(t.type){case"ProcessingInstruction":e+=`<?${t.target}`,t.content&&(e+=` ${t.content}`),e+="?>";break;case"Comment":e+=`<!--${t.text}-->`;break;case"EntityDeclaration":e+=`<!ENTITY ${t.name} "${t.definition}">`;break;case"ElementStart":e+=`<${t.prefix.length>0?`${t.prefix}:`:""}${t.local}`;break;case"Attribute":e+=` ${t.prefix.length>0?`${t.prefix}:`:""}${t.local}="${t.value}"`;break;case"ElementEnd":t.end.type==="Open"?e+=">":t.end.type==="Close"?e+=`</${t.end.prefix.length>0?`${t.end.prefix}:`:""}${t.end.local}>`:e+="/>";break;case"Text":e+=t.text;break;case"Cdata":e+=`<![CDATA[${t.text}]]>`;break}return e}exports.tokenToXml=n;
@@ -1 +1 @@
1
- "use strict";var s=require("./utils.js"),o=require("./XmlError.js"),u=Object.defineProperty,m=(h,t,e)=>t in h?u(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e,l=(h,t,e)=>m(h,typeof t!="symbol"?t+"":t,e);class c{constructor(t,e=0){l(this,"_text"),l(this,"_pos"),l(this,"_end"),this._text=t,this._pos=e,this._end=this._text.length}clone(){return new c(this._text,this._pos)}getPos(){return this._pos}atEnd(){return this._pos>=this._end}currCodeUnit(){if(this._pos>=this._end)throw new o.XmlError({type:"UnexpectedEndOfStream"});return this._text.charCodeAt(this._pos)}currCodeUnitUnchecked(){return this._text.charCodeAt(this._pos)}nextCodeUnit(){if(this._pos+1>=this._end)throw new o.XmlError({type:"UnexpectedEndOfStream"});return this._text.charCodeAt(this._pos+1)}advance(t){this._pos+=t}goTo(t){this._pos=t}startsWith(t){return this._text.startsWith(t,this._pos)}consumeCodeUnit(t){const e=this.currCodeUnit();if(e!==t)throw new o.XmlError({type:"InvalidChar",expected:t,actual:e},this.genTextPos());this._pos+=1}tryConsumeCodeUnit(t){return this.currCodeUnit()===t?(this._pos+=1,!0):!1}skipString(t){if(!this.startsWith(t))throw new o.XmlError({type:"InvalidString",expected:t},this.genTextPos());this._pos+=t.length}consumeCodeUnitsWhile(t){const e=this._pos;return this.skipCodeUnitsWhile(t),this.sliceBack(e)}skipCodeUnitsWhile(t){for(;this._pos<this._end&&t(this.currCodeUnitUnchecked());)this._pos+=1}consumeCharsWhile(t){const e=this._pos;return this.skipCharsWhile(t),this.sliceBack(e)}skipCharsWhile(t){for(;this._pos<this._end;){const e=this._text[this._pos];if(e==null||!s.isXmlChar(e.codePointAt(0)))throw new o.XmlError({type:"NonXmlChar",char:e!=null?e:"\uFFFD"},this.genTextPos());if(t(this,e))this._pos+=e.length;else break}}sliceBack(t){return this._text.slice(t,this._pos)}rangeFrom(t){return{start:t,end:this._pos}}skipSpaces(){for(;this.startsWithSpace();)this._pos+=1}startsWithSpace(){return this._pos<this._end&&s.isXmlSpaceByte(this.currCodeUnitUnchecked())}consumeSpaces(){if(this._pos>=this._end)throw new o.XmlError({type:"UnexpectedEndOfStream"},this.genTextPos());if(!this.startsWithSpace())throw new o.XmlError({type:"InvalidChar",expected:"a whitespace",actual:this.currCodeUnitUnchecked()},this.genTextPos());this.skipSpaces()}tryConsumeReference(){const t=this._pos,e=this.clone(),r=e.consumeReference();return r!=null?(this._pos+=e.getPos()-t,r):null}consumeReference(){if(!this.tryConsumeCodeUnit(s.AMPERSAND))return null;let t;if(this.tryConsumeCodeUnit(s.HASH)){let e,r;this.tryConsumeCodeUnit(s.LOWERCASE_X)?(e=this.consumeCodeUnitsWhile(i=>i>=s.ZERO&&i<=s.NINE||i>=s.UPPERCASE_A&&i<=s.UPPERCASE_F||i>=s.LOWERCASE_A&&i<=s.LOWERCASE_F),r=16):(e=this.consumeCodeUnitsWhile(i=>s.isAsciiDigit(i)),r=10);const n=parseInt(e,r);isNaN(n)||!s.isXmlChar(n)?t=null:t={type:"Char",value:String.fromCodePoint(n)}}else{const e=this.consumeName();switch(e){case"quot":t={type:"Char",value:'"'};break;case"amp":t={type:"Char",value:"&"};break;case"apos":t={type:"Char",value:"'"};break;case"lt":t={type:"Char",value:"<"};break;case"gt":t={type:"Char",value:">"};break;default:t={type:"Entity",value:e}}}return this.tryConsumeCodeUnit(s.SEMICOLON)?t:null}consumeName(){const t=this._pos;this.skipName();const e=this.sliceBack(t);if(e.length===0)throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(t));return e}skipName(){const t=this._pos;for(;this._pos<this._end;){const e=this.currCodeUnitUnchecked();if(this._pos===t){if(!s.isXmlNameStart(e))throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(t))}else if(!s.isXmlName(e))break;this._pos+=1}}consumeQName(){var t,e;const r=this._pos;let n=null;for(;this._pos<this._end;){const p=this.currCodeUnitUnchecked();if(p===s.COLON)if(n==null)n=this._pos,this._pos+=1;else throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(r));else if(s.isXmlName(p))this._pos+=1;else break}let i,a;if(n!=null?(i=this._text.slice(r,n),a=this.sliceBack(n+1)):(i="",a=this.sliceBack(r)),i.length>0&&!s.isXmlNameStart((t=i[0])==null?void 0:t.codePointAt(0)))throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(r));if(a.length>0){if(!s.isXmlNameStart((e=a[0])==null?void 0:e.codePointAt(0)))throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(r))}else throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(r));return[i,a]}consumeQuote(){const t=this.currCodeUnit();if(t===s.SINGLE_QUOTE||t===s.DOUBLE_QUOTE)return this._pos+=1,t;throw new o.XmlError({type:"InvalidChar",expected:"a quote",actual:t},this.genTextPos())}genTextPos(){return this.genTextPosFrom(this._pos)}genTextPosFrom(t){const e=Math.min(t,this._end);let r=1,n=1;for(let i=0;i<e;i++)this._text.charCodeAt(i)===s.LINE_FEED?(r++,n=1):n++;return{row:r,col:n}}}exports.XmlStream=c;
1
+ "use strict";var r=require("./ascii-constants.js"),h=require("./utils.js"),o=require("./XmlError.js"),m=Object.defineProperty,d=(a,t,e)=>t in a?m(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,c=(a,t,e)=>d(a,typeof t!="symbol"?t+"":t,e);class p{constructor(t,e=0){c(this,"_text"),c(this,"_pos"),c(this,"_end"),this._text=t,this._pos=e,this._end=this._text.length}clone(){return new p(this._text,this._pos)}getPos(){return this._pos}atEnd(){return this._pos>=this._end}currCodeUnit(){if(this._pos>=this._end)throw new o.XmlError({type:"UnexpectedEndOfStream"});return this._text.charCodeAt(this._pos)}currCodeUnitUnchecked(){return this._text.charCodeAt(this._pos)}nextCodeUnit(){if(this._pos+1>=this._end)throw new o.XmlError({type:"UnexpectedEndOfStream"});return this._text.charCodeAt(this._pos+1)}advance(t){this._pos+=t}goTo(t){this._pos=t}startsWith(t){return this._text.startsWith(t,this._pos)}consumeCodeUnit(t){const e=this.currCodeUnit();if(e!==t)throw new o.XmlError({type:"InvalidChar",expected:t,actual:e},this.genTextPos());this._pos+=1}tryConsumeCodeUnit(t){return this.currCodeUnit()===t?(this._pos+=1,!0):!1}skipString(t){if(!this.startsWith(t))throw new o.XmlError({type:"InvalidString",expected:t},this.genTextPos());this._pos+=t.length}consumeCodeUnitsWhile(t){const e=this._pos;return this.skipCodeUnitsWhile(t),this.sliceBack(e)}skipCodeUnitsWhile(t){for(;this._pos<this._end&&t(this.currCodeUnitUnchecked());)this._pos+=1}consumeCharsWhile(t){const e=this._pos;return this.skipCharsWhile(t),this.sliceBack(e)}skipCharsWhile(t){for(;this._pos<this._end;){const e=this._text[this._pos];if(e==null||!h.isXmlChar(e.codePointAt(0)))throw new o.XmlError({type:"NonXmlChar",char:e!=null?e:"\uFFFD"},this.genTextPos());if(t(this,e))this._pos+=e.length;else break}}sliceBack(t){return this._text.slice(t,this._pos)}rangeFrom(t){return{start:t,end:this._pos}}skipSpaces(){for(;this.startsWithSpace();)this._pos+=1}startsWithSpace(){return this._pos<this._end&&h.isXmlSpaceByte(this.currCodeUnitUnchecked())}consumeSpaces(){if(this._pos>=this._end)throw new o.XmlError({type:"UnexpectedEndOfStream"},this.genTextPos());if(!this.startsWithSpace())throw new o.XmlError({type:"InvalidChar",expected:"a whitespace",actual:this.currCodeUnitUnchecked()},this.genTextPos());this.skipSpaces()}tryConsumeReference(){const t=this._pos,e=this.clone(),i=e.consumeReference();return i!=null?(this._pos+=e.getPos()-t,i):null}consumeReference(){if(!this.tryConsumeCodeUnit(r.AMPERSAND))return null;let t;if(this.tryConsumeCodeUnit(r.HASH)){let e,i;this.tryConsumeCodeUnit(r.LOWERCASE_X)?(e=this.consumeCodeUnitsWhile(s=>s>=r.ZERO&&s<=r.NINE||s>=r.UPPERCASE_A&&s<=r.UPPERCASE_F||s>=r.LOWERCASE_A&&s<=r.LOWERCASE_F),i=16):(e=this.consumeCodeUnitsWhile(s=>h.isAsciiDigit(s)),i=10);const n=parseInt(e,i);isNaN(n)||!h.isXmlChar(n)?t=null:t={type:"Char",value:String.fromCodePoint(n)}}else{const e=this.consumeName();switch(e){case"quot":t={type:"Char",value:'"'};break;case"amp":t={type:"Char",value:"&"};break;case"apos":t={type:"Char",value:"'"};break;case"lt":t={type:"Char",value:"<"};break;case"gt":t={type:"Char",value:">"};break;default:t={type:"Entity",value:e}}}return this.tryConsumeCodeUnit(r.SEMICOLON)?t:null}consumeName(){const t=this._pos;this.skipName();const e=this.sliceBack(t);if(e.length===0)throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(t));return e}skipName(){const t=this._pos;for(;this._pos<this._end;){const e=this.currCodeUnitUnchecked();if(this._pos===t){if(!h.isXmlNameStart(e))throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(t))}else if(!h.isXmlName(e))break;this._pos+=1}}consumeQName(){var t,e;const i=this._pos;let n=null;for(;this._pos<this._end;){const u=this.currCodeUnitUnchecked();if(u===r.COLON)if(n==null)n=this._pos,this._pos+=1;else throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(i));else if(h.isXmlName(u))this._pos+=1;else break}let s,l;if(n!=null?(s=this._text.slice(i,n),l=this.sliceBack(n+1)):(s="",l=this.sliceBack(i)),s.length>0&&!h.isXmlNameStart((t=s[0])==null?void 0:t.codePointAt(0)))throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(i));if(l.length>0){if(!h.isXmlNameStart((e=l[0])==null?void 0:e.codePointAt(0)))throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(i))}else throw new o.XmlError({type:"InvalidName"},this.genTextPosFrom(i));return[s,l]}consumeQuote(){const t=this.currCodeUnit();if(t===r.SINGLE_QUOTE||t===r.DOUBLE_QUOTE)return this._pos+=1,t;throw new o.XmlError({type:"InvalidChar",expected:"a quote",actual:t},this.genTextPos())}genTextPos(){return this.genTextPosFrom(this._pos)}genTextPosFrom(t){const e=Math.min(t,this._end);let i=1,n=1;for(let s=0;s<e;s++)this._text.charCodeAt(s)===r.LINE_FEED?(i++,n=1):n++;return{row:i,col:n}}}exports.XmlStream=p;
@@ -0,0 +1 @@
1
+ "use strict";const E=9,A=10,R=13,S=32,O=33,_=34,C=35,N=37,P=38,L=39,T=45,U=46,I=47,H=48,D=57,M=58,Q=59,W=60,Z=61,B=62,F=63,G=65,K=70,X=80,s=83,t=90,Y=91,c=95,e=97,i=102,n=120,o=122;exports.AMPERSAND=38,exports.CARRIAGE_RETURN=13,exports.COLON=58,exports.DOUBLE_QUOTE=34,exports.EQUALS=61,exports.EXCLAMATION_MARK=33,exports.GREATER_THAN=62,exports.HASH=35,exports.HORIZONTAL_TAB=9,exports.HYPHEN=45,exports.LESS_THAN=60,exports.LINE_FEED=10,exports.LOWERCASE_A=97,exports.LOWERCASE_F=102,exports.LOWERCASE_X=120,exports.LOWERCASE_Z=122,exports.NINE=57,exports.OPEN_BRACKET=91,exports.PERCENT=37,exports.PERIOD=46,exports.QUESTION_MARK=63,exports.SEMICOLON=59,exports.SINGLE_QUOTE=39,exports.SLASH=47,exports.SPACE=32,exports.UNDERSCORE=95,exports.UPPERCASE_A=65,exports.UPPERCASE_F=70,exports.UPPERCASE_P=80,exports.UPPERCASE_S=83,exports.UPPERCASE_Z=90,exports.ZERO=48;
@@ -1 +1 @@
1
- "use strict";var r=require("./utils.js"),i=require("./XmlError.js"),P=require("./XmlStream.js");function w(t,n,s){T(new P.XmlStream(t),n,s)}function T(t,n,s){if(t.startsWith("\uFEFF")&&t.advance(1),t.startsWith("<?xml ")&&A(t),m(t,s),t.skipSpaces(),t.startsWith("<!DOCTYPE")){if(!n)throw new i.XmlError({type:"DtdDetected"});W(t,s),m(t,s)}if(t.skipSpaces(),!t.atEnd()&&t.currCodeUnit()===r.LESS_THAN&&S(t,s),m(t,s),!t.atEnd())throw new i.XmlError({type:"UnknownToken",message:"Not at end"},t.genTextPos())}function m(t,n){for(;!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!--"))h(t,n);else if(t.startsWith("<?"))f(t,n);else break}function A(t){if(t.advance(5),E(t),!t.startsWith("version"))throw new i.XmlError({type:"InvalidString",expected:"version"},t.genTextPos());d(t),E(t),t.startsWith("encoding")&&(d(t),E(t)),t.startsWith("standalone")&&d(t),t.skipSpaces(),t.skipString("?>")}function E(t){if(t.startsWithSpace())t.skipSpaces();else if(!t.startsWith("?>")&&!t.atEnd())throw new i.XmlError({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos())}function h(t,n){const s=t.getPos();t.advance(4);const o=t.consumeCharsWhile((e,a)=>!(a==="-"&&e.startsWith("-->")));if(t.skipString("-->"),o.includes("--")||o.endsWith("-"))throw new i.XmlError({type:"InvalidComment"},t.genTextPosFrom(s));n({type:"Comment",text:o,range:t.rangeFrom(s)})}function f(t,n){if(t.startsWith("<?xml "))throw new i.XmlError({type:"UnexpectedDeclaration"},t.genTextPos());const s=t.getPos();t.advance(2);const o=t.consumeName();t.skipSpaces();const e=t.consumeCharsWhile((a,c)=>!(c==="?"&&a.startsWith("?>")));t.skipString("?>"),n({type:"ProcessingInstruction",target:o,content:e.length===0?void 0:e,range:t.rangeFrom(s)})}function W(t,n){const s=t.getPos();if(v(t),t.skipSpaces(),t.currCodeUnit()===r.GREATER_THAN){t.advance(1);return}for(t.advance(1);!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!ENTITY"))y(t,n);else if(t.startsWith("<!--"))h(t,n);else if(t.startsWith("<?"))f(t,n);else if(t.startsWith("]"))if(t.advance(1),t.skipSpaces(),t.currCodeUnit()===r.GREATER_THAN){t.advance(1);break}else throw new i.XmlError({type:"InvalidChar",expected:"'>'",actual:t.currCodeUnitUnchecked()},t.genTextPos());else if(t.startsWith("<!ELEMENT")||t.startsWith("<!ATTLIST")||t.startsWith("<!NOTATION"))try{N(t)}catch(o){throw new i.XmlError({type:"UnknownToken",message:"Failed to consume declaration"},t.genTextPosFrom(s))}else throw new i.XmlError({type:"UnknownToken",message:"Failed to parse doctype"},t.genTextPos())}function v(t){t.advance(9),t.consumeSpaces(),t.skipName(),t.skipSpaces(),g(t),t.skipSpaces();const n=t.currCodeUnit();if(n!==r.OPEN_BRACKET&&n!==r.GREATER_THAN)throw new i.XmlError({type:"InvalidChar",expected:"'[' or '>'",actual:n},t.genTextPos())}function g(t){if(t.startsWith("SYSTEM")||t.startsWith("PUBLIC")){const n=t.getPos();t.advance(6);const s=t.sliceBack(n);t.consumeSpaces();const o=t.consumeQuote();if(t.consumeCodeUnitsWhile(e=>e!==o),t.consumeCodeUnit(o),s==="PUBLIC"){t.consumeSpaces();const e=t.consumeQuote();t.consumeCodeUnitsWhile(a=>a!==e),t.consumeCodeUnit(e)}return!0}return!1}function y(t,n){t.advance(8),t.consumeSpaces();const s=!t.tryConsumeCodeUnit(r.PERCENT);s||t.consumeSpaces();const o=t.consumeName();t.consumeSpaces();const e=x(t,s);e!==null&&n({type:"EntityDeclaration",name:o,definition:e}),t.skipSpaces(),t.consumeCodeUnit(r.GREATER_THAN)}function x(t,n){const s=t.currCodeUnit();if(s===r.DOUBLE_QUOTE||s===r.SINGLE_QUOTE){const o=t.consumeQuote(),e=t.getPos();t.skipCodeUnitsWhile(c=>c!==o);const a=t.sliceBack(e);return t.consumeCodeUnit(o),a}else if(s===r.UPPERCASE_S||s===r.UPPERCASE_P){if(g(t))return n&&(t.skipSpaces(),t.startsWith("NDATA")&&(t.advance(5),t.consumeSpaces(),t.skipName())),null;throw new i.XmlError({type:"InvalidExternalID"},t.genTextPos())}else throw new i.XmlError({type:"InvalidChar",expected:"a quote, SYSTEM or PUBLIC",actual:s},t.genTextPos())}function N(t){t.skipCodeUnitsWhile(n=>n!==r.GREATER_THAN),t.consumeCodeUnit(r.GREATER_THAN)}function S(t,n){const s=t.getPos();t.advance(1);const[o,e]=t.consumeQName();n({type:"ElementStart",prefix:o,local:e,start:s});let a=!1;for(;!t.atEnd();){const c=t.startsWithSpace();t.skipSpaces();const p=t.getPos(),u=t.currCodeUnit();if(u===r.SLASH){t.advance(1),t.consumeCodeUnit(r.GREATER_THAN);const l=t.rangeFrom(p);n({type:"ElementEnd",end:{type:"Empty"},range:l});break}else if(u===r.GREATER_THAN){t.advance(1);const l=t.rangeFrom(p);n({type:"ElementEnd",end:{type:"Open"},range:l}),a=!0;break}else{if(!c)throw new i.XmlError({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos());const[l,C,k]=d(t),U=t.getPos();n({type:"Attribute",range:{start:p,end:U},prefix:l,local:C,value:k})}}a&&R(t,n)}function d(t){const[n,s]=t.consumeQName();let o;const e=t.getPos();if(t.skipSpaces(),t.tryConsumeCodeUnit(r.EQUALS)){t.skipSpaces();const a=t.consumeQuote(),c=String.fromCharCode(a),p=t.getPos();t.skipCharsWhile((u,l)=>l!==c&&l!=="<"),o=t.sliceBack(p),t.consumeCodeUnit(a)}else t.goTo(e),o="true";return[n,s,o]}function R(t,n){for(;!t.atEnd();)if(t.currCodeUnit()===r.LESS_THAN){const s=t.nextCodeUnit();if(s===r.EXCLAMATION_MARK)if(t.startsWith("<!--"))h(t,n);else if(t.startsWith("<![CDATA["))X(t,n);else throw new i.XmlError({type:"UnknownToken",message:"Failed to parse content"},t.genTextPos());else if(s===r.QUESTION_MARK)f(t,n);else if(s===r.SLASH){I(t,n);break}else S(t,n)}else _(t,n)}function X(t,n){const s=t.getPos();t.advance(9);const o=t.consumeCharsWhile((a,c)=>!(c==="]"&&a.startsWith("]]>")));t.skipString("]]>");const e=t.rangeFrom(s);n({type:"Cdata",text:o,range:e})}function I(t,n){const s=t.getPos();t.advance(2);const[o,e]=t.consumeQName();t.skipSpaces(),t.consumeCodeUnit(r.GREATER_THAN);const a=t.rangeFrom(s);n({type:"ElementEnd",end:{type:"Close",prefix:o,local:e},range:a})}function _(t,n){const s=t.getPos(),o=t.consumeCharsWhile((e,a)=>a!=="<");if(o.includes(">")&&o.includes("]]>"))throw new i.XmlError({type:"InvalidCharacterData"},t.genTextPos());n({type:"Text",text:o,range:t.rangeFrom(s)})}exports.tokenize=w,exports.tokenizeXmlStream=T;
1
+ "use strict";var r=require("./ascii-constants.js"),i=require("./XmlError.js"),P=require("./XmlStream.js");function w(t,n,s){T(new P.XmlStream(t),n,s)}function T(t,n,s){if(t.startsWith("\uFEFF")&&t.advance(1),t.startsWith("<?xml ")&&A(t),m(t,s),t.skipSpaces(),t.startsWith("<!DOCTYPE")){if(!n)throw new i.XmlError({type:"DtdDetected"});W(t,s),m(t,s)}if(t.skipSpaces(),!t.atEnd()&&t.currCodeUnit()===r.LESS_THAN&&S(t,s),m(t,s),!t.atEnd())throw new i.XmlError({type:"UnknownToken",message:"Not at end"},t.genTextPos())}function m(t,n){for(;!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!--"))h(t,n);else if(t.startsWith("<?"))f(t,n);else break}function A(t){if(t.advance(5),E(t),!t.startsWith("version"))throw new i.XmlError({type:"InvalidString",expected:"version"},t.genTextPos());d(t),E(t),t.startsWith("encoding")&&(d(t),E(t)),t.startsWith("standalone")&&d(t),t.skipSpaces(),t.skipString("?>")}function E(t){if(t.startsWithSpace())t.skipSpaces();else if(!t.startsWith("?>")&&!t.atEnd())throw new i.XmlError({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos())}function h(t,n){const s=t.getPos();t.advance(4);const o=t.consumeCharsWhile((e,a)=>!(a==="-"&&e.startsWith("-->")));if(t.skipString("-->"),o.includes("--")||o.endsWith("-"))throw new i.XmlError({type:"InvalidComment"},t.genTextPosFrom(s));n({type:"Comment",text:o,range:t.rangeFrom(s)})}function f(t,n){if(t.startsWith("<?xml "))throw new i.XmlError({type:"UnexpectedDeclaration"},t.genTextPos());const s=t.getPos();t.advance(2);const o=t.consumeName();t.skipSpaces();const e=t.consumeCharsWhile((a,c)=>!(c==="?"&&a.startsWith("?>")));t.skipString("?>"),n({type:"ProcessingInstruction",target:o,content:e.length===0?void 0:e,range:t.rangeFrom(s)})}function W(t,n){const s=t.getPos();if(v(t),t.skipSpaces(),t.currCodeUnit()===r.GREATER_THAN){t.advance(1);return}for(t.advance(1);!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!ENTITY"))y(t,n);else if(t.startsWith("<!--"))h(t,n);else if(t.startsWith("<?"))f(t,n);else if(t.startsWith("]"))if(t.advance(1),t.skipSpaces(),t.currCodeUnit()===r.GREATER_THAN){t.advance(1);break}else throw new i.XmlError({type:"InvalidChar",expected:"'>'",actual:t.currCodeUnitUnchecked()},t.genTextPos());else if(t.startsWith("<!ELEMENT")||t.startsWith("<!ATTLIST")||t.startsWith("<!NOTATION"))try{N(t)}catch(o){throw new i.XmlError({type:"UnknownToken",message:"Failed to consume declaration"},t.genTextPosFrom(s))}else throw new i.XmlError({type:"UnknownToken",message:"Failed to parse doctype"},t.genTextPos())}function v(t){t.advance(9),t.consumeSpaces(),t.skipName(),t.skipSpaces(),g(t),t.skipSpaces();const n=t.currCodeUnit();if(n!==r.OPEN_BRACKET&&n!==r.GREATER_THAN)throw new i.XmlError({type:"InvalidChar",expected:"'[' or '>'",actual:n},t.genTextPos())}function g(t){if(t.startsWith("SYSTEM")||t.startsWith("PUBLIC")){const n=t.getPos();t.advance(6);const s=t.sliceBack(n);t.consumeSpaces();const o=t.consumeQuote();if(t.consumeCodeUnitsWhile(e=>e!==o),t.consumeCodeUnit(o),s==="PUBLIC"){t.consumeSpaces();const e=t.consumeQuote();t.consumeCodeUnitsWhile(a=>a!==e),t.consumeCodeUnit(e)}return!0}return!1}function y(t,n){t.advance(8),t.consumeSpaces();const s=!t.tryConsumeCodeUnit(r.PERCENT);s||t.consumeSpaces();const o=t.consumeName();t.consumeSpaces();const e=x(t,s);e!==null&&n({type:"EntityDeclaration",name:o,definition:e}),t.skipSpaces(),t.consumeCodeUnit(r.GREATER_THAN)}function x(t,n){const s=t.currCodeUnit();if(s===r.DOUBLE_QUOTE||s===r.SINGLE_QUOTE){const o=t.consumeQuote(),e=t.getPos();t.skipCodeUnitsWhile(c=>c!==o);const a=t.sliceBack(e);return t.consumeCodeUnit(o),a}else if(s===r.UPPERCASE_S||s===r.UPPERCASE_P){if(g(t))return n&&(t.skipSpaces(),t.startsWith("NDATA")&&(t.advance(5),t.consumeSpaces(),t.skipName())),null;throw new i.XmlError({type:"InvalidExternalID"},t.genTextPos())}else throw new i.XmlError({type:"InvalidChar",expected:"a quote, SYSTEM or PUBLIC",actual:s},t.genTextPos())}function N(t){t.skipCodeUnitsWhile(n=>n!==r.GREATER_THAN),t.consumeCodeUnit(r.GREATER_THAN)}function S(t,n){const s=t.getPos();t.advance(1);const[o,e]=t.consumeQName();n({type:"ElementStart",prefix:o,local:e,start:s});let a=!1;for(;!t.atEnd();){const c=t.startsWithSpace();t.skipSpaces();const p=t.getPos(),u=t.currCodeUnit();if(u===r.SLASH){t.advance(1),t.consumeCodeUnit(r.GREATER_THAN);const l=t.rangeFrom(p);n({type:"ElementEnd",end:{type:"Empty"},range:l});break}else if(u===r.GREATER_THAN){t.advance(1);const l=t.rangeFrom(p);n({type:"ElementEnd",end:{type:"Open"},range:l}),a=!0;break}else{if(!c)throw new i.XmlError({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos());const[l,C,k]=d(t),U=t.getPos();n({type:"Attribute",range:{start:p,end:U},prefix:l,local:C,value:k})}}a&&R(t,n)}function d(t){const[n,s]=t.consumeQName();let o;const e=t.getPos();if(t.skipSpaces(),t.tryConsumeCodeUnit(r.EQUALS)){t.skipSpaces();const a=t.consumeQuote(),c=String.fromCharCode(a),p=t.getPos();t.skipCharsWhile((u,l)=>l!==c&&l!=="<"),o=t.sliceBack(p),t.consumeCodeUnit(a)}else t.goTo(e),o="true";return[n,s,o]}function R(t,n){for(;!t.atEnd();)if(t.currCodeUnit()===r.LESS_THAN){const s=t.nextCodeUnit();if(s===r.EXCLAMATION_MARK)if(t.startsWith("<!--"))h(t,n);else if(t.startsWith("<![CDATA["))X(t,n);else throw new i.XmlError({type:"UnknownToken",message:"Failed to parse content"},t.genTextPos());else if(s===r.QUESTION_MARK)f(t,n);else if(s===r.SLASH){I(t,n);break}else S(t,n)}else _(t,n)}function X(t,n){const s=t.getPos();t.advance(9);const o=t.consumeCharsWhile((a,c)=>!(c==="]"&&a.startsWith("]]>")));t.skipString("]]>");const e=t.rangeFrom(s);n({type:"Cdata",text:o,range:e})}function I(t,n){const s=t.getPos();t.advance(2);const[o,e]=t.consumeQName();t.skipSpaces(),t.consumeCodeUnit(r.GREATER_THAN);const a=t.rangeFrom(s);n({type:"ElementEnd",end:{type:"Close",prefix:o,local:e},range:a})}function _(t,n){const s=t.getPos(),o=t.consumeCharsWhile((e,a)=>a!=="<");if(o.includes(">")&&o.includes("]]>"))throw new i.XmlError({type:"InvalidCharacterData"},t.genTextPos());n({type:"Text",text:o,range:t.rangeFrom(s)})}exports.tokenize=w,exports.tokenizeXmlStream=T;
@@ -1 +1 @@
1
- "use strict";const C=9,P=10,L=13,T=32,U=33,i=34,I=35,t=37,H=38,n=39,e=45,r=46,s=47,D=48,l=57,m=58,u=59,X=60,M=61,B=62,a=63,c=65,Q=70,W=80,Z=83,F=90,G=91,K=95,o=97,f=102,y=120,Y=122;function S(E){return E>=48&&E<=57}function N(E){return E==null?!1:E<=128?E>=65&&E<=90||E>=97&&E<=122||E===58||E===95:E>=192&&E<=214||E>=216&&E<=246||E>=248&&E<=767||E>=880&&E<=893||E>=895&&E<=8191||E>=8204&&E<=8205||E>=8304&&E<=8591||E>=11264&&E<=12271||E>=12289&&E<=55295||E>=63744&&E<=64975||E>=65008&&E<=65533||E>=65536&&E<=983039}function O(E){return E==null?!1:E<=128?R(E):E===183||E>=192&&E<=214||E>=216&&E<=246||E>=248&&E<=767||E>=768&&E<=879||E>=880&&E<=893||E>=895&&E<=8191||E>=8204&&E<=8205||E>=8255&&E<=8256||E>=8304&&E<=8591||E>=11264&&E<=12271||E>=12289&&E<=55295||E>=63744&&E<=64975||E>=65008&&E<=65533||E>=65536&&E<=983039}function _(E){return E==null?!1:E<32?A(E):E!==65535&&E!==65534}function A(E){return E===32||E===9||E===10||E===13}function R(E){return E>=48&&E<=57||E>=65&&E<=90||E>=97&&E<=122||E===58||E===95||E===45||E===46}exports.AMPERSAND=38,exports.CARRIAGE_RETURN=13,exports.COLON=58,exports.DOUBLE_QUOTE=34,exports.EQUALS=61,exports.EXCLAMATION_MARK=33,exports.GREATER_THAN=62,exports.HASH=35,exports.HORIZONTAL_TAB=9,exports.HYPHEN=45,exports.LESS_THAN=60,exports.LINE_FEED=10,exports.LOWERCASE_A=97,exports.LOWERCASE_F=102,exports.LOWERCASE_X=120,exports.LOWERCASE_Z=122,exports.NINE=57,exports.OPEN_BRACKET=91,exports.PERCENT=37,exports.PERIOD=46,exports.QUESTION_MARK=63,exports.SEMICOLON=59,exports.SINGLE_QUOTE=39,exports.SLASH=47,exports.SPACE=32,exports.UNDERSCORE=95,exports.UPPERCASE_A=65,exports.UPPERCASE_F=70,exports.UPPERCASE_P=80,exports.UPPERCASE_S=83,exports.UPPERCASE_Z=90,exports.ZERO=48,exports.isAsciiDigit=S,exports.isXmlChar=_,exports.isXmlName=O,exports.isXmlNameByte=R,exports.isXmlNameStart=N,exports.isXmlSpaceByte=A;
1
+ "use strict";var i=require("./ascii-constants.js");function e(E){return E>=i.ZERO&&E<=i.NINE}function r(E){return E==null?!1:E<=128?E>=i.UPPERCASE_A&&E<=i.UPPERCASE_Z||E>=i.LOWERCASE_A&&E<=i.LOWERCASE_Z||E===i.COLON||E===i.UNDERSCORE:E>=192&&E<=214||E>=216&&E<=246||E>=248&&E<=767||E>=880&&E<=893||E>=895&&E<=8191||E>=8204&&E<=8205||E>=8304&&E<=8591||E>=11264&&E<=12271||E>=12289&&E<=55295||E>=63744&&E<=64975||E>=65008&&E<=65533||E>=65536&&E<=983039}function R(E){return E==null?!1:E<=128?n(E):E===183||E>=192&&E<=214||E>=216&&E<=246||E>=248&&E<=767||E>=768&&E<=879||E>=880&&E<=893||E>=895&&E<=8191||E>=8204&&E<=8205||E>=8255&&E<=8256||E>=8304&&E<=8591||E>=11264&&E<=12271||E>=12289&&E<=55295||E>=63744&&E<=64975||E>=65008&&E<=65533||E>=65536&&E<=983039}function s(E){return E==null?!1:E<32?t(E):E!==65535&&E!==65534}function t(E){return E===i.SPACE||E===i.HORIZONTAL_TAB||E===i.LINE_FEED||E===i.CARRIAGE_RETURN}function n(E){return E>=i.ZERO&&E<=i.NINE||E>=i.UPPERCASE_A&&E<=i.UPPERCASE_Z||E>=i.LOWERCASE_A&&E<=i.LOWERCASE_Z||E===i.COLON||E===i.UNDERSCORE||E===i.HYPHEN||E===i.PERIOD}exports.isAsciiDigit=e,exports.isXmlChar=s,exports.isXmlName=R,exports.isXmlNameByte=n,exports.isXmlNameStart=r,exports.isXmlSpaceByte=t;
@@ -1 +1 @@
1
- "use strict";function n(t){let e="";switch(t.type){case"ProcessingInstruction":e+=`<?${t.target}`,t.content&&(e+=` ${t.content}`),e+="?>";break;case"Comment":e+=`<!--${t.text}-->`;break;case"EntityDeclaration":e+=`<!ENTITY ${t.name} "${t.definition}">`;break;case"ElementStart":e+=`<${t.prefix.length>0?`${t.prefix}:`:""}${t.local}`;break;case"Attribute":e+=` ${t.prefix.length>0?`${t.prefix}:`:""}${t.local}="${t.value}"`;break;case"ElementEnd":t.end.type==="Open"?e+=">":t.end.type==="Close"?e+=`</${t.end.prefix.length>0?`${t.end.prefix}:`:""}${t.end.local}>`:e+="/>";break;case"Text":e+=t.text;break;case"Cdata":e+=`<![CDATA[${t.text}]]>`;break}return e}function r(t){let e="";return t.forEach(a=>{e+=n(a)}),e}exports.tokenToXml=n,exports.tokensToXml=r;
1
+ "use strict";var n=require("./token-to-xml.js");function r(e){let o="";return e.forEach(t=>{o+=n.tokenToXml(t)}),o}exports.tokensToXml=r;
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{select as o}from"./selector/select.js";import{TokenSelector as r}from"./selector/TokenSelector.js";import{EToCacheNodeProps as A,ETokenMatchCriteria as m,TokenSelectState as R}from"./selector/TokenSelectState.js";import{TokenSelectStateMachine as C}from"./selector/TokenSelectStateMachine.js";import{tokenize as T,tokenizeXmlStream as _}from"./tokenizer/tokenize.js";import{AMPERSAND as i,CARRIAGE_RETURN as l,COLON as a,DOUBLE_QUOTE as L,EQUALS as p,EXCLAMATION_MARK as U,GREATER_THAN as X,HASH as x,HORIZONTAL_TAB as c,HYPHEN as f,LESS_THAN as s,LINE_FEED as n,LOWERCASE_A as I,LOWERCASE_F as k,LOWERCASE_X as H,LOWERCASE_Z as M,NINE as D,OPEN_BRACKET as B,PERCENT as h,PERIOD as Q,QUESTION_MARK as W,SEMICOLON as Z,SINGLE_QUOTE as F,SLASH as G,SPACE as K,UNDERSCORE as y,UPPERCASE_A as z,UPPERCASE_F as b,UPPERCASE_P as d,UPPERCASE_S as g,UPPERCASE_Z as j,ZERO as Y,isAsciiDigit as q,isXmlChar as u,isXmlName as v,isXmlNameByte as w,isXmlNameStart as J,isXmlSpaceByte as V}from"./tokenizer/utils.js";import{XmlError as EE}from"./tokenizer/XmlError.js";import{XmlStream as oE}from"./tokenizer/XmlStream.js";import{tokenToXml as rE,tokensToXml as SE}from"./tokens-to-xml.js";import{xmlToObject as mE}from"./xml-to-object.js";export{i as AMPERSAND,l as CARRIAGE_RETURN,a as COLON,L as DOUBLE_QUOTE,p as EQUALS,A as EToCacheNodeProps,m as ETokenMatchCriteria,U as EXCLAMATION_MARK,X as GREATER_THAN,x as HASH,c as HORIZONTAL_TAB,f as HYPHEN,s as LESS_THAN,n as LINE_FEED,I as LOWERCASE_A,k as LOWERCASE_F,H as LOWERCASE_X,M as LOWERCASE_Z,D as NINE,B as OPEN_BRACKET,h as PERCENT,Q as PERIOD,W as QUESTION_MARK,Z as SEMICOLON,F as SINGLE_QUOTE,G as SLASH,K as SPACE,R as TokenSelectState,C as TokenSelectStateMachine,r as TokenSelector,y as UNDERSCORE,z as UPPERCASE_A,b as UPPERCASE_F,d as UPPERCASE_P,g as UPPERCASE_S,j as UPPERCASE_Z,EE as XmlError,oE as XmlStream,Y as ZERO,q as isAsciiDigit,u as isXmlChar,v as isXmlName,w as isXmlNameByte,J as isXmlNameStart,V as isXmlSpaceByte,o as select,rE as tokenToXml,T as tokenize,_ as tokenizeXmlStream,SE as tokensToXml,mE as xmlToObject};
1
+ import{select as o}from"./selector/select.js";import{TokenSelector as t}from"./selector/TokenSelector.js";import{EToCacheNodeProps as A,ETokenMatchCriteria as m,TokenSelectState as R}from"./selector/TokenSelectState.js";import{TokenSelectStateMachine as C}from"./selector/TokenSelectStateMachine.js";import{tokenToXml as T}from"./token-to-xml.js";import{AMPERSAND as P,CARRIAGE_RETURN as i,COLON as l,DOUBLE_QUOTE as a,EQUALS as p,EXCLAMATION_MARK as L,GREATER_THAN as x,HASH as f,HORIZONTAL_TAB as U,HYPHEN as X,LESS_THAN as c,LINE_FEED as s,LOWERCASE_A as n,LOWERCASE_F as I,LOWERCASE_X as k,LOWERCASE_Z as H,NINE as M,OPEN_BRACKET as D,PERCENT as B,PERIOD as h,QUESTION_MARK as Q,SEMICOLON as W,SINGLE_QUOTE as Z,SLASH as F,SPACE as G,UNDERSCORE as K,UPPERCASE_A as y,UPPERCASE_F as z,UPPERCASE_P as b,UPPERCASE_S as d,UPPERCASE_Z as g,ZERO as j}from"./tokenizer/ascii-constants.js";import{tokenize as q,tokenizeXmlStream as u}from"./tokenizer/tokenize.js";import{isAsciiDigit as w,isXmlChar as J,isXmlName as V,isXmlNameByte as $,isXmlNameStart as EE,isXmlSpaceByte as eE}from"./tokenizer/utils.js";import{XmlError as rE}from"./tokenizer/XmlError.js";import{XmlStream as SE}from"./tokenizer/XmlStream.js";import{tokensToXml as mE}from"./tokens-to-xml.js";import{xmlToObject as NE}from"./xml-to-object.js";export{P as AMPERSAND,i as CARRIAGE_RETURN,l as COLON,a as DOUBLE_QUOTE,p as EQUALS,A as EToCacheNodeProps,m as ETokenMatchCriteria,L as EXCLAMATION_MARK,x as GREATER_THAN,f as HASH,U as HORIZONTAL_TAB,X as HYPHEN,c as LESS_THAN,s as LINE_FEED,n as LOWERCASE_A,I as LOWERCASE_F,k as LOWERCASE_X,H as LOWERCASE_Z,M as NINE,D as OPEN_BRACKET,B as PERCENT,h as PERIOD,Q as QUESTION_MARK,W as SEMICOLON,Z as SINGLE_QUOTE,F as SLASH,G as SPACE,R as TokenSelectState,C as TokenSelectStateMachine,t as TokenSelector,K as UNDERSCORE,y as UPPERCASE_A,z as UPPERCASE_F,b as UPPERCASE_P,d as UPPERCASE_S,g as UPPERCASE_Z,rE as XmlError,SE as XmlStream,j as ZERO,w as isAsciiDigit,J as isXmlChar,V as isXmlName,$ as isXmlNameByte,EE as isXmlNameStart,eE as isXmlSpaceByte,o as select,T as tokenToXml,q as tokenize,u as tokenizeXmlStream,mE as tokensToXml,NE as xmlToObject};
@@ -1 +1 @@
1
- import{getQName as l}from"../get-q-name.js";var n=Object.defineProperty,o=(t,e,r)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,a=(t,e,r)=>o(t,typeof e!="symbol"?e+"":e,r);class p{constructor(e){a(this,"_part"),a(this,"_matchCriteria",0),a(this,"_toCacheNodeProps",0),a(this,"_enteredDepth",null),this._part=e,this.applyLevels()}get matchCriteria(){return this._matchCriteria}get toCacheNodeProps(){return this._toCacheNodeProps}get enteredDepth(){return this._enteredDepth}applyLevels(){let e=0,r=0;(this._part.local!=null||this._part.prefix!=null)&&(e|=1),this._part.attributes!=null&&(e|=2,r|=2),this._part.textContains!=null&&(e|=4),this._part.predicate!=null&&(e|=8,r|=7),this._matchCriteria=e,this._toCacheNodeProps=r}matchesName(e,r){return(this._part.local==null||this._part.local==="*"||this._part.local===e)&&(this._part.prefix==null||this._part.prefix===r)}matchesAttributes(e){if(this._part.attributes!=null)for(const r of this._part.attributes){const s=l(r.local,r.prefix);if(!(s in e)||r.value!=null&&e[s]!==r.value)return!1}return!0}matchesText(e){return this._part.textContains==null||e.includes(this._part.textContains)}matchesDepth(e,r){switch(this._part.axis){case"child":return e===r+1;case"self-or-descendant":return e>=r}}match(e){this._enteredDepth=e}unmatch(){this._enteredDepth=null}}var i=(t=>(t[t.None=0]="None",t[t.Name=1]="Name",t[t.Attributes=2]="Attributes",t[t.Text=4]="Text",t))(i||{}),h=(t=>(t[t.None=0]="None",t[t.Name=1]="Name",t[t.Attributes=2]="Attributes",t[t.Text=4]="Text",t[t.Node=8]="Node",t))(h||{});export{i as EToCacheNodeProps,h as ETokenMatchCriteria,p as TokenSelectState};
1
+ import{getQName as h}from"../get-q-name.js";var l=Object.defineProperty,o=(e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,r=(e,t,s)=>o(e,typeof t!="symbol"?t+"":t,s);class c{constructor(t){r(this,"_segment"),r(this,"_matchCriteria",0),r(this,"_toCacheNodeProps",0),r(this,"_enteredDepth",null),this._segment=t,this.applyLevels()}get matchCriteria(){return this._matchCriteria}get toCacheNodeProps(){return this._toCacheNodeProps}get enteredDepth(){return this._enteredDepth}applyLevels(){let t=0,s=0;(this._segment.local!=null||this._segment.prefix!=null)&&(t|=1),this._segment.attributes!=null&&(t|=2,s|=2),this._segment.containsText!=null&&(t|=4),this._segment.predicate!=null&&(t|=8,s|=7),this._matchCriteria=t,this._toCacheNodeProps=s}matchesName(t,s){return(this._segment.local==null||this._segment.local==="*"||this._segment.local===t)&&(this._segment.prefix==null||this._segment.prefix===s)}matchesAttributes(t){if(this._segment.attributes!=null)for(const s of this._segment.attributes){const i=h(s.local,s.prefix);if(!(i in t)||s.value!=null&&t[i]!==s.value)return!1}return!0}matchesText(t){return this._segment.containsText==null||t.includes(this._segment.containsText)}matchesDepth(t,s){switch(this._segment.axis){case"child":return t===s+1;case"self-or-descendant":return t>=s}}match(t){this._enteredDepth=t}unmatch(){this._enteredDepth=null}}var a=(e=>(e[e.None=0]="None",e[e.Name=1]="Name",e[e.Attributes=2]="Attributes",e[e.Text=4]="Text",e))(a||{}),n=(e=>(e[e.None=0]="None",e[e.Name=1]="Name",e[e.Attributes=2]="Attributes",e[e.Text=4]="Text",e[e.Node=8]="Node",e))(n||{});export{a as EToCacheNodeProps,n as ETokenMatchCriteria,c as TokenSelectState};
@@ -1 +1 @@
1
- import{getQName as _}from"../get-q-name.js";import{EToCacheNodeProps as l,TokenSelectState as p,ETokenMatchCriteria as o}from"./TokenSelectState.js";var C=Object.defineProperty,N=(i,t,e)=>t in i?C(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,h=(i,t,e)=>N(i,typeof t!="symbol"?t+"":t,e);class S{constructor(t){h(this,"_states"),h(this,"_currentState",null),h(this,"_hasActiveCache",!1),h(this,"_toCacheNodeProps",l.None),h(this,"_cachedNodeProps",{prefix:null,local:null,attributes:null,text:null}),h(this,"_cachedTokens",[]),h(this,"_toRecordTokens",[]),this._states=t.map(e=>new p(e))}getNextState(){var t;const e=this._currentState!=null?this._currentState+1:0;return e<this._states.length&&(t=this._states[e])!=null?t:null}getCurrentState(){var t;return this._currentState!=null&&this._currentState<this._states.length&&(t=this._states[this._currentState])!=null?t:null}record(t){this._hasActiveCache&&this._cachedTokens.push(t)}takeRecordedTokens(){if(this._toRecordTokens.length>0){const t=this._toRecordTokens;return this._toRecordTokens=[],t}return null}transitionIfNameMatch(t,e,s){var r;const a=this.getNextState(),n=this.getCurrentState();return a!=null&&a.matchesName(t,e)&&a.matchesDepth(s,(r=n==null?void 0:n.enteredDepth)!=null?r:0)?a.matchCriteria&(o.Attributes|o.Text|o.Node)?(this._hasActiveCache=!0,this._toCacheNodeProps|=a.toCacheNodeProps,this._toCacheNodeProps&l.Name&&(this._cachedNodeProps.local=t,this._cachedNodeProps.prefix=e),!1):(this.transitionForward(s),!0):!1}transitionIfAttributesMatch(t,e,s,r){var a,n;const c=this.getNextState(),d=this.getCurrentState(),u=(a=this._cachedNodeProps.attributes)!=null?a:{};return u[_(t,e)]=s,c!=null&&c.matchesAttributes(u)&&c.matchesDepth(r,(n=d==null?void 0:d.enteredDepth)!=null?n:0)?c.matchCriteria&(o.Text|o.Node)?(this._hasActiveCache=!0,this._toCacheNodeProps|=c.toCacheNodeProps,this._toCacheNodeProps&l.Attributes&&(this._cachedNodeProps.attributes=u),!1):(this.transitionForward(r),!0):!1}transitionIfTextMatch(t,e){var s;const r=this.getNextState(),a=this.getCurrentState();return r!=null&&r.matchesText(t)&&r.matchesDepth(e,(s=a==null?void 0:a.enteredDepth)!=null?s:0)?r.matchCriteria&o.Node?(this._hasActiveCache=!0,this._toCacheNodeProps|=r.toCacheNodeProps,this._toCacheNodeProps&l.Text&&(this._cachedNodeProps.text=t),!1):(this.transitionForward(e),!0):!1}transitionForward(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState+1:0;const s=this.getCurrentState();s!=null&&s.match(t),this.isFinalState()&&(this._toRecordTokens=this._cachedTokens),this.resetCurrentStateCache()}transitionBack(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState-1:0;const s=this.getCurrentState();s!=null&&s.match(t),this.resetCurrentStateCache()}isFinalState(){return this._currentState!=null&&this._currentState>=this._states.length-1}resetCurrentStateCache(){this._hasActiveCache=!1,this._toCacheNodeProps=l.None,this._cachedNodeProps.prefix=null,this._cachedNodeProps.local=null,this._cachedNodeProps.attributes=null,this._cachedNodeProps.text=null,this._cachedTokens=[]}}export{S as TokenSelectStateMachine};
1
+ import{getQName as _}from"../get-q-name.js";import{TokenSelectState as S,EToCacheNodeProps as u,ETokenMatchCriteria as h}from"./TokenSelectState.js";var p=Object.defineProperty,N=(a,t,e)=>t in a?p(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,c=(a,t,e)=>N(a,typeof t!="symbol"?t+"":t,e);class m{constructor(t){c(this,"_states"),c(this,"_currentState",null),c(this,"_cachedNodeProps",{prefix:null,local:null,attributes:null,text:null}),c(this,"_cachedTokens",[]),c(this,"_toRecordTokens",[]),this._states=t.map(e=>new S(e))}getNextState(){var t;const e=this._currentState!=null?this._currentState+1:0;return e<this._states.length&&(t=this._states[e])!=null?t:null}getCurrentState(){var t;return this._currentState!=null&&this._currentState<this._states.length&&(t=this._states[this._currentState])!=null?t:null}record(t){this.getOffsetToFinal()<=1&&this._cachedTokens.push(t)}takeRecordedTokens(){if(this._toRecordTokens.length>0){const t=this._toRecordTokens;return this._toRecordTokens=[],t}return null}transitionIfNameMatch(t,e,r){var s;const n=this.getNextState(),i=this.getCurrentState();return n==null?!1:(n.toCacheNodeProps&u.Name&&(this._cachedNodeProps.local=t,this._cachedNodeProps.prefix=e),n.matchesName(t,e)&&n.matchesDepth(r,(s=i==null?void 0:i.enteredDepth)!=null?s:0)&&!(n.matchCriteria&(h.Attributes|h.Text|h.Node))?(this.transitionForward(r),!0):!1)}transitionIfAttributesMatch(t,e,r,s){var n,i;const o=this.getNextState(),d=this.getCurrentState();if(o==null)return!1;const l=(n=this._cachedNodeProps.attributes)!=null?n:{};return l[_(t,e)]=r,o.toCacheNodeProps&u.Attributes&&(this._cachedNodeProps.attributes=l),o.matchesAttributes(l)&&o.matchesDepth(s,(i=d==null?void 0:d.enteredDepth)!=null?i:0)&&!(o.matchCriteria&(h.Text|h.Node))?(this.transitionForward(s),!0):!1}transitionIfTextMatch(t,e){var r;const s=this.getNextState(),n=this.getCurrentState();return s==null?!1:(s.toCacheNodeProps&u.Text&&(this._cachedNodeProps.text=t),s.matchesText(t)&&s.matchesDepth(e,(r=n==null?void 0:n.enteredDepth)!=null?r:0)&&!(s.matchCriteria&h.Node)?(this.transitionForward(e),!0):!1)}transitionForward(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState+1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.isFinalState()&&(this._toRecordTokens=this._cachedTokens),this.resetCurrentStateCache()}transitionBack(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState-1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.resetCurrentStateCache()}isFinalState(){return this._currentState!=null&&this._currentState>=this._states.length-1}getOffsetToFinal(){return this._currentState==null?this._states.length:this._states.length-1-this._currentState}resetCurrentStateCache(){this._cachedNodeProps.prefix=null,this._cachedNodeProps.local=null,this._cachedNodeProps.attributes=null,this._cachedNodeProps.text=null,this._cachedTokens=[]}}export{m as TokenSelectStateMachine};
@@ -0,0 +1 @@
1
+ function n(t){let e="";switch(t.type){case"ProcessingInstruction":e+=`<?${t.target}`,t.content&&(e+=` ${t.content}`),e+="?>";break;case"Comment":e+=`<!--${t.text}-->`;break;case"EntityDeclaration":e+=`<!ENTITY ${t.name} "${t.definition}">`;break;case"ElementStart":e+=`<${t.prefix.length>0?`${t.prefix}:`:""}${t.local}`;break;case"Attribute":e+=` ${t.prefix.length>0?`${t.prefix}:`:""}${t.local}="${t.value}"`;break;case"ElementEnd":t.end.type==="Open"?e+=">":t.end.type==="Close"?e+=`</${t.end.prefix.length>0?`${t.end.prefix}:`:""}${t.end.local}>`:e+="/>";break;case"Text":e+=t.text;break;case"Cdata":e+=`<![CDATA[${t.text}]]>`;break}return e}export{n as tokenToXml};
@@ -1 +1 @@
1
- import{isXmlChar as u,isXmlSpaceByte as _,AMPERSAND as m,HASH as C,LOWERCASE_X as f,ZERO as x,NINE as U,UPPERCASE_A as w,UPPERCASE_F as y,LOWERCASE_A as g,LOWERCASE_F as k,isAsciiDigit as E,SEMICOLON as P,isXmlNameStart as a,isXmlName as d,COLON as v,SINGLE_QUOTE as N,DOUBLE_QUOTE as S,LINE_FEED as A}from"./utils.js";import{XmlError as n}from"./XmlError.js";var T=Object.defineProperty,W=(h,t,e)=>t in h?T(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e,c=(h,t,e)=>W(h,typeof t!="symbol"?t+"":t,e);class l{constructor(t,e=0){c(this,"_text"),c(this,"_pos"),c(this,"_end"),this._text=t,this._pos=e,this._end=this._text.length}clone(){return new l(this._text,this._pos)}getPos(){return this._pos}atEnd(){return this._pos>=this._end}currCodeUnit(){if(this._pos>=this._end)throw new n({type:"UnexpectedEndOfStream"});return this._text.charCodeAt(this._pos)}currCodeUnitUnchecked(){return this._text.charCodeAt(this._pos)}nextCodeUnit(){if(this._pos+1>=this._end)throw new n({type:"UnexpectedEndOfStream"});return this._text.charCodeAt(this._pos+1)}advance(t){this._pos+=t}goTo(t){this._pos=t}startsWith(t){return this._text.startsWith(t,this._pos)}consumeCodeUnit(t){const e=this.currCodeUnit();if(e!==t)throw new n({type:"InvalidChar",expected:t,actual:e},this.genTextPos());this._pos+=1}tryConsumeCodeUnit(t){return this.currCodeUnit()===t?(this._pos+=1,!0):!1}skipString(t){if(!this.startsWith(t))throw new n({type:"InvalidString",expected:t},this.genTextPos());this._pos+=t.length}consumeCodeUnitsWhile(t){const e=this._pos;return this.skipCodeUnitsWhile(t),this.sliceBack(e)}skipCodeUnitsWhile(t){for(;this._pos<this._end&&t(this.currCodeUnitUnchecked());)this._pos+=1}consumeCharsWhile(t){const e=this._pos;return this.skipCharsWhile(t),this.sliceBack(e)}skipCharsWhile(t){for(;this._pos<this._end;){const e=this._text[this._pos];if(e==null||!u(e.codePointAt(0)))throw new n({type:"NonXmlChar",char:e!=null?e:"\uFFFD"},this.genTextPos());if(t(this,e))this._pos+=e.length;else break}}sliceBack(t){return this._text.slice(t,this._pos)}rangeFrom(t){return{start:t,end:this._pos}}skipSpaces(){for(;this.startsWithSpace();)this._pos+=1}startsWithSpace(){return this._pos<this._end&&_(this.currCodeUnitUnchecked())}consumeSpaces(){if(this._pos>=this._end)throw new n({type:"UnexpectedEndOfStream"},this.genTextPos());if(!this.startsWithSpace())throw new n({type:"InvalidChar",expected:"a whitespace",actual:this.currCodeUnitUnchecked()},this.genTextPos());this.skipSpaces()}tryConsumeReference(){const t=this._pos,e=this.clone(),i=e.consumeReference();return i!=null?(this._pos+=e.getPos()-t,i):null}consumeReference(){if(!this.tryConsumeCodeUnit(m))return null;let t;if(this.tryConsumeCodeUnit(C)){let e,i;this.tryConsumeCodeUnit(f)?(e=this.consumeCodeUnitsWhile(s=>s>=x&&s<=U||s>=w&&s<=y||s>=g&&s<=k),i=16):(e=this.consumeCodeUnitsWhile(s=>E(s)),i=10);const o=parseInt(e,i);isNaN(o)||!u(o)?t=null:t={type:"Char",value:String.fromCodePoint(o)}}else{const e=this.consumeName();switch(e){case"quot":t={type:"Char",value:'"'};break;case"amp":t={type:"Char",value:"&"};break;case"apos":t={type:"Char",value:"'"};break;case"lt":t={type:"Char",value:"<"};break;case"gt":t={type:"Char",value:">"};break;default:t={type:"Entity",value:e}}}return this.tryConsumeCodeUnit(P)?t:null}consumeName(){const t=this._pos;this.skipName();const e=this.sliceBack(t);if(e.length===0)throw new n({type:"InvalidName"},this.genTextPosFrom(t));return e}skipName(){const t=this._pos;for(;this._pos<this._end;){const e=this.currCodeUnitUnchecked();if(this._pos===t){if(!a(e))throw new n({type:"InvalidName"},this.genTextPosFrom(t))}else if(!d(e))break;this._pos+=1}}consumeQName(){var t,e;const i=this._pos;let o=null;for(;this._pos<this._end;){const p=this.currCodeUnitUnchecked();if(p===v)if(o==null)o=this._pos,this._pos+=1;else throw new n({type:"InvalidName"},this.genTextPosFrom(i));else if(d(p))this._pos+=1;else break}let s,r;if(o!=null?(s=this._text.slice(i,o),r=this.sliceBack(o+1)):(s="",r=this.sliceBack(i)),s.length>0&&!a((t=s[0])==null?void 0:t.codePointAt(0)))throw new n({type:"InvalidName"},this.genTextPosFrom(i));if(r.length>0){if(!a((e=r[0])==null?void 0:e.codePointAt(0)))throw new n({type:"InvalidName"},this.genTextPosFrom(i))}else throw new n({type:"InvalidName"},this.genTextPosFrom(i));return[s,r]}consumeQuote(){const t=this.currCodeUnit();if(t===N||t===S)return this._pos+=1,t;throw new n({type:"InvalidChar",expected:"a quote",actual:t},this.genTextPos())}genTextPos(){return this.genTextPosFrom(this._pos)}genTextPosFrom(t){const e=Math.min(t,this._end);let i=1,o=1;for(let s=0;s<e;s++)this._text.charCodeAt(s)===A?(i++,o=1):o++;return{row:i,col:o}}}export{l as XmlStream};
1
+ import{AMPERSAND as _,HASH as m,LOWERCASE_X as C,ZERO as f,NINE as x,UPPERCASE_A as U,UPPERCASE_F as w,LOWERCASE_A as y,LOWERCASE_F as g,SEMICOLON as k,COLON as E,SINGLE_QUOTE as P,DOUBLE_QUOTE as v,LINE_FEED as N}from"./ascii-constants.js";import{isXmlChar as u,isXmlSpaceByte as S,isAsciiDigit as A,isXmlNameStart as a,isXmlName as d}from"./utils.js";import{XmlError as n}from"./XmlError.js";var T=Object.defineProperty,W=(h,t,e)=>t in h?T(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e,c=(h,t,e)=>W(h,typeof t!="symbol"?t+"":t,e);class l{constructor(t,e=0){c(this,"_text"),c(this,"_pos"),c(this,"_end"),this._text=t,this._pos=e,this._end=this._text.length}clone(){return new l(this._text,this._pos)}getPos(){return this._pos}atEnd(){return this._pos>=this._end}currCodeUnit(){if(this._pos>=this._end)throw new n({type:"UnexpectedEndOfStream"});return this._text.charCodeAt(this._pos)}currCodeUnitUnchecked(){return this._text.charCodeAt(this._pos)}nextCodeUnit(){if(this._pos+1>=this._end)throw new n({type:"UnexpectedEndOfStream"});return this._text.charCodeAt(this._pos+1)}advance(t){this._pos+=t}goTo(t){this._pos=t}startsWith(t){return this._text.startsWith(t,this._pos)}consumeCodeUnit(t){const e=this.currCodeUnit();if(e!==t)throw new n({type:"InvalidChar",expected:t,actual:e},this.genTextPos());this._pos+=1}tryConsumeCodeUnit(t){return this.currCodeUnit()===t?(this._pos+=1,!0):!1}skipString(t){if(!this.startsWith(t))throw new n({type:"InvalidString",expected:t},this.genTextPos());this._pos+=t.length}consumeCodeUnitsWhile(t){const e=this._pos;return this.skipCodeUnitsWhile(t),this.sliceBack(e)}skipCodeUnitsWhile(t){for(;this._pos<this._end&&t(this.currCodeUnitUnchecked());)this._pos+=1}consumeCharsWhile(t){const e=this._pos;return this.skipCharsWhile(t),this.sliceBack(e)}skipCharsWhile(t){for(;this._pos<this._end;){const e=this._text[this._pos];if(e==null||!u(e.codePointAt(0)))throw new n({type:"NonXmlChar",char:e!=null?e:"\uFFFD"},this.genTextPos());if(t(this,e))this._pos+=e.length;else break}}sliceBack(t){return this._text.slice(t,this._pos)}rangeFrom(t){return{start:t,end:this._pos}}skipSpaces(){for(;this.startsWithSpace();)this._pos+=1}startsWithSpace(){return this._pos<this._end&&S(this.currCodeUnitUnchecked())}consumeSpaces(){if(this._pos>=this._end)throw new n({type:"UnexpectedEndOfStream"},this.genTextPos());if(!this.startsWithSpace())throw new n({type:"InvalidChar",expected:"a whitespace",actual:this.currCodeUnitUnchecked()},this.genTextPos());this.skipSpaces()}tryConsumeReference(){const t=this._pos,e=this.clone(),i=e.consumeReference();return i!=null?(this._pos+=e.getPos()-t,i):null}consumeReference(){if(!this.tryConsumeCodeUnit(_))return null;let t;if(this.tryConsumeCodeUnit(m)){let e,i;this.tryConsumeCodeUnit(C)?(e=this.consumeCodeUnitsWhile(s=>s>=f&&s<=x||s>=U&&s<=w||s>=y&&s<=g),i=16):(e=this.consumeCodeUnitsWhile(s=>A(s)),i=10);const o=parseInt(e,i);isNaN(o)||!u(o)?t=null:t={type:"Char",value:String.fromCodePoint(o)}}else{const e=this.consumeName();switch(e){case"quot":t={type:"Char",value:'"'};break;case"amp":t={type:"Char",value:"&"};break;case"apos":t={type:"Char",value:"'"};break;case"lt":t={type:"Char",value:"<"};break;case"gt":t={type:"Char",value:">"};break;default:t={type:"Entity",value:e}}}return this.tryConsumeCodeUnit(k)?t:null}consumeName(){const t=this._pos;this.skipName();const e=this.sliceBack(t);if(e.length===0)throw new n({type:"InvalidName"},this.genTextPosFrom(t));return e}skipName(){const t=this._pos;for(;this._pos<this._end;){const e=this.currCodeUnitUnchecked();if(this._pos===t){if(!a(e))throw new n({type:"InvalidName"},this.genTextPosFrom(t))}else if(!d(e))break;this._pos+=1}}consumeQName(){var t,e;const i=this._pos;let o=null;for(;this._pos<this._end;){const p=this.currCodeUnitUnchecked();if(p===E)if(o==null)o=this._pos,this._pos+=1;else throw new n({type:"InvalidName"},this.genTextPosFrom(i));else if(d(p))this._pos+=1;else break}let s,r;if(o!=null?(s=this._text.slice(i,o),r=this.sliceBack(o+1)):(s="",r=this.sliceBack(i)),s.length>0&&!a((t=s[0])==null?void 0:t.codePointAt(0)))throw new n({type:"InvalidName"},this.genTextPosFrom(i));if(r.length>0){if(!a((e=r[0])==null?void 0:e.codePointAt(0)))throw new n({type:"InvalidName"},this.genTextPosFrom(i))}else throw new n({type:"InvalidName"},this.genTextPosFrom(i));return[s,r]}consumeQuote(){const t=this.currCodeUnit();if(t===P||t===v)return this._pos+=1,t;throw new n({type:"InvalidChar",expected:"a quote",actual:t},this.genTextPos())}genTextPos(){return this.genTextPosFrom(this._pos)}genTextPosFrom(t){const e=Math.min(t,this._end);let i=1,o=1;for(let s=0;s<e;s++)this._text.charCodeAt(s)===N?(i++,o=1):o++;return{row:i,col:o}}}export{l as XmlStream};
@@ -0,0 +1 @@
1
+ const E=9,A=10,R=13,S=32,O=33,_=34,C=35,N=37,P=38,L=39,T=45,U=46,I=47,H=48,D=57,M=58,Q=59,W=60,Z=61,B=62,F=63,G=65,K=70,o=80,t=83,X=90,c=91,e=95,n=97,p=102,r=120,s=122;export{P as AMPERSAND,R as CARRIAGE_RETURN,M as COLON,_ as DOUBLE_QUOTE,Z as EQUALS,O as EXCLAMATION_MARK,B as GREATER_THAN,C as HASH,E as HORIZONTAL_TAB,T as HYPHEN,W as LESS_THAN,A as LINE_FEED,n as LOWERCASE_A,p as LOWERCASE_F,r as LOWERCASE_X,s as LOWERCASE_Z,D as NINE,c as OPEN_BRACKET,N as PERCENT,U as PERIOD,F as QUESTION_MARK,Q as SEMICOLON,L as SINGLE_QUOTE,I as SLASH,S as SPACE,e as UNDERSCORE,G as UPPERCASE_A,K as UPPERCASE_F,o as UPPERCASE_P,t as UPPERCASE_S,X as UPPERCASE_Z,H as ZERO};
@@ -1 +1 @@
1
- import{LESS_THAN as C,GREATER_THAN as r,OPEN_BRACKET as W,PERCENT as y,DOUBLE_QUOTE as x,SINGLE_QUOTE as v,UPPERCASE_S as I,UPPERCASE_P as N,SLASH as S,EQUALS as A,EXCLAMATION_MARK as F,QUESTION_MARK as L}from"./utils.js";import{XmlError as i}from"./XmlError.js";import{XmlStream as Q}from"./XmlStream.js";function O(t,n,s){k(new Q(t),n,s)}function k(t,n,s){if(t.startsWith("\uFEFF")&&t.advance(1),t.startsWith("<?xml ")&&D(t),m(t,s),t.skipSpaces(),t.startsWith("<!DOCTYPE")){if(!n)throw new i({type:"DtdDetected"});_(t,s),m(t,s)}if(t.skipSpaces(),!t.atEnd()&&t.currCodeUnit()===C&&U(t,s),m(t,s),!t.atEnd())throw new i({type:"UnknownToken",message:"Not at end"},t.genTextPos())}function m(t,n){for(;!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!--"))f(t,n);else if(t.startsWith("<?"))g(t,n);else break}function D(t){if(t.advance(5),h(t),!t.startsWith("version"))throw new i({type:"InvalidString",expected:"version"},t.genTextPos());u(t),h(t),t.startsWith("encoding")&&(u(t),h(t)),t.startsWith("standalone")&&u(t),t.skipSpaces(),t.skipString("?>")}function h(t){if(t.startsWithSpace())t.skipSpaces();else if(!t.startsWith("?>")&&!t.atEnd())throw new i({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos())}function f(t,n){const s=t.getPos();t.advance(4);const o=t.consumeCharsWhile((e,a)=>!(a==="-"&&e.startsWith("-->")));if(t.skipString("-->"),o.includes("--")||o.endsWith("-"))throw new i({type:"InvalidComment"},t.genTextPosFrom(s));n({type:"Comment",text:o,range:t.rangeFrom(s)})}function g(t,n){if(t.startsWith("<?xml "))throw new i({type:"UnexpectedDeclaration"},t.genTextPos());const s=t.getPos();t.advance(2);const o=t.consumeName();t.skipSpaces();const e=t.consumeCharsWhile((a,c)=>!(c==="?"&&a.startsWith("?>")));t.skipString("?>"),n({type:"ProcessingInstruction",target:o,content:e.length===0?void 0:e,range:t.rangeFrom(s)})}function _(t,n){const s=t.getPos();if(B(t),t.skipSpaces(),t.currCodeUnit()===r){t.advance(1);return}for(t.advance(1);!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!ENTITY"))R(t,n);else if(t.startsWith("<!--"))f(t,n);else if(t.startsWith("<?"))g(t,n);else if(t.startsWith("]"))if(t.advance(1),t.skipSpaces(),t.currCodeUnit()===r){t.advance(1);break}else throw new i({type:"InvalidChar",expected:"'>'",actual:t.currCodeUnitUnchecked()},t.genTextPos());else if(t.startsWith("<!ELEMENT")||t.startsWith("<!ATTLIST")||t.startsWith("<!NOTATION"))try{M(t)}catch(o){throw new i({type:"UnknownToken",message:"Failed to consume declaration"},t.genTextPosFrom(s))}else throw new i({type:"UnknownToken",message:"Failed to parse doctype"},t.genTextPos())}function B(t){t.advance(9),t.consumeSpaces(),t.skipName(),t.skipSpaces(),E(t),t.skipSpaces();const n=t.currCodeUnit();if(n!==W&&n!==r)throw new i({type:"InvalidChar",expected:"'[' or '>'",actual:n},t.genTextPos())}function E(t){if(t.startsWith("SYSTEM")||t.startsWith("PUBLIC")){const n=t.getPos();t.advance(6);const s=t.sliceBack(n);t.consumeSpaces();const o=t.consumeQuote();if(t.consumeCodeUnitsWhile(e=>e!==o),t.consumeCodeUnit(o),s==="PUBLIC"){t.consumeSpaces();const e=t.consumeQuote();t.consumeCodeUnitsWhile(a=>a!==e),t.consumeCodeUnit(e)}return!0}return!1}function R(t,n){t.advance(8),t.consumeSpaces();const s=!t.tryConsumeCodeUnit(y);s||t.consumeSpaces();const o=t.consumeName();t.consumeSpaces();const e=b(t,s);e!==null&&n({type:"EntityDeclaration",name:o,definition:e}),t.skipSpaces(),t.consumeCodeUnit(r)}function b(t,n){const s=t.currCodeUnit();if(s===x||s===v){const o=t.consumeQuote(),e=t.getPos();t.skipCodeUnitsWhile(c=>c!==o);const a=t.sliceBack(e);return t.consumeCodeUnit(o),a}else if(s===I||s===N){if(E(t))return n&&(t.skipSpaces(),t.startsWith("NDATA")&&(t.advance(5),t.consumeSpaces(),t.skipName())),null;throw new i({type:"InvalidExternalID"},t.genTextPos())}else throw new i({type:"InvalidChar",expected:"a quote, SYSTEM or PUBLIC",actual:s},t.genTextPos())}function M(t){t.skipCodeUnitsWhile(n=>n!==r),t.consumeCodeUnit(r)}function U(t,n){const s=t.getPos();t.advance(1);const[o,e]=t.consumeQName();n({type:"ElementStart",prefix:o,local:e,start:s});let a=!1;for(;!t.atEnd();){const c=t.startsWithSpace();t.skipSpaces();const d=t.getPos(),l=t.currCodeUnit();if(l===S){t.advance(1),t.consumeCodeUnit(r);const p=t.rangeFrom(d);n({type:"ElementEnd",end:{type:"Empty"},range:p});break}else if(l===r){t.advance(1);const p=t.rangeFrom(d);n({type:"ElementEnd",end:{type:"Open"},range:p}),a=!0;break}else{if(!c)throw new i({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos());const[p,T,P]=u(t),w=t.getPos();n({type:"Attribute",range:{start:d,end:w},prefix:p,local:T,value:P})}}a&&X(t,n)}function u(t){const[n,s]=t.consumeQName();let o;const e=t.getPos();if(t.skipSpaces(),t.tryConsumeCodeUnit(A)){t.skipSpaces();const a=t.consumeQuote(),c=String.fromCharCode(a),d=t.getPos();t.skipCharsWhile((l,p)=>p!==c&&p!=="<"),o=t.sliceBack(d),t.consumeCodeUnit(a)}else t.goTo(e),o="true";return[n,s,o]}function X(t,n){for(;!t.atEnd();)if(t.currCodeUnit()===C){const s=t.nextCodeUnit();if(s===F)if(t.startsWith("<!--"))f(t,n);else if(t.startsWith("<![CDATA["))Y(t,n);else throw new i({type:"UnknownToken",message:"Failed to parse content"},t.genTextPos());else if(s===L)g(t,n);else if(s===S){H(t,n);break}else U(t,n)}else K(t,n)}function Y(t,n){const s=t.getPos();t.advance(9);const o=t.consumeCharsWhile((a,c)=>!(c==="]"&&a.startsWith("]]>")));t.skipString("]]>");const e=t.rangeFrom(s);n({type:"Cdata",text:o,range:e})}function H(t,n){const s=t.getPos();t.advance(2);const[o,e]=t.consumeQName();t.skipSpaces(),t.consumeCodeUnit(r);const a=t.rangeFrom(s);n({type:"ElementEnd",end:{type:"Close",prefix:o,local:e},range:a})}function K(t,n){const s=t.getPos(),o=t.consumeCharsWhile((e,a)=>a!=="<");if(o.includes(">")&&o.includes("]]>"))throw new i({type:"InvalidCharacterData"},t.genTextPos());n({type:"Text",text:o,range:t.rangeFrom(s)})}export{O as tokenize,k as tokenizeXmlStream};
1
+ import{LESS_THAN as C,GREATER_THAN as r,OPEN_BRACKET as W,PERCENT as y,DOUBLE_QUOTE as x,SINGLE_QUOTE as v,UPPERCASE_S as I,UPPERCASE_P as N,SLASH as S,EQUALS as A,EXCLAMATION_MARK as F,QUESTION_MARK as L}from"./ascii-constants.js";import{XmlError as i}from"./XmlError.js";import{XmlStream as Q}from"./XmlStream.js";function O(t,n,s){k(new Q(t),n,s)}function k(t,n,s){if(t.startsWith("\uFEFF")&&t.advance(1),t.startsWith("<?xml ")&&D(t),m(t,s),t.skipSpaces(),t.startsWith("<!DOCTYPE")){if(!n)throw new i({type:"DtdDetected"});_(t,s),m(t,s)}if(t.skipSpaces(),!t.atEnd()&&t.currCodeUnit()===C&&U(t,s),m(t,s),!t.atEnd())throw new i({type:"UnknownToken",message:"Not at end"},t.genTextPos())}function m(t,n){for(;!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!--"))f(t,n);else if(t.startsWith("<?"))g(t,n);else break}function D(t){if(t.advance(5),h(t),!t.startsWith("version"))throw new i({type:"InvalidString",expected:"version"},t.genTextPos());u(t),h(t),t.startsWith("encoding")&&(u(t),h(t)),t.startsWith("standalone")&&u(t),t.skipSpaces(),t.skipString("?>")}function h(t){if(t.startsWithSpace())t.skipSpaces();else if(!t.startsWith("?>")&&!t.atEnd())throw new i({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos())}function f(t,n){const s=t.getPos();t.advance(4);const o=t.consumeCharsWhile((e,a)=>!(a==="-"&&e.startsWith("-->")));if(t.skipString("-->"),o.includes("--")||o.endsWith("-"))throw new i({type:"InvalidComment"},t.genTextPosFrom(s));n({type:"Comment",text:o,range:t.rangeFrom(s)})}function g(t,n){if(t.startsWith("<?xml "))throw new i({type:"UnexpectedDeclaration"},t.genTextPos());const s=t.getPos();t.advance(2);const o=t.consumeName();t.skipSpaces();const e=t.consumeCharsWhile((a,c)=>!(c==="?"&&a.startsWith("?>")));t.skipString("?>"),n({type:"ProcessingInstruction",target:o,content:e.length===0?void 0:e,range:t.rangeFrom(s)})}function _(t,n){const s=t.getPos();if(B(t),t.skipSpaces(),t.currCodeUnit()===r){t.advance(1);return}for(t.advance(1);!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!ENTITY"))R(t,n);else if(t.startsWith("<!--"))f(t,n);else if(t.startsWith("<?"))g(t,n);else if(t.startsWith("]"))if(t.advance(1),t.skipSpaces(),t.currCodeUnit()===r){t.advance(1);break}else throw new i({type:"InvalidChar",expected:"'>'",actual:t.currCodeUnitUnchecked()},t.genTextPos());else if(t.startsWith("<!ELEMENT")||t.startsWith("<!ATTLIST")||t.startsWith("<!NOTATION"))try{M(t)}catch(o){throw new i({type:"UnknownToken",message:"Failed to consume declaration"},t.genTextPosFrom(s))}else throw new i({type:"UnknownToken",message:"Failed to parse doctype"},t.genTextPos())}function B(t){t.advance(9),t.consumeSpaces(),t.skipName(),t.skipSpaces(),E(t),t.skipSpaces();const n=t.currCodeUnit();if(n!==W&&n!==r)throw new i({type:"InvalidChar",expected:"'[' or '>'",actual:n},t.genTextPos())}function E(t){if(t.startsWith("SYSTEM")||t.startsWith("PUBLIC")){const n=t.getPos();t.advance(6);const s=t.sliceBack(n);t.consumeSpaces();const o=t.consumeQuote();if(t.consumeCodeUnitsWhile(e=>e!==o),t.consumeCodeUnit(o),s==="PUBLIC"){t.consumeSpaces();const e=t.consumeQuote();t.consumeCodeUnitsWhile(a=>a!==e),t.consumeCodeUnit(e)}return!0}return!1}function R(t,n){t.advance(8),t.consumeSpaces();const s=!t.tryConsumeCodeUnit(y);s||t.consumeSpaces();const o=t.consumeName();t.consumeSpaces();const e=b(t,s);e!==null&&n({type:"EntityDeclaration",name:o,definition:e}),t.skipSpaces(),t.consumeCodeUnit(r)}function b(t,n){const s=t.currCodeUnit();if(s===x||s===v){const o=t.consumeQuote(),e=t.getPos();t.skipCodeUnitsWhile(c=>c!==o);const a=t.sliceBack(e);return t.consumeCodeUnit(o),a}else if(s===I||s===N){if(E(t))return n&&(t.skipSpaces(),t.startsWith("NDATA")&&(t.advance(5),t.consumeSpaces(),t.skipName())),null;throw new i({type:"InvalidExternalID"},t.genTextPos())}else throw new i({type:"InvalidChar",expected:"a quote, SYSTEM or PUBLIC",actual:s},t.genTextPos())}function M(t){t.skipCodeUnitsWhile(n=>n!==r),t.consumeCodeUnit(r)}function U(t,n){const s=t.getPos();t.advance(1);const[o,e]=t.consumeQName();n({type:"ElementStart",prefix:o,local:e,start:s});let a=!1;for(;!t.atEnd();){const c=t.startsWithSpace();t.skipSpaces();const d=t.getPos(),l=t.currCodeUnit();if(l===S){t.advance(1),t.consumeCodeUnit(r);const p=t.rangeFrom(d);n({type:"ElementEnd",end:{type:"Empty"},range:p});break}else if(l===r){t.advance(1);const p=t.rangeFrom(d);n({type:"ElementEnd",end:{type:"Open"},range:p}),a=!0;break}else{if(!c)throw new i({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos());const[p,T,P]=u(t),w=t.getPos();n({type:"Attribute",range:{start:d,end:w},prefix:p,local:T,value:P})}}a&&X(t,n)}function u(t){const[n,s]=t.consumeQName();let o;const e=t.getPos();if(t.skipSpaces(),t.tryConsumeCodeUnit(A)){t.skipSpaces();const a=t.consumeQuote(),c=String.fromCharCode(a),d=t.getPos();t.skipCharsWhile((l,p)=>p!==c&&p!=="<"),o=t.sliceBack(d),t.consumeCodeUnit(a)}else t.goTo(e),o="true";return[n,s,o]}function X(t,n){for(;!t.atEnd();)if(t.currCodeUnit()===C){const s=t.nextCodeUnit();if(s===F)if(t.startsWith("<!--"))f(t,n);else if(t.startsWith("<![CDATA["))Y(t,n);else throw new i({type:"UnknownToken",message:"Failed to parse content"},t.genTextPos());else if(s===L)g(t,n);else if(s===S){H(t,n);break}else U(t,n)}else K(t,n)}function Y(t,n){const s=t.getPos();t.advance(9);const o=t.consumeCharsWhile((a,c)=>!(c==="]"&&a.startsWith("]]>")));t.skipString("]]>");const e=t.rangeFrom(s);n({type:"Cdata",text:o,range:e})}function H(t,n){const s=t.getPos();t.advance(2);const[o,e]=t.consumeQName();t.skipSpaces(),t.consumeCodeUnit(r);const a=t.rangeFrom(s);n({type:"ElementEnd",end:{type:"Close",prefix:o,local:e},range:a})}function K(t,n){const s=t.getPos(),o=t.consumeCharsWhile((e,a)=>a!=="<");if(o.includes(">")&&o.includes("]]>"))throw new i({type:"InvalidCharacterData"},t.genTextPos());n({type:"Text",text:o,range:t.rangeFrom(s)})}export{O as tokenize,k as tokenizeXmlStream};
@@ -1 +1 @@
1
- const S=9,n=10,N=13,t=32,O=33,_=34,C=35,P=37,i=38,r=39,u=45,L=46,e=47,T=48,U=57,l=58,c=59,I=60,m=61,o=62,s=63,H=65,X=70,a=80,f=83,D=90,B=91,M=95,Q=97,W=102,Z=120,F=122;function G(E){return E>=48&&E<=57}function K(E){return E==null?!1:E<=128?E>=65&&E<=90||E>=97&&E<=122||E===58||E===95:E>=192&&E<=214||E>=216&&E<=246||E>=248&&E<=767||E>=880&&E<=893||E>=895&&E<=8191||E>=8204&&E<=8205||E>=8304&&E<=8591||E>=11264&&E<=12271||E>=12289&&E<=55295||E>=63744&&E<=64975||E>=65008&&E<=65533||E>=65536&&E<=983039}function p(E){return E==null?!1:E<=128?R(E):E===183||E>=192&&E<=214||E>=216&&E<=246||E>=248&&E<=767||E>=768&&E<=879||E>=880&&E<=893||E>=895&&E<=8191||E>=8204&&E<=8205||E>=8255&&E<=8256||E>=8304&&E<=8591||E>=11264&&E<=12271||E>=12289&&E<=55295||E>=63744&&E<=64975||E>=65008&&E<=65533||E>=65536&&E<=983039}function y(E){return E==null?!1:E<32?A(E):E!==65535&&E!==65534}function A(E){return E===32||E===9||E===10||E===13}function R(E){return E>=48&&E<=57||E>=65&&E<=90||E>=97&&E<=122||E===58||E===95||E===45||E===46}export{i as AMPERSAND,N as CARRIAGE_RETURN,l as COLON,_ as DOUBLE_QUOTE,m as EQUALS,O as EXCLAMATION_MARK,o as GREATER_THAN,C as HASH,S as HORIZONTAL_TAB,u as HYPHEN,I as LESS_THAN,n as LINE_FEED,Q as LOWERCASE_A,W as LOWERCASE_F,Z as LOWERCASE_X,F as LOWERCASE_Z,U as NINE,B as OPEN_BRACKET,P as PERCENT,L as PERIOD,s as QUESTION_MARK,c as SEMICOLON,r as SINGLE_QUOTE,e as SLASH,t as SPACE,M as UNDERSCORE,H as UPPERCASE_A,X as UPPERCASE_F,a as UPPERCASE_P,f as UPPERCASE_S,D as UPPERCASE_Z,T as ZERO,G as isAsciiDigit,y as isXmlChar,p as isXmlName,R as isXmlNameByte,K as isXmlNameStart,A as isXmlSpaceByte};
1
+ import{ZERO as E,NINE as t,UPPERCASE_A as i,UPPERCASE_Z as r,LOWERCASE_A as u,LOWERCASE_Z as e,COLON as R,UNDERSCORE as A,SPACE as m,HORIZONTAL_TAB as o,LINE_FEED as C,CARRIAGE_RETURN as O,HYPHEN as c,PERIOD as S}from"./ascii-constants.js";function s(n){return n>=E&&n<=t}function P(n){return n==null?!1:n<=128?n>=i&&n<=r||n>=u&&n<=e||n===R||n===A:n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||n>=65536&&n<=983039}function _(n){return n==null?!1:n<=128?N(n):n===183||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=768&&n<=879||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8255&&n<=8256||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||n>=65536&&n<=983039}function a(n){return n==null?!1:n<32?l(n):n!==65535&&n!==65534}function l(n){return n===m||n===o||n===C||n===O}function N(n){return n>=E&&n<=t||n>=i&&n<=r||n>=u&&n<=e||n===R||n===A||n===c||n===S}export{s as isAsciiDigit,a as isXmlChar,_ as isXmlName,N as isXmlNameByte,P as isXmlNameStart,l as isXmlSpaceByte};
@@ -1 +1 @@
1
- function n(t){let e="";switch(t.type){case"ProcessingInstruction":e+=`<?${t.target}`,t.content&&(e+=` ${t.content}`),e+="?>";break;case"Comment":e+=`<!--${t.text}-->`;break;case"EntityDeclaration":e+=`<!ENTITY ${t.name} "${t.definition}">`;break;case"ElementStart":e+=`<${t.prefix.length>0?`${t.prefix}:`:""}${t.local}`;break;case"Attribute":e+=` ${t.prefix.length>0?`${t.prefix}:`:""}${t.local}="${t.value}"`;break;case"ElementEnd":t.end.type==="Open"?e+=">":t.end.type==="Close"?e+=`</${t.end.prefix.length>0?`${t.end.prefix}:`:""}${t.end.local}>`:e+="/>";break;case"Text":e+=t.text;break;case"Cdata":e+=`<![CDATA[${t.text}]]>`;break}return e}function r(t){let e="";return t.forEach(a=>{e+=n(a)}),e}export{n as tokenToXml,r as tokensToXml};
1
+ import{tokenToXml as e}from"./token-to-xml.js";function n(t){let o="";return t.forEach(r=>{o+=e(r)}),o}export{n as tokensToXml};
@@ -1,2 +1,7 @@
1
+ /**
2
+ * Constructs a qualified name (QName) from a local name and an optional namespace prefix.
3
+ *
4
+ * https://www.w3.org/2001/tag/doc/qnameids.html
5
+ */
1
6
  export declare function getQName(local: string, prefix?: string | null): string;
2
7
  //# sourceMappingURL=get-q-name.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-q-name.d.ts","sourceRoot":"","sources":["../../src/get-q-name.ts"],"names":[],"mappings":"AACA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAE5E"}
1
+ {"version":3,"file":"get-q-name.d.ts","sourceRoot":"","sources":["../../src/get-q-name.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAE5E"}
@@ -1,4 +1,5 @@
1
1
  export * from './selector';
2
+ export * from './token-to-xml';
2
3
  export * from './tokenizer';
3
4
  export * from './tokens-to-xml';
4
5
  export * from './xml-to-object';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
@@ -1,10 +1,10 @@
1
- import { type TTokenSelectPathPart } from './types';
1
+ import { type TTokenSelectPathSegment } from './types';
2
2
  export declare class TokenSelectState {
3
- private _part;
3
+ private _segment;
4
4
  private _matchCriteria;
5
5
  private _toCacheNodeProps;
6
6
  private _enteredDepth;
7
- constructor(part: TTokenSelectPathPart);
7
+ constructor(segment: TTokenSelectPathSegment);
8
8
  get matchCriteria(): ETokenMatchCriteria;
9
9
  get toCacheNodeProps(): EToCacheNodeProps;
10
10
  get enteredDepth(): number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"TokenSelectState.d.ts","sourceRoot":"","sources":["../../../src/selector/TokenSelectState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,cAAc,CAAiD;IACvE,OAAO,CAAC,iBAAiB,CAA6C;IACtE,OAAO,CAAC,aAAa,CAAuB;gBAEhC,IAAI,EAAE,oBAAoB;IAKtC,IAAW,aAAa,IAAI,mBAAmB,CAE9C;IAED,IAAW,gBAAgB,IAAI,iBAAiB,CAE/C;IAED,IAAW,YAAY,IAAI,MAAM,GAAG,IAAI,CAEvC;IAED,OAAO,CAAC,WAAW;IAuBZ,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IASnD,iBAAiB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO;IAe9D,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIlC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IASzD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1B,OAAO,IAAI,IAAI;CAGtB;AAED,0BAAkB,iBAAiB;IAClC,IAAI,IAAI,CAAE,aAAa;IACvB,IAAI,IAAS,CAAE,uCAAuC;IACtD,UAAU,IAAS,CAAE,+CAA+C;IACpE,IAAI,IAAS;CACb;AAED,0BAAkB,mBAAmB;IACpC,IAAI,IAAI,CAAE,aAAa;IACvB,IAAI,IAAS,CAAE,uCAAuC;IACtD,UAAU,IAAS,CAAE,+CAA+C;IACpE,IAAI,IAAS,CAAE,sDAAsD;IACrE,IAAI,IAAS;CACb"}
1
+ {"version":3,"file":"TokenSelectState.d.ts","sourceRoot":"","sources":["../../../src/selector/TokenSelectState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,cAAc,CAAiD;IACvE,OAAO,CAAC,iBAAiB,CAA6C;IACtE,OAAO,CAAC,aAAa,CAAuB;gBAEhC,OAAO,EAAE,uBAAuB;IAK5C,IAAW,aAAa,IAAI,mBAAmB,CAE9C;IAED,IAAW,gBAAgB,IAAI,iBAAiB,CAE/C;IAED,IAAW,YAAY,IAAI,MAAM,GAAG,IAAI,CAEvC;IAED,OAAO,CAAC,WAAW;IAuBZ,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAWnD,iBAAiB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO;IAe9D,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIlC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IASzD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1B,OAAO,IAAI,IAAI;CAGtB;AAED,0BAAkB,iBAAiB;IAClC,IAAI,IAAI,CAAE,aAAa;IACvB,IAAI,IAAS,CAAE,uCAAuC;IACtD,UAAU,IAAS,CAAE,+CAA+C;IACpE,IAAI,IAAS;CACb;AAED,0BAAkB,mBAAmB;IACpC,IAAI,IAAI,CAAE,aAAa;IACvB,IAAI,IAAS,CAAE,uCAAuC;IACtD,UAAU,IAAS,CAAE,+CAA+C;IACpE,IAAI,IAAS,CAAE,sDAAsD;IACrE,IAAI,IAAS;CACb"}
@@ -4,8 +4,6 @@ import { type TTokenSelectPath } from './types';
4
4
  export declare class TokenSelectStateMachine {
5
5
  private _states;
6
6
  private _currentState;
7
- private _hasActiveCache;
8
- private _toCacheNodeProps;
9
7
  private _cachedNodeProps;
10
8
  private _cachedTokens;
11
9
  private _toRecordTokens;
@@ -20,6 +18,7 @@ export declare class TokenSelectStateMachine {
20
18
  private transitionForward;
21
19
  transitionBack(depth: number): void;
22
20
  isFinalState(): boolean;
21
+ getOffsetToFinal(): number;
23
22
  resetCurrentStateCache(): void;
24
23
  }
25
24
  //# sourceMappingURL=TokenSelectStateMachine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TokenSelectStateMachine.d.ts","sourceRoot":"","sources":["../../../src/selector/TokenSelectStateMachine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAA0C,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,qBAAa,uBAAuB;IACnC,OAAO,CAAC,OAAO,CAAqB;IAGpC,OAAO,CAAC,aAAa,CAAuB;IAG5C,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAA6C;IACtE,OAAO,CAAC,gBAAgB,CAKtB;IACF,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,eAAe,CAAmB;gBAE9B,eAAe,EAAE,gBAAgB;IAItC,YAAY,IAAI,gBAAgB,GAAG,IAAI;IAQvC,eAAe,IAAI,gBAAgB,GAAG,IAAI;IAO1C,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAM9B,kBAAkB,IAAI,SAAS,EAAE,GAAG,IAAI;IASxC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IA6B5E,2BAA2B,CACjC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACX,OAAO;IA4BH,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAyBlE,OAAO,CAAC,iBAAiB;IAmBlB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAgBnC,YAAY,IAAI,OAAO;IAIvB,sBAAsB,IAAI,IAAI;CASrC"}
1
+ {"version":3,"file":"TokenSelectStateMachine.d.ts","sourceRoot":"","sources":["../../../src/selector/TokenSelectStateMachine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAA0C,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,qBAAa,uBAAuB;IACnC,OAAO,CAAC,OAAO,CAAqB;IAGpC,OAAO,CAAC,aAAa,CAAuB;IAG5C,OAAO,CAAC,gBAAgB,CAKtB;IACF,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,eAAe,CAAmB;gBAE9B,eAAe,EAAE,gBAAgB;IAItC,YAAY,IAAI,gBAAgB,GAAG,IAAI;IAQvC,eAAe,IAAI,gBAAgB,GAAG,IAAI;IAO1C,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAM9B,kBAAkB,IAAI,SAAS,EAAE,GAAG,IAAI;IASxC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IA8B5E,2BAA2B,CACjC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACX,OAAO;IA4BH,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAwBlE,OAAO,CAAC,iBAAiB;IAmBlB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAgBnC,YAAY,IAAI,OAAO;IAIvB,gBAAgB,IAAI,MAAM;IAO1B,sBAAsB,IAAI,IAAI;CAOrC"}
@@ -1,45 +1,42 @@
1
1
  /**
2
- * Represents a single segment of a XPath expression.
3
- *
4
- * This interface allows for constructing XPath expressions in a object-oriented way,
5
- * avoiding the complexities of parsing a full XPath string.
6
- * If parsing a full XPath becomes necessary in the future, a tool like [Peggy](https://github.com/peggyjs/peggy)
7
- * could be used to facilitate the process.
8
- *
9
- * https://www.w3.org/TR/xpath-31/
2
+ * A limited segment of an XPath expression in an object-oriented manner.
10
3
  *
11
4
  * @example
12
5
  * // Represents the XPath expression `/bookstore/book[@category='fiction'][1]`
13
- * const xpathExpr: TXPathExpr = [
14
- * \{ axis: '/', name: 'bookstore' \},
6
+ * const xpathExpr: TTokenSelectPath = [
7
+ * \{ axis: '/', local: 'bookstore' \},
15
8
  * \{
16
9
  * axis: '/',
17
- * name: 'book',
18
- * predicate: \{ attribute: 'category', value: 'fiction' \},
19
- * position: 1,
20
- * attributes: ['category', 'lang'] // Selects the 'category' and 'lang' attributes
10
+ * local: 'book',
11
+ * attributes: [\{ local: 'category', value: 'fiction' \}],
12
+ * position: 1
21
13
  * \}
22
14
  * ];
23
15
  */
24
- export interface TTokenSelectPathPart {
16
+ export interface TTokenSelectPathSegment {
25
17
  /**
26
- * The axis defining the relationship between nodes.
18
+ * Specifies the axis defining the relationship between nodes.
19
+ *
20
+ * - 'child' ('/'): Selects all children of the current node
21
+ * - 'self-or-descendant' ('//'): Selects all descendants (children, grandchildren, etc.) of the current node and the current node itself
27
22
  */
28
23
  axis: 'child' | 'self-or-descendant';
29
24
  /**
30
- * The tag name of the node to match.
25
+ * The local name of the node to match.
26
+ *
27
+ * Use '*' to match any node.
31
28
  */
32
29
  local?: string | '*';
33
30
  /**
34
- * An optional prefix (e.g. namespace) to qualify the node name.
31
+ * An optional namespace prefix to qualify the node name.
35
32
  */
36
33
  prefix?: string;
37
34
  /**
38
- * An optional attribute-based filter.
35
+ * Optional filters based on node attributes.
39
36
  *
40
37
  * @example
41
- * // Matches a book element with a category attribute equal to 'fiction'
42
- * predicate: \{ attribute: 'category', value: 'fiction' \}
38
+ * // Matches a node with an attribute 'category' equal to 'fiction'
39
+ * attributes: [\{ local: 'category', value: 'fiction' \}]
43
40
  */
44
41
  attributes?: {
45
42
  local: string;
@@ -47,19 +44,32 @@ export interface TTokenSelectPathPart {
47
44
  value?: string;
48
45
  }[];
49
46
  /**
50
- * An optional text content matcher.
47
+ * Optional filter to match nodes containing specific text content.
48
+ *
49
+ * Currenlty only plain text can be matched.
50
+ * Text with sub nodes like <b/>, <strong/> can't be matched as of now.
51
51
  *
52
52
  * @example
53
- * // Matches elements containing the text 'bestseller'
54
- * textContains: 'bestseller'
53
+ * // Matches nodes containing the text 'bestseller'
54
+ * containsText: 'bestseller'
55
55
  */
56
- textContains?: string;
57
- predicate?: (node: any) => boolean;
56
+ containsText?: string;
57
+ /**
58
+ * Optional custom predicate function to further filter nodes.
59
+ *
60
+ * @example
61
+ * // Custom predicate to match nodes with specific characteristics
62
+ * predicate: (node) =\> node.local === 'title'
63
+ */
64
+ predicate?: (node: {
65
+ local: string;
66
+ prefix?: string;
67
+ attributes: Record<string, string>;
68
+ text?: string;
69
+ }) => boolean;
58
70
  }
59
71
  /**
60
- * Represents an entire XPath expression composed of multiple parts.
61
- * The expression is an array of `TXPathPart` objects, each defining
62
- * a segment of the XPath.
72
+ * A limited XPath expression composed of multiple segments in an object-oriented manner.
63
73
  */
64
- export type TTokenSelectPath = TTokenSelectPathPart[];
74
+ export type TTokenSelectPath = TTokenSelectPathSegment[];
65
75
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/selector/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,IAAI,EAAE,OAAO,GAAG,oBAAoB,CAAC;IAErC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAYlE;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/selector/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,MAAM,WAAW,uBAAuB;IACvC;;;;;OAKG;IACH,IAAI,EAAE,OAAO,GAAG,oBAAoB,CAAC;IAErC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAElE;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,KAAK,OAAO,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type TXmlToken } from './tokenizer';
2
+ export declare function tokenToXml(token: TXmlToken): string;
3
+ //# sourceMappingURL=token-to-xml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-to-xml.d.ts","sourceRoot":"","sources":["../../src/token-to-xml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAgDnD"}
@@ -1,6 +1,6 @@
1
1
  import { type TRange, type TReference, type TTextPos } from './types';
2
2
  /**
3
- * Represents a stream of characters for parsing XML-like content.
3
+ * A stream of characters for parsing XML-like content.
4
4
  *
5
5
  * This implementation uses UTF-16 code units, whereas the Rust implementation is based on bytes (UTF-8).
6
6
  * This difference in encoding affects how characters are handled and parsed.
@@ -1 +1 @@
1
- {"version":3,"file":"XmlStream.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/XmlStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAwBtE;;;;;;GAMG;AACH,qBAAa,SAAS;IACrB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;gBAEF,IAAI,EAAE,MAAM,EAAE,GAAG,SAAI;IAMxC;;;;OAIG;IACI,KAAK,IAAI,SAAS;IAIzB;;;;OAIG;IACI,MAAM,IAAI,MAAM;IAIvB;;;;OAIG;IACI,KAAK,IAAI,OAAO;IAIvB;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAO7B;;;;OAIG;IACI,qBAAqB,IAAI,MAAM;IAItC;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAO7B;;;;OAIG;IACI,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAI/B;;;;OAIG;IACI,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI9B;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIxC;;;;;OAKG;IACI,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAW9C;;;;;;OAMG;IACI,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQpD;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOrC;;;;;OAKG;IACI,qBAAqB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM;IAM9E;;;;OAIG;IACI,kBAAkB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IAMzE;;;;;;OAMG;IACI,iBAAiB,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM;IAMzF;;;;;OAKG;IACI,cAAc,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IAapF;;;;;OAKG;IACI,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIrC;;;;;OAKG;IACI,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIvC;;OAEG;IACI,UAAU,IAAI,IAAI;IAMzB;;;;OAIG;IACI,eAAe,IAAI,OAAO;IAIjC;;;;;OAKG;IACI,aAAa,IAAI,IAAI;IAe5B;;;;;OAKG;IACI,mBAAmB,IAAI,UAAU,GAAG,IAAI;IAiB/C;;;;OAIG;IACI,gBAAgB,IAAI,UAAU,GAAG,IAAI;IA4D5C;;;;;;OAMG;IACI,WAAW,IAAI,MAAM;IAY5B;;;;OAIG;IACI,QAAQ,IAAI,IAAI;IAgBvB;;;;;;OAMG;IACI,YAAY,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAiDvC;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAY7B;;;;;OAKG;IACI,UAAU,IAAI,QAAQ;IAI7B;;;;;;OAMG;IACI,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;CAc5C"}
1
+ {"version":3,"file":"XmlStream.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/XmlStream.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAItE;;;;;;GAMG;AACH,qBAAa,SAAS;IACrB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;gBAEF,IAAI,EAAE,MAAM,EAAE,GAAG,SAAI;IAMxC;;;;OAIG;IACI,KAAK,IAAI,SAAS;IAIzB;;;;OAIG;IACI,MAAM,IAAI,MAAM;IAIvB;;;;OAIG;IACI,KAAK,IAAI,OAAO;IAIvB;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAO7B;;;;OAIG;IACI,qBAAqB,IAAI,MAAM;IAItC;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAO7B;;;;OAIG;IACI,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAI/B;;;;OAIG;IACI,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI9B;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIxC;;;;;OAKG;IACI,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAW9C;;;;;;OAMG;IACI,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQpD;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOrC;;;;;OAKG;IACI,qBAAqB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM;IAM9E;;;;OAIG;IACI,kBAAkB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IAMzE;;;;;;OAMG;IACI,iBAAiB,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM;IAMzF;;;;;OAKG;IACI,cAAc,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IAapF;;;;;OAKG;IACI,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIrC;;;;;OAKG;IACI,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIvC;;OAEG;IACI,UAAU,IAAI,IAAI;IAMzB;;;;OAIG;IACI,eAAe,IAAI,OAAO;IAIjC;;;;;OAKG;IACI,aAAa,IAAI,IAAI;IAe5B;;;;;OAKG;IACI,mBAAmB,IAAI,UAAU,GAAG,IAAI;IAiB/C;;;;OAIG;IACI,gBAAgB,IAAI,UAAU,GAAG,IAAI;IA4D5C;;;;;;OAMG;IACI,WAAW,IAAI,MAAM;IAY5B;;;;OAIG;IACI,QAAQ,IAAI,IAAI;IAgBvB;;;;;;OAMG;IACI,YAAY,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAiDvC;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAY7B;;;;;OAKG;IACI,UAAU,IAAI,QAAQ;IAI7B;;;;;;OAMG;IACI,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;CAc5C"}
@@ -0,0 +1,33 @@
1
+ export declare const HORIZONTAL_TAB = 9;
2
+ export declare const LINE_FEED = 10;
3
+ export declare const CARRIAGE_RETURN = 13;
4
+ export declare const SPACE = 32;
5
+ export declare const EXCLAMATION_MARK = 33;
6
+ export declare const DOUBLE_QUOTE = 34;
7
+ export declare const HASH = 35;
8
+ export declare const PERCENT = 37;
9
+ export declare const AMPERSAND = 38;
10
+ export declare const SINGLE_QUOTE = 39;
11
+ export declare const HYPHEN = 45;
12
+ export declare const PERIOD = 46;
13
+ export declare const SLASH = 47;
14
+ export declare const ZERO = 48;
15
+ export declare const NINE = 57;
16
+ export declare const COLON = 58;
17
+ export declare const SEMICOLON = 59;
18
+ export declare const LESS_THAN = 60;
19
+ export declare const EQUALS = 61;
20
+ export declare const GREATER_THAN = 62;
21
+ export declare const QUESTION_MARK = 63;
22
+ export declare const UPPERCASE_A = 65;
23
+ export declare const UPPERCASE_F = 70;
24
+ export declare const UPPERCASE_P = 80;
25
+ export declare const UPPERCASE_S = 83;
26
+ export declare const UPPERCASE_Z = 90;
27
+ export declare const OPEN_BRACKET = 91;
28
+ export declare const UNDERSCORE = 95;
29
+ export declare const LOWERCASE_A = 97;
30
+ export declare const LOWERCASE_F = 102;
31
+ export declare const LOWERCASE_X = 120;
32
+ export declare const LOWERCASE_Z = 122;
33
+ //# sourceMappingURL=ascii-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ascii-constants.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/ascii-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,KAAK,KAAK,CAAC;AACxB,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,IAAI,KAAK,CAAC;AACvB,eAAO,MAAM,OAAO,KAAK,CAAC;AAC1B,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,MAAM,KAAK,CAAC;AACzB,eAAO,MAAM,MAAM,KAAK,CAAC;AACzB,eAAO,MAAM,KAAK,KAAK,CAAC;AACxB,eAAO,MAAM,IAAI,KAAK,CAAC;AACvB,eAAO,MAAM,IAAI,KAAK,CAAC;AACvB,eAAO,MAAM,KAAK,KAAK,CAAC;AACxB,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,MAAM,KAAK,CAAC;AACzB,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,WAAW,MAAM,CAAC"}
@@ -1,3 +1,4 @@
1
+ export * from './ascii-constants';
1
2
  export * from './tokenize';
2
3
  export * from './types';
3
4
  export * from './utils';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tokenize.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/tokenize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAgB9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,wBAAgB,QAAQ,CACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,cAAc,GAC3B,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,CAAC,EAAE,SAAS,EACZ,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,cAAc,GAC3B,IAAI,CAgCN"}
1
+ {"version":3,"file":"tokenize.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/tokenize.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,wBAAgB,QAAQ,CACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,cAAc,GAC3B,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,CAAC,EAAE,SAAS,EACZ,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,cAAc,GAC3B,IAAI,CAgCN"}
@@ -1,35 +1,3 @@
1
- export declare const HORIZONTAL_TAB = 9;
2
- export declare const LINE_FEED = 10;
3
- export declare const CARRIAGE_RETURN = 13;
4
- export declare const SPACE = 32;
5
- export declare const EXCLAMATION_MARK = 33;
6
- export declare const DOUBLE_QUOTE = 34;
7
- export declare const HASH = 35;
8
- export declare const PERCENT = 37;
9
- export declare const AMPERSAND = 38;
10
- export declare const SINGLE_QUOTE = 39;
11
- export declare const HYPHEN = 45;
12
- export declare const PERIOD = 46;
13
- export declare const SLASH = 47;
14
- export declare const ZERO = 48;
15
- export declare const NINE = 57;
16
- export declare const COLON = 58;
17
- export declare const SEMICOLON = 59;
18
- export declare const LESS_THAN = 60;
19
- export declare const EQUALS = 61;
20
- export declare const GREATER_THAN = 62;
21
- export declare const QUESTION_MARK = 63;
22
- export declare const UPPERCASE_A = 65;
23
- export declare const UPPERCASE_F = 70;
24
- export declare const UPPERCASE_P = 80;
25
- export declare const UPPERCASE_S = 83;
26
- export declare const UPPERCASE_Z = 90;
27
- export declare const OPEN_BRACKET = 91;
28
- export declare const UNDERSCORE = 95;
29
- export declare const LOWERCASE_A = 97;
30
- export declare const LOWERCASE_F = 102;
31
- export declare const LOWERCASE_X = 120;
32
- export declare const LOWERCASE_Z = 122;
33
1
  export declare function isAsciiDigit(byte: number): boolean;
34
2
  /**
35
3
  * Checks if the unicode code point (character) is within the name start char range.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,KAAK,KAAK,CAAC;AACxB,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,IAAI,KAAK,CAAC;AACvB,eAAO,MAAM,OAAO,KAAK,CAAC;AAC1B,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,MAAM,KAAK,CAAC;AACzB,eAAO,MAAM,MAAM,KAAK,CAAC;AACzB,eAAO,MAAM,KAAK,KAAK,CAAC;AACxB,eAAO,MAAM,IAAI,KAAK,CAAC;AACvB,eAAO,MAAM,IAAI,KAAK,CAAC;AACvB,eAAO,MAAM,KAAK,KAAK,CAAC;AACxB,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,MAAM,KAAK,CAAC;AACzB,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CA6BrE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CA2BhE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAUhE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUnD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/utils.ts"],"names":[],"mappings":"AAiBA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CA6BrE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CA2BhE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAUhE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUnD"}
@@ -1,4 +1,3 @@
1
1
  import { type TXmlToken } from './tokenizer';
2
- export declare function tokenToXml(token: TXmlToken): string;
3
2
  export declare function tokensToXml(tokens: TXmlToken[]): string;
4
3
  //# sourceMappingURL=tokens-to-xml.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens-to-xml.d.ts","sourceRoot":"","sources":["../../src/tokens-to-xml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAgDnD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAQvD"}
1
+ {"version":3,"file":"tokens-to-xml.d.ts","sourceRoot":"","sources":["../../src/tokens-to-xml.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAQvD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xml-tokenizer",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Straightforward and typesafe XML tokenizer that streams tokens through a callback mechanism",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",