From 0d09aabad61630ba96eb3feff7886d5cec84440a Mon Sep 17 00:00:00 2001 From: Samantha Marshall Date: Sun, 13 Nov 2016 15:02:20 -0800 Subject: [PATCH 1/2] adding objective-c syntax rules --- runtime/syntax/objc.micro | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 runtime/syntax/objc.micro diff --git a/runtime/syntax/objc.micro b/runtime/syntax/objc.micro new file mode 100644 index 00000000..f4d352d6 --- /dev/null +++ b/runtime/syntax/objc.micro @@ -0,0 +1,37 @@ +## Here is an example for C/C++/Obj-C. +## +syntax "Objective-C" "\.(m|mm|h)$" + +color type "\b(float|double|CGFloat|id|bool|BOOL|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline|Class|SEL|IMP)\b" +color type "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b" +color type "\b[A-Z][A-Z][[:alnum:]]*\b" +color type "\b[A-Za-z0-9_]*_t\b" +color type "\bdispatch_[a-zA-Z0-9_]*_t\b" + +color statement "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__" "__unused" "_Nonnull" "_Nullable" "__block" "__builtin.*" +color statement "\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\b" +color statement "\b(for|if|while|do|else|case|default|switch)\b" +color statement "\b(try|throw|catch|operator|new|delete)\b" +color statement "\b(goto|continue|break|return)\b" +color statement "\b(nonatomic|atomic|readonly|readwrite|strong|weak|assign)\b" +color statement "@(encode|end|interface|implementation|class|selector|protocol|synchronized|try|catch|finally|property|optional|required|import|autoreleasepool)" + +color preproc "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma).*$" +color preproc "__[A-Z0-9_]*__" + +color special "^[[:space:]]*[#|@][[:space:]]*(import|include)[[:space:]]*[\"|<].*\/?[>|\"][[:space:]]*$" + +color statement "[.:;,+*|=!\%\[\]]" "<" ">" "/" "-" "&" + +color constant.number "\b(-?)?[0-9]+\b" "\b\[0-9]+\.[0-9]+\b" "\b0x[0-9A-F]+\b" +color constant "@\[(\\.|[^\]])*\]" "@\{(\\.|[^\}])*\}" "@\((\\.|[^\)])*\)" +color constant "\b<(\\.[^\>])*\>\b" +color constant "\b(nil|NULL|YES|NO|TRUE|true|FALSE|false|self)\b" +color constant "\bk[[:alnum]]*\b" +color constant.string "\"(\\.|[^\"])*\"" "@\"(\\.|[^\"])*\"" "'.'" + + +color comment "//.*" +color comment start="/\*" end="\*/" + + From 935d39091159dee66834ab5589b1d16252159a18 Mon Sep 17 00:00:00 2001 From: Samantha Marshall Date: Sun, 13 Nov 2016 15:05:07 -0800 Subject: [PATCH 2/2] updating types --- runtime/syntax/objc.micro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/syntax/objc.micro b/runtime/syntax/objc.micro index f4d352d6..b97d660c 100644 --- a/runtime/syntax/objc.micro +++ b/runtime/syntax/objc.micro @@ -1,8 +1,8 @@ -## Here is an example for C/C++/Obj-C. +## Here is an example for Obj-C. ## syntax "Objective-C" "\.(m|mm|h)$" -color type "\b(float|double|CGFloat|id|bool|BOOL|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline|Class|SEL|IMP)\b" +color type "\b(float|double|CGFloat|id|bool|BOOL|Boolean|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline|Class|SEL|IMP|NS(U)?Integer)\b" color type "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b" color type "\b[A-Z][A-Z][[:alnum:]]*\b" color type "\b[A-Za-z0-9_]*_t\b"