Content of an element can also contain a tag terminator ('>') #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The content of an element can also contain a tag terminator ('>'), even if the CDATA, COMMENT or PI sections are not used. (Tag starters ('<') cannot be included.)
Citation.
https://www.w3.org/TR/xml/#NT-content
From the above, the following was the correct XML format. (I'm sorry.)
(I've also verified it using this site ( https://www.w3schools.com/xml/xml_validator.asp ))
So, I rethought the logic for getting the tag endings as follows.
・When retrieving the tag endpoint ('>') of a tag containing the current cursor, read the current cursor position one character at a time and use the following rules to find the tag endpoint ('>') while skipping the character string.
†1 " (double quotes) does not appear in a string enclosed in "(double quotes).
†2 ' (single quote) does not appear in a string enclosed in ' (single quote).
†3 If the corresponding symbol does not exist, the error is handled in the same way as before.
In considering the above logic, the following definitions were taken into account.
・The BNF of the start tag (STAG) (tag name, Attribute and blank (S) can only be included in the start tag)
Citation.
https://www.w3.org/TR/xml/#sec-starttags
EmptyElemTag, as well as the start tag (STAG)
The BNF of Attribute
The BNF of AttValue
I also modified the test code assumptions and added test items.
We would appreciate it if you would consider incorporating the above considerations.