* Iterates through the buffer, calling the function corresponding to the current state. * * States that are more likely to be hit are higher up, as a performance improvement.
()
| 896 | * States that are more likely to be hit are higher up, as a performance improvement. |
| 897 | */ |
| 898 | private parse() { |
| 899 | while (this.shouldContinue()) { |
| 900 | const c = this.buffer.charCodeAt(this.index - this.offset); |
| 901 | switch (this.state) { |
| 902 | case State.Text: { |
| 903 | this.stateText(c); |
| 904 | break; |
| 905 | } |
| 906 | case State.InPlainText: { |
| 907 | // Skip to end of buffer; cleanup() emits the text. |
| 908 | this.index = this.buffer.length + this.offset - 1; |
| 909 | break; |
| 910 | } |
| 911 | case State.SpecialStartSequence: { |
| 912 | this.stateSpecialStartSequence(c); |
| 913 | break; |
| 914 | } |
| 915 | case State.InSpecialTag: { |
| 916 | this.stateInSpecialTag(c); |
| 917 | break; |
| 918 | } |
| 919 | case State.CDATASequence: { |
| 920 | this.stateCDATASequence(c); |
| 921 | break; |
| 922 | } |
| 923 | case State.DeclarationSequence: { |
| 924 | this.stateDeclarationSequence(c); |
| 925 | break; |
| 926 | } |
| 927 | case State.InAttributeValueDq: { |
| 928 | this.stateInAttributeValueDoubleQuotes(c); |
| 929 | break; |
| 930 | } |
| 931 | case State.InAttributeName: { |
| 932 | this.stateInAttributeName(c); |
| 933 | break; |
| 934 | } |
| 935 | case State.InCommentLike: { |
| 936 | this.stateInCommentLike(c); |
| 937 | break; |
| 938 | } |
| 939 | case State.InSpecialComment: { |
| 940 | this.stateInSpecialComment(c); |
| 941 | break; |
| 942 | } |
| 943 | case State.BeforeAttributeName: { |
| 944 | this.stateBeforeAttributeName(c); |
| 945 | break; |
| 946 | } |
| 947 | case State.InTagName: { |
| 948 | this.stateInTagName(c); |
| 949 | break; |
| 950 | } |
| 951 | case State.InClosingTagName: { |
| 952 | this.stateInClosingTagName(c); |
| 953 | break; |
| 954 | } |
| 955 | case State.BeforeTagName: { |
no test coverage detected