├── Support ├── completion │ ├── c.functions.txt.gz │ └── cpp.functions.txt.gz ├── CLib.txt.gz ├── C++Lib.txt.gz ├── bin │ ├── bootstrap.sh │ ├── insert_missing_includes.rb │ └── headers ├── SpotlightSearch.rb └── c_completion2.rb ├── Snippets ├── std::string.tmSnippet ├── Enumeration.tmSnippet ├── std::map (map).plist ├── std::vector (v).plist ├── Typedef.tmSnippet ├── #include "" (inc).plist ├── #include <> (Inc).plist ├── template (template).plist ├── 030 for int loop (fori).plist ├── if .. (if).plist ├── Shared Pointer.tmSnippet ├── do...while loop (do).plist ├── #pragma mark (mark).plist ├── #endif.plist ├── printf .. (printf).plist ├── fprintf ….tmSnippet ├── #ifndef … #define … #endif.tmSnippet ├── $1.begin(), $1.end() (beginend).plist ├── 010 main() (main).plist ├── struct.plist ├── namespace .. (namespace).plist ├── Continue Block Comment.tmSnippet ├── class .. (class).plist ├── Include header once only guard.plist └── read file (readF).plist ├── Preferences ├── Disable Spell Checking.plist ├── Symbol List: Prefix Banner Items.tmPreferences ├── Symbol List: Exclude class inheritance.tmPreferences ├── Folding: Access.tmPreferences ├── Folding.tmPreferences ├── Include Completion.plist ├── Symbol List: Indent Class Methods.tmPreferences ├── Include Completion (System).tmPreferences ├── Template:cast typing pairs.plist ├── Include typing pairs.plist ├── Comments (C++).tmPreferences ├── Typing Pairs: Integer Literals.tmPreferences ├── Highlight Pairs: if...endif.tmPreferences ├── Typing Pairs: Selection.tmPreferences └── Indentation Rules.plist ├── Macros ├── Insert ; and Indent Line.tmMacro └── Insert Missing Includes.plist ├── Commands ├── Toggle System:Local Include.tmCommand ├── C Library Completions.tmCommand ├── C & C++ Library Completions.tmCommand ├── Insert Call to Constructors.tmCommand ├── Reformat Document.tmCommand ├── System Header Completion.tmCommand ├── Run.tmCommand ├── Quick Open.plist └── Fold:Unfold Code.tmCommand ├── README.mdown ├── info.plist └── Syntaxes ├── C++.plist └── C.plist /Support/completion/c.functions.txt.gz: -------------------------------------------------------------------------------- 1 | ../CLib.txt.gz -------------------------------------------------------------------------------- /Support/completion/cpp.functions.txt.gz: -------------------------------------------------------------------------------- 1 | ../C++Lib.txt.gz -------------------------------------------------------------------------------- /Support/CLib.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/textmate/c.tmbundle/master/Support/CLib.txt.gz -------------------------------------------------------------------------------- /Support/C++Lib.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/textmate/c.tmbundle/master/Support/C++Lib.txt.gz -------------------------------------------------------------------------------- /Support/bin/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | A_OUT=$(mktemp "${TMPDIR}/${TM_DISPLAYNAME:-untitled}_XXX") 4 | trap 'rm "$A_OUT"' EXIT 5 | 6 | "$@" -o "$A_OUT" 7 | 8 | if [ $? -eq 0 ]; then 9 | "$A_OUT" 10 | fi 11 | -------------------------------------------------------------------------------- /Snippets/std::string.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | std::string 7 | name 8 | std::string 9 | scope 10 | source.c++, source.objc++ 11 | tabTrigger 12 | str 13 | uuid 14 | A5F0BA15-A173-47B4-8C3D-3C128A1316CA 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Enumeration.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | enum ${1:name} { $0 }; 7 | name 8 | Enumeration 9 | scope 10 | source.c, source.objc, source.c++, source.objc++ 11 | tabTrigger 12 | enum 13 | uuid 14 | DD10B510-1C36-45E0-A378-527401EE55B1 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/std::map (map).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | std::map<${1:key}, ${2:value}> map$0; 7 | name 8 | std::map 9 | scope 10 | source.c++, source.objc++ 11 | tabTrigger 12 | map 13 | uuid 14 | A295A902-ACAF-11D9-987D-000D93589AF6 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/std::vector (v).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | std::vector<${1:char}> v$0; 7 | name 8 | std::vector 9 | scope 10 | source.c++, source.objc++ 11 | tabTrigger 12 | vector 13 | uuid 14 | 5E468268-ACAF-11D9-987D-000D93589AF6 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Typedef.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | typedef ${1:int} ${2:MyCustomType}; 7 | name 8 | Typedef 9 | scope 10 | source.c, source.objc, source.c++, source.objc++ 11 | tabTrigger 12 | td 13 | uuid 14 | 08E16CAE-DBD8-4570-B778-9E0E0EFFF80C 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/#include "" (inc).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | #include "${1:${TM_FILENAME/\..+$/.h/}}" 7 | name 8 | #include "…" 9 | scope 10 | source.c, source.objc, source.c++, source.objc++ 11 | tabTrigger 12 | inc 13 | uuid 14 | 9AB31B76-7298-11D9-813A-000D93589AF6 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/#include <> (Inc).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | #include <${1:.h}> 7 | name 8 | #include <…> 9 | scope 10 | source.c, source.objc, source.c++, source.objc++ 11 | tabTrigger 12 | Inc 13 | uuid 14 | B10CBD5D-7298-11D9-813A-000D93589AF6 15 | 16 | 17 | -------------------------------------------------------------------------------- /Preferences/Disable Spell Checking.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Spell Checking: Disable for Include Strings 7 | scope 8 | meta.preprocessor.c.include string.quoted 9 | settings 10 | 11 | spellChecking 12 | 0 13 | 14 | uuid 15 | DC32505E-226B-409A-B3C3-8FC88BF4A131 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/template (template).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | template <typename ${1:_InputIter}> 7 | name 8 | template <typename …> 9 | scope 10 | source.c++, source.objc++ 11 | tabTrigger 12 | tp 13 | uuid 14 | C5DEE118-4C9E-4F3E-97A4-0E01A250F142 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/030 for int loop (fori).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | for(size_t ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) 7 | { 8 | ${0:/* code */} 9 | } 10 | name 11 | For Loop 12 | scope 13 | source.c, source.c++ 14 | tabTrigger 15 | for 16 | uuid 17 | 78EF7134-0859-4475-89C3-30927865E855 18 | 19 | 20 | -------------------------------------------------------------------------------- /Snippets/if .. (if).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | if(${1:/* condition */}) 7 | { 8 | ${0:/* code */} 9 | } 10 | name 11 | If Condition 12 | scope 13 | source.c, source.objc, source.c++, source.objc++ 14 | tabTrigger 15 | if 16 | uuid 17 | F060AC09-C289-11D9-8CEF-000D93589AF6 18 | 19 | 20 | -------------------------------------------------------------------------------- /Snippets/Shared Pointer.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | typedef std::shared_ptr<${2:${1:my_type}_t}> ${3:${2/_t$/_ptr/}}; 7 | name 8 | Shared Pointer 9 | scope 10 | source.c, source.objc, source.c++, source.objc++ 11 | tabTrigger 12 | sp 13 | uuid 14 | 986C0149-7802-4385-A237-90074D9D5ACD 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/do...while loop (do).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | do { 7 | ${0:/* code */} 8 | } while(${1:/* condition */}); 9 | name 10 | Do While Loop 11 | scope 12 | source.c, source.objc, source.c++, source.objc++ 13 | tabTrigger 14 | do 15 | uuid 16 | D1F5A25E-A70F-11D9-A11A-000A95A89C98 17 | 18 | 19 | -------------------------------------------------------------------------------- /Preferences/Symbol List: Prefix Banner Items.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Symbol List: Prefix Banner Items 7 | scope 8 | meta.toc-list.banner 9 | settings 10 | 11 | symbolTransformation 12 | 13 | s/^\s+/# /; 14 | s/^=+$/-/; 15 | 16 | 17 | uuid 18 | A8E4E48A-81F3-4DB7-A7A2-88662C06E011 19 | 20 | 21 | -------------------------------------------------------------------------------- /Snippets/#pragma mark (mark).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | #if 0 7 | ${1:#pragma mark - 8 | }#pragma mark $2 9 | #endif 10 | 11 | $0 12 | name 13 | #pragma mark 14 | scope 15 | source.c, source.objc, source.c++, source.objc++ 16 | tabTrigger 17 | mark 18 | uuid 19 | ADD104E9-830A-4AC4-AAF4-DB6D3B0B7506 20 | 21 | 22 | -------------------------------------------------------------------------------- /Snippets/#endif.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | #endif 7 | 8 | keyEquivalent 9 | ~@. 10 | name 11 | #endif 12 | scope 13 | source.c, source.c++, source.objc, source.objc++, (source.c | source.c++ | source.objc | source.objc++) & comment.block.preprocessor 14 | uuid 15 | 5039DA0E-538B-48E2-A45A-E5A27787E765 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/printf .. (printf).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | printf("${1:%s}\\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/} 7 | name 8 | printf … 9 | scope 10 | source.c, source.objc, source.c++, source.objc++ 11 | tabTrigger 12 | printf 13 | uuid 14 | 5A086BE2-BCF6-11D9-82A9-000D93589AF6 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/fprintf ….tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | fprintf(${1:stderr}, "${2:%s}\\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/} 7 | name 8 | fprintf … 9 | scope 10 | source.c, source.objc, source.c++, source.objc++ 11 | tabTrigger 12 | fprintf 13 | uuid 14 | FE378349-BD63-4390-9A3B-516F7FF7F413 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/#ifndef … #define … #endif.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | #ifndef ${1/([A-Za-z0-9_]+).*/$1/} 7 | #define ${1:SYMBOL} ${2:value} 8 | #endif 9 | name 10 | #ifndef … #define … #endif 11 | scope 12 | source.c, source.c++, source.objc, source.objc++ 13 | tabTrigger 14 | def 15 | uuid 16 | 680358EA-B24B-4662-8DDA-AD42288795E4 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/$1.begin(), $1.end() (beginend).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}begin(), ${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end() 7 | name 8 | $1.begin(), $1.end() 9 | scope 10 | source.c++, source.objc++ 11 | tabTrigger 12 | beginend 13 | uuid 14 | 62D59E1C-1DF1-490E-86E9-DFF8A461AD9C 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/010 main() (main).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | int main (int argc, char const${TM_C_POINTER: *}argv[]) 7 | { 8 | ${0:/* code */} 9 | return 0; 10 | } 11 | name 12 | main() 13 | scope 14 | source.c, source.objc, source.c++, source.objc++ 15 | tabTrigger 16 | main 17 | uuid 18 | BC8B81AB-5F16-11D9-B9C3-000D93589AF6 19 | 20 | 21 | -------------------------------------------------------------------------------- /Snippets/struct.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | struct ${1:${TM_DISPLAYNAME/(.+?)(\..+)?$/${1/(\w+)(\W+$)?|\W+/${1:?${1:/asciify/downcase}:_}/g}_t/}} 7 | { 8 | ${0:/* data */} 9 | }; 10 | name 11 | Struct 12 | scope 13 | source.c, source.objc, source.c++, source.objc++ 14 | tabTrigger 15 | st 16 | uuid 17 | 1D14B92E-8819-11D9-8661-000D93589AF6 18 | 19 | 20 | -------------------------------------------------------------------------------- /Preferences/Symbol List: Exclude class inheritance.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleUUID 6 | 4675A940-6227-11D9-BFB1-000D93589AF6 7 | name 8 | Symbol List: Exclude class inheritance 9 | scope 10 | entity.name.type.inherited.c++ 11 | settings 12 | 13 | showInSymbolList 14 | 0 15 | 16 | uuid 17 | DA926AFF-E231-4036-9197-AFD6E314A0DC 18 | 19 | 20 | -------------------------------------------------------------------------------- /Snippets/namespace .. (namespace).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | namespace${1/.+/ /m}${1:${TM_DISPLAYNAME/(.+?)(\..+)?$/${1/(\w+)(\W+$)?|\W+/${1:?${1:/asciify/downcase}:_}/g}/}} 7 | { 8 | $0 9 | }${1/.+/ \/* /m}$1${1/.+/ *\//m} 10 | name 11 | Namespace 12 | scope 13 | source.c++, source.objc++ 14 | tabTrigger 15 | ns 16 | uuid 17 | CEE5F928-47A2-4648-96F0-99FF5C2A7419 18 | 19 | 20 | -------------------------------------------------------------------------------- /Preferences/Folding: Access.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Folding: Access/Comments 7 | scope 8 | source.c++, source.objc++ 9 | settings 10 | 11 | foldingIndentedBlockIgnore 12 | ^\s*# 13 | foldingIndentedBlockStart 14 | ^\s*(public|protected|private):\s*(//.*)?$|^\s*/[*](?!.*[*]/) 15 | 16 | uuid 17 | 4CA2F06B-4B5F-4618-BAF4-3F48AE647082 18 | 19 | 20 | -------------------------------------------------------------------------------- /Preferences/Folding.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Folding 7 | scope 8 | source.c, source.c++ 9 | settings 10 | 11 | foldingStartMarker 12 | (?x) 13 | /\*\*(?!\*) 14 | |^(?![^{]*?//|[^{]*?/\*(?!.*?\*/.*?\{)).*?\{\s*($|//|/\*(?!.*?\*/.*\S)) 15 | 16 | foldingStopMarker 17 | (?<!\*)\*\*/|^\s*\} 18 | 19 | uuid 20 | C7881C3D-B09F-405A-8E88-972EB244154A 21 | 22 | 23 | -------------------------------------------------------------------------------- /Preferences/Include Completion.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Header Completion (User) 7 | scope 8 | meta.preprocessor.c.include string.quoted.double 9 | settings 10 | 11 | completionCommand 12 | "$TM_BUNDLE_SUPPORT/bin/headers" -p"$TM_CURRENT_WORD" -duser -C"$TM_DIRECTORY" 13 | disableDefaultCompletion 14 | 1 15 | 16 | uuid 17 | 66EE7D45-6AA0-4AB9-9699-A3DF4E2B9AE7 18 | 19 | 20 | -------------------------------------------------------------------------------- /Preferences/Symbol List: Indent Class Methods.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleUUID 6 | 4675A940-6227-11D9-BFB1-000D93589AF6 7 | name 8 | Symbol List: Indent Class Methods 9 | scope 10 | meta.class-struct-block.c++ entity.name.function 11 | settings 12 | 13 | symbolTransformation 14 | 15 | s/^\s*/ /; # pad 16 | 17 | uuid 18 | B2B97E23-E686-4410-991D-A92AF3A9FC95 19 | 20 | 21 | -------------------------------------------------------------------------------- /Preferences/Include Completion (System).tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Header Completion (System) 7 | scope 8 | meta.preprocessor.c.include string.quoted.other.lt-gt.include 9 | settings 10 | 11 | completionCommand 12 | "$TM_BUNDLE_SUPPORT/bin/headers" -p"$TM_CURRENT_WORD" 13 | disableDefaultCompletion 14 | 1 15 | 16 | uuid 17 | 9136716A-CE06-4801-ABC9-3D64300869F8 18 | 19 | 20 | -------------------------------------------------------------------------------- /Snippets/Continue Block Comment.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${TM_CURRENT_LINE/(.*\*\/$)|.*?(\/\*(?!.*\*\/)).*|.*/(?1: 7 | : 8 | (?2: )* )/} 9 | hideFromUser 10 | 11 | keyEquivalent 12 |  13 | name 14 | Continue Block Comment 15 | scope 16 | source.c comment.block, source.c++ comment.block, source.objc comment.block, source.objc++ comment.block 17 | uuid 18 | F3EFAE6A-0978-4E1A-A3D7-4D16EE3EA079 19 | 20 | 21 | -------------------------------------------------------------------------------- /Snippets/class .. (class).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | class ${1:${TM_DISPLAYNAME/(.+?)(\..+)?$/${1/(\w+)(\W+$)?|\W+/${1:?${1:/asciify/downcase}:_}/g}_t/}} 7 | { 8 | public: 9 | ${1/(\w+).*/$1/} (${2:arguments}); 10 | virtual ~${1/(\w+).*/$1/} (); 11 | 12 | private: 13 | ${0:/* data */} 14 | }; 15 | name 16 | Class 17 | scope 18 | source.c++, source.objc++ 19 | tabTrigger 20 | cl 21 | uuid 22 | 523B30D4-C28A-11D9-8CEF-000D93589AF6 23 | 24 | 25 | -------------------------------------------------------------------------------- /Snippets/Include header once only guard.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | #ifndef ${1:${TM_DISPLAYNAME/(\w+)(\W+$)?|\W+/${1:?${1:/asciify/upcase}:_}/g}_`uuidgen|cut -c-8`} 7 | #define $1 8 | 9 | ${TM_SELECTED_TEXT/\Z\n//}${0:} 10 | 11 | #endif /* end of include guard: $1 */ 12 | 13 | name 14 | Header Include-Guard 15 | scope 16 | source.c, source.objc, source.c++, source.objc++ 17 | tabTrigger 18 | once 19 | uuid 20 | 74AF5E38-994C-4641-96F0-EB98A2183F60 21 | 22 | 23 | -------------------------------------------------------------------------------- /Snippets/read file (readF).plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | std::vector<char> v; 7 | if(FILE${TM_C_POINTER: *}fp = fopen(${1:"filename"}, "r")) 8 | { 9 | char buf[1024]; 10 | while(size_t len = fread(buf, 1, sizeof(buf), fp)) 11 | v.insert(v.end(), buf, buf + len); 12 | fclose(fp); 13 | } 14 | name 15 | Read File Into Vector 16 | scope 17 | source.c++, source.objc++ 18 | tabTrigger 19 | readfile 20 | uuid 21 | E8C3B596-9045-11D9-AB38-000D93589AF6 22 | 23 | 24 | -------------------------------------------------------------------------------- /Preferences/Template:cast typing pairs.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Typing Pairs: Template/Cast 7 | scope 8 | storage.type.c++.template, keyword.operator.c++.cast 9 | settings 10 | 11 | highlightPairs 12 | 13 | 14 | < 15 | > 16 | 17 | 18 | smartTypingPairs 19 | 20 | 21 | < 22 | > 23 | 24 | 25 | 26 | uuid 27 | 47DD44E6-B4F5-4C2E-BC62-C6ACEBC02A0D 28 | 29 | 30 | -------------------------------------------------------------------------------- /Macros/Insert ; and Indent Line.tmMacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | commands 6 | 7 | 8 | argument 9 | ; 10 | command 11 | insertText: 12 | 13 | 14 | command 15 | indent: 16 | 17 | 18 | isDisabled 19 | 20 | keyEquivalent 21 | ; 22 | name 23 | Insert ; and Indent Line 24 | scope 25 | (source.c | source.c++ | source.objc | source.objc++) - comment - string 26 | scopeType 27 | local 28 | uuid 29 | 034C3F18-097D-4B2C-8F20-C1CA3E9573E9 30 | 31 | 32 | -------------------------------------------------------------------------------- /Preferences/Include typing pairs.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Typing Pairs: Include Statements 7 | scope 8 | meta.preprocessor.c.include 9 | settings 10 | 11 | highlightPairs 12 | 13 | 14 | " 15 | " 16 | 17 | 18 | < 19 | > 20 | 21 | 22 | smartTypingPairs 23 | 24 | 25 | " 26 | " 27 | 28 | 29 | < 30 | > 31 | 32 | 33 | 34 | uuid 35 | 1EACF554-A30C-44B0-B97A-11E3FA995045 36 | 37 | 38 | -------------------------------------------------------------------------------- /Commands/Toggle System:Local Include.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 9 | 10 | print case str = STDIN.read 11 | when /\A"(.*)"\z/m then "<" + $1 + ">" 12 | when /\A<(.*)>\z/m then '"' + $1 + '"' 13 | else str 14 | end 15 | 16 | fallbackInput 17 | scope 18 | input 19 | selection 20 | keyEquivalent 21 | ^" 22 | name 23 | Toggle System/Local Include 24 | output 25 | replaceSelectedText 26 | scope 27 | string.quoted.double.include.c, string.quoted.other.lt-gt.include.c 28 | uuid 29 | E8D80809-0CDE-4E57-AC2A-8C22DFF353EE 30 | 31 | 32 | -------------------------------------------------------------------------------- /Commands/C Library Completions.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | 4675A940-6227-11D9-BFB1-000D93589AF6 9 | command 10 | #!/usr/bin/env ruby18 11 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes" 12 | require "#{ENV['TM_SUPPORT_PATH']}/lib/escape" 13 | require "#{ENV['TM_BUNDLE_SUPPORT']}/c_completion2"#{ 14 | 15 | res = CCompletion.new.print 16 | print res 17 | fallbackInput 18 | line 19 | input 20 | none 21 | keyEquivalent 22 | ~ 23 | name 24 | C Library Completions 25 | output 26 | insertAsSnippet 27 | scope 28 | source.c 29 | uuid 30 | 45FFA4DA-C84A-4D1F-862B-F249C24941EF 31 | 32 | 33 | -------------------------------------------------------------------------------- /Commands/C & C++ Library Completions.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | 4675A940-6227-11D9-BFB1-000D93589AF6 9 | command 10 | #!/usr/bin/env ruby18 11 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes" 12 | require "#{ENV['TM_SUPPORT_PATH']}/lib/escape" 13 | require "#{ENV['TM_BUNDLE_SUPPORT']}/c_completion2" 14 | 15 | res = CppCompletion.new.print 16 | print res 17 | fallbackInput 18 | line 19 | input 20 | none 21 | keyEquivalent 22 | ~ 23 | name 24 | C & C++ Library Completions 25 | output 26 | insertAsSnippet 27 | scope 28 | source.c++ 29 | uuid 30 | 093DA4F2-D97F-4309-B869-6970C090A539 31 | 32 | 33 | -------------------------------------------------------------------------------- /README.mdown: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | You can install this bundle in TextMate by opening the preferences and going to the bundles tab. After installation it will be automatically updated for you. 4 | 5 | # General 6 | 7 | * [Bundle Styleguide](http://kb.textmate.org/bundle_styleguide) — _before you make changes_ 8 | * [Commit Styleguide](http://kb.textmate.org/commit_styleguide) — _before you send a pull request_ 9 | * [Writing Bug Reports](http://kb.textmate.org/writing_bug_reports) — _before you report an issue_ 10 | 11 | # License 12 | 13 | If not otherwise specified (see below), files in this repository fall under the following license: 14 | 15 | Permission to copy, use, modify, sell and distribute this 16 | software is granted. This software is provided "as is" without 17 | express or implied warranty, and with no claim as to its 18 | suitability for any purpose. 19 | 20 | An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example “tidy” is accompanied by “tidy-license.txt”. -------------------------------------------------------------------------------- /Preferences/Comments (C++).tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Comments 7 | scope 8 | source.c, source.c++, source.objc, source.objc++ 9 | settings 10 | 11 | shellVariables 12 | 13 | 14 | name 15 | TM_COMMENT_START 16 | value 17 | // 18 | 19 | 20 | name 21 | TM_COMMENT_START_2 22 | value 23 | /* 24 | 25 | 26 | name 27 | TM_COMMENT_END_2 28 | value 29 | */ 30 | 31 | 32 | name 33 | TM_COMMENT_DISABLE_INDENT_2 34 | value 35 | yes 36 | 37 | 38 | 39 | uuid 40 | 38DBCCE5-2005-410C-B7D7-013097751AC8 41 | 42 | 43 | -------------------------------------------------------------------------------- /Preferences/Typing Pairs: Integer Literals.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Typing Pairs: Integer Literals 7 | scope 8 | L:constant.numeric.c - dyn.selection 9 | settings 10 | 11 | smartTypingPairs 12 | 13 | 14 | " 15 | " 16 | 17 | 18 | ( 19 | ) 20 | 21 | 22 | { 23 | } 24 | 25 | 26 | [ 27 | ] 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | ` 39 | ` 40 | 41 | 42 | 43 | uuid 44 | 8A8361BE-A002-4DA9-96B5-FEFA8DBC1648 45 | 46 | 47 | -------------------------------------------------------------------------------- /Macros/Insert Missing Includes.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | commands 6 | 7 | 8 | argument 9 | 10 | command 11 | insertText: 12 | 13 | 14 | command 15 | selectAll: 16 | 17 | 18 | argument 19 | 20 | command 21 | insert_missing_includes.rb 22 | input 23 | document 24 | output 25 | insertAsSnippet 26 | 27 | command 28 | executeCommandWithOptions: 29 | 30 | 31 | keyEquivalent 32 | ^# 33 | name 34 | Insert Missing Includes 35 | scope 36 | source.c, source.c++, source.objc, source.objc++ 37 | scopeType 38 | local 39 | uuid 40 | 0DABAE22-81C5-4ADF-8BCC-9B343A51CCB9 41 | 42 | 43 | -------------------------------------------------------------------------------- /Preferences/Highlight Pairs: if...endif.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Highlight Pairs: #if…#endif 7 | scope 8 | source.c, source.c++, source.objc, source.objc++ 9 | settings 10 | 11 | highlightPairs 12 | 13 | 14 | ( 15 | ) 16 | 17 | 18 | [ 19 | ] 20 | 21 | 22 | { 23 | } 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | /^\s*#if\b/ 35 | /^\s*#(else|endif)\b/ 36 | 37 | 38 | /^\s*#(if|else)\b/ 39 | /^\s*#endif\b/ 40 | 41 | 42 | 43 | uuid 44 | EF911492-6DBB-413B-9801-D7150BF6BD6A 45 | 46 | 47 | -------------------------------------------------------------------------------- /Commands/Insert Call to Constructors.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 -wKU 9 | 10 | line = STDIN.read 11 | 12 | if line =~ /\((.*)\)(\s?)/ # extract parameters 13 | line, ws = $1, $2 14 | line.gsub!(/<.*?>/, '') # remove template args 15 | line.gsub!(/\(.*?\)/, '') # remove (…), e.g. ‘type const& var = type()’ 16 | line = line.split(',').map { |e| e.gsub(/.*?(\w+)(\s+=.*)?$/, '\1(\1)') }.join(', ') 17 | print ' ' if ws.empty? 18 | print ': ' + line 19 | end 20 | 21 | fallbackInput 22 | line 23 | input 24 | selection 25 | name 26 | Insert Call to Constructors 27 | output 28 | afterSelectedText 29 | scope 30 | dyn.caret.end & (source.c++ | source.objc++) 31 | tabTrigger 32 | : 33 | uuid 34 | 1B7326BB-6A85-4ED2-A0D7-51619763D98F 35 | 36 | 37 | -------------------------------------------------------------------------------- /Preferences/Typing Pairs: Selection.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Typing Pairs: Selection 7 | scope 8 | (source.c++ | source.objc++) & dyn.selection 9 | settings 10 | 11 | smartTypingPairs 12 | 13 | 14 | " 15 | " 16 | 17 | 18 | ( 19 | ) 20 | 21 | 22 | { 23 | } 24 | 25 | 26 | [ 27 | ] 28 | 29 | 30 | < 31 | > 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | ' 43 | ' 44 | 45 | 46 | ` 47 | ` 48 | 49 | 50 | 51 | uuid 52 | F6AEAB37-D14E-49BF-BE1F-07883E248BFF 53 | 54 | 55 | -------------------------------------------------------------------------------- /Commands/Reformat Document.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/bin/bash 9 | if ! "${TM_CLANG_FORMAT}" -style="${TM_CLANG_FORMAT_STYLE:-file}" -assume-filename="${TM_FILEPATH}"; then 10 | . "$TM_SUPPORT_PATH/lib/bash_init.sh" 11 | exit_show_tool_tip 12 | fi 13 | 14 | input 15 | document 16 | inputFormat 17 | text 18 | keyEquivalent 19 | ^H 20 | name 21 | Reformat Document 22 | outputCaret 23 | interpolateByLine 24 | outputFormat 25 | text 26 | outputLocation 27 | replaceDocument 28 | requiredCommands 29 | 30 | 31 | command 32 | clang-format 33 | locations 34 | 35 | /usr/local/bin/clang-format 36 | 37 | moreInfoURL 38 | http://clang.llvm.org/docs/ClangFormat.html 39 | variable 40 | TM_CLANG_FORMAT 41 | 42 | 43 | scope 44 | source.c, source.objc, source.c++, source.objc++ 45 | uuid 46 | 24966EE2-1BC4-4995-B39F-F6F9461184F5 47 | version 48 | 2 49 | 50 | 51 | -------------------------------------------------------------------------------- /Preferences/Indentation Rules.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Indentation Rules 7 | scope 8 | source.c, source.c++, source.objc, source.objc++ 9 | settings 10 | 11 | decreaseIndentPattern 12 | (?x) 13 | ^ \s* ( (?! \S.* /[*] ) .* [*]/ \s* )? \} 14 | | ^ \s* (public|private|protected): \s* $ 15 | | ^ \s* @(public|private|protected) \s* $ 16 | 17 | increaseIndentPattern 18 | (?x) 19 | ^ .* \{ [^}"']* $ 20 | | ^ \s* (public|private|protected): \s* $ 21 | | ^ \s* @(public|private|protected) \s* $ 22 | | ^ \s* \{ \} $ 23 | 24 | indentNextLinePattern 25 | (?x)^ 26 | (?! .* [;:{},] \s* # do not indent when line ends with ;, :, {, }, or comma 27 | ( // .* | /[*] .* [*]/ \s* )? $ # …account for potential trailing comment 28 | | @(public|private|protected) # do not indent after obj-c data access keywords 29 | ) 30 | . # the negative look-ahead above means we don’t care about what we match here 31 | 32 | unIndentedLinePattern 33 | ^\s*((/\*|\*/|//|template\b.*?>(?!\(.*\))|@protocol|@optional|@interface(?!.*\{)|@implementation|@end).*)?$ 34 | zeroIndentPattern 35 | ^\s*# 36 | 37 | uuid 38 | 02EB44C6-9203-4F4C-BFCB-7E3360B12812 39 | 40 | 41 | -------------------------------------------------------------------------------- /Support/SpotlightSearch.rb: -------------------------------------------------------------------------------- 1 | 2 | user_folder = ENV['TM_PROJECT_DIRECTORY'] 3 | 4 | (user_folder = ENV['TM_DIRECTORY']) if user_folder.nil? or user_folder.empty? or user_folder == '/' 5 | (user_folder = nil) if user_folder.nil? or user_folder.empty? or user_folder == '/' 6 | 7 | SearchFolders = [user_folder, "/System/Library/Frameworks", "/usr/include"].compact 8 | 9 | header = ARGV[0] 10 | fragment_path_to_header = header.split("/") 11 | header_component = fragment_path_to_header.pop 12 | 13 | def search( header_name ) 14 | result_paths = Array.new 15 | 16 | # find all candidates 17 | SearchFolders.each do |folder| 18 | results = %x{mdfind -onlyin "#{folder}" "kMDItemFSName == \"#{header_name}\" || kMDItemFSName == \"#{header_name}.h\"" } 19 | results.each_line {|line| result_paths << line} 20 | end 21 | 22 | return result_paths 23 | end 24 | 25 | result_paths = search(header_component) 26 | 27 | # verify the prefix path, if one is specified, 28 | # e.g. header == sys/errno.h, need to verify that "sys" is the parent directory 29 | if result_paths.size > 0 and fragment_path_to_header.size > 0 30 | fragment_path_to_header.reverse! 31 | 32 | # there's probably a simpler way to do this 33 | filtered_result_paths = result_paths.reject do |path| 34 | reject_me = false 35 | result_path_components = path.split("/") 36 | result_path_components.pop 37 | 38 | fragment_path_to_header.each {|frag| reject_me = true if result_path_components.pop != frag } 39 | reject_me 40 | end 41 | 42 | # don't filter the result paths if it means an empty array, on the theory 43 | # that finding something is better than finding nothing (and might be what 44 | # the user wanted anyway) 45 | result_paths = filtered_result_paths if filtered_result_paths.size > 0 46 | end 47 | 48 | puts result_paths.compact.join("\n") 49 | -------------------------------------------------------------------------------- /Support/bin/insert_missing_includes.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby18 2 | 3 | require 'set' 4 | require "zlib" 5 | 6 | def find_include_lines(io) 7 | res = [] 8 | in_synopsis = false 9 | io.each_line do |line| 10 | if in_synopsis then 11 | case line 12 | when /^\.In (\S+)$/: res << $1 13 | when /^\.\w+ #include <(\S+)>$/: res << $1 14 | when /^\.Sh /: break 15 | end 16 | elsif line =~ /^\.Sh SYNOPSIS/ 17 | in_synopsis = true 18 | end 19 | end 20 | res 21 | end 22 | 23 | MARK = [0xFFFC].pack("U").freeze 24 | def esc (txt); txt.gsub(/[$`\\]/, '\\\\\0'); end 25 | parts = STDIN.read.split(MARK) 26 | src = parts.join 27 | 28 | # find all function calls 29 | src.gsub!(/(if|while|for|switch|sizeof|sizeofA)\s*\(/, '') 30 | functions = src.scan(/(?:(?!->).(?!@|\.).|^\s*)\b([a-z]+)(?=\()/).flatten.to_set 31 | 32 | # collect paths to all man files involved 33 | paths = functions.collect do |func| 34 | %x{ man 2>/dev/null -WS2:3 #{func} }.scan(/.+/) 35 | end.flatten.sort.uniq 36 | 37 | # harvest includes from man files 38 | includes = Set.new 39 | paths.each do |path| 40 | if path =~ /\.gz$/ 41 | Zlib::GzipReader.open(path) { |io| includes.merge(find_include_lines(io)) } 42 | else 43 | File.open(path) { |io| includes.merge(find_include_lines(io)) } 44 | end 45 | end 46 | 47 | # figure out what we already included 48 | included = src.scan(/^\s*#\s*(?:include|import)\s+<(\S+)>/).flatten.to_set 49 | 50 | new_includes = (includes - included).collect do |inc| 51 | "#include <#{inc}>\n" 52 | end.join 53 | 54 | parts[0].sub!(/\A (?: 55 | ^ \s* (?: 56 | \/\/ .* # line comments 57 | | \/\* (?m:.*?) \*\/ # comment blocks 58 | | \# \s* (?:include|import) \s+ <.* # system includes 59 | | # blank lines 60 | ) \s* $ \n )*/x, '\0' + new_includes) 61 | 62 | print parts.collect { |part| esc part }.join('${0}') 63 | -------------------------------------------------------------------------------- /Commands/System Header Completion.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 -wKU 9 | require "#{ENV['TM_SUPPORT_PATH']}/lib/escape" 10 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes" 11 | 12 | def parse(input) 13 | return :system, $1 if input =~ /^<(.*?)>?$/ 14 | return :user, $1 if input =~ /^"(.*?)"?$/ 15 | abort "Malformed input: #{input}" 16 | end 17 | 18 | def wrap(header, domain) 19 | return "<#{header}>" if domain == :system 20 | return "\"#{header}\"" if domain == :user 21 | abort "Unknown domain: #{domain}" 22 | end 23 | 24 | domain, input = parse(STDIN.read) 25 | string = %x{ "$TM_BUNDLE_SUPPORT/bin/headers" -p #{e_sh input} -d #{domain} -C "${TM_DIRECTORY}" } 26 | list = string.split("\n").reject { |e| e == input } 27 | prefix = list.inject { |lhs, rhs| lhs = lhs.chop while lhs != rhs[0...lhs.length]; lhs } 28 | list = list.map { |e| e_sn e[prefix.size..-1] } 29 | 30 | case list.size 31 | when 0 then TextMate.exit_show_tool_tip "No headers matching ‘#{input}’." 32 | when 1 then print wrap("#{e_sn string}$0", domain) 33 | else print wrap("#{e_sn prefix}${1|#{list.join(',')}|}", domain) 34 | end 35 | 36 | fallbackInput 37 | scope 38 | input 39 | selection 40 | inputFormat 41 | text 42 | keyEquivalent 43 | ~ 44 | name 45 | Header Completion 46 | outputCaret 47 | afterOutput 48 | outputFormat 49 | snippet 50 | outputLocation 51 | replaceInput 52 | scope 53 | meta.preprocessor.c.include string.quoted 54 | uuid 55 | 73CB5A73-593F-489B-923F-4F703718283D 56 | version 57 | 2 58 | 59 | 60 | -------------------------------------------------------------------------------- /Commands/Run.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | autoScrollOutput 6 | 7 | beforeRunningCommand 8 | saveModifiedFiles 9 | command 10 | #!/usr/bin/env ruby18 11 | 12 | require "#{ENV['TM_SUPPORT_PATH']}/lib/tm/executor" 13 | require "#{ENV['TM_SUPPORT_PATH']}/lib/tm/save_current_document" 14 | require "shellwords" 15 | 16 | CONFIG = { 17 | 'source.c' => [ ENV['TM_GCC'] || 'xcrun clang', "-x c #{ENV['TM_C_FLAGS'] || '-Wall -include stdio.h'}", 'c' ], 18 | 'source.c++' => [ ENV['TM_GXX'] || 'xcrun clang++', "-x c++ #{ENV['TM_CXX_FLAGS'] || '-Wall -include stdio.h -include iostream'}", 'cc' ], 19 | 'source.objc' => [ ENV['TM_GCC'] || 'xcrun clang', "-x objective-c #{ENV['TM_OBJC_FLAGS'] || '-Wall -include stdio.h -framework Cocoa'}", 'm' ], 20 | 'source.objc++' => [ ENV['TM_GXX'] || 'xcrun clang++', "-x objective-c++ #{ENV['TM_OBJCXX_FLAGS'] || '-Wall -include stdio.h -include iostream -framework Cocoa'}", 'mm' ], 21 | } 22 | 23 | cc, flags, ext = *CONFIG['source.objc++'] # default 24 | cc, flags, ext = *CONFIG[$&] if ENV["TM_SCOPE"] =~ /\bsource\.(obj)?c(\+\+)?/ 25 | 26 | TextMate.save_if_untitled(ext) 27 | TextMate::Executor.make_project_master_current_document 28 | args = Shellwords.split(cc) << Shellwords.split(flags) << ENV["TM_FILEPATH"] 29 | TextMate::Executor.run(args, :version_args => ["--version"], :version_regex => /\A([^\n]*) \(GCC\).*/m) 30 | 31 | input 32 | document 33 | inputFormat 34 | text 35 | keyEquivalent 36 | @r 37 | name 38 | Run 39 | outputCaret 40 | afterOutput 41 | outputFormat 42 | html 43 | outputLocation 44 | newWindow 45 | scope 46 | source.c, source.c++, source.objc, source.objc++ 47 | semanticClass 48 | process.run.c 49 | uuid 50 | E823A373-FFD6-42F1-998F-7571A3553847 51 | version 52 | 2 53 | 54 | 55 | -------------------------------------------------------------------------------- /Commands/Quick Open.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env ruby18 -wKU 9 | 10 | require ENV['TM_SUPPORT_PATH'] + '/lib/textmate.rb' 11 | require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb' 12 | 13 | def header 14 | if ENV.has_key? 'TM_SELECTED_TEXT' 15 | [:all, ENV['TM_SELECTED_TEXT']] 16 | elsif ENV['TM_CURRENT_LINE'] =~ /#\s*(?:include|import)\s*([<"])(.*?)[">]/; 17 | [$1 == '<' ? :system : :user, $2] 18 | else 19 | defaultText = %x{ /usr/bin/pbpaste -pboard find } 20 | header = TextMate::UI.request_string :title => "Quick Open", :default => defaultText, :prompt => "Which header file do you wish to open?" 21 | [:all, header] 22 | end 23 | end 24 | 25 | def select_header(headers) 26 | if headers.size > 1 27 | menu = headers.map do |e| 28 | header_name = $& if e =~ /[^\/]+$/ 29 | if e =~ /\.framework/ 30 | suffix = e.scan(/\/([^\/]+?).framework/).flatten.join(' → ') 31 | else 32 | suffix = File.split(e).first 33 | end 34 | { 'path' => e, 'title' => "#{header_name} — #{suffix}" } 35 | end 36 | if res = TextMate::UI.menu(menu) 37 | res['path'] 38 | else 39 | nil 40 | end 41 | else 42 | headers.first 43 | end 44 | end 45 | 46 | domain, file = header() 47 | exit if file.nil? 48 | 49 | headers = %x{ "$TM_BUNDLE_SUPPORT/bin/headers" -s #{e_sh file} -d #{domain} -C "${TM_DIRECTORY}" }.split("\n") 50 | 51 | if header = select_header(headers) 52 | TextMate.go_to :file => header 53 | elsif headers.empty? 54 | abort "Unable to find ‘#{file}’." 55 | end 56 | 57 | input 58 | none 59 | inputFormat 60 | text 61 | keyEquivalent 62 | @D 63 | name 64 | Quick Open 65 | outputCaret 66 | afterOutput 67 | outputFormat 68 | text 69 | outputLocation 70 | toolTip 71 | scope 72 | source.c, source.objc, source.c++, source.objc++ 73 | uuid 74 | FF0E22D6-7D78-11D9-B4DE-000A95A89C98 75 | version 76 | 2 77 | 78 | 79 | -------------------------------------------------------------------------------- /Commands/Fold:Unfold Code.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | bundleUUID 8 | 4675A940-6227-11D9-BFB1-000D93589AF6 9 | command 10 | #!/usr/bin/env ruby18 11 | line = STDIN.read 12 | $tab = (ENV['TM_SOFT_TABS'] == "NO" ? "\t" : " "*ENV['TM_TAB_SIZE'].to_i ) 13 | def join_code s 14 | # transform // comments to /* */ comments while leaving strings intact 15 | s.gsub!(/((['"])(?:\\.|.)*?\2)|\/\*.*?\*\/|\/\/([^\n\r]*)/m) do |line| 16 | if $3 17 | '/*' + $3.gsub(/\*\//, '') + '*/' 18 | else 19 | line 20 | end 21 | end 22 | print s.split("\n").map {|line| line.strip}.join(" ") 23 | end 24 | 25 | def print_line(line, indent, for_ticker) 26 | s = "" 27 | s = "\n" if for_ticker == 0 28 | s + $tab*indent + line # the space should be replaced with soft or hard tab 29 | end 30 | 31 | def split_code s 32 | res = [] 33 | indent = 0 34 | for_ticker = 1 35 | # this regexp should not have a capture depth deeper than 1 36 | # yes that does rule out backrefs :( 37 | s.split(/([\{\}\;]|"(?:\\.|.)*?"|'(?:\\.|.)*?'|\/\*.*?\*\/|\/\/[^\n\r]*)/).map do |l| 38 | l = l.strip 39 | case l 40 | when /^for\s*\(/ 41 | res << print_line(l, indent, for_ticker) 42 | for_ticker = 5 43 | when "{" 44 | s = print_line(l, indent, for_ticker) 45 | for_ticker -= 1 unless for_ticker == 0 46 | indent += 1 47 | s += print_line("", indent, for_ticker) 48 | res << s 49 | when "}" 50 | indent -= 1 51 | res << print_line(l, indent, for_ticker) 52 | res << print_line("", indent, for_ticker) 53 | when ";" 54 | res << l 55 | if for_ticker == 0 56 | res << print_line("", indent, for_ticker) 57 | else 58 | res << " " 59 | end 60 | when /^\s*$/ 61 | for_ticker += 1 # if empty string maintain the status-quo 62 | else 63 | res << l 64 | end 65 | for_ticker -= 1 unless for_ticker == 0 66 | end 67 | 68 | require "enumerator" 69 | out = [] 70 | res.each_cons(2) do |a,b| 71 | # remove empty lines inserted when ; is followed by { or } 72 | out << a unless a.match(/^\n\s*$/) && b.match(/^\n\s*(\}|\{)\s*$/) 73 | end 74 | print out.join 75 | end 76 | 77 | if line.count("\n") > 1 78 | join_code(line) 79 | else 80 | split_code(line) 81 | end 82 | 83 | #k = "- (id)showSomeWindow 84 | # { 85 | # for(int i =0;i<a;i++) 86 | # { 87 | # \" boras /* */ //\" 88 | # // hello /* */ 89 | # if(a) 90 | # [ window makeKeyAndOrderFront:self]; 91 | # } 92 | # }" 93 | #join_code(k) 94 | #l = "- (id)showSomeWindow { for(int i =0;i<a;i++) { \" boras /* */ //\" /* hello /* */ if(a) [ window makeKeyAndOrderFront:self]; } }" 95 | #split_code(l) 96 | fallbackInput 97 | scope 98 | input 99 | selection 100 | keyEquivalent 101 | ^{ 102 | name 103 | Fold/Unfold Code 104 | output 105 | replaceSelectedText 106 | scope 107 | meta.block.c 108 | uuid 109 | 3D221F96-F4CC-432D-9A04-F9F4DF3E0F55 110 | 111 | 112 | -------------------------------------------------------------------------------- /Support/c_completion2.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby18 2 | require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes" 3 | require "#{ENV['TM_SUPPORT_PATH']}/lib/escape" 4 | require "zlib" 5 | require "set" 6 | require "#{ENV['TM_SUPPORT_PATH']}/lib/ui" 7 | 8 | 9 | class ExternalSnippetizer 10 | 11 | def initialize(options = {}) 12 | @star = options[:star] || false 13 | @arg_name = options[:arg_name] || false 14 | @tm_C_pointer = options[:tm_C_pointer] || " *" 15 | end 16 | 17 | def snippet_generator(cand, start) 18 | 19 | cand = cand.strip 20 | oldstuff = cand[0..-1].split("\t") 21 | stuff = cand[start..-1].split("\t") 22 | stuffSize = stuff[0].size 23 | if oldstuff[0].count(":") == 1 24 | out = "${0:#{stuff[6]}}" 25 | elsif oldstuff[0].count(":") > 1 26 | 27 | name_array = stuff[0].split(":") 28 | out = "${1:#{stuff[-name_array.size - 1]}} " 29 | unless name_array.empty? 30 | begin 31 | stuff[-(name_array.size)..-1].each_with_index do |arg,i| 32 | out << name_array[i] + ":${#{i+2}:#{arg}} " 33 | end 34 | rescue NoMethodError 35 | out = "$0" 36 | end 37 | end 38 | else 39 | out = "$0" 40 | end 41 | return out.chomp.strip 42 | end 43 | 44 | def construct_arg_name(arg) 45 | a = arg.match(/(NS|AB|CI|CD)?(Mutable)?(([AEIOQUYi])?[A-Za-z_0-9]+)/) 46 | unless a.nil? 47 | (a[4].nil? ? "a": "an") + a[3].sub!(/\b\w/) { $&.upcase } 48 | else 49 | "" 50 | end 51 | end 52 | 53 | def type_declaration_snippet_generator(dict) 54 | 55 | arg_name = @arg_name && dict['noArg'] 56 | star = @star && dict['pure'] 57 | pointer = @tm_C_pointer 58 | pointer = " *" unless pointer 59 | 60 | if arg_name 61 | name = "${2:#{construct_arg_name dict['match']}}" 62 | if star 63 | name = ("${1:#{pointer}#{name}}") 64 | else 65 | name = " " + name 66 | end 67 | 68 | else 69 | name = pointer.rstrip if star 70 | end 71 | # name = name[0..-2].rstrip unless arg_name 72 | name + "$0" 73 | end 74 | 75 | def cfunction_snippet_generator(c) 76 | c = c.split"\t" 77 | i = 0 78 | "("+c[1][1..-2].split(",").collect do |arg| 79 | "${"+(i+=1).to_s+":"+ arg.strip + "}" 80 | end.join(", ")+")$0" 81 | end 82 | 83 | def run(res) 84 | if res['type'] == "methods" 85 | r = snippet_generator(res['cand'], res['match'].size) 86 | elsif res['type'] == "functions" 87 | r = cfunction_snippet_generator(res['cand']) 88 | elsif res['pure'] && res['noArg'] 89 | r = type_declaration_snippet_generator res 90 | else 91 | r = "$0" 92 | end 93 | return r 94 | end 95 | end 96 | 97 | class CCompletion 98 | def file_names 99 | ["CLib.txt.gz"] 100 | end 101 | 102 | def candidates_or_exit(methodSearch="") 103 | candidates = [] 104 | file_names.each do |name| 105 | zGrepped = %x{ zgrep ^#{e_sh methodSearch } #{e_sh ENV['TM_BUNDLE_SUPPORT']}/#{name} } 106 | candidates += zGrepped.split("\n") 107 | end 108 | TextMate.exit_show_tool_tip "No completion available" if candidates.empty? 109 | return candidates 110 | end 111 | 112 | def prettify(candidate) 113 | ca = candidate.split("\t") 114 | ca[0]+ca[1] 115 | end 116 | 117 | def snippet_generator(cand, s) 118 | c = cand.split"\t" 119 | i = 0 120 | middle = c[1][1..-2].split(",").collect do |arg| 121 | "${"+(i+=1).to_s+":"+ arg.strip + "}" 122 | end.join(", ") 123 | c[0][s..-1]+"("+middle+")$0" 124 | end 125 | 126 | def pop_up(candidates, searchTerm) 127 | start = searchTerm.size 128 | prettyCandidates = candidates.map { |candidate| [prettify(candidate), candidate] }.sort 129 | if prettyCandidates.size > 1 130 | require "enumerator" 131 | pruneList = [] 132 | 133 | prettyCandidates.each_cons(2) do |a| 134 | pruneList << (a[0][0] != a[1][0]) # check if prettified versions are the same 135 | end 136 | pruneList << true 137 | ind = -1 138 | prettyCandidates = prettyCandidates.select do |a| #remove duplicates 139 | pruneList[ind+=1] 140 | end 141 | end 142 | 143 | if prettyCandidates.size > 1 144 | #index = start 145 | #test = false 146 | #while !test 147 | # candidates.each_cons(2) do |a,b| 148 | # break if test = (a[index].chr != b[index].chr || a[index].chr == "\t") 149 | # end 150 | # break if test 151 | # searchTerm << candidates[0][index].chr 152 | # index +=1 153 | #end 154 | 155 | pl = prettyCandidates.map do |pretty, full | 156 | { 'display' => pretty, 157 | 'cand' => full, 158 | 'type' => "functions", 159 | 'match'=> full.split("\t")[0] 160 | } 161 | end 162 | 163 | flags = {} 164 | flags[:extra_chars]= '_' 165 | flags[:initial_filter]= searchTerm 166 | #TextMate.exit_show_tool_tip pl.inspect 167 | begin 168 | TextMate::UI.complete(pl, flags) do |hash| 169 | #{}"kalle kula" 170 | #hash.inspect 171 | es = ExternalSnippetizer.new 172 | 173 | es.run(hash) 174 | #hash.inspect 175 | end 176 | rescue NoMethodError 177 | TextMate.exit_show_tool_tip "you have Dialog2 installed but not the ui.rb in review" 178 | end 179 | TextMate.exit_discard # create_new_document 180 | else 181 | snippet_generator( candidates[0], start ) 182 | end 183 | end 184 | 185 | def print 186 | line = ENV['TM_CURRENT_LINE'] 187 | if ENV['TM_INPUT_START_LINE_INDEX'] 188 | caret_placement =ENV['TM_INPUT_START_LINE_INDEX'].to_i -1 189 | else 190 | caret_placement =ENV['TM_LINE_INDEX'].to_i - 1 191 | end 192 | 193 | backContext = line[1+caret_placement..-1].match /^[a-zA-Z0-9_]/ 194 | 195 | if backContext 196 | TextMate.exit_discard 197 | end 198 | 199 | 200 | alpha_and_caret = /[a-zA-Z_][_a-zA-Z0-9]*\(?$/ 201 | if k = line[0..caret_placement].match(alpha_and_caret) 202 | candidates = candidates_or_exit(k[0]) 203 | res = pop_up(candidates, k[0]) 204 | else 205 | res = "" 206 | end 207 | end 208 | end 209 | 210 | class CppCompletion < CCompletion 211 | def file_names 212 | super << "C++Lib.txt.gz" 213 | end 214 | end -------------------------------------------------------------------------------- /Support/bin/headers: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby18 -wKU 2 | # == Synopsis 3 | # 4 | # headers: find include headers 5 | # 6 | # == Usage 7 | # 8 | # --help: 9 | # show help 10 | # 11 | # -d/--domain [user|system|all] 12 | # search either for user or system headers 13 | # 14 | # -s/--search «header» 15 | # search for the given «header» 16 | # 17 | # -p/--prefix «string» 18 | # only show headers with «string» as prefix 19 | # 20 | # -C/--basedir «dir» 21 | # this is used when searching the user domain 22 | 23 | require 'getoptlong' 24 | require 'rdoc/usage' 25 | require 'pathname' 26 | require 'set' 27 | 28 | USR_HEAD = Regexp.escape "#include \"...\" search starts here:\n" 29 | SYS_HEAD = Regexp.escape "#include <...> search starts here:\n" 30 | FOOTER = Regexp.escape "End of search list." 31 | 32 | CONFIG = { 33 | 'source.c' => "#{ENV['TM_GCC'] || 'xcrun clang'} 2>&1 >/dev/null -E -v -x c #{ENV['TM_C_FLAGS']} /dev/null", 34 | 'source.c++' => "#{ENV['TM_GXX'] || 'xcrun clang++'} 2>&1 >/dev/null -E -v -x c++ #{ENV['TM_CXX_FLAGS']} /dev/null", 35 | 'source.objc' => "#{ENV['TM_GCC'] || 'xcrun clang'} 2>&1 >/dev/null -E -v -x objective-c #{ENV['TM_OBJC_FLAGS']} /dev/null", 36 | 'source.objc++' => "#{ENV['TM_GXX'] || 'xcrun clang++'} 2>&1 >/dev/null -E -v -x objective-c++ #{ENV['TM_OBJCXX_FLAGS']} /dev/null", 37 | } 38 | 39 | def compiler(scope = ENV['TM_SCOPE']) 40 | return CONFIG[$&] if scope =~ /\bsource\.(obj)?c(\+\+)?/ 41 | return CONFIG['source.objc++'] 42 | end 43 | 44 | def compiler_search_path(domain = :system) 45 | res = IO.popen(compiler) { |io| io.read } 46 | if res =~ /#{USR_HEAD}(.*)#{SYS_HEAD}(.*)#{FOOTER}/m 47 | list = case domain 48 | when :system then $2 49 | when :user then $1 50 | when :all then $1 + $2 51 | end 52 | 53 | res = [ ] 54 | list.grep(/^ (\S*)( \(framework directory\)$)?/) do 55 | next unless File.exists? $1 56 | res << { :path => $1, :framework => ($2 ? true : false) } 57 | end 58 | res 59 | else 60 | abort "Failed to parse compiler output.\nCommand: " + compiler 61 | end 62 | end 63 | 64 | def user_search_path(domain = :system) 65 | headers = [ ] 66 | headers << ENV["TM_USR_HEADER_PATH"].to_s.split(':') unless domain == :system 67 | headers << ENV["TM_SYS_HEADER_PATH"].to_s.split(':') unless domain == :user 68 | headers.flatten.reject { |path| path.empty? }.map { |path| { :path => path } } 69 | end 70 | 71 | def find_header(header, dirs) 72 | dirs.each do |dir| 73 | if File.file?("#{dir[:path]}/#{header}") 74 | return [ "#{dir[:path]}/#{header}" ] 75 | elsif dir[:framework] 76 | Dir.chdir(dir[:path]) do 77 | glob = "{*.framework/Frameworks/,}*.framework/Headers/#{header}{,.h}" 78 | glob = "{*.framework/Frameworks/,}#$1.framework/Headers/#$2" if header =~ /(.+)\/(.*)/ 79 | res = [ ] 80 | Dir[glob].map do |path| 81 | res << "#{dir[:path]}/#{path}" 82 | end 83 | return res.map { |path| Pathname.new(path).realpath }.sort.uniq unless res.empty? 84 | end 85 | end 86 | end 87 | [ ] 88 | end 89 | 90 | def find_header_recursive(header, dirs) 91 | seen = Set.new 92 | res = [ ] 93 | while dir = dirs.shift 94 | next unless File.directory?(dir[:path]) 95 | realpath = Pathname.new(dir[:path]).realpath 96 | next if seen.include?(realpath) 97 | seen << realpath 98 | if dir[:framework] 99 | Dir.chdir(realpath) do 100 | dirs.concat(Dir['*.framework/{Frameworks/*.framework/,}Headers'].map { |path| { :path => "#{realpath}/#{path}" } }) 101 | end 102 | else 103 | Dir.entries(realpath).each do |path| 104 | next if path =~ /^\./ 105 | full_path = "#{realpath}/#{path}" 106 | if File.directory?(full_path) 107 | dirs << { :path => full_path } 108 | elsif path == header || path.sub(/\.[^.]+$/, '') == header 109 | res << full_path 110 | end 111 | end 112 | end 113 | end 114 | res.sort.uniq 115 | end 116 | 117 | def find_header_with_prefix(prefix, dirs) 118 | res = [ ] 119 | dirs.each do |dir| 120 | Dir.chdir(dir[:path]) do 121 | if !dir[:framework] 122 | Dir["#{prefix}*"].each do |path| 123 | if File.directory?(path) 124 | res << Dir["#{path}/[A-Za-z]*.h{,pp}"] 125 | elsif path != prefix && (path =~ /\.h(pp)?$/ || path =~ /\/[^.]+$/) 126 | res << path 127 | end 128 | end 129 | else 130 | paths = [ ] 131 | if prefix =~ /(.+)\/(.*)/ 132 | paths << Dir["{,*.framework/Frameworks/}#$1.framework/Headers/#$2*"] 133 | else 134 | Dir["{,*.framework/Frameworks/}#{prefix}*.framework/Headers"].map do |path| 135 | if path =~ /(?:.*\.framework\/Frameworks\/)?(.*)\.framework\/Headers/ 136 | if File.exists? "#{path}/#$1.h" 137 | paths << [ "#$1/#$1.h" ] 138 | else 139 | paths << Dir["#{path}/[A-Za-z]*.h"] 140 | end 141 | end 142 | end 143 | end 144 | res << paths.flatten.map { |path| path.sub(/(?:.*\.framework\/Frameworks\/)?(.*)\.framework\/Headers\//, '\1/') } 145 | end 146 | end 147 | end 148 | res.flatten.sort.uniq 149 | end 150 | 151 | opts = GetoptLong.new( 152 | [ '--search', '-s', GetoptLong::REQUIRED_ARGUMENT ], 153 | [ '--prefix', '-p', GetoptLong::REQUIRED_ARGUMENT ], 154 | [ '--domain', '-d', GetoptLong::REQUIRED_ARGUMENT ], 155 | [ '--basedir', '-C', GetoptLong::REQUIRED_ARGUMENT ], 156 | [ '--help', GetoptLong::NO_ARGUMENT ] 157 | ) 158 | 159 | full_search = nil 160 | prefix_search = nil 161 | domain = :system 162 | basedir = nil 163 | 164 | opts.each do |opt, arg| 165 | case opt 166 | when '--help' then RDoc::usage 167 | when '--search' then full_search = arg 168 | when '--prefix' then prefix_search = arg 169 | when '--domain' then domain = arg.to_sym 170 | when '--basedir' then basedir = arg 171 | end 172 | end 173 | 174 | dirs = [ user_search_path(domain), compiler_search_path(domain) ].flatten 175 | dirs << { :path => basedir } unless domain == :system || basedir.to_s.empty? 176 | 177 | if full_search 178 | res = find_header(full_search, dirs) 179 | res = find_header_recursive(full_search, dirs) if res.empty? 180 | STDOUT << res.join("\n") 181 | elsif prefix_search 182 | STDOUT << find_header_with_prefix(prefix_search, dirs).join("\n") 183 | end 184 | -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | contactEmailRot13 6 | gz-ohaqyrf@znpebzngrf.pbz 7 | contactName 8 | Allan Odgaard 9 | deleted 10 | 11 | A468007A-1960-4E1A-9F09-81EBFE04429C 12 | 13 | description 14 | Support for the venerable <a href="http://en.wikipedia.org/wiki/C_%28programming_language%29">C programming language</a> and for the leaner C++. The bundle has completion (using ⌥⎋) for the standard C functions and, in C++, STL algorithms. 15 | mainMenu 16 | 17 | excludedItems 18 | 19 | 5039DA0E-538B-48E2-A45A-E5A27787E765 20 | ADD104E9-830A-4AC4-AAF4-DB6D3B0B7506 21 | E8D80809-0CDE-4E57-AC2A-8C22DFF353EE 22 | 034C3F18-097D-4B2C-8F20-C1CA3E9573E9 23 | 093DA4F2-D97F-4309-B869-6970C090A539 24 | 25 | items 26 | 27 | E823A373-FFD6-42F1-998F-7571A3553847 28 | FF165AAB-1582-4DA8-B0D1-13EBD30B24FD 29 | ------------------------------------ 30 | FF0E22D6-7D78-11D9-B4DE-000A95A89C98 31 | 0DABAE22-81C5-4ADF-8BCC-9B343A51CCB9 32 | 1B7326BB-6A85-4ED2-A0D7-51619763D98F 33 | 45FFA4DA-C84A-4D1F-862B-F249C24941EF 34 | ------------------------------------ 35 | 318EB8ED-24B7-4BDA-840F-0BD4DE8635C1 36 | 95FCF3A0-0EF9-4BAD-9C20-78AA542CE9A4 37 | ------------------------------------ 38 | B10CBD5D-7298-11D9-813A-000D93589AF6 39 | 9AB31B76-7298-11D9-813A-000D93589AF6 40 | 680358EA-B24B-4662-8DDA-AD42288795E4 41 | ------------------------------------ 42 | A295A902-ACAF-11D9-987D-000D93589AF6 43 | 5E468268-ACAF-11D9-987D-000D93589AF6 44 | ------------------------------------ 45 | 5A086BE2-BCF6-11D9-82A9-000D93589AF6 46 | FE378349-BD63-4390-9A3B-516F7FF7F413 47 | 3D221F96-F4CC-432D-9A04-F9F4DF3E0F55 48 | ------------------------------------ 49 | 24966EE2-1BC4-4995-B39F-F6F9461184F5 50 | 51 | submenus 52 | 53 | 318EB8ED-24B7-4BDA-840F-0BD4DE8635C1 54 | 55 | items 56 | 57 | F060AC09-C289-11D9-8CEF-000D93589AF6 58 | D1F5A25E-A70F-11D9-A11A-000A95A89C98 59 | 78EF7134-0859-4475-89C3-30927865E855 60 | ------------------------------------ 61 | 523B30D4-C28A-11D9-8CEF-000D93589AF6 62 | 1D14B92E-8819-11D9-8661-000D93589AF6 63 | CEE5F928-47A2-4648-96F0-99FF5C2A7419 64 | DD10B510-1C36-45E0-A378-527401EE55B1 65 | 08E16CAE-DBD8-4570-B778-9E0E0EFFF80C 66 | ------------------------------------ 67 | C5DEE118-4C9E-4F3E-97A4-0E01A250F142 68 | 69 | name 70 | Declarations 71 | 72 | 95FCF3A0-0EF9-4BAD-9C20-78AA542CE9A4 73 | 74 | items 75 | 76 | 74AF5E38-994C-4641-96F0-EB98A2183F60 77 | E8C3B596-9045-11D9-AB38-000D93589AF6 78 | BC8B81AB-5F16-11D9-B9C3-000D93589AF6 79 | 62D59E1C-1DF1-490E-86E9-DFF8A461AD9C 80 | 986C0149-7802-4385-A237-90074D9D5ACD 81 | 82 | name 83 | Idioms 84 | 85 | 86 | 87 | name 88 | C 89 | ordering 90 | 91 | FF0E22D6-7D78-11D9-B4DE-000A95A89C98 92 | FF165AAB-1582-4DA8-B0D1-13EBD30B24FD 93 | E8D80809-0CDE-4E57-AC2A-8C22DFF353EE 94 | 0DABAE22-81C5-4ADF-8BCC-9B343A51CCB9 95 | 034C3F18-097D-4B2C-8F20-C1CA3E9573E9 96 | 74AF5E38-994C-4641-96F0-EB98A2183F60 97 | E8C3B596-9045-11D9-AB38-000D93589AF6 98 | B10CBD5D-7298-11D9-813A-000D93589AF6 99 | 9AB31B76-7298-11D9-813A-000D93589AF6 100 | 680358EA-B24B-4662-8DDA-AD42288795E4 101 | ADD104E9-830A-4AC4-AAF4-DB6D3B0B7506 102 | BC8B81AB-5F16-11D9-B9C3-000D93589AF6 103 | D1F5A25E-A70F-11D9-A11A-000A95A89C98 104 | 78EF7134-0859-4475-89C3-30927865E855 105 | F060AC09-C289-11D9-8CEF-000D93589AF6 106 | 1D14B92E-8819-11D9-8661-000D93589AF6 107 | 523B30D4-C28A-11D9-8CEF-000D93589AF6 108 | CEE5F928-47A2-4648-96F0-99FF5C2A7419 109 | DD10B510-1C36-45E0-A378-527401EE55B1 110 | 08E16CAE-DBD8-4570-B778-9E0E0EFFF80C 111 | A295A902-ACAF-11D9-987D-000D93589AF6 112 | 5E468268-ACAF-11D9-987D-000D93589AF6 113 | 5A086BE2-BCF6-11D9-82A9-000D93589AF6 114 | FE378349-BD63-4390-9A3B-516F7FF7F413 115 | 62D59E1C-1DF1-490E-86E9-DFF8A461AD9C 116 | C5DEE118-4C9E-4F3E-97A4-0E01A250F142 117 | 5039DA0E-538B-48E2-A45A-E5A27787E765 118 | 25066DC2-6B1D-11D9-9D5B-000D93589AF6 119 | 26251B18-6B1D-11D9-AFDB-000D93589AF6 120 | 38DBCCE5-2005-410C-B7D7-013097751AC8 121 | 9136716A-CE06-4801-ABC9-3D64300869F8 122 | 66EE7D45-6AA0-4AB9-9699-A3DF4E2B9AE7 123 | 02EB44C6-9203-4F4C-BFCB-7E3360B12812 124 | DC32505E-226B-409A-B3C3-8FC88BF4A131 125 | 1EACF554-A30C-44B0-B97A-11E3FA995045 126 | 47DD44E6-B4F5-4C2E-BC62-C6ACEBC02A0D 127 | 45FFA4DA-C84A-4D1F-862B-F249C24941EF 128 | 093DA4F2-D97F-4309-B869-6970C090A539 129 | 3D221F96-F4CC-432D-9A04-F9F4DF3E0F55 130 | 1B7326BB-6A85-4ED2-A0D7-51619763D98F 131 | E823A373-FFD6-42F1-998F-7571A3553847 132 | B2B97E23-E686-4410-991D-A92AF3A9FC95 133 | A8E4E48A-81F3-4DB7-A7A2-88662C06E011 134 | 135 | uuid 136 | 4675A940-6227-11D9-BFB1-000D93589AF6 137 | 138 | 139 | -------------------------------------------------------------------------------- /Syntaxes/C++.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | comment 6 | I don't think anyone uses .hp. .cp tends to be paired with .h. (I could be wrong. :) -- chris 7 | fileTypes 8 | 9 | cc 10 | cpp 11 | cp 12 | cxx 13 | c++ 14 | C 15 | h 16 | hh 17 | hpp 18 | hxx 19 | h++ 20 | 21 | firstLineMatch 22 | -\*- C\+\+ -\*- 23 | keyEquivalent 24 | ^~C 25 | name 26 | C++ 27 | patterns 28 | 29 | 30 | include 31 | #special_block 32 | 33 | 34 | include 35 | #strings 36 | 37 | 38 | captures 39 | 40 | 1 41 | 42 | name 43 | keyword.control.c++ 44 | 45 | 2 46 | 47 | name 48 | keyword.control.c++ 49 | 50 | 51 | match 52 | \b(if)\s+(constexpr)\b 53 | 54 | 55 | captures 56 | 57 | 1 58 | 59 | name 60 | punctuation.separator.scope.c++ 61 | 62 | 2 63 | 64 | comment 65 | https://en.cppreference.com/w/cpp/language/dependent_name 66 | name 67 | storage.modifier.template.c++ 68 | 69 | 70 | match 71 | (::)\s*(template)\b 72 | 73 | 74 | include 75 | source.c 76 | 77 | 78 | match 79 | \b(friend|explicit|virtual)\b 80 | name 81 | storage.modifier.$1.c++ 82 | 83 | 84 | match 85 | \b(private|protected|public): 86 | name 87 | storage.modifier.$1.c++ 88 | 89 | 90 | match 91 | \b(catch|operator|try|throw|using)\b 92 | name 93 | keyword.control.c++ 94 | 95 | 96 | match 97 | \bdelete\b(\s*\[\])?|\bnew\b(?!]) 98 | name 99 | keyword.control.c++ 100 | 101 | 102 | comment 103 | common C++ instance var naming idiom -- fMemberName 104 | match 105 | \b(f|m)[A-Z]\w*\b 106 | name 107 | variable.other.readwrite.member.c++ 108 | 109 | 110 | match 111 | \b(this|nullptr)\b 112 | name 113 | variable.language.c++ 114 | 115 | 116 | match 117 | \b(template|concept)\b\s* 118 | name 119 | storage.type.template.c++ 120 | 121 | 122 | match 123 | \b(const_cast|dynamic_cast|reinterpret_cast|static_cast)\b\s* 124 | name 125 | keyword.operator.cast.c++ 126 | 127 | 128 | match 129 | \b(co_await|co_return|co_yield|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq)\b 130 | name 131 | keyword.operator.c++ 132 | 133 | 134 | match 135 | \b(class|wchar_t|char8_t|char16_t|char32_t)\b 136 | name 137 | storage.type.c++ 138 | 139 | 140 | match 141 | \b(consteval|constinit|constexpr|export|mutable|typename|thread_local|noexcept|final|override)\b 142 | name 143 | storage.modifier.c++ 144 | 145 | 146 | begin 147 | (?x) 148 | (?: ^ # begin-of-line 149 | | (?: (?<!else|new|=) ) # or word + space before name 150 | ) 151 | ((?:[A-Za-z_][A-Za-z0-9_]*::)*+~[A-Za-z_][A-Za-z0-9_]*) # actual name 152 | \s*(\() # start bracket or end-of-line 153 | 154 | beginCaptures 155 | 156 | 1 157 | 158 | name 159 | entity.name.function.c++ 160 | 161 | 2 162 | 163 | name 164 | punctuation.definition.parameters.begin.c 165 | 166 | 167 | end 168 | \) 169 | endCaptures 170 | 171 | 0 172 | 173 | name 174 | punctuation.definition.parameters.end.c 175 | 176 | 177 | name 178 | meta.function.destructor.c++ 179 | patterns 180 | 181 | 182 | include 183 | $base 184 | 185 | 186 | 187 | 188 | begin 189 | (?x) 190 | (?: ^ # begin-of-line 191 | | (?: (?<!else|new|=) ) # or word + space before name 192 | ) 193 | ((?:[A-Za-z_][A-Za-z0-9_]*::)*+~[A-Za-z_][A-Za-z0-9_]*) # actual name 194 | \s*(\() # terminating semi-colon 195 | 196 | beginCaptures 197 | 198 | 1 199 | 200 | name 201 | entity.name.function.c++ 202 | 203 | 2 204 | 205 | name 206 | punctuation.definition.parameters.begin.c 207 | 208 | 209 | end 210 | \) 211 | endCaptures 212 | 213 | 0 214 | 215 | name 216 | punctuation.definition.parameters.end.c 217 | 218 | 219 | name 220 | meta.function.destructor.prototype.c++ 221 | patterns 222 | 223 | 224 | include 225 | $base 226 | 227 | 228 | 229 | 230 | repository 231 | 232 | angle_brackets 233 | 234 | begin 235 | < 236 | end 237 | > 238 | name 239 | meta.angle-brackets.c++ 240 | patterns 241 | 242 | 243 | include 244 | #angle_brackets 245 | 246 | 247 | include 248 | $base 249 | 250 | 251 | 252 | block 253 | 254 | begin 255 | \{ 256 | beginCaptures 257 | 258 | 0 259 | 260 | name 261 | punctuation.section.block.begin.c 262 | 263 | 264 | end 265 | \} 266 | endCaptures 267 | 268 | 0 269 | 270 | name 271 | punctuation.section.block.end.c 272 | 273 | 274 | name 275 | meta.block.c++ 276 | patterns 277 | 278 | 279 | captures 280 | 281 | 1 282 | 283 | name 284 | support.function.any-method.c 285 | 286 | 2 287 | 288 | name 289 | punctuation.definition.parameters.c 290 | 291 | 292 | match 293 | (?x) 294 | ( 295 | (?!while|for|do|if|else|switch|catch|return)(?: \b[A-Za-z_][A-Za-z0-9_]*+\b | :: )*+ # actual name 296 | ) 297 | \s*(\() 298 | name 299 | meta.function-call.c 300 | 301 | 302 | include 303 | $base 304 | 305 | 306 | 307 | constructor 308 | 309 | patterns 310 | 311 | 312 | begin 313 | (?x) 314 | (?: ^\s*) # begin-of-line 315 | ((?!while|for|do|if|else|switch|catch)[A-Za-z_][A-Za-z0-9_:]*) # actual name 316 | \s*(\() # start bracket or end-of-line 317 | 318 | beginCaptures 319 | 320 | 1 321 | 322 | name 323 | entity.name.function.c++ 324 | 325 | 2 326 | 327 | name 328 | punctuation.definition.parameters.begin.c 329 | 330 | 331 | end 332 | \) 333 | endCaptures 334 | 335 | 0 336 | 337 | name 338 | punctuation.definition.parameters.end.c 339 | 340 | 341 | name 342 | meta.function.constructor.c++ 343 | patterns 344 | 345 | 346 | include 347 | $base 348 | 349 | 350 | 351 | 352 | begin 353 | (?x) 354 | (:) # begin-of-line 355 | ((?=\s*[A-Za-z_][A-Za-z0-9_:]* # actual name 356 | \s*(\())) # start bracket or end-of-line 357 | 358 | beginCaptures 359 | 360 | 1 361 | 362 | name 363 | punctuation.definition.parameters.c 364 | 365 | 366 | end 367 | (?=\{) 368 | name 369 | meta.function.constructor.initializer-list.c++ 370 | patterns 371 | 372 | 373 | include 374 | $base 375 | 376 | 377 | 378 | 379 | 380 | special_block 381 | 382 | patterns 383 | 384 | 385 | begin 386 | \b(namespace)\b\s*([_A-Za-z][_A-Za-z0-9]*\b)?+ 387 | beginCaptures 388 | 389 | 1 390 | 391 | name 392 | storage.type.c++ 393 | 394 | 2 395 | 396 | name 397 | entity.name.type.c++ 398 | 399 | 400 | captures 401 | 402 | 1 403 | 404 | name 405 | keyword.control.namespace.$2 406 | 407 | 408 | end 409 | (?<=\})|(?=(;|,|\(|\)|>|\[|\]|=)) 410 | name 411 | meta.namespace-block${2:+.$2}.c++ 412 | patterns 413 | 414 | 415 | begin 416 | \{ 417 | beginCaptures 418 | 419 | 0 420 | 421 | name 422 | punctuation.definition.scope.c++ 423 | 424 | 425 | end 426 | \} 427 | endCaptures 428 | 429 | 0 430 | 431 | name 432 | punctuation.definition.scope.c++ 433 | 434 | 435 | patterns 436 | 437 | 438 | include 439 | #special_block 440 | 441 | 442 | include 443 | #constructor 444 | 445 | 446 | include 447 | $base 448 | 449 | 450 | 451 | 452 | include 453 | $base 454 | 455 | 456 | 457 | 458 | begin 459 | \b(class|struct)\b\s*([_A-Za-z][_A-Za-z0-9]*\b)?+(\s*:\s*(public|protected|private)\b\s*([_A-Za-z][_A-Za-z0-9]*\b)((\s*,\s*(public|protected|private)\b\s*[_A-Za-z][_A-Za-z0-9]*\b)*))? 460 | beginCaptures 461 | 462 | 1 463 | 464 | name 465 | storage.type.c++ 466 | 467 | 2 468 | 469 | name 470 | entity.name.type.c++ 471 | 472 | 4 473 | 474 | name 475 | storage.type.modifier.c++ 476 | 477 | 5 478 | 479 | name 480 | entity.name.type.inherited.c++ 481 | 482 | 6 483 | 484 | patterns 485 | 486 | 487 | match 488 | \b(public|protected|private)\b 489 | name 490 | storage.type.modifier.c++ 491 | 492 | 493 | match 494 | [_A-Za-z][_A-Za-z0-9]* 495 | name 496 | entity.name.type.inherited.c++ 497 | 498 | 499 | 500 | 501 | end 502 | (?<=\})|(?=(;|\(|\)|>|\[|\]|=)) 503 | name 504 | meta.class-struct-block.c++ 505 | patterns 506 | 507 | 508 | include 509 | #angle_brackets 510 | 511 | 512 | begin 513 | \{ 514 | beginCaptures 515 | 516 | 0 517 | 518 | name 519 | punctuation.section.block.begin.c++ 520 | 521 | 522 | end 523 | (\})(\s*\n)? 524 | endCaptures 525 | 526 | 1 527 | 528 | name 529 | punctuation.definition.invalid.c++ 530 | 531 | 2 532 | 533 | name 534 | invalid.illegal.you-forgot-semicolon.c++ 535 | 536 | 537 | patterns 538 | 539 | 540 | include 541 | #special_block 542 | 543 | 544 | include 545 | #constructor 546 | 547 | 548 | include 549 | $base 550 | 551 | 552 | 553 | 554 | include 555 | $base 556 | 557 | 558 | 559 | 560 | begin 561 | \b(extern)(?=\s*") 562 | beginCaptures 563 | 564 | 1 565 | 566 | name 567 | storage.modifier.c++ 568 | 569 | 570 | end 571 | (?<=\})|(?=\w) 572 | name 573 | meta.extern-block.c++ 574 | patterns 575 | 576 | 577 | begin 578 | \{ 579 | beginCaptures 580 | 581 | 0 582 | 583 | name 584 | punctuation.section.block.begin.c 585 | 586 | 587 | end 588 | \} 589 | endCaptures 590 | 591 | 0 592 | 593 | name 594 | punctuation.section.block.end.c 595 | 596 | 597 | patterns 598 | 599 | 600 | include 601 | #special_block 602 | 603 | 604 | include 605 | $base 606 | 607 | 608 | 609 | 610 | include 611 | $base 612 | 613 | 614 | 615 | 616 | 617 | strings 618 | 619 | patterns 620 | 621 | 622 | begin 623 | (u|u8|U|L)?" 624 | beginCaptures 625 | 626 | 0 627 | 628 | name 629 | punctuation.definition.string.begin.c++ 630 | 631 | 1 632 | 633 | name 634 | meta.encoding.c++ 635 | 636 | 637 | end 638 | " 639 | endCaptures 640 | 641 | 0 642 | 643 | name 644 | punctuation.definition.string.end.c++ 645 | 646 | 647 | name 648 | string.quoted.double.c++ 649 | patterns 650 | 651 | 652 | match 653 | \\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8} 654 | name 655 | constant.character.escape.c++ 656 | 657 | 658 | match 659 | \\['"?\\abfnrtv] 660 | name 661 | constant.character.escape.c++ 662 | 663 | 664 | match 665 | \\[0-7]{1,3} 666 | name 667 | constant.character.escape.c++ 668 | 669 | 670 | match 671 | \\x[0-9A-Fa-f]+ 672 | name 673 | constant.character.escape.c++ 674 | 675 | 676 | 677 | 678 | begin 679 | (u|u8|U|L)?R"(?:([^ ()\\\t]{0,16})|([^ ()\\\t]*))\( 680 | beginCaptures 681 | 682 | 0 683 | 684 | name 685 | punctuation.definition.string.begin.c++ 686 | 687 | 1 688 | 689 | name 690 | meta.encoding.c++ 691 | 692 | 3 693 | 694 | name 695 | invalid.illegal.delimiter-too-long.c++ 696 | 697 | 698 | end 699 | \)\2(\3)" 700 | endCaptures 701 | 702 | 0 703 | 704 | name 705 | punctuation.definition.string.end.c++ 706 | 707 | 1 708 | 709 | name 710 | invalid.illegal.delimiter-too-long.c++ 711 | 712 | 713 | name 714 | string.quoted.double.raw.c++ 715 | 716 | 717 | 718 | 719 | scopeName 720 | source.c++ 721 | uuid 722 | 26251B18-6B1D-11D9-AFDB-000D93589AF6 723 | 724 | 725 | -------------------------------------------------------------------------------- /Syntaxes/C.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | c 8 | h 9 | 10 | firstLineMatch 11 | -[*]-( Mode:)? C -[*]- 12 | keyEquivalent 13 | ^~C 14 | name 15 | C 16 | patterns 17 | 18 | 19 | include 20 | #preprocessor-rule-enabled 21 | 22 | 23 | include 24 | #preprocessor-rule-disabled 25 | 26 | 27 | include 28 | #preprocessor-rule-other 29 | 30 | 31 | include 32 | #comments 33 | 34 | 35 | include 36 | source.c.platform 37 | 38 | 39 | match 40 | \b(break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while)\b 41 | name 42 | keyword.control.c 43 | 44 | 45 | match 46 | \b(asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void)\b 47 | name 48 | storage.type.c 49 | 50 | 51 | match 52 | \b(const|extern|register|restrict|static|volatile|inline)\b 53 | name 54 | storage.modifier.c 55 | 56 | 57 | comment 58 | common C constant naming idiom -- kConstantVariable 59 | match 60 | \bk[A-Z]\w*\b 61 | name 62 | constant.other.variable.mac-classic.c 63 | 64 | 65 | match 66 | \bg[A-Z]\w*\b 67 | name 68 | variable.other.readwrite.global.mac-classic.c 69 | 70 | 71 | match 72 | \bs[A-Z]\w*\b 73 | name 74 | variable.other.readwrite.static.mac-classic.c 75 | 76 | 77 | match 78 | \b(NULL|true|false|TRUE|FALSE)\b 79 | name 80 | constant.language.c 81 | 82 | 83 | include 84 | #sizeof 85 | 86 | 87 | captures 88 | 89 | inc 90 | 91 | name 92 | invalid.illegal.digit-separator-should-not-be-last.c++ 93 | 94 | 95 | match 96 | (?x)\b 97 | ( (?i: 98 | 0x ( [0-9A-Fa-f]+ ( ' [0-9A-Fa-f]+ )* )? # Hexadecimal 99 | | 0b ( [0-1]+ ( ' [0-1]+ )* )? # Binary 100 | | 0 ( [0-7]+ ( ' [0-7]+ )* ) # Octal 101 | | ( [0-9]+ ( ' [0-9]+ )* ) # Decimal 102 | ) 103 | ( ([uUfF] | u?ll? | U?LL?)\b | (?<inc>') | \b ) 104 | | ( [0-9]+ ( ' [0-9]+ )* )? 105 | (?i: 106 | \. ( [0-9]+ ( ' [0-9]+ )* ) E(\+|-)? ( [0-9]+ ( ' [0-9]+ )* ) 107 | | \. ( [0-9]+ ( ' [0-9]+ )* ) 108 | | E(\+|-)? ( [0-9]+ ( ' [0-9]+ )* ) 109 | ) 110 | ( (?<inc>') | \b ) 111 | ) 112 | name 113 | constant.numeric.c 114 | 115 | 116 | begin 117 | " 118 | beginCaptures 119 | 120 | 0 121 | 122 | name 123 | punctuation.definition.string.begin.c 124 | 125 | 126 | end 127 | " 128 | endCaptures 129 | 130 | 0 131 | 132 | name 133 | punctuation.definition.string.end.c 134 | 135 | 136 | name 137 | string.quoted.double.c 138 | patterns 139 | 140 | 141 | include 142 | #string_escaped_char 143 | 144 | 145 | include 146 | #string_placeholder 147 | 148 | 149 | 150 | 151 | begin 152 | ' 153 | beginCaptures 154 | 155 | 0 156 | 157 | name 158 | punctuation.definition.string.begin.c 159 | 160 | 161 | end 162 | ' 163 | endCaptures 164 | 165 | 0 166 | 167 | name 168 | punctuation.definition.string.end.c 169 | 170 | 171 | name 172 | string.quoted.single.c 173 | patterns 174 | 175 | 176 | include 177 | #string_escaped_char 178 | 179 | 180 | 181 | 182 | begin 183 | (?x) 184 | ^\s*\#\s*(define)\s+ # define 185 | ((?<id>[a-zA-Z_][a-zA-Z0-9_]*)) # macro name 186 | (?: # and optionally: 187 | (\() # an open parenthesis 188 | ( 189 | \s* \g<id> \s* # first argument 190 | ((,) \s* \g<id> \s*)* # additional arguments 191 | (?:\.\.\.)? # varargs ellipsis? 192 | ) 193 | (\)) # a close parenthesis 194 | )? 195 | 196 | beginCaptures 197 | 198 | 1 199 | 200 | name 201 | keyword.control.import.define.c 202 | 203 | 2 204 | 205 | name 206 | entity.name.function.preprocessor.c 207 | 208 | 4 209 | 210 | name 211 | punctuation.definition.parameters.begin.c 212 | 213 | 5 214 | 215 | name 216 | variable.parameter.preprocessor.c 217 | 218 | 7 219 | 220 | name 221 | punctuation.separator.parameters.c 222 | 223 | 8 224 | 225 | name 226 | punctuation.definition.parameters.end.c 227 | 228 | 229 | end 230 | (?=(?://|/\*))|$ 231 | name 232 | meta.preprocessor.macro.c 233 | patterns 234 | 235 | 236 | match 237 | (?>\\\s*\n) 238 | name 239 | punctuation.separator.continuation.c 240 | 241 | 242 | include 243 | $base 244 | 245 | 246 | 247 | 248 | begin 249 | ^\s*#\s*(error|warning)\b 250 | captures 251 | 252 | 1 253 | 254 | name 255 | keyword.control.import.error.c 256 | 257 | 258 | end 259 | $ 260 | name 261 | meta.preprocessor.diagnostic.c 262 | patterns 263 | 264 | 265 | match 266 | (?>\\\s*\n) 267 | name 268 | punctuation.separator.continuation.c 269 | 270 | 271 | 272 | 273 | begin 274 | ^\s*#\s*(include|import)\b 275 | captures 276 | 277 | 1 278 | 279 | name 280 | keyword.control.import.include.c 281 | 282 | 283 | end 284 | (?=(?://|/\*))|$ 285 | name 286 | meta.preprocessor.c.include 287 | patterns 288 | 289 | 290 | match 291 | (?>\\\s*\n) 292 | name 293 | punctuation.separator.continuation.c 294 | 295 | 296 | begin 297 | " 298 | beginCaptures 299 | 300 | 0 301 | 302 | name 303 | punctuation.definition.string.begin.c 304 | 305 | 306 | end 307 | " 308 | endCaptures 309 | 310 | 0 311 | 312 | name 313 | punctuation.definition.string.end.c 314 | 315 | 316 | name 317 | string.quoted.double.include.c 318 | 319 | 320 | begin 321 | < 322 | beginCaptures 323 | 324 | 0 325 | 326 | name 327 | punctuation.definition.string.begin.c 328 | 329 | 330 | end 331 | > 332 | endCaptures 333 | 334 | 0 335 | 336 | name 337 | punctuation.definition.string.end.c 338 | 339 | 340 | name 341 | string.quoted.other.lt-gt.include.c 342 | 343 | 344 | 345 | 346 | include 347 | #pragma-mark 348 | 349 | 350 | begin 351 | ^\s*#\s*(define|defined|elif|else|if|ifdef|ifndef|line|pragma|undef)\b 352 | captures 353 | 354 | 1 355 | 356 | name 357 | keyword.control.import.c 358 | 359 | 360 | end 361 | (?=(?://|/\*))|$ 362 | name 363 | meta.preprocessor.c 364 | patterns 365 | 366 | 367 | match 368 | (?>\\\s*\n) 369 | name 370 | punctuation.separator.continuation.c 371 | 372 | 373 | 374 | 375 | comment 376 | Reserved POSIX types 377 | match 378 | \b([a-z0-9_]+_t)\b 379 | name 380 | support.type.posix-reserved.c 381 | 382 | 383 | include 384 | #block 385 | 386 | 387 | begin 388 | (?x) 389 | (?: ^ # begin-of-line 390 | | 391 | (?: (?= \s ) (?<!else|new|return) (?<=\w) # or word + space before name 392 | | (?= \s*[A-Za-z_] ) (?<!&&) (?<=[*&>]) # or type modifier before name 393 | ) 394 | ) 395 | (\s*) (?!(while|for|do|if|else|switch|catch|enumerate|return|sizeof|[cr]?iterate|(?:::)?new|(?:::)?delete)\s*\() 396 | ( 397 | (?: [A-Za-z_][A-Za-z0-9_]*+ | :: )++ | # actual name 398 | (?: (?<=operator) (?: [-*&<>=+!]+ | \(\) | \[\] ) ) # if it is a C++ operator 399 | ) 400 | \s*(?=\() 401 | beginCaptures 402 | 403 | 1 404 | 405 | name 406 | punctuation.whitespace.function.leading.c 407 | 408 | 3 409 | 410 | name 411 | entity.name.function.c 412 | 413 | 4 414 | 415 | name 416 | punctuation.definition.parameters.c 417 | 418 | 419 | end 420 | (?<=\})|(?=#)|(;) 421 | name 422 | meta.function.c 423 | patterns 424 | 425 | 426 | include 427 | #comments 428 | 429 | 430 | include 431 | #parens 432 | 433 | 434 | match 435 | \b(const|final|override|noexcept)\b 436 | name 437 | storage.modifier.$1.c++ 438 | 439 | 440 | include 441 | #block 442 | 443 | 444 | 445 | 446 | repository 447 | 448 | access 449 | 450 | captures 451 | 452 | 1 453 | 454 | name 455 | punctuation.separator.variable-access.c 456 | 457 | 2 458 | 459 | comment 460 | https://en.cppreference.com/w/cpp/language/dependent_name 461 | name 462 | storage.modifier.template.c++ 463 | 464 | 3 465 | 466 | name 467 | variable.other.dot-access.c 468 | 469 | 470 | match 471 | (\.|\->)(?:\s*(template)\s+)?([a-zA-Z_][a-zA-Z_0-9]*)\b(?!\s*\() 472 | 473 | block 474 | 475 | patterns 476 | 477 | 478 | begin 479 | \{ 480 | beginCaptures 481 | 482 | 0 483 | 484 | name 485 | punctuation.section.block.begin.c 486 | 487 | 488 | end 489 | \} 490 | endCaptures 491 | 492 | 0 493 | 494 | name 495 | punctuation.section.block.end.c 496 | 497 | 498 | name 499 | meta.block.c 500 | patterns 501 | 502 | 503 | include 504 | #block_innards 505 | 506 | 507 | 508 | 509 | 510 | block_innards 511 | 512 | patterns 513 | 514 | 515 | include 516 | #preprocessor-rule-enabled-block 517 | 518 | 519 | include 520 | #preprocessor-rule-disabled-block 521 | 522 | 523 | include 524 | #preprocessor-rule-other-block 525 | 526 | 527 | include 528 | #sizeof 529 | 530 | 531 | include 532 | #access 533 | 534 | 535 | include 536 | source.c.platform#functions 537 | 538 | 539 | include 540 | #c_function_call 541 | 542 | 543 | captures 544 | 545 | 1 546 | 547 | name 548 | variable.other.c 549 | 550 | 2 551 | 552 | name 553 | punctuation.definition.parameters.c 554 | 555 | 556 | match 557 | (?x) 558 | (?x) 559 | (?: 560 | (?: (?= \s ) (?<!else|new|return) (?<=\w)\s+ # or word + space before name 561 | ) 562 | ) 563 | ( 564 | (?: [A-Za-z_][A-Za-z0-9_]*+ | :: )++ | # actual name 565 | (?: (?<=operator) (?: [-*&<>=+!]+ | \(\) | \[\] ) )? # if it is a C++ operator 566 | ) 567 | \s*(\() 568 | name 569 | meta.initialization.c 570 | 571 | 572 | include 573 | #block 574 | 575 | 576 | include 577 | $base 578 | 579 | 580 | 581 | c_function_call 582 | 583 | captures 584 | 585 | 1 586 | 587 | name 588 | punctuation.whitespace.function-call.leading.c 589 | 590 | 2 591 | 592 | name 593 | support.function.any-method.c 594 | 595 | 3 596 | 597 | name 598 | punctuation.definition.parameters.c 599 | 600 | 601 | match 602 | (?x) (?: (?= \s ) (?:(?<=else|new|return) | (?<!\w)) (\s+))? 603 | (\b 604 | (?!(while|for|do|if|else|switch|catch|enumerate|return|sizeof|[cr]?iterate|(?:::)?new|(?:::)?delete)\s*\()(?:(?!NS)[A-Za-z_][A-Za-z0-9_]*+\b | :: )++ # actual name 605 | ) 606 | \s*(\() 607 | name 608 | meta.function-call.c 609 | 610 | comments 611 | 612 | patterns 613 | 614 | 615 | captures 616 | 617 | 1 618 | 619 | name 620 | meta.toc-list.banner.block.c 621 | 622 | 623 | match 624 | ^/\* =(\s*.*?)\s*= \*/$\n? 625 | name 626 | comment.block.c 627 | 628 | 629 | begin 630 | /\* 631 | beginCaptures 632 | 633 | 0 634 | 635 | name 636 | punctuation.definition.comment.begin.c 637 | 638 | 639 | end 640 | \*/ 641 | endCaptures 642 | 643 | 0 644 | 645 | name 646 | punctuation.definition.comment.end.c 647 | 648 | 649 | name 650 | comment.block.c 651 | 652 | 653 | match 654 | \*/.*\n 655 | name 656 | invalid.illegal.stray-comment-end.c 657 | 658 | 659 | captures 660 | 661 | 1 662 | 663 | name 664 | meta.toc-list.banner.line.c 665 | 666 | 667 | match 668 | ^// =(\s*.*?)\s*=\s*$\n? 669 | name 670 | comment.line.banner.c++ 671 | 672 | 673 | begin 674 | (^[ \t]+)?(?=//) 675 | beginCaptures 676 | 677 | 1 678 | 679 | name 680 | punctuation.whitespace.comment.leading.c++ 681 | 682 | 683 | end 684 | (?!\G) 685 | patterns 686 | 687 | 688 | begin 689 | // 690 | beginCaptures 691 | 692 | 0 693 | 694 | name 695 | punctuation.definition.comment.c++ 696 | 697 | 698 | end 699 | \n 700 | name 701 | comment.line.double-slash.c++ 702 | patterns 703 | 704 | 705 | match 706 | (?>\\\s*\n) 707 | name 708 | punctuation.separator.continuation.c++ 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | disabled 717 | 718 | begin 719 | ^\s*#\s*if(n?def)?\b.*$ 720 | comment 721 | eat nested preprocessor if(def)s 722 | end 723 | ^\s*#\s*endif\b 724 | patterns 725 | 726 | 727 | include 728 | #disabled 729 | 730 | 731 | include 732 | #pragma-mark 733 | 734 | 735 | 736 | parens 737 | 738 | begin 739 | \( 740 | beginCaptures 741 | 742 | 0 743 | 744 | name 745 | punctuation.section.parens.begin.c 746 | 747 | 748 | end 749 | \) 750 | endCaptures 751 | 752 | 0 753 | 754 | name 755 | punctuation.section.parens.end.c 756 | 757 | 758 | name 759 | meta.parens.c 760 | patterns 761 | 762 | 763 | include 764 | $base 765 | 766 | 767 | 768 | pragma-mark 769 | 770 | captures 771 | 772 | 1 773 | 774 | name 775 | meta.preprocessor.c 776 | 777 | 2 778 | 779 | name 780 | keyword.control.import.pragma.c 781 | 782 | 3 783 | 784 | name 785 | meta.toc-list.pragma-mark.c 786 | 787 | 788 | match 789 | ^\s*(#\s*(pragma\s+mark)\s+(.*)) 790 | name 791 | meta.section 792 | 793 | preprocessor-rule-disabled 794 | 795 | begin 796 | ^\s*(#(if)\s+(0)\b).* 797 | captures 798 | 799 | 1 800 | 801 | name 802 | meta.preprocessor.c 803 | 804 | 2 805 | 806 | name 807 | keyword.control.import.if.c 808 | 809 | 3 810 | 811 | name 812 | constant.numeric.preprocessor.c 813 | 814 | 815 | end 816 | ^\s*(#\s*(endif)\b) 817 | patterns 818 | 819 | 820 | begin 821 | ^\s*(#\s*(else)\b) 822 | captures 823 | 824 | 1 825 | 826 | name 827 | meta.preprocessor.c 828 | 829 | 2 830 | 831 | name 832 | keyword.control.import.else.c 833 | 834 | 835 | end 836 | (?=^\s*#\s*endif\b) 837 | patterns 838 | 839 | 840 | include 841 | $base 842 | 843 | 844 | 845 | 846 | begin 847 | 848 | end 849 | (?=^\s*#\s*(else|endif)\b) 850 | name 851 | comment.block.preprocessor.if-branch 852 | patterns 853 | 854 | 855 | include 856 | #disabled 857 | 858 | 859 | include 860 | #pragma-mark 861 | 862 | 863 | 864 | 865 | 866 | preprocessor-rule-disabled-block 867 | 868 | begin 869 | ^\s*(#(if)\s+(0)\b).* 870 | captures 871 | 872 | 1 873 | 874 | name 875 | meta.preprocessor.c 876 | 877 | 2 878 | 879 | name 880 | keyword.control.import.if.c 881 | 882 | 3 883 | 884 | name 885 | constant.numeric.preprocessor.c 886 | 887 | 888 | end 889 | ^\s*(#\s*(endif)\b) 890 | patterns 891 | 892 | 893 | begin 894 | ^\s*(#\s*(else)\b) 895 | captures 896 | 897 | 1 898 | 899 | name 900 | meta.preprocessor.c 901 | 902 | 2 903 | 904 | name 905 | keyword.control.import.else.c 906 | 907 | 908 | end 909 | (?=^\s*#\s*endif\b) 910 | patterns 911 | 912 | 913 | include 914 | #block_innards 915 | 916 | 917 | 918 | 919 | begin 920 | 921 | end 922 | (?=^\s*#\s*(else|endif)\b) 923 | name 924 | comment.block.preprocessor.if-branch.in-block 925 | patterns 926 | 927 | 928 | include 929 | #disabled 930 | 931 | 932 | include 933 | #pragma-mark 934 | 935 | 936 | 937 | 938 | 939 | preprocessor-rule-enabled 940 | 941 | begin 942 | ^\s*(#(if)\s+(0*1)\b) 943 | captures 944 | 945 | 1 946 | 947 | name 948 | meta.preprocessor.c 949 | 950 | 2 951 | 952 | name 953 | keyword.control.import.if.c 954 | 955 | 3 956 | 957 | name 958 | constant.numeric.preprocessor.c 959 | 960 | 961 | end 962 | ^\s*(#\s*(endif)\b) 963 | patterns 964 | 965 | 966 | begin 967 | ^\s*(#\s*(else)\b).* 968 | captures 969 | 970 | 1 971 | 972 | name 973 | meta.preprocessor.c 974 | 975 | 2 976 | 977 | name 978 | keyword.control.import.else.c 979 | 980 | 981 | contentName 982 | comment.block.preprocessor.else-branch 983 | end 984 | (?=^\s*#\s*endif\b) 985 | patterns 986 | 987 | 988 | include 989 | #disabled 990 | 991 | 992 | include 993 | #pragma-mark 994 | 995 | 996 | 997 | 998 | begin 999 | 1000 | end 1001 | (?=^\s*#\s*(else|endif)\b) 1002 | patterns 1003 | 1004 | 1005 | include 1006 | $base 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | preprocessor-rule-enabled-block 1013 | 1014 | begin 1015 | ^\s*(#(if)\s+(0*1)\b) 1016 | captures 1017 | 1018 | 1 1019 | 1020 | name 1021 | meta.preprocessor.c 1022 | 1023 | 2 1024 | 1025 | name 1026 | keyword.control.import.if.c 1027 | 1028 | 3 1029 | 1030 | name 1031 | constant.numeric.preprocessor.c 1032 | 1033 | 1034 | end 1035 | ^\s*(#\s*(endif)\b) 1036 | patterns 1037 | 1038 | 1039 | begin 1040 | ^\s*(#\s*(else)\b).* 1041 | captures 1042 | 1043 | 1 1044 | 1045 | name 1046 | meta.preprocessor.c 1047 | 1048 | 2 1049 | 1050 | name 1051 | keyword.control.import.else.c 1052 | 1053 | 1054 | contentName 1055 | comment.block.preprocessor.else-branch.in-block 1056 | end 1057 | (?=^\s*#\s*endif\b) 1058 | patterns 1059 | 1060 | 1061 | include 1062 | #disabled 1063 | 1064 | 1065 | include 1066 | #pragma-mark 1067 | 1068 | 1069 | 1070 | 1071 | begin 1072 | 1073 | end 1074 | (?=^\s*#\s*(else|endif)\b) 1075 | patterns 1076 | 1077 | 1078 | include 1079 | #block_innards 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | preprocessor-rule-other 1086 | 1087 | begin 1088 | ^\s*(#\s*(if(n?def)?)\b.*?(?:(?=(?://|/\*))|$)) 1089 | captures 1090 | 1091 | 1 1092 | 1093 | name 1094 | meta.preprocessor.c 1095 | 1096 | 2 1097 | 1098 | name 1099 | keyword.control.import.c 1100 | 1101 | 1102 | end 1103 | ^\s*(#\s*(endif)\b) 1104 | patterns 1105 | 1106 | 1107 | include 1108 | $base 1109 | 1110 | 1111 | 1112 | preprocessor-rule-other-block 1113 | 1114 | begin 1115 | ^\s*(#\s*(if(n?def)?)\b.*?(?:(?=(?://|/\*))|$)) 1116 | captures 1117 | 1118 | 1 1119 | 1120 | name 1121 | meta.preprocessor.c 1122 | 1123 | 2 1124 | 1125 | name 1126 | keyword.control.import.c 1127 | 1128 | 1129 | end 1130 | ^\s*(#\s*(endif)\b) 1131 | patterns 1132 | 1133 | 1134 | include 1135 | #block_innards 1136 | 1137 | 1138 | 1139 | sizeof 1140 | 1141 | match 1142 | \b(sizeof)\b 1143 | name 1144 | keyword.operator.sizeof.c 1145 | 1146 | string_escaped_char 1147 | 1148 | patterns 1149 | 1150 | 1151 | match 1152 | \\(\\|[abefnprtv'"?]|[0-3]\d{0,2}|[4-7]\d?|x[a-fA-F0-9]{0,2}|u[a-fA-F0-9]{0,4}|U[a-fA-F0-9]{0,8}) 1153 | name 1154 | constant.character.escape.c 1155 | 1156 | 1157 | match 1158 | \\. 1159 | name 1160 | invalid.illegal.unknown-escape.c 1161 | 1162 | 1163 | 1164 | string_placeholder 1165 | 1166 | patterns 1167 | 1168 | 1169 | match 1170 | (?x)% 1171 | (\d+\$)? # field (argument #) 1172 | [#0\- +']* # flags 1173 | [,;:_]? # separator character (AltiVec) 1174 | ((-?\d+)|\*(-?\d+\$)?)? # minimum field width 1175 | (\.((-?\d+)|\*(-?\d+\$)?)?)? # precision 1176 | (hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier 1177 | [diouxXDOUeEfFgGaACcSspn%] # conversion type 1178 | 1179 | name 1180 | constant.other.placeholder.c 1181 | 1182 | 1183 | 1184 | 1185 | scopeName 1186 | source.c 1187 | uuid 1188 | 25066DC2-6B1D-11D9-9D5B-000D93589AF6 1189 | 1190 | 1191 | --------------------------------------------------------------------------------