Skip to content
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

[ASP.NET, JSP] Two bugs for server side comment block #191

Closed
zufuliu opened this issue Jul 20, 2023 · 1 comment
Closed

[ASP.NET, JSP] Two bugs for server side comment block #191

zufuliu opened this issue Jul 20, 2023 · 1 comment
Labels
asp Caused by ASP or ASP.NET for the html lexer committed Issue fixed in repository but not in release html Caused by the hypertext lexer

Comments

@zufuliu
Copy link
Contributor

zufuliu commented Jul 20, 2023

Here are two bugs for server side comment <%-- ... --%> (maybe SCE_H_XCCOMMENT could be renamed? as it's not unique to XCode/JSP):
https://learn.microsoft.com/en-us/troubleshoot/developer/webapps/aspnet/development/inline-expressions#--------server-side-comments-block

lexilla/lexers/LexHTML.cxx

Lines 801 to 803 in 157f28e

19, "SCE_H_VALUE", "literal string", "Unquoted values",
20, "SCE_H_XCCOMMENT", "comment", "JSP Comment <%-- ... --%>",
21, "SCE_H_SGML_DEFAULT", "default", "SGML tags <! ... >",

# X-Code
val SCE_H_XCCOMMENT=20

First bug is code folding, I think fold whole script block should be promoted before if (chNext2 == '@') {:

lexilla/lexers/LexHTML.cxx

Lines 1516 to 1541 in 157f28e

if (chNext2 == '@') {
i += 2; // place as if it was the second next char treated
visibleChars += 2;
state = SCE_H_ASPAT;
scriptLanguage = eScriptVBS;
} else if ((chNext2 == '-') && (styler.SafeGetCharAt(i + 3) == '-')) {
styler.ColourTo(i + 3, SCE_H_ASP);
state = SCE_H_XCCOMMENT;
scriptLanguage = eScriptVBS;
continue;
} else {
if (chNext2 == '=') {
i += 2; // place as if it was the second next char treated
visibleChars += 2;
} else {
i++; // place as if it was the next char treated
visibleChars++;
}
state = StateForScript(aspScript);
scriptLanguage = aspScript;
}
styler.ColourTo(i, SCE_H_ASP);
// fold whole script
if (foldHTMLPreprocessor)
levelCurrent++;

Second bug is scriptLanguage lost on editing inside multiline comment block (e.g. press Enter before --%>), which cause comment block not terminated at handle the end of a pre-processor = Non-HTML. this is same for multiline SCE_H_ASPAT. Change ScriptOfState() to return eScriptVBS for SCE_H_XCCOMMENT and SCE_H_ASPAT fixed the problem. also ScriptOfState() likely has bug for SCE_HPHP_COMPLEX_VARIABLE.

@nyamatongwe nyamatongwe added the html Caused by the hypertext lexer label Jul 21, 2023
@nyamatongwe
Copy link
Member

<%-- wasn't allowed in old ASP but is in ASP.NET:

Warning: File /ServerBasic.asp Line 4 Expected statement. .

Changing names can be a problem for projects using these definitions.

First bug is code folding; scriptLanguage lost on editing inside multiline comment block; same for multiline 1SCE_H_ASPAT1

OK

@zufuliu zufuliu changed the title [ASP] Two bugs for server side comment block [ASP.NET, JSP] Two bugs for server side comment block Jul 21, 2023
@nyamatongwe nyamatongwe added committed Issue fixed in repository but not in release asp Caused by ASP or ASP.NET for the html lexer labels Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
asp Caused by ASP or ASP.NET for the html lexer committed Issue fixed in repository but not in release html Caused by the hypertext lexer
Projects
None yet
Development

No branches or pull requests

2 participants