From 505c19580e0f43fe5224431459cacb7c21edd93d Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Fri, 6 Apr 2012 15:14:11 +0200 Subject: Imported Upstream version 1 --- misc/xcode/3/README | 3 + misc/xcode/3/go.pbfilespec | 31 +++++ misc/xcode/3/go.xclangspec | 293 +++++++++++++++++++++++++++++++++++++++++++++ misc/xcode/4/README | 2 + misc/xcode/4/go.xclangspec | 290 ++++++++++++++++++++++++++++++++++++++++++++ misc/xcode/4/go4xcode.sh | 100 ++++++++++++++++ misc/xcode/go.pbfilespec | 31 ----- misc/xcode/go.xclangspec | 293 --------------------------------------------- 8 files changed, 719 insertions(+), 324 deletions(-) create mode 100644 misc/xcode/3/README create mode 100644 misc/xcode/3/go.pbfilespec create mode 100644 misc/xcode/3/go.xclangspec create mode 100644 misc/xcode/4/README create mode 100644 misc/xcode/4/go.xclangspec create mode 100755 misc/xcode/4/go4xcode.sh delete mode 100644 misc/xcode/go.pbfilespec delete mode 100644 misc/xcode/go.xclangspec (limited to 'misc/xcode') diff --git a/misc/xcode/3/README b/misc/xcode/3/README new file mode 100644 index 000000000..69f371c2c --- /dev/null +++ b/misc/xcode/3/README @@ -0,0 +1,3 @@ +This directory contains files for Go syntax highlighting in Xcode 3.x. +See the comments in go.pbfilespec and go.xclangspec for installation +instructions. diff --git a/misc/xcode/3/go.pbfilespec b/misc/xcode/3/go.pbfilespec new file mode 100644 index 000000000..1034778f5 --- /dev/null +++ b/misc/xcode/3/go.pbfilespec @@ -0,0 +1,31 @@ +/* + 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.pbfilespec + Go source file spec for Xcode 3 + + There is not much documentation available regarding the format + of .pbfilespec 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/ +*/ + +( + { + Identifier = sourcecode.go; + BasedOn = sourcecode; + Name = "Go Files"; + Extensions = ("go"); + MIMETypes = ("text/go"); + Language = "xcode.lang.go"; + IsTextFile = YES; + IsSourceFile = YES; + } +) diff --git a/misc/xcode/3/go.xclangspec b/misc/xcode/3/go.xclangspec new file mode 100644 index 000000000..4a8c94d5b --- /dev/null +++ b/misc/xcode/3/go.xclangspec @@ -0,0 +1,293 @@ +/* + 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"; + }; + }, + + { + Identifier = "xcode.lang.go.rawstring"; + Syntax = { + Start = "`"; + End = "`"; + Type = "xcode.syntax.string"; + }; + }, + +// ---------------------------------------------------------------------------- +// 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.rawstring", + "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.rawstring", + "xcode.lang.go.type.declaration", + "xcode.lang.go.method.declaration", + "xcode.lang.go.function.declaration", + "xcode.lang.go.identifier", + "xcode.lang.number", + ); + }; + }, + + { + Identifier = "xcode.lang.go.method.declaration"; + Syntax = { + Tokenizer = "xcode.lang.go.lexer"; + Rules = ( + "func", + "xcode.lang.go.parenexpr", + "xcode.lang.go.identifier", + "xcode.lang.go.parenexpr", + ); + Type = "xcode.syntax.declaration.method"; + }; + }, + + { + Identifier = "xcode.lang.go.type.declaration"; + Syntax = { + Tokenizer = "xcode.lang.go.lexer"; + Rules = ( + "type", + "xcode.lang.go.identifier", + ); + Type = "xcode.syntax.typedef"; + }; + }, + + { + Identifier = "xcode.lang.go.function.declaration"; + Syntax = { + Tokenizer = "xcode.lang.go.lexer"; + Rules = ( + "func", + "xcode.lang.go.identifier", + "xcode.lang.go.parenexpr", + ); + Type = "xcode.syntax.declaration.function"; + }; + }, + +// ---------------------------------------------------------------------------- +// 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", + "xcode.lang.go.block", + ); + }; + }, + + { + 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"; + }; + }, + + // This rule recognizes special comments markers and adds them + // to the list of file markers at the top of the editor window. + // This overrides the markers specified in + // /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/BaseSupport.xclangspec + // and appears to apply them to all languages. Thus, for now + // "inherit" the existing markers here for backward-compatibility. + { + Identifier = "xcode.lang.comment.mark"; + Syntax = { + StartChars = "BMTF!?"; + Match = ( + // Go-specific markers + "^\(BUG.*$\)$", // include "BUG" in the markers list + "^\(TODO.*$\)$", // include "TODO" in the markers list + // inherited markers + "^MARK:[ \t]+\(.*\)$", + "^\(TODO:[ \t]+.*\)$", // include "TODO: " in the markers list + "^\(FIXME:[ \t]+.*\)$", // include "FIXME: " in the markers list + "^\(!!!:.*\)$", // include "!!!:" in the markers list + "^\(\\?\\?\\?:.*\)$" // include "???:" in the markers list + ); + // This is the order of captures. All of the match strings above need the same order. + CaptureTypes = ( + "xcode.syntax.mark" + ); + Type = "xcode.syntax.comment"; + }; + }, + +) diff --git a/misc/xcode/4/README b/misc/xcode/4/README new file mode 100644 index 000000000..09576d6d5 --- /dev/null +++ b/misc/xcode/4/README @@ -0,0 +1,2 @@ +This directory contains files for Go syntax highlighting in Xcode 4.x. +For installation, read, edit, and run go4xcode.sh . \ No newline at end of file diff --git a/misc/xcode/4/go.xclangspec b/misc/xcode/4/go.xclangspec new file mode 100644 index 000000000..96edc8000 --- /dev/null +++ b/misc/xcode/4/go.xclangspec @@ -0,0 +1,290 @@ +/* + Copyright 2012 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 4.x. + + This is a preliminary version that supports basic syntax coloring + (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 + +*/ + +( + +// ---------------------------------------------------------------------------- +// 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"; + }; + }, + + { + Identifier = "xcode.lang.go.rawstring"; + Syntax = { + Start = "`"; + End = "`"; + Type = "xcode.syntax.string"; + }; + }, + +// ---------------------------------------------------------------------------- +// 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.rawstring", + "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.rawstring", + "xcode.lang.go.type.declaration", + "xcode.lang.go.method.declaration", + "xcode.lang.go.function.declaration", + "xcode.lang.go.identifier", + "xcode.lang.number", + ); + }; + }, + + { + Identifier = "xcode.lang.go.method.declaration"; + Syntax = { + Tokenizer = "xcode.lang.go.lexer"; + Rules = ( + "func", + "xcode.lang.go.parenexpr", + "xcode.lang.go.identifier", + "xcode.lang.go.parenexpr", + ); + Type = "xcode.syntax.declaration.method"; + }; + }, + + { + Identifier = "xcode.lang.go.type.declaration"; + Syntax = { + Tokenizer = "xcode.lang.go.lexer"; + Rules = ( + "type", + "xcode.lang.go.identifier", + ); + Type = "xcode.syntax.typedef"; + }; + }, + + { + Identifier = "xcode.lang.go.function.declaration"; + Syntax = { + Tokenizer = "xcode.lang.go.lexer"; + Rules = ( + "func", + "xcode.lang.go.identifier", + "xcode.lang.go.parenexpr", + ); + Type = "xcode.syntax.declaration.function"; + }; + }, + +// ---------------------------------------------------------------------------- +// 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", + "xcode.lang.go.block", + ); + }; + }, + + { + 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"; + }; + }, + + // This rule recognizes special comments markers and adds them + // to the list of file markers at the top of the editor window. + // This overrides the markers specified in + // /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/BaseSupport.xclangspec + // and appears to apply them to all languages. Thus, for now + // "inherit" the existing markers here for backward-compatibility. + { + Identifier = "xcode.lang.comment.mark"; + Syntax = { + StartChars = "BMTF!?"; + Match = ( + // Go-specific markers + "^\(BUG.*$\)$", // include "BUG" in the markers list + "^\(TODO.*$\)$", // include "TODO" in the markers list + // inherited markers + "^MARK:[ \t]+\(.*\)$", + "^\(TODO:[ \t]+.*\)$", // include "TODO: " in the markers list + "^\(FIXME:[ \t]+.*\)$", // include "FIXME: " in the markers list + "^\(!!!:.*\)$", // include "!!!:" in the markers list + "^\(\\?\\?\\?:.*\)$" // include "???:" in the markers list + ); + // This is the order of captures. All of the match strings above need the same order. + CaptureTypes = ( + "xcode.syntax.mark" + ); + Type = "xcode.syntax.comment"; + }; + }, + +) diff --git a/misc/xcode/4/go4xcode.sh b/misc/xcode/4/go4xcode.sh new file mode 100755 index 000000000..fbdd0cfed --- /dev/null +++ b/misc/xcode/4/go4xcode.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +# Copyright 2012 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. + +# Illustrates how a Go language specification can be installed for Xcode 4.x., +# to enable syntax coloring, by adding an entry to a plugindata file. +# +# FIXME: Write a decent Xcode plugin to handle the file type association and +# language specification properly instead of altering Xcode library files. + +set -e + +# Assumes Xcode 4+. +XCODE_MAJOR_VERSION=`xcodebuild -version | awk 'NR == 1 {print substr($2,1,1)}'` +if [ "$XCODE_MAJOR_VERSION" -lt "4" ]; then + echo "Xcode 4.x not found." + exit 1 +fi + +# DVTFOUNDATION_DIR may vary depending on Xcode setup. Change it to reflect +# your current Xcode setup. Find suitable path with e.g.: +# +# find / -type f -name 'DVTFoundation.xcplugindata' 2> /dev/null +# +# Example of DVTFOUNDATION_DIR's from "default" Xcode 4.x setups; +# +# Xcode 4.1: /Developer/Library/PrivateFrameworks/DVTFoundation.framework/Versions/A/Resources/ +# Xcode 4.3: /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/ +# +DVTFOUNDATION_DIR="/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/" +PLUGINDATA_FILE="DVTFoundation.xcplugindata" + +PLISTBUDDY=/usr/libexec/PlistBuddy +PLIST_FILE=tmp.plist + +# Provide means of deleting the Go entry from the plugindata file. +if [ "$1" = "--delete-entry" ]; then + echo "Removing Go language specification entry." + $PLISTBUDDY -c "Delete :plug-in:extensions:Xcode.SourceCodeLanguage.Go" $DVTFOUNDATION_DIR/$PLUGINDATA_FILE + echo "Run 'sudo rm -rf /var/folders/*' and restart Xcode to update change immediately." + exit 0 +fi + +GO_VERSION="`go version`" + +GO_LANG_ENTRY=" + + + + + Xcode.SourceCodeLanguage.Go + + conformsTo + + + identifier + Xcode.SourceCodeLanguage.Generic + + + documentationAbbreviation + go + fileDataType + + + identifier + com.apple.xcode.go-source + + + id + Xcode.SourceCodeLanguage.Go + languageName + Go + languageSpecification + xcode.lang.go + name + The Go Programming Language + point + Xcode.SourceCodeLanguage + version + $GO_VERSION + + + +" + +echo "Backing up plugindata file." +cp $DVTFOUNDATION_DIR/$PLUGINDATA_FILE $DVTFOUNDATION_DIR/$PLUGINDATA_FILE.bak + +echo "Adding Go language specification entry." +echo $GO_LANG_ENTRY > $PLIST_FILE +$PLISTBUDDY -c "Merge $PLIST_FILE plug-in:extensions" $DVTFOUNDATION_DIR/$PLUGINDATA_FILE + +rm -f $PLIST_FILE + +echo "Installing Go language specification file for Xcode." +cp $GOROOT/misc/xcode/4/go.xclangspec $DVTFOUNDATION_DIR + +echo "Run 'sudo rm -rf /var/folders/*' and restart Xcode to update change immediately." +echo "Syntax coloring must be manually selected from the Editor - Syntax Coloring menu in Xcode." diff --git a/misc/xcode/go.pbfilespec b/misc/xcode/go.pbfilespec deleted file mode 100644 index 1034778f5..000000000 --- a/misc/xcode/go.pbfilespec +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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.pbfilespec - Go source file spec for Xcode 3 - - There is not much documentation available regarding the format - of .pbfilespec 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/ -*/ - -( - { - Identifier = sourcecode.go; - BasedOn = sourcecode; - Name = "Go Files"; - Extensions = ("go"); - MIMETypes = ("text/go"); - Language = "xcode.lang.go"; - IsTextFile = YES; - IsSourceFile = YES; - } -) diff --git a/misc/xcode/go.xclangspec b/misc/xcode/go.xclangspec deleted file mode 100644 index e515564da..000000000 --- a/misc/xcode/go.xclangspec +++ /dev/null @@ -1,293 +0,0 @@ -/* - 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"; - }; - }, - - { - Identifier = "xcode.lang.go.rawstring"; - Syntax = { - Start = "`"; - End = "`"; - Type = "xcode.syntax.string"; - }; - }, - -// ---------------------------------------------------------------------------- -// 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.rawstring", - "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.rawstring", - "xcode.lang.go.type.declaration", - "xcode.lang.go.method.declaration", - "xcode.lang.go.function.declaration", - "xcode.lang.go.identifier", - "xcode.lang.number", - ); - }; - }, - - { - Identifier = "xcode.lang.go.method.declaration"; - Syntax = { - Tokenizer = "xcode.lang.go.lexer"; - Rules = ( - "func", - "xcode.lang.go.parenexpr", - "xcode.lang.go.identifier", - "xcode.lang.go.parenexpr", - ); - Type = "xcode.syntax.declaration.method"; - }; - }, - - { - Identifier = "xcode.lang.go.type.declaration"; - Syntax = { - Tokenizer = "xcode.lang.go.lexer"; - Rules = ( - "type", - "xcode.lang.go.identifier", - ); - Type = "xcode.syntax.typedef"; - }; - }, - - { - Identifier = "xcode.lang.go.function.declaration"; - Syntax = { - Tokenizer = "xcode.lang.go.lexer"; - Rules = ( - "func", - "xcode.lang.go.identifier", - "xcode.lang.go.parenexpr", - ); - Type = "xcode.syntax.declaration.function"; - }; - }, - -// ---------------------------------------------------------------------------- -// 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", - "xcode.lang.go.block", - ); - }; - }, - - { - 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"; - }; - }, - - // This rule recognizes special comments markers and adds them - // to the list of file markers at the top of the editor window. - // This overrides the markers specified in - // /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/BaseSupport.xclangspec - // and appears to apply them to all languages. Thus, for now - // "inherit" the existing markers here for backward-compatibility. - { - Identifier = "xcode.lang.comment.mark"; - Syntax = { - StartChars = "BMTF!?"; - Match = ( - // Go-specific markers - "^\(BUG.*$\)$", // inlude "BUG" in the markers list - "^\(TODO.*$\)$", // inlude "TODO" in the markers list - // inherited markers - "^MARK:[ \t]+\(.*\)$", - "^\(TODO:[ \t]+.*\)$", // include "TODO: " in the markers list - "^\(FIXME:[ \t]+.*\)$", // include "FIXME: " in the markers list - "^\(!!!:.*\)$", // include "!!!:" in the markers list - "^\(\\?\\?\\?:.*\)$" // include "???:" in the markers list - ); - // This is the order of captures. All of the match strings above need the same order. - CaptureTypes = ( - "xcode.syntax.mark" - ); - Type = "xcode.syntax.comment"; - }; - }, - -) -- cgit v1.2.3