diff --git a/Contents/Info.plist b/Contents/Info.plist index 46a5c4e..e9505b7 100644 --- a/Contents/Info.plist +++ b/Contents/Info.plist @@ -1,20 +1,20 @@ - - CFBundleIdentifier - SEEMode.CoffeeScript - CFBundleName - CoffeeScript + + CFBundleIdentifier + SEEMode.CoffeeScript + CFBundleName + CoffeeScript CFBundleShortVersionString - 0.1 - CFBundleVersion - 0.1 + 0.1 + CFBundleVersion + 0.1 CFBundleGetInfoString - 0.1, Copyright Sean Durham 2010 - CFBundlePackageType - BNDL - CFBundleInfoDictionaryVersion - 6.0 - + 0.1, Copyright Sean Durham 2010 (revised for Coda 2 by Bastiaan van de Weerd) + CFBundlePackageType + BNDL + CFBundleInfoDictionaryVersion + 6.0 + diff --git a/Contents/Resources/AutocompleteAdditions.txt b/Contents/Resources/AutocompleteAdditions.txt index b6acee0..e69de29 100644 --- a/Contents/Resources/AutocompleteAdditions.txt +++ b/Contents/Resources/AutocompleteAdditions.txt @@ -1,6 +0,0 @@ -these -strings -are added -to the -autocomplete -dictionary \ No newline at end of file diff --git a/Contents/Resources/RegexSymbols.xml b/Contents/Resources/RegexSymbols.xml index b62fe37..80e935b 100644 --- a/Contents/Resources/RegexSymbols.xml +++ b/Contents/Resources/RegexSymbols.xml @@ -1,22 +1,19 @@ - { } - + (?<=[\n\r]|^)[ \t]*class[ \t]+(?:[\w\d_\$]+\.)*([\w\d_\$]+)[ \t]*(?:\([^\)]*\))?[ \t]* - + - (?<=[\n\r]|^)[ \t]*(@*[\w\d_\$]+)[ \t]*[: =][ \t]*\(?[\w\d\s,]*\)?[ \t]+[-=]> + (?<=[\n\r]|^)[ \t]*(@*[\w\d_\$]+)[ \t]*[: =]\s*(?:\([^\n]*?\))?\s*[\-=]> - - + # !([^\n\r]+) - \ No newline at end of file diff --git a/Contents/Resources/SyntaxDefinition.xml b/Contents/Resources/SyntaxDefinition.xml index 206f2e7..c8df9f8 100644 --- a/Contents/Resources/SyntaxDefinition.xml +++ b/Contents/Resources/SyntaxDefinition.xml @@ -1,178 +1,187 @@ - - - CoffeeScript - - - - - - - - - - - - - - - - - if - unless - else - switch - when - then - - - for - while - until - do - - - new - this - - - break - continue - return - - - try - catch - throw - - - is - isnt - not - and - or - true - yes - on - false - no - of - off - in - - - - - - (?:[\(][\w\s\.\,\$]*[\)][\s])?[-=]> - [\s] - - - - - (?<=[^\w\d]|^)(((([0-9]+\.[0-9]*)|(\.[0-9]+))([eE][+\-]?[0-9]+)?[fFlL]?)|((([1-9][0-9]*)|0[0-7]*|(0[xX][0-9a-fA-F]+))(([uU][lL]?)|([lL][uU]?))?))(?=[^\w\d]|$) - - - - - (@\w*) - - - - (\w+(\s+)?:) - - - - (\b[A-Z]\w*) - - - - ### - ### - - - - - # - [\n\r] - - - - - " - (((?<!\\)(\\\\)*)|^)" - - - #{ - } - - - - - ' - (((?<!\\)(\\\\)*)|^)' - - - - - (?i)(?<=[=(,:\+~]|^|return|;)\s*/(?![/*+{}?]) - /[cgimosx]* - - - - - - + + CoffeeScript + + + + + + + + this + + + + true + yes + on + false + no + off + + null + undefined + + + arguments + process + console + window + document + $ + + + + if + unless + else + switch + when + then + + class + extends + + for + while + until + do + + break + continue + return + + try + catch + finally + throw + + new + + + + is + isnt + not + and + of + or + in + ([\+\-\*\/\=\!\?\<\>\%]) + + + + {(?={) + (?<=})} + + + { + } + + + + + ([\-=]>) + + + \((?=[^\n\)]*?\)\s*[\-=]>) + \)\s*[\-=]> + + + [\(,]\s*(\w+)\s*(?=[=,\)]) + + + + + = + \s(?=[,\)]) + + + + + + NaN + infinity + (?<=[^\w\d]|^)(((([0-9]+\.[0-9]*)|(\.[0-9]+))([eE][+\-]?[0-9]+)?[fFlL]?)|((([1-9][0-9]*)|0[0-7]*|(0[xX][0-9a-fA-F]+))(([uU][lL]?)|([lL][uU]?))?))(?=[^\w\d]|$) + + + + (@\w*) + (\w+(\s+)?:) + (?:\D|[a-zA-Z@\$]\d)\.(\w+) + + + + (\$\w*) + + + + (\b[A-Z]\w*) + + + + ### + ### + + + + # + [\n\r] + + + + " + (((?<!\\)(\\\\)*)|^)" + + + #(?={) + } + + + + (?<={)\s + \s(?=}) + + + + + + + ' + (((?<!\\)(\\\\)*)|^)' + + + + (?i)(?<=[=(,:\+~]|^|return|;)\s*/(?![/*+{}?]) + /[cgimosx]* + + + + `` + ` + + + + + + diff --git a/Contents/Resources/template.coffee b/Contents/Resources/template.coffee index 17b24c3..efe38a7 100644 --- a/Contents/Resources/template.coffee +++ b/Contents/Resources/template.coffee @@ -1,57 +1,69 @@ +### Comments ### - - - - -###------------------ - PASSING -------------------### - - -### COMMENTS ### - # A singe line comment should be colorized as a comment ### A multi-line comment should be colorized as a comment ### -answer = 4 + 5 # A comment trailing code should be colorized as a comment - - - +variable # A comment trailing code should be colorized as a comment + + +### OPERATORS ### + +a = 30 + 70 +s = 62 - 10 +m = 5 * 5 +d = 10 / NaN + ### STRINGS ### -double_quote_string = "This string is in double quotes" -single_quote_string = 'This string is in single quotes' -string_segment = 'interpolated in-line' -interpolated_string = "This string is #{ string_segment }" - - - +theFirstString = 'is in single quotes' +thenThisString = "is in double quotes + and can span multiple lines" +heredocStrings = """ + are + rather #{"awesome"}. + """ + +#-- Meh... +interpolatedStrings = "contain code-colored #{ Inter.pol() + "ation, #{"but currently only when whitespace-padded"}" }..." + ### FUNCTIONS ### -# A function with no arguments should be colorized as a function -$(document).ready -> - alert 'ready!' +withoutArguments = -> "in-line" +withoutArguments = => + "indented" +withArguments = (a, b) -> + (f > "indented") -# A function with arguments should be colorized as a function -square = (x) -> x * x +#-- Meh... (again with the whitespace-padding (end only))----v +defaultArg = (u, ments, are='nice' in ['colors'] or not true? , man) -> + "...but the function definition's RPAREN (before the arrow) isn't, and + it fails with more complex things, which is a #{not are} shame" -# A function binding with no arguments should be colorized as a function -$('.element').bind 'click', (event) => - @customer.purchase @cart +#-- Fail +the = (second) -> (inline > "function is mean") and ((captures)=>"the first LPAREN too greedily")() + +#-- Fail with foldable block +foo 'bar', -> + "baz" -# A function binding with arguments should be colorized as a function -bound_function = => - # bound function code - - -### Embedded javascript ### +### VARIABLES ### + +Class.attribute = + property: yes + property: yes + +### REGULAR EXPRESSION ### +r = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/g + + +### EMBEDDED JAVASCRIPT ### apple = `function(){ - Apple = function (){ + apple = function(){ this.family = "Granny Smith"; this.peel = function(){ // Peel this apple. @@ -62,30 +74,8 @@ apple = `function(){ return Apple.new(); }` - -# Regular Expression -r = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/g - -# Operators -a = 30 + 70 -s = 62 - 10 -m = 5 * 5 -d = 10/2 #division symbol should be interepereted as a regular expression - - - -###------------------ - FAILING -------------------### - - - - - -###------------------ - PENDING -------------------### +#-- This was left from Sean Durham's work # Assignment: number = 42 @@ -111,5 +101,5 @@ race = (winner, runners...) -> alert "I knew it!" if elvis? # Array comprehensions: -cubes = (math.cube num for num in list) +cubes = (Math.cube num for num in list) diff --git a/README.md b/README.md index 6d55cff..bef118c 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,16 @@ Read me ======= - -This is a Coda/SubEthaEdit syntax coloring mode for the CoffeeScript language. - -Special thanks to brajeshwar's Sass.Mode and jashkenas' TextMate bundle-- -I used them for reference while developing this mode. - - + +This is fork of Sean Durham's Coda/SubEthaEdit syntax coloring mode for the +CoffeeScript language, revisited for use with Coda 2. + +Special thanks to brajeshwar's Sass.Mode and jashkenas' TextMate bundle--Sean +apparently used them for reference while developing this mode. + Installation ============ - Download and unpack either the ZIP or TAR version of the CoffeeScript mode. - Rename the unzipped directory to 'CoffeeScript.mode'. - Coda: - Manually copy the CoffeeScript.mode directory into ~/Library/Application\ Support/Coda/Modes/. -- SubEthaEdit: - Open the CoffeeScript.mode file from within SubEthaEdit using the File > Open command - or by dragging the CoffeeScript.mode file onto the SubEthaEdit application icon in the dock. - -Extras ------------- -Chendrix made an alternate [light-on-dark color scheme](https://github.com/chendrix/Specials-Board) for those who prefer the dark side. - + Manually copy the CoffeeScript.mode directory into ~/Library/Application\ Support/Coda 2/Modes/. \ No newline at end of file