ScintillaOrg / lexilla

A library of language lexers for use with Scintilla
https://www.scintilla.org/Lexilla.html
Other
185 stars 65 forks source link

Template literals for server JavaScript use wrong style #286

Open nyamatongwe opened 1 week ago

nyamatongwe commented 1 week ago

280 added basic template literal support but it only works for client-side scripts, not server-side where it produces client style SCE_HJ_TEMPLATELITERAL (53) instead of server-side SCE_HJA_TEMPLATELITERAL (68).

<html>
<%@language=JScript%>
<%`template ${2+2}`%>
</html>

statePrintForState needs to be updated to allow for SCE_HJ_TEMPLATELITERAL:

@@ -147,7 +147,7 @@ constexpr int statePrintForState(int state, script_mode inScriptType) noexcept {
            StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_PYTHON);
        } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) {
            StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_VBS);
-       } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
+       } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_TEMPLATELITERAL)) {
            StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_JS);
        }
    }

This will be committed in a couple of days.

zufuliu commented 1 week ago

The test case can be added into ServerJavaScript.aspx to reduce files inside hypertext folder.