https://bugs.kde.org/show_bug.cgi?id=457548

            Bug ID: 457548
           Summary: [PATCH] CartoCSS has wrong syntax highlighting when
                    the last statement in curly braces does not terminate
                    with a semicolon
           Product: frameworks-syntax-highlighting
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: syntax
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: sommer...@gmail.com
                CC: walter.von.entfer...@posteo.net
  Target Milestone: ---

Created attachment 151145
  --> https://bugs.kde.org/attachment.cgi?id=151145&action=edit
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)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to