Initial commit of Xcode editor integration

This commit is contained in:
Alex Karahalios authored and Ross Boucher committed 2009-04-22 12:05:56 -07:00
1 parent 64010672eb
commit a95aae22ab
5 files changed
+1370

No files matched your search

+762
View File
@@ -0,0 +1,762 @@
// Objective-J language
(
/****************************************************************************/
// MARK: Strings and Characters
/****************************************************************************/
{
Identifier = "xcode.lang.string.objj";
Syntax = {
Start = "@\"";
EscapeChar = "\\";
End = "\"";
Type = "xcode.syntax.string";
};
},
/****************************************************************************/
// MARK: Objective-J keywords
/****************************************************************************/
{
Identifier = "xcode.lang.objj.identifier";
Syntax = {
StartChars = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
Chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
Words = (
// keywords from JavaScript
"break",
"case",
"catch",
"continue",
"default",
"delete",
"do",
"else",
"false",
"finally",
"for",
"function",
"if",
"in",
"instanceof",
"new",
"null",
"return",
"switch",
"this",
"throw",
"true",
"try",
"typeof",
"var",
"void",
"while",
"with",
// Select keywords from Objective-C
"@catch",
"@class",
"@defs",
"@dynamic",
"@encode",
"@end",
"@finally",
"@implementation",
"@interface",
"@import",
"@optional",
"@package",
"@private",
"@property",
"@protected",
"@protocol",
"@public",
"@required",
"@selector",
"@synchronized",
"@synthesize",
"@throw",
"@try",
"bycopy",
"byref",
"in",
"inout",
"oneway",
"out",
"BOOL",
"IBAction",
"IBOutlet",
"IMP",
"NO",
"Nil",
"SEL",
"YES",
"id",
"nil",
"self",
"super",
);
Type = "xcode.syntax.keyword";
AltType = "xcode.syntax.identifier"; // non-keywords are identifiers
};
},
/****************************************************************************/
// MARK: Objective-J Top-Level
/****************************************************************************/
{
Identifier = "xcode.lang.objj";
Description = "Objective-J Coloring";
BasedOn = "xcode.lang.javascript";
IncludeInMenu = YES;
Name = "Objective-J";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer.toplevel";
IncludeRules = (
"xcode.lang.objj.block",
"xcode.lang.objj.bracketexpr",
"xcode.lang.objj.parenexpr",
"xcode.lang.objj.interface",
"xcode.lang.objj.implementation",
"xcode.lang.objj.protocol.declaration",
"xcode.lang.objj.protocol",
"xcode.lang.objj.function.declaration",
"xcode.lang.objj.function.definition",
"xcode.lang.objj.initializer",
);
Type = "xcode.syntax.plain";
};
},
/****************************************************************************/
// MARK: Lexers
/****************************************************************************/
// The following rule returns tokens to the other rules
{
Identifier = "xcode.lang.objj.lexer";
Syntax = {
IncludeRules = (
"xcode.lang.comment.headerdoc",
"xcode.lang.comment",
"xcode.lang.comment.singleline",
"xcode.lang.c.preprocessor",
"xcode.lang.string.objj",
"xcode.lang.string",
"xcode.lang.character",
"xcode.lang.completionplaceholder",
"xcode.lang.objj.identifier",
"xcode.lang.number",
);
};
},
{
Identifier = "xcode.lang.objj.lexer.toplevel";
Syntax = {
IncludeRules = (
"xcode.lang.comment.headerdoc",
"xcode.lang.comment",
"xcode.lang.comment.singleline",
"xcode.lang.c.preprocessor",
"xcode.lang.string.objj",
"xcode.lang.string",
"xcode.lang.character",
"xcode.lang.completionplaceholder",
"xcode.lang.objj.interface.declarator",
"xcode.lang.objj.implementation.declarator",
"xcode.lang.objj.protocol.declarator",
"xcode.lang.objj.property.declarator",
"xcode.lang.objj.identifier",
"xcode.lang.number",
);
};
},
{
Identifier = "xcode.lang.objj.lexer.attribute";
Syntax = {
IncludeRules = (
"xcode.lang.comment.headerdoc",
"xcode.lang.comment",
"xcode.lang.comment.singleline",
"xcode.lang.c.preprocessor",
"xcode.lang.string.objj",
"xcode.lang.string",
"xcode.lang.character",
"xcode.lang.completionplaceholder",
"xcode.lang.objj.identifier",
"xcode.lang.number",
);
};
},
{
Identifier = "xcode.lang.objj.parenexpr.attribute";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer.attribute";
Start = "(";
End = ")";
Recursive = YES;
};
},
{
Identifier = "xcode.lang.objj.implementation.declarator";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"@implementation",
"xcode.lang.objj.classnameclause",
);
Type = "xcode.syntax.name.tree";
};
},
{
Identifier = "xcode.lang.objj.interface.declarator";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"@interface",
"xcode.lang.objj.classnameclause",
":?",
"xcode.lang.objj.classname?",
"xcode.lang.objj.protocolclause?",
);
Type = "xcode.syntax.name.tree";
};
},
{
Identifier = "xcode.lang.objj.protocol.declarator";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"@protocol",
"xcode.lang.objj.protocolname",
);
Type = "xcode.syntax.name.tree";
};
},
{
Identifier = "xcode.lang.objj.classnameclause";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.classname",
"xcode.lang.objj.categoryclause?",
);
Type = "xcode.syntax.name.tree";
};
},
{
Identifier = "xcode.lang.objj.classname";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.identifier",
);
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.protocolname";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.identifier",
);
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.protocol.openangle";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"<",
);
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.protocol.closeangle";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
">",
);
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.protocolclause";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.protocol.openangle",
"xcode.lang.objj.protocolname",
"xcode.lang.objj.protocol.protocollist*",
"xcode.lang.objj.protocol.closeangle",
);
};
},
{
Identifier = "xcode.lang.objj.categoryname";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.identifier",
);
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.category.openparen";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"(",
);
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.category.closeparen";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
")",
);
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.categoryclause";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.category.openparen",
"xcode.lang.objj.categoryname",
"xcode.lang.objj.category.closeparen"
);
};
},
/****************************************************************************/
// MARK: Interfaces/Implementations
/****************************************************************************/
{
Identifier = "xcode.lang.objj.protocol.declaration";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer.toplevel";
Rules = (
"xcode.lang.objj.protocol.declarator",
"xcode.lang.objj.protocol.protocolclause*",
";",
);
Type = "xcode.syntax.declaration.objj.protocol";
};
},
{
Identifier = "xcode.lang.objj.protocol.protocollist";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
",",
"xcode.lang.objj.protocolname",
);
};
},
{
Identifier = "xcode.lang.objj.protocol";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer.toplevel";
Start = "xcode.lang.objj.protocol.declarator";
End = "@end";
Foldable = YES;
IncludeRules = (
"xcode.lang.objj.function.declaration",
"xcode.lang.objj.method.declaration",
"xcode.lang.objj.classmethod.declaration",
"xcode.lang.objj.property.declaration",
"xcode.lang.objj.block",
"xcode.lang.objj.bracketexpr",
"xcode.lang.objj.parenexpr",
);
Type = "xcode.syntax.declaration.objj.protocol";
};
},
{
Identifier = "xcode.lang.objj.interface";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer.toplevel";
Start = "xcode.lang.objj.interface.declarator";
End = "@end";
Foldable = YES;
IncludeRules = (
"xcode.lang.objj.function.declaration",
"xcode.lang.objj.method.declaration",
"xcode.lang.objj.classmethod.declaration",
"xcode.lang.objj.property.declaration",
"xcode.lang.objj.block",
"xcode.lang.objj.bracketexpr",
"xcode.lang.objj.parenexpr",
);
Type = "xcode.syntax.declaration.objj.interface";
};
},
{
Identifier = "xcode.lang.objj.implementation";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer.toplevel";
Start = "xcode.lang.objj.implementation.declarator";
End = "@end";
Foldable = YES;
IncludeRules = (
"xcode.lang.objj.function.declaration",
"xcode.lang.objj.function.definition",
"xcode.lang.objj.method.definition",
"xcode.lang.objj.classmethod.definition",
"xcode.lang.objj.block",
"xcode.lang.objj.bracketexpr",
"xcode.lang.objj.parenexpr",
"xcode.lang.objj.initializer",
);
Type = "xcode.syntax.definition.objj.implementation";
};
},
/****************************************************************************/
// MARK: Methods
/****************************************************************************/
{
Identifier = "xcode.lang.objj.method.minus";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = ( "-", );
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.method.plus";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = ( "+", );
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.method.colon";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = ( ":", );
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.partialname";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = ( "xcode.lang.objj.identifier", );
Type = "xcode.syntax.name.partial";
};
},
{
Identifier = "xcode.lang.objj.method.declaration";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.method.declarator",
"xcode.lang.objj.identifier?",
";",
);
Type = "xcode.syntax.declaration.method";
};
},
{
Identifier = "xcode.lang.objj.method.definition";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.method.declarator",
";?",
"xcode.lang.objj.block",
);
Type = "xcode.syntax.definition.method";
};
},
{
Identifier = "xcode.lang.objj.method.declarator";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.method.minus",
"xcode.lang.objj.parenexpr?",
"xcode.lang.objj.partialname",
"xcode.lang.objj.method.declarator.args?",
);
Type = "xcode.syntax.method.declarator";
};
},
{
Identifier = "xcode.lang.objj.classmethod.declaration";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.classmethod.declarator",
"xcode.lang.objj.identifier?",
";",
);
Type = "xcode.syntax.declaration.method";
};
},
{
Identifier = "xcode.lang.objj.classmethod.definition";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.classmethod.declarator",
";?",
"xcode.lang.objj.block",
);
Type = "xcode.syntax.definition.method";
};
},
{
Identifier = "xcode.lang.objj.classmethod.declarator";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.method.plus",
"xcode.lang.objj.parenexpr?",
"xcode.lang.objj.partialname",
"xcode.lang.objj.method.declarator.args?",
);
Type = "xcode.syntax.method.declarator";
};
},
{
Identifier = "xcode.lang.objj.method.declarator.args";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.method.colon",
"xcode.lang.objj.parenexpr?",
"xcode.lang.objj.identifier",
"xcode.lang.objj.method.declarator.moreargs*",
"xcode.lang.objj.method.declarator.varargs?",
);
};
},
{
Identifier = "xcode.lang.objj.method.declarator.moreargs";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.partialname?",
"xcode.lang.objj.method.colon",
"xcode.lang.objj.parenexpr?",
"xcode.lang.objj.identifier"
);
};
},
{
Identifier = "xcode.lang.objj.method.declarator.varargs";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
",",
"...",
);
};
},
/****************************************************************************/
// MARK: Functions
/****************************************************************************/
{
Identifier = "xcode.lang.objj.function.definition";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.function.declarator",
"xcode.lang.objj.block",
);
Type = "xcode.syntax.definition.c.function";
};
},
{
Identifier = "xcode.lang.objj.function.declaration";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.function.declarator",
"xcode.lang.objj.identifier?",
";"
);
Type = "xcode.syntax.declaration.c.function";
};
},
{
Identifier = "xcode.lang.objj.function.declarator";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.function.name",
"xcode.lang.objj.parenexpr",
);
};
},
{
Identifier = "xcode.lang.objj.function.name";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"xcode.lang.objj.identifier",
);
Type = "xcode.syntax.name.partial";
};
},
/****************************************************************************/
// MARK: Properties
/****************************************************************************/
{
Identifier = "xcode.lang.objj.property.declaration";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Start = "xcode.lang.objj.property.declarator";
End = ";";
Type = "xcode.syntax.declaration.property";
};
},
{
Identifier = "xcode.lang.objj.property.declarator";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Rules = (
"@property",
"xcode.lang.objj.property.options?",
);
};
},
{
Identifier = "xcode.lang.objj.property.options";
Syntax = {
Tokenizer = "xcode.lang.objj.property.options.lexer";
Start = "(";
End = ")";
Recursive = YES;
};
},
{
Identifier = "xcode.lang.objj.property.options.lexer";
Syntax = {
IncludeRules = (
"xcode.lang.comment.headerdoc",
"xcode.lang.comment",
"xcode.lang.comment.singleline",
"xcode.lang.c.preprocessor",
"xcode.lang.string.objj",
"xcode.lang.string",
"xcode.lang.character",
"xcode.lang.completionplaceholder",
"xcode.lang.objj.property.options.identifier",
"xcode.lang.objj.identifier",
"xcode.lang.number",
);
};
},
{
Identifier = "xcode.lang.objj.property.options.identifier";
Syntax = {
Words = (
"setter",
"getter",
"readonly",
"readwrite",
"assign",
"retain",
"copy",
"nonatomic",
);
Type = "xcode.syntax.keyword";
};
},
/****************************************************************************/
// MARK: Blocks
/****************************************************************************/
{
Identifier = "xcode.lang.objj.block";
BasedOn = "xcode.lang.javascript.block"; // for text macros
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Start = "{";
End = "}";
Foldable = YES;
Recursive = YES;
IncludeRules = (
"xcode.lang.objj.bracketexpr",
"xcode.lang.objj.parenexpr",
);
};
},
{
Identifier = "xcode.lang.objj.parenexpr";
BasedOn = "xcode.lang.javascript.parenexpr";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Start = "(";
End = ")";
Recursive = YES;
IncludeRules = (
"xcode.lang.objj.bracketexpr",
"xcode.lang.objj.block",
);
};
},
{
Identifier = "xcode.lang.objj.bracketexpr";
BasedOn = "xcode.lang.javascript.bracketexpr";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer";
Start = "[";
End = "]";
Recursive = YES;
IncludeRules = (
"xcode.lang.objj.parenexpr",
"xcode.lang.objj.block",
);
};
},
{
Identifier = "xcode.lang.objj.initializer";
Syntax = {
Tokenizer = "xcode.lang.objj.lexer.toplevel";
Start = "=";
End = ";";
Recursive = NO;
IncludeRules = (
"xcode.lang.objj.parenexpr",
"xcode.lang.objj.bracketexpr",
);
};
},
)
+15
View File
@@ -0,0 +1,15 @@
/*
* ObjectiveJ.xcspec: Xcode file type for Objective-J
*
*/
(
{
Type = FileType;
Identifier = sourcecode.objj;
BasedOn = sourcecode;
Name = "Objective-J file";
Extensions = ( j );
Language = "xcode.lang.objj";
}
)
+541
View File
@@ -0,0 +1,541 @@
/**
Objective J text macro specifications derived from
Objective C text macro specifications and C text macro specifications which are
Copyright © 2004-2007 Apple Inc. All rights reserved.
*/
(
//
// Objective-J language macros
//
{
Identifier = objj;
Name = "Objective J";
IsMenu = YES;
// Can be set (for all languages) with the XCCodeSenseFormattingOptions user default
// DefaultSettings = {
// PreExpressionsSpacing = " ";
// InExpressionsSpacing = "";
// BlockSeparator = " ";
// PostBlockSeparator = "\n";
// };
IncludeContexts = ( "xcode.lang.objj");
ExcludeContexts = ( "xcode.lang.string", "xcode.lang.character", "xcode.lang.comment", "xcode.lang.c.preprocessor" );
},
{
Identifier = objj.try;
BasedOn = objj;
IsMenuItem = YES;
Name = "Try / Catch Block";
TextString = "@try$(BlockSeparator){\n\t<#!statements!#>\n}$(PostBlockSeparator)@catch$(PreExpressionsSpacing)($(InExpressionsSpacing)CPException * e$(InExpressionsSpacing))$(BlockSeparator){\n\t<#handler#>\n}$(PostBlockSeparator)@finally$(BlockSeparator){\n\t<#statements#>\n}";
CompletionPrefix = "@try";
IncludeContexts = ( "xcode.lang.objj.block" );
},
{
Identifier = objj.catch;
BasedOn = objj;
IsMenuItem = YES;
Name = "Catch Block";
TextString = "@catch$(PreExpressionsSpacing)($(InExpressionsSpacing)<#exception#>$(InExpressionsSpacing))$(BlockSeparator){\n\t<#!handler!#>\n}";
CompletionPrefix = "@catch";
IncludeContexts = ( "xcode.lang.objj.block" );
},
{
Identifier = objj.finally;
BasedOn = objj;
IsMenuItem = YES;
Name = "Finally Block";
TextString = "@finally$(BlockSeparator){\n\t<#!handler!#>\n}";
CompletionPrefix = "@finally";
IncludeContexts = ( "xcode.lang.objj.block" );
},
{
Identifier = objj.log;
BasedOn = objj;
IsMenuItem = YES;
Name = "CPLog() Call";
TextString = "CPLog$(PreFunctionArgsSpacing)($(InFunctionArgsSpacing)@\"<#message#>\"$(InFunctionArgsSpacing));";
CompletionPrefix = log;
IncludeContexts = ( "xcode.lang.objj.block" );
},
{
Identifier = objj.bracket;
BasedOn = objj;
IsMenuItem = YES;
Name = "Bracket Expression";
TextString = "[<#!expression!#> ]";
CompletionPrefix = "[";
},
{
Identifier = objj.allocinit;
BasedOn = objj;
IsMenuItem = YES;
Name = "Alloc / Init Call";
TextString = "[[<#!class!#> alloc] init]";
CompletionPrefix = a;
},
{
Identifier = objj.array;
BasedOn = objj;
IsMenuItem = YES;
Name = "Array Declaration";
TextString = "CPArray * array;";
CompletionPrefix = aa;
},
{
Identifier = objj.mutablearray;
BasedOn = objj;
IsMenuItem = YES;
Name = "Mutable Array Declaration";
TextString = "CPMutableArray * array;";
CompletionPrefix = ma;
},
{
Identifier = objj.arrayiteration;
BasedOn = objj;
IsMenuItem = YES;
Name = "Array For Loop";
TextString = "CPUInteger i, count = [<#array#> count];\nfor$(PreExpressionsSpacing)($(InExpressionsSpacing)i = 0; i < count; i++$(InExpressionsSpacing))$(BlockSeparator){\n\tCPObject * obj = [<#array#> objectAtIndex:i];\n\t<#!statements!#>\n}";
CompletionPrefix = fora;
IncludeContexts = ( "xcode.lang.objj.block" );
},
{
Identifier = objj.arrayiteration.foreach;
BasedOn = objj;
IsMenuItem = YES;
Name = "Array Foreach Loop";
TextString = "for$(PreExpressionsSpacing)($(InExpressionsSpacing)<#object#> in <#array#>$(InExpressionsSpacing))$(BlockSeparator){\n\t<#!statements!#>\n}";
CompletionPrefix = fore;
IncludeContexts = ( "xcode.lang.objj.block" );
},
// MARK: Block Statements
{
Identifier = objj.block;
BasedOn = objj;
TextString = "$(Statement)$(BlockSeparator){\n\t<#!statements!#>\n}";
Statement = "$(Command)$(PreExpressionsSpacing)($(InExpressionsSpacing)$(Expressions)$(InExpressionsSpacing))";
IncludeContexts = ( "xcode.lang.objj.block", "xcode.lang.java.block" ); // these all work in Java too
ExcludeContexts = ( "xcode.lang.string", "xcode.lang.character", "xcode.lang.comment", "xcode.lang.c.preprocessor", "xcode.lang.objj.parenexpr", "xcode.lang.objj.bracketexpr" );
},
{
Identifier = objj.block.if;
BasedOn = objj.block;
Name = "If Block";
IsMenuItem = YES;
Command = "if";
Expressions = "<#condition#>";
CompletionPrefix = if;
CycleList = (
objj.block.if,
objj.block.ifelse,
);
},
{
Identifier = objj.block.ifelse;
BasedOn = objj.block;
Name = "If / Else Block";
IsMenuItem = NO;
Command = "if";
Expressions = "<#condition#>";
TextString = "$(Statement)$(BlockSeparator){\n\t<#!statements!#>\n}$(PostBlockSeparator)else$(BlockSeparator){\n\t<#statements#>\n}";
CompletionPrefix = ifelse;
},
{
Identifier = objj.block.elseif;
BasedOn = objj.block;
Name = "Else If Block";
IsMenuItem = NO;
Command = "else if";
Expressions = "<#condition#>";
CompletionPrefix = elseif;
},
{
Identifier = objj.block.for;
BasedOn = objj.block;
Name = "For Loop";
IsMenuItem = YES;
Command = "for";
Expressions = "<#initial#>; <#condition#>; <#increment#>";
CompletionPrefix = for;
CycleList = (
objj.block.for,
objj.block.for.i,
);
},
{
Identifier = objj.block.for.i;
BasedOn = objj.block;
Name = "For i Loop";
IsMenuItem = NO;
Command = "for";
Expressions = "int i = 0; i < <#limit#>; i++";
CompletionPrefix = fori;
},
{
Identifier = objj.block.while;
BasedOn = objj.block;
Name = "While Loop";
IsMenuItem = YES;
Command = "while";
Expressions = "<#condition#>";
CompletionPrefix = while;
},
{
Identifier = objj.block.dowhile;
BasedOn = objj.block;
Name = "Do While Loop";
IsMenuItem = YES;
Command = "while";
TextString = "do$(BlockSeparator){\n\t<#!statements!#>\n}$(PreExpressionsSpacing)$(Statement)";
Expressions = "<#condition#>";
CompletionPrefix = do;
},
{
Identifier = objj.block.switch;
BasedOn = objj.block;
Name = "Switch Block";
IsMenuItem = YES;
Command = "switch";
TextString = "$(Statement)$(BlockSeparator){\n$(CaseStatementSpacing)case <#constant#>:\n$(CaseStatementSpacing)\t<#!statements!#>\n$(CaseStatementSpacing)\tbreak;\n$(CaseStatementSpacing)default:\n$(CaseStatementSpacing)\tbreak;\n}";
Expressions = "<#expression#>";
CompletionPrefix = switch;
},
{
Identifier = objj.caseblock;
BasedOn = objj;
IsMenuItem = YES;
Name = "Case Block";
TextString = "case <#constant#>:\n\t<#!statements!#>\n\tbreak;\n";
CompletionPrefix = case;
IncludeContexts = ( "xcode.lang.objj.block", "xcode.lang.java.block" ); // this works in Java too
ExcludeContexts = ( "xcode.lang.string", "xcode.lang.character", "xcode.lang.comment", "xcode.lang.c.preprocessor", "xcode.lang.objj.parenexpr", "xcode.lang.objj.bracketexpr" );
},
{
Identifier = objj.elseblock;
BasedOn = objj;
IsMenuItem = YES;
Name = "Else Block";
TextString = "else$(BlockSeparator){\n\t<#!statements!#>\n}\n";
CompletionPrefix = else;
IncludeContexts = ( "xcode.lang.objj.block", "xcode.lang.java.block" ); // this works in Java too
ExcludeContexts = ( "xcode.lang.string", "xcode.lang.character", "xcode.lang.comment", "xcode.lang.c.preprocessor", "xcode.lang.objj.parenexpr", "xcode.lang.objj.bracketexpr" );
CycleList = (
objj.elseblock,
objj.block.elseif,
);
},
{
Identifier = objj.paren;
BasedOn = objj;
IsMenuItem = YES;
Name = "Parenthesize Selection";
TextString = "($(InExpressionsSpacing)<#!expression!#>$(InExpressionsSpacing))";
IncludeContexts = ( "xcode.lang.objj");
},
{
Identifier = objj.quote;
BasedOn = objj;
IsMenuItem = YES;
Name = "Quote Selection";
TextString = "\"<#!text!#>\"";
IncludeContexts = ( "xcode.lang.objj");
},
{
Identifier = objj.pragmamark;
BasedOn = objj;
IsMenuItem = YES;
Name = "#Pragma Mark";
TextString = "#pragma mark <#!label!#>";
CompletionPrefix = pm;
},
{
Identifier = objj.pp.pragmamark;
BasedOn = objj;
IsMenuItem = NO;
Name = "Pragma Mark";
TextString = "pragma mark <#!label!#>";
CompletionPrefix = pragma;
IncludeContexts = ( "xcode.lang.c.preprocessor" );
},
{
Identifier = objj.import;
BasedOn = objj;
IsMenuItem = YES;
Name = "#Import Statement";
TextString = "#import \"<#!file!#>\"";
CompletionPrefix = pim;
CycleList = (
objj.import,
objj.import.sys,
objj.import.fw
);
ExcludeContexts = ( "xcode.lang.objj.block", "xcode.lang.string", "xcode.lang.character", "xcode.lang.comment", "xcode.lang.c.preprocessor" );
},
{
Identifier = objj.import.sys;
BasedOn = objj.import;
IsMenuItem = NO;
Name = "#Import Statement (System)";
TextString = "#import <<#!file!#>>";
CompletionPrefix = pims;
},
{
Identifier = objj.import.fw;
BasedOn = objj.import;
IsMenuItem = NO;
Name = "#Import Statement (Framework)";
TextString = "#import <<#framework#>/<#!file!#>>";
CompletionPrefix = pimf;
},
{
Identifier = objj.pif;
BasedOn = objj;
IsMenuItem = YES;
Name = "#If Block";
IfText = "if";
TextString = "#$(IfText) $(Expression)\n<#!statements!#>\n#endif";
Expression = "<#expression#>";
CompletionPrefix = pif;
CycleList = (
objj.pif,
objj.pifzero,
objj.pifdef,
objj.pifelse,
objj.pifdefelse
);
},
{
Identifier = objj.pifdef;
BasedOn = objj.pif;
IsMenuItem = NO;
Name = "#Ifdef Block";
IfText = "ifdef";
CompletionPrefix = pifd;
},
{
Identifier = objj.pifelse;
BasedOn = objj.pif;
IsMenuItem = NO;
Name = "#If / Else Block";
TextString = "#$(IfText) $(Expression)\n<#!statements!#>\n#else\n<#statements#>\n#endif";
CompletionPrefix = pife;
},
{
Identifier = objj.pifdefelse;
BasedOn = objj.pifelse;
IsMenuItem = NO;
IfText = "ifdef";
Name = "#Ifdef / Else Block";
CompletionPrefix = pifde;
},
{
Identifier = objj.pifzero;
BasedOn = objj.pif;
IsMenuItem = NO;
Name = "#If 0 Block";
Expression = "0";
CompletionPrefix = pifz;
},
{
Identifier = objj.copyright;
BasedOn = objj;
IsMenuItem = YES;
Name = "Copyright Comment";
TextString = "//\n// Copyright (c) $(YEAR), $(ORGANIZATIONNAME)\n// All rights reserved.\n//\n";
CompletionPrefix = copyright;
IncludeContexts = ( "xcode.lang.objj");
},
{
Identifier = objj.comment;
BasedOn = objj;
IsMenuItem = YES;
Name = "Comment Selection";
TextString = "/* <#!comment!#> */";
CompletionPrefix = comment;
IncludeContexts = ( "xcode.lang.objj");
},
{
Identifier = objj.separatorcomment;
BasedOn = objj;
IsMenuItem = YES;
Name = "Separator Comment";
TextString = "/****************************************************************************/\n";
CompletionPrefix = cseparator;
IncludeContexts = ( "xcode.lang.objj");
},
// MARK: methods templates
{
Identifier = objj.init;
BasedOn = objj;
IsMenuItem = YES;
Name = "init Definition";
TextString = "-$(PreMethodTypeSpacing)(id)$(PreMethodDeclSpacing)init$(FunctionBlockSeparator){\n\tself = [super init];\n\tif$(PreExpressionsSpacing)($(InExpressionsSpacing)self != nil$(InExpressionsSpacing))$(BlockSeparator){\n\t\t<#!initializations!#>\n\t}\n\treturn self;\n}\n";
CompletionPrefix = init;
IncludeContexts = ( "xcode.lang.objj.implementation" );
ExcludeContexts = ( "xcode.lang.objj.block" );
},
{
Identifier = objj.dealloc;
BasedOn = objj;
IsMenuItem = YES;
Name = "dealloc Definition";
TextString = "-$(PreMethodTypeSpacing)(void)$(PreMethodDeclSpacing)dealloc$(FunctionBlockSeparator){\n\t<#!deallocations!#>\n\t[super dealloc];\n}\n";
CompletionPrefix = dealloc;
IncludeContexts = ( "xcode.lang.objj.implementation" );
ExcludeContexts = ( "xcode.lang.objj.block" );
},
{
Identifier = objj.observe;
BasedOn = objj;
IsMenuItem = YES;
Name = "observeValueForKeyPath: Definition";
TextString =
"-$(PreMethodTypeSpacing)(void)$(PreMethodDeclSpacing)observeValueForKeyPath$(PreColonSpacing):$(PostColonSpacing)(CPString *)$(MessageArgSpacing)keyPath ofObject$(PreColonSpacing):$(PostColonSpacing)(id)$(MessageArgSpacing)object change$(PreColonSpacing):$(PostColonSpacing)(CPDictionary *)$(MessageArgSpacing)change context$(PreColonSpacing):$(PostColonSpacing)(void *)$(MessageArgSpacing)context$(FunctionBlockSeparator){
if$(PreExpressionsSpacing)($(InExpressionsSpacing)context == <#context#>$(InExpressionsSpacing))$(BlockSeparator){
<#work#>
}$(PostBlockSeparator)\telse$(BlockSeparator){
[$(InMessageSpacing)super observeValueForKeyPath$(PreColonSpacing):$(PostColonSpacing)keyPath ofObject$(PreColonSpacing):$(PostColonSpacing)object change$(PreColonSpacing):$(PostColonSpacing)change context$(PreColonSpacing):$(PostColonSpacing)context$(InMessageSpacing)];
}
}
";
CompletionPrefix = observeValueForKeyPath;
IncludeContexts = ( "xcode.lang.objj.implementation" );
ExcludeContexts = ( "xcode.lang.objj.block" );
},
{
Identifier = objj.observe.decl;
BasedOn = objj;
IsMenuItem = YES;
Name = "observeValueForKeyPath: Declaration";
TextString = "-$(PreMethodTypeSpacing)(void)$(PreMethodDeclSpacing)observeValueForKeyPath$(PreColonSpacing):$(PostColonSpacing)(CPString *)$(MessageArgSpacing)keyPath ofObject$(PreColonSpacing):$(PostColonSpacing)(id)$(MessageArgSpacing)object change$(PreColonSpacing):$(PostColonSpacing)(CPDictionary *)$(MessageArgSpacing)change context$(PreColonSpacing):$(PostColonSpacing)(void *)$(MessageArgSpacing)context;\n";
CompletionPrefix = observeValueForKeyPath;
IncludeContexts = ( "xcode.lang.objj.interface" );
ExcludeContexts = ( "xcode.lang.objj.block" );
},
{
Identifier = objj.bind;
BasedOn = objj;
IsMenuItem = YES;
Name = "bind: Definition";
TextString =
"-$(PreMethodTypeSpacing)(void)$(PreMethodDeclSpacing)bind$(PreColonSpacing):$(PostColonSpacing)(CPString *)$(MessageArgSpacing)binding toObject$(PreColonSpacing):$(PostColonSpacing)(id)$(MessageArgSpacing)observable withKeyPath$(PreColonSpacing):$(PostColonSpacing)(CPString *)$(MessageArgSpacing)keyPath options$(PreColonSpacing):$(PostColonSpacing)(CPDictionary *)$(MessageArgSpacing)options$(FunctionBlockSeparator){
if$(PreExpressionsSpacing)($(InExpressionsSpacing)[$(InMessageSpacing)binding isEqualToString$(PreColonSpacing):$(PostColonSpacing)<#bindingName#>$(InMessageSpacing)]$(InExpressionsSpacing))$(BlockSeparator){
[$(InMessageSpacing)observable addObserver$(PreColonSpacing):$(PostColonSpacing)self forKeyPath$(PreColonSpacing):$(PostColonSpacing)keyPath options$(PreColonSpacing):$(PostColonSpacing)0 context$(PreColonSpacing):$(PostColonSpacing)<#context#>$(InMessageSpacing)];
<#store binding info#>
}$(PostBlockSeparator)\telse$(BlockSeparator){
[$(InMessageSpacing)super bind$(PreColonSpacing):$(PostColonSpacing)binding toObject$(PreColonSpacing):$(PostColonSpacing)observable withKeyPath$(PreColonSpacing):$(PostColonSpacing)keyPath options$(PreColonSpacing):$(PostColonSpacing)options$(InMessageSpacing)];
}
}
";
CompletionPrefix = bind;
IncludeContexts = ( "xcode.lang.objj.implementation" );
ExcludeContexts = ( "xcode.lang.objj.block" );
},
{
Identifier = objj.observe.bind;
BasedOn = objj;
IsMenuItem = YES;
Name = "bind: Declaration";
TextString = "-$(PreMethodTypeSpacing)(void)$(PreMethodDeclSpacing)bind$(PreColonSpacing):$(PostColonSpacing)(CPString *)$(MessageArgSpacing)binding toObject$(PreColonSpacing):$(PostColonSpacing)(id)$(MessageArgSpacing)observable withKeyPath$(PreColonSpacing):$(PostColonSpacing)(CPString *)$(MessageArgSpacing)keyPath options$(PreColonSpacing):$(PostColonSpacing)(CPDictionary *)$(MessageArgSpacing)options;\n";
CompletionPrefix = bind;
IncludeContexts = ( "xcode.lang.objj.interface" );
ExcludeContexts = ( "xcode.lang.objj.block" );
},
// MARK: classes and protocols
{
Identifier = objj.interface;
BasedOn = objj;
IsMenuItem = YES;
Name = "@interface Definition";
TextString = "@interface <#class#> : <#superclass#>$(FunctionBlockSeparator){\n\t<#ivars#>\n}\n\n<#methods#>\n\n@end\n";
CompletionPrefix = "@interface";
ExcludeContexts = ( "xcode.lang.objj.implementation", "xcode.lang.objj.interface", "xcode.lang.objj.protocol" );
},
{
Identifier = objj.implementation;
BasedOn = objj;
IsMenuItem = YES;
Name = "@implementation Definition";
TextString = "@implementation <#class#>\n\n<#methods#>\n\n@end\n";
CompletionPrefix = "@implementation";
ExcludeContexts = ( "xcode.lang.objj.implementation", "xcode.lang.objj.interface", "xcode.lang.objj.protocol" );
},
{
Identifier = objj.protocol;
BasedOn = objj;
IsMenuItem = YES;
Name = "@protocol Definition";
TextString = "@protocol <#protocol#>\n\n<#methods#>\n\n@end\n";
CompletionPrefix = "@protocol";
ExcludeContexts = ( "xcode.lang.objj.implementation", "xcode.lang.objj.interface", "xcode.lang.objj.protocol" );
},
// MARK: Common Class shorthands
{
Identifier = objj.cps;
BasedOn = objj;
IsMenuItem = NO;
Name = "CPString";
TextString = "CPString";
CompletionPrefix = cps;
},
{
Identifier = objj.cpa;
BasedOn = objj;
IsMenuItem = NO;
Name = "CPArray";
TextString = "CPArray";
CompletionPrefix = cpa;
},
{
Identifier = objj.cpma;
BasedOn = objj;
IsMenuItem = NO;
Name = "CPMutableArray";
TextString = "CPMutableArray";
CompletionPrefix = cpma;
},
{
Identifier = objj.cpd;
BasedOn = objj;
IsMenuItem = NO;
Name = "CPDictionary";
TextString = "CPDictionary";
CompletionPrefix = cpd;
},
)
+47
View File
@@ -0,0 +1,47 @@
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf430
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww15700\viewh12860\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\fs24 \cf0 The following files provide support for Objective-J syntax coloring and text completion in Xcode version 3 and above\
\
\fs26
\b ObjectiveJ.xcspec
\b0 \
\b ObjectiveJ.xclangspec
\b0 \
\b ObjectiveJ.xctxtmacro
\b0 \
\fs24 \
The above files were derived from the Apple Objective-C and JavaScript files located at\
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\i\fs26 \cf0 /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources
\i0\fs24 \
\i
\fs26 /Developer/Applications/Xcode.app/Contents/PlugIns/TextMacros.xctxtmacro/Contents/Resources\
\pard\tx580\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\i0 \cf0 (
\fs20 some files are Copyright \'a9 2004-2007 Apple Inc. and copyright text has been preserved
\fs26 )
\i\fs24 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\i0 \cf0 \
To install the files, double click on \
\
\b\fs26 install.command
\b0\fs24 \
\
This will create a "
\i\fs26 ~/Library/Application Support/Developer/Shared/Xcode/Specifications
\i0\fs24 " directory if it does not already exist and copy the ObjectiveJ.* files to that directory. You will need to restart Xcode for the changes to take effect.}
+5
View File
@@ -0,0 +1,5 @@
#~/bin/bash
echo Creating destination directory..
mkdir -pv ~/Library/Application\ Support/Developer/Shared/Xcode/Specifications
echo Copying files...
cp -v ${0%/*}/ObjectiveJ.* ~/Library/Application\ Support/Developer/Shared/Xcode/Specifications