Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion grammars/c.cson
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
'strings':
'patterns': [
{
'begin': '"'
'begin': '(?:u8|u|U|L)?"'
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.c'
Expand Down
16 changes: 16 additions & 0 deletions spec/c-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@ describe "Language-C", ->
expect(tokens[1]).toEqual value: '%', scopes: ['source.c', 'string.quoted.double.c']
expect(tokens[2]).toEqual value: '"', scopes: ['source.c', 'string.quoted.double.c', 'punctuation.definition.string.end.c']

it "tokenizes utf-8 string literal", ->
{tokens} = grammar.tokenizeLine 'char[] s = u8"this is utf-8 string literal"'
expect(tokens[6]).toEqual value: 'u8"', scopes: ['source.c', 'string.quoted.double.c', 'punctuation.definition.string.begin.c']

it "tokenizes 16-bit string literal", ->
{tokens} = grammar.tokenizeLine 'char16_t[] s = u"this is 16-bit string literal"'
expect(tokens[6]).toEqual value: 'u"', scopes: ['source.c', 'string.quoted.double.c', 'punctuation.definition.string.begin.c']

it "tokenizes 32-bit string literal", ->
{tokens} = grammar.tokenizeLine 'char32_t[] s = U"this is 32-bit string literal"'
expect(tokens[6]).toEqual value: 'U"', scopes: ['source.c', 'string.quoted.double.c', 'punctuation.definition.string.begin.c']

it "tokenizes wide string literal", ->
{tokens} = grammar.tokenizeLine 'wchar_t[] s = L"this is wide string literal"'
expect(tokens[6]).toEqual value: 'L"', scopes: ['source.c', 'string.quoted.double.c', 'punctuation.definition.string.begin.c']

describe "comments", ->
it "tokenizes them", ->
{tokens} = grammar.tokenizeLine '/**/'
Expand Down