mirror of
https://github.com/golang/go
synced 2024-11-12 05:50:21 -07:00
e6cddeaee8
R=r DELTA=250 (250 added, 0 deleted, 0 changed) OCL=29120 CL=29127
224 lines
4.4 KiB
Plaintext
224 lines
4.4 KiB
Plaintext
/*
|
|
Copyright 2009 The Go Authors. All rights reserved.
|
|
Use of this source code is governed by a BSD-style
|
|
license that can be found in the LICENSE file.
|
|
|
|
Go.xclangspec
|
|
Go language specification for Xcode 3
|
|
|
|
This is a preliminary version that supports basic syntax high-lighting
|
|
(such as keywords, literals, and comments) and an attempt to provide
|
|
some structure information (incomplete).
|
|
|
|
There is not much documentation available regarding the format
|
|
of .xclangspec files. As a starting point, see for instance the
|
|
outdated documentation at:
|
|
http://maxao.free.fr/xcode-plugin-interface/specifications.html
|
|
and the files in:
|
|
/Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/
|
|
|
|
Place this file in directory:
|
|
~/Library/Application Support/Developer/Shared/Xcode/Specifications/
|
|
*/
|
|
|
|
(
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// Keywords
|
|
|
|
// TODO How do we get general Unicode identifiers?
|
|
|
|
{
|
|
Identifier = "xcode.lang.go.identifier";
|
|
Syntax = {
|
|
StartChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
|
|
Chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
|
|
Words = (
|
|
"break",
|
|
"case",
|
|
"chan",
|
|
"const",
|
|
"continue",
|
|
|
|
"default",
|
|
"defer",
|
|
"else",
|
|
"fallthrough",
|
|
"for",
|
|
|
|
"func",
|
|
"go",
|
|
"goto",
|
|
"if",
|
|
"import",
|
|
|
|
"interface",
|
|
"map",
|
|
"package",
|
|
"range",
|
|
"return",
|
|
|
|
"select",
|
|
"struct",
|
|
"switch",
|
|
"type",
|
|
"var",
|
|
);
|
|
Type = "xcode.syntax.keyword";
|
|
AltType = "xcode.syntax.identifier"; // non-keywords are identifiers
|
|
};
|
|
},
|
|
|
|
// TODO decide what should go here, if anything
|
|
{
|
|
Identifier = "xcode.lang.go.interestingOperators";
|
|
Syntax = {
|
|
Words = (
|
|
"...",
|
|
".",
|
|
":",
|
|
);
|
|
Type = "xcode.syntax.plain";
|
|
};
|
|
},
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// Syntax Coloring
|
|
|
|
{
|
|
Identifier = "xcode.lang.go";
|
|
Description = "Go Coloring";
|
|
BasedOn = "xcode.lang.simpleColoring";
|
|
IncludeInMenu = YES;
|
|
Name = "Go";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.go.lexer.toplevel";
|
|
IncludeRules = (
|
|
"xcode.lang.go.block",
|
|
"xcode.lang.go.bracketexpr",
|
|
"xcode.lang.go.parenexpr",
|
|
);
|
|
Type = "xcode.syntax.plain";
|
|
};
|
|
},
|
|
|
|
// The following rule returns tokens to the other rules
|
|
{
|
|
Identifier = "xcode.lang.go.lexer";
|
|
Syntax = {
|
|
IncludeRules = (
|
|
"xcode.lang.go.comment",
|
|
"xcode.lang.go.comment.singleline",
|
|
"xcode.lang.string",
|
|
"xcode.lang.character",
|
|
"xcode.lang.go.identifier",
|
|
"xcode.lang.number",
|
|
"xcode.lang.go.interestingOperators",
|
|
);
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.go.lexer.toplevel";
|
|
Syntax = {
|
|
IncludeRules = (
|
|
"xcode.lang.go.comment",
|
|
"xcode.lang.go.comment.singleline",
|
|
"xcode.lang.string",
|
|
"xcode.lang.character",
|
|
"xcode.lang.go.type.declaration",
|
|
"xcode.lang.go.identifier",
|
|
"xcode.lang.number",
|
|
);
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.go.type.declaration";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.go.lexer";
|
|
Rules = (
|
|
"type",
|
|
"xcode.lang.go.identifier",
|
|
);
|
|
Type = "xcode.syntax.name.partial";
|
|
};
|
|
},
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// Blocks
|
|
|
|
{
|
|
Identifier = "xcode.lang.go.block";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.go.lexer";
|
|
Start = "{";
|
|
End = "}";
|
|
Foldable = YES;
|
|
Recursive = YES;
|
|
IncludeRules = (
|
|
"xcode.lang.go.bracketexpr",
|
|
"xcode.lang.go.parenexpr",
|
|
);
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.go.parenexpr";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.go.lexer";
|
|
Start = "(";
|
|
End = ")";
|
|
Recursive = YES;
|
|
IncludeRules = (
|
|
"xcode.lang.go.bracketexpr",
|
|
);
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.go.bracketexpr";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.go.lexer";
|
|
Start = "[";
|
|
End = "]";
|
|
Recursive = YES;
|
|
IncludeRules = (
|
|
"xcode.lang.go.parenexpr",
|
|
);
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.go.comment";
|
|
Syntax = {
|
|
Start = "/*";
|
|
End = "*/";
|
|
Foldable = YES;
|
|
IncludeRules = (
|
|
"xcode.lang.url",
|
|
"xcode.lang.url.mail",
|
|
"xcode.lang.comment.mark",
|
|
);
|
|
Type = "xcode.syntax.comment";
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.go.comment.singleline";
|
|
Syntax = {
|
|
Start = "//";
|
|
End = "\n";
|
|
IncludeRules = (
|
|
"xcode.lang.url",
|
|
"xcode.lang.url.mail",
|
|
"xcode.lang.comment.mark",
|
|
);
|
|
Type = "xcode.syntax.comment";
|
|
};
|
|
},
|
|
|
|
)
|