Skip to content

Commit

Permalink
chore: fix circular reference issue
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Mar 1, 2022
1 parent f1e073b commit f20e52e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
12 changes: 8 additions & 4 deletions src/states/HTML_CONTENT.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { checkForCDATA, checkForPlaceholder, handleDelimitedBlockEOL } from ".";
import {
Parser,
CODE,
Expand Down Expand Up @@ -43,7 +42,12 @@ export const HTML_CONTENT: StateDefinition<HTMLContentMeta> = {
this.endText();
this.endHtmlBlock();
} else if (content.delimiter) {
handleDelimitedBlockEOL(this, len, content.delimiter, content.indent);
STATE.handleDelimitedBlockEOL(
this,
len,
content.delimiter,
content.indent
);
} else {
this.startText();
}
Expand All @@ -53,7 +57,7 @@ export const HTML_CONTENT: StateDefinition<HTMLContentMeta> = {

char(code) {
if (code === CODE.OPEN_ANGLE_BRACKET) {
if (checkForCDATA(this)) return;
if (STATE.checkForCDATA(this)) return;

const nextCode = this.lookAtCharCodeAhead(1);

Expand Down Expand Up @@ -103,7 +107,7 @@ export const HTML_CONTENT: StateDefinition<HTMLContentMeta> = {
this.endText();
this.enterState(STATE.INLINE_SCRIPT);
this.skip(1); // skip space
} else if (!checkForPlaceholder(this, code)) {
} else if (!STATE.checkForPlaceholder(this, code)) {
this.startText();
}
},
Expand Down
5 changes: 2 additions & 3 deletions src/states/JS_COMMENT_LINE.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { checkForClosingTag } from ".";
import { BODY_MODE, CODE, StateDefinition } from "../internal";
import { BODY_MODE, CODE, STATE, StateDefinition } from "../internal";

// We enter STATE.JS_COMMENT_LINE after we encounter a "//" sequence
// when parsing JavaScript code.
Expand All @@ -23,7 +22,7 @@ export const JS_COMMENT_LINE: StateDefinition = {
) {
// First, see if we need to see if we reached the closing tag
// eg: <script>//foo</script>
checkForClosingTag(this);
STATE.checkForClosingTag(this);
}
},
};
17 changes: 8 additions & 9 deletions src/states/PARSED_TEXT_CONTENT.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {
checkForCDATA,
checkForClosingTag,
checkForPlaceholder,
handleDelimitedBlockEOL,
} from ".";
import { Parser, STATE, CODE, StateDefinition, Range } from "../internal";

export interface ParsedTextContentMeta extends Range {
Expand All @@ -30,7 +24,12 @@ export const PARSED_TEXT_CONTENT: StateDefinition<ParsedTextContentMeta> = {
this.endText();
this.endHtmlBlock();
} else if (content.delimiter) {
handleDelimitedBlockEOL(this, len, content.delimiter, content.indent);
STATE.handleDelimitedBlockEOL(
this,
len,
content.delimiter,
content.indent
);
} else {
this.startText();
}
Expand All @@ -42,7 +41,7 @@ export const PARSED_TEXT_CONTENT: StateDefinition<ParsedTextContentMeta> = {
switch (code) {
case CODE.OPEN_ANGLE_BRACKET:
if (!this.isConcise) {
checkForClosingTag(this) || checkForCDATA(this);
STATE.checkForClosingTag(this) || STATE.checkForCDATA(this);
}
break;
case CODE.FORWARD_SLASH:
Expand All @@ -63,7 +62,7 @@ export const PARSED_TEXT_CONTENT: StateDefinition<ParsedTextContentMeta> = {
this.enterState(STATE.TEMPLATE_STRING);
break;
default:
if (!checkForPlaceholder(this, code)) this.startText();
if (!STATE.checkForPlaceholder(this, code)) this.startText();
break;
}
},
Expand Down

0 comments on commit f20e52e

Please sign in to comment.