Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
WIP Fix C++ synatx highlighting error in macros with extern "C"
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Zolotarev committed Apr 12, 2018
1 parent 7a97c96 commit b9c911f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions grammars/c++.cson
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,19 @@
]
}
{
'begin': '\\b(extern)(?=\\s*")'
'begin': '\\b(extern)(?=\\s*\")'
'beginCaptures':
'1':
'name': 'storage.modifier.cpp'
'end': '(?<=\\})|(?=\\w)|(?=\\s*#\\s*endif\\b)'
'end': '(?<=})|(?=\\w)|(?=\\s*#\\s*(?:elif|else|endif)\\b)'
'name': 'meta.extern-block.cpp'
'patterns': [
{
'begin': '\\{'
'begin': '{'
'beginCaptures':
'0':
'name': 'punctuation.section.block.begin.bracket.curly.c'
'end': '\\}|(?=\\s*#\\s*endif\\b)'
'end': '}|(?=\\s*#\\s*(?:elif|else|endif)\\b)'
'endCaptures':
'0':
'name': 'punctuation.section.block.end.bracket.curly.c'
Expand Down
10 changes: 10 additions & 0 deletions spec/c-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,16 @@ describe "Language-C", ->
expect(lines[6][0]).toEqual value: '#', scopes: ['source.cpp', 'meta.preprocessor.c', 'keyword.control.directive.conditional.c', 'punctuation.definition.directive.c']
expect(lines[6][1]).toEqual value: 'endif', scopes: ['source.cpp', 'meta.preprocessor.c', 'keyword.control.directive.conditional.c']

lines = grammar.tokenizeLines '''
#ifdef __cplusplus
#define EXTERN extern "C"
#else
#define EXTERN extern
#endif
'''
# TODO
expect(lines).toEqual false

it "tokenizes UTF string escapes", ->
lines = grammar.tokenizeLines '''
string str = U"\\U01234567\\u0123\\"\\0123\\x123";
Expand Down

0 comments on commit b9c911f

Please sign in to comment.