-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
supplement(parser): reason for looping and searching for tags in the function isEnd is #231
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```typescript | ||
function isEnd(context: ParserContext, ancestors: ElementNode[]): boolean { | ||
const s = context.source; | ||
|
||
// sが"</"で始まり、かつその後にancestorsのタグ名が続くことを判定し、閉じタグがあるか(parseChildrenが終了するべきか)を判定します。 | ||
if (startsWith(s, "</")) { | ||
for (let i = ancestors.length - 1; i >= 0; --i) { | ||
if (startsWithEndTagOpen(s, ancestors[i].tag)) { | ||
return true; | ||
} | ||
} | ||
} | ||
|
||
return !s; | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove semi-colons and double quotes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure my change that removes semi-colons and double quotes is ok, but I removed them anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! This is fine.
I made a comprehensive commit regarding this format issue yesterday, but it seems like it hasn't been reflected in your branch. (Please sync it.)
resolve #213
I couldn't find clear reason for loop, so this tip is just things ubugeeei said in discord mostly.