Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Objective C: Improved string token (#3235)
  • Loading branch information
RunDevelopment committed Dec 7, 2021
1 parent afd77ed commit 8e0e95f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
5 changes: 4 additions & 1 deletion components/prism-objectivec.js
@@ -1,5 +1,8 @@
Prism.languages.objectivec = Prism.languages.extend('c', {
'string': /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|@"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
'string': {
pattern: /@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
greedy: true
},
'keyword': /\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,
'operator': /-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/
});
Expand Down
2 changes: 1 addition & 1 deletion components/prism-objectivec.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions tests/languages/objectivec/char_feature.test
@@ -1,12 +1,15 @@
''
'fo\'o'
'foo\
bar'
'a'
'\n'
'\000'
'\x00'
'\u0000'

----------------------------------------------------

[
["char", "''"],
["char", "'fo\\'o'"],
["char", "'foo\\\r\nbar'"]
["char", "'a'"],
["char", "'\\n'"],
["char", "'\\000'"],
["char", "'\\x00'"],
["char", "'\\u0000'"]
]

0 comments on commit 8e0e95f

Please sign in to comment.