diff --git a/components/prism-objectivec.js b/components/prism-objectivec.js index 412ab7f331..e17fc4e435 100644 --- a/components/prism-objectivec.js +++ b/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': /-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/ }); diff --git a/components/prism-objectivec.min.js b/components/prism-objectivec.min.js index 75763b2df1..f8932973ea 100644 --- a/components/prism-objectivec.min.js +++ b/components/prism-objectivec.min.js @@ -1 +1 @@ -Prism.languages.objectivec=Prism.languages.extend("c",{string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|@"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,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:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete Prism.languages.objectivec["class-name"],Prism.languages.objc=Prism.languages.objectivec; \ No newline at end of file +Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},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:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete Prism.languages.objectivec["class-name"],Prism.languages.objc=Prism.languages.objectivec; \ No newline at end of file diff --git a/tests/languages/objectivec/char_feature.test b/tests/languages/objectivec/char_feature.test index cf11705b77..a97fc67d96 100644 --- a/tests/languages/objectivec/char_feature.test +++ b/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'"] ]