Created attachment 151145 [details] carto-css.xml SUMMARY [PATCH] CartoCSS has wrong syntax highlighting when the last statement in curly braces does not terminate with a semicolon STEPS TO REPRODUCE Use the following example.mss with carto-css.xml syntax highlighting: [zoom >= 17] { text-size: 9; text-repeat-distance: 10 } [zoom >= 19] { text-size: 11; } OBSERVED RESULT The second “zoom” is not highlighted correctly. EXPECTED RESULT The second “zoom” is not highlighted correctly. ADDITIONAL INFORMATION The reason is the “missing” semicolon after “10”. The current carto-css.xml assumes that each statement within curly braces has to be terminated with a semicolon. However, the CartoCSS parser accepts (and without warnings!) that the last statement before curly braces is NOT terminated with a semicolon. So currently, we get wrong highlighting for syntactically correct CartoCSS files. The attached patch - fixes this issue by adding the necessary context switches to get correct highlighting - fixes the spell checking configuration (data field names and variable names should not be spell-checked because often they use abbreviations and the name of data fields is usually outside the influence of the CartoCSS user - use entities instead of repeating the same string (does not change the highlighting, but makes the XML code more structured)
Commit: https://invent.kde.org/frameworks/syntax-highlighting/-/commit/ce3eed7d886d57813116261592cc6b2cc81224dc The link is not made automatically because I did not write BUG correctly