atom/language-objective-c

syntax highlighting bug on objective c file

Closed this issue · 3 comments

From @scgaw2000 on March 24, 2015 5:40

The double quotation mark after a backslash is not the end of NSString construction. As a result, the following code should be highlighted as

if (![string isEqualToString:@"\t\n\"123") {
    // do somthing
}

but not
screen shot 2015-03-24 at 13 27 02

Using version 0.187.0 (0.187.0) on OS X 10.0.3 beta

Copied from original issue: atom/atom#6080

The cause of this bug is that the string_escaped_char is not loaded from source.c.

if we replace

      {
        'include': 'source.c#string_escaped_char'
      }

with

      {
        'match': '\\\\(\\\\|[abefnprtv\'"?]|[0-3]\\d{,2}|[4-7]\\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8})'
        'name': 'constant.character.escape.c'
      }
      {
        'match': '\\\\.'
        'name': 'invalid.illegal.unknown-escape.c'
      }

, then the highlighter works fine.

Not only the source.c#string_escaped_char is not loaded, and also source.c#string_placeholder is not loaded.

untitled

Perhaps this bug is not related to the content of grammar file but how atom parse the grammar file.

I checked http://manual.macromates.com/en/language_grammars#language_rules, which doesn't show that include can be used for referencing rules, such as #string_escaped_char' in source.c file. So I replace these includes with the rules in source.c file.

I can't reproduce this using the language-objective-c v0.15.1 and language-c v0.50.1, so closing.