trying out new arrows for function literals -> is a function, => is a bound function

This commit is contained in:
Jeremy Ashkenas
2010-01-26 10:52:05 -05:00
parent 55df898112
commit a9f016e292
54 changed files with 259 additions and 259 deletions

View File

@@ -3,7 +3,7 @@
# '.', '^', '$', and '*'.
# Search for the regexp anywhere in the text.
match: (regexp, text) =>
match: (regexp, text) ->
return match_here(regexp.slice(1), text) if regexp[0] is '^'
while text
return true if match_here(regexp, text)
@@ -11,7 +11,7 @@ match: (regexp, text) =>
false
# Search for the regexp at the beginning of the text.
match_here: (regexp, text) =>
match_here: (regexp, text) ->
[cur, next]: [regexp[0], regexp[1]]
if regexp.length is 0 then return true
if next is '*' then return match_star(cur, regexp.slice(2), text)
@@ -20,7 +20,7 @@ match_here: (regexp, text) =>
false
# Search for a kleene star match at the beginning of the text.
match_star: (c, regexp, text) =>
match_star: (c, regexp, text) ->
while true
return true if match_here(regexp, text)
return false unless text and (text[0] is c or c is '.')