Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Recognize 0.9.0 assignment syntax

  • Loading branch information...
commit 5c5a414d5e4e5b031fea2aea8376ed9a0871e652 1 parent 227a360
@sstephenson sstephenson authored
Showing with 27 additions and 28 deletions.
  1. +1 −1  coffee-mode.el
  2. +17 −17 examples/basic.coffee
  3. +9 −10 examples/imenu.coffee
View
2  coffee-mode.el
@@ -235,7 +235,7 @@ path."
(defvar coffee-prototype-regexp "\\(\\(\\w\\|\\.\\|_\\| \\|$\\)+?\\)::\\(\\(\\w\\|\\.\\|_\\| \\|$\\)+?\\):")
;; Assignment
-(defvar coffee-assign-regexp "\\(\\(\\w\\|\\.\\|_\\| \\|$\\)+?\\):")
+(defvar coffee-assign-regexp "\\(\\(\\w\\|\\.\\|_\\| \\|$\\)+?\\)[:=]")
;; Lambda
(defvar coffee-lambda-regexp "\\((.+)\\)?\\s *\\(->\\|=>\\)")
View
34 examples/basic.coffee
@@ -1,32 +1,32 @@
# These examples are taken from
# http://jashkenas.github.com/coffee-script/
-song: ["do", "re", "mi", "fa", "so"]
+song = ["do", "re", "mi", "fa", "so"]
-ages: {
+ages = {
max: 10
ida: 9
tim: 11
}
-matrix: [
+matrix = [
1, 0, 1
0, 0, 1
1, 1, 0
]
-eldest: if 24 > 21 then "Liz" else "Ike"
+eldest = if 24 > 21 then "Liz" else "Ike"
-six: (one: 1) + (two: 2) + (three: 3)
+six = (one = 1) + (two = 2) + (three = 3)
-My.mood: greatly_improved if true
+My.mood = greatly_improved if true
# Unfancy JavaScript
if happy and knows_it
cha_cha_cha()
false
-Account: (customer, cart) ->
+Account = (customer, cart) ->
@customer: customer
@cart: cart
@@ -56,8 +56,8 @@ class Horse extends Animal
alert "Galloping..."
super 45
-sam: new Snake "Sammy the Python"
-tom: new Horse "Tommy the Palomino"
+sam = new Snake "Sammy the Python"
+tom = new Horse "Tommy the Palomino"
sam.move()
tom.move()
@@ -65,14 +65,14 @@ if car.speed < speed_limit then accelerate()
print "My name is " + @name
-gold: silver: the_field: "unknown"
+gold = silver = the_field = "unknown"
-award_medals: (first, second, rest...) ->
+award_medals = (first, second, rest...) ->
gold: first
silver: second
the_field: rest
-contenders: [
+contenders = [
"Michael Phelps"
"Liu Xiang"
]
@@ -86,14 +86,14 @@ alert "The Field: " + the_field
# Eat lunch.
# what up
# love it.
-lunch: eat food for food in ['toast', 'cheese', 'wine']
+lunch = eat food for food in ['toast', 'cheese', 'wine']
$('#demo').click ->
asd
# sup
# asd
# asdasd
-blah: true
+blah = true
okay
@@ -103,12 +103,12 @@ for roid in asteroids
for roid2 in asteroids when roid isnt roid2
roid.explode() if roid.overlaps roid2
-years_old: {max: 10, ida: 9, tim: 11}
+years_old = max: 10, ida: 9, tim: 11
-ages: for child, age of years_old
+ages = for child, age of years_old
child + " is " + age
-grade: (student) ->
+grade = (student) ->
if student.excellent_work
"A+"
else if student.okay_stuff
View
19 examples/imenu.coffee
@@ -1,29 +1,28 @@
# Testing imenu
-regexp: /asdas/
-two: 4 / 2
+regexp = /asdas/
+two = 4 / 2
-minus: (x, y) -> x - y
+minus = (x, y) -> x - y
-String::length: -> 10
+String::length = -> 10
class Person
print: ->
print 'My name is ' + this.name + '.'
-app = {
+app =
window: {width: 200, height: 200}
para: 'Welcome.'
button: 'OK'
-}
-block: ->
+block = ->
print('potion')
-Please: {}
-Please.print: (word) ->
+Please = {}
+Please.print = (word) ->
print(word)
-HomePage::get: (url) ->
+HomePage::get = (url) ->
session: url.query.session if url.query?
class Policeman extends Person
Please sign in to comment.
Something went wrong with that request. Please try again.