Skip to content
This repository has been archived by the owner on Jul 3, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
vendethiel committed Nov 10, 2013
2 parents f7fa288 + ec482e6 commit 38b1e13
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 26 deletions.
40 changes: 24 additions & 16 deletions Syntaxes/CoffeeScript.tmLanguage
Expand Up @@ -49,7 +49,7 @@
<key>comment</key>
<string>match stuff like: a -&gt;</string>
<key>match</key>
<string>(\s*\!?\(\s*[^()]*?\))\s*([~-]{1,2}&gt;)|\s*\!?(\(?[^()]*?\)?)\s*(&lt;[~-]{1,2}!?)</string>
<string>(\s*\!?\(\s*[^()]*?\))\s*(!?[~-]{1,2}&gt;)|\s*\!?(\(?[^()]*?\)?)\s*(&lt;[~-]{1,2}!?)</string>
<key>name</key>
<string>meta.inline.function.livescript</string>
</dict>
Expand Down Expand Up @@ -513,7 +513,7 @@
</dict>
<dict>
<key>match</key>
<string>((?&lt;=console\.)(debug|warn|info|log|error|time|timeEnd|assert))\b</string>
<string>((?&lt;=console\.)(debug|warn|info|log|error|time(End|-end)|assert))\b</string>
<key>name</key>
<string>support.function.console.livescript</string>
</dict>
Expand All @@ -538,14 +538,18 @@
<key>match</key>
<string>(?x)(?&lt;![.-])\b(
map|filter|reject|partition|find|each|head|tail|last|initial|empty|
values|keys|length|cons|append|join|reverse|fold|fold1|foldr|foldr1|
andList|orList|any|all|unique|sum|product|mean|concat|concatMap|
maximum|minimum|scan|scan1|scar|scanr1|replicate|take|drop|splitAt|
takeWhile|dropWhile|span|breakIt|listToObj|objToFunc|
zip|zipWith|zipAll|zipAllWith|compose|curry|partial|flip|fix|
values|keys|length|cons|append|join|reverse|fold(l|r)?1?|unfoldr|
and(List|-list)|or(List|-list)|any|all|unique|sum|product|mean|compact|
concat(Map|-map)?|maximum|minimum|scan(l|r)?1?|replicate|slice|apply|
split(At|-at)?|take(While|-while)?|drop(While|-while)?|span|first|
break(It|-it)|list(ToObj|-to-obj)|obj(ToFunc|-to-func)|
pairs(ToObj|-to-obj)|obj(ToPairs|-to-pairs|ToLists|-to-lists)|
zip(All|-all)?(With|-with)?|compose|curry|partial|flip|fix|
sort(With|-with|By|-by)?|group(By|-by)|break(List|-list|Str|-str)|
difference|intersection|union|average|flatten|chars|unchars|repeat|
lines|unlines|words|unwords|max|min|negate|abs|signum|quot|rem|div|mod|
recip|pi|tau|exp|sqrt|ln|pow|sin|cos|tan|asin|acos|atan|atan2|truncate|
round|ceiling|floor|isItNaN|even|odd|gcd|lcm|disabled__id
round|ceiling|floor|is(It|-it)NaN|even|odd|gcd|lcm|disabled__id
)\b(?![.-])</string>
<key>name</key>
<string>support.function.prelude.livescript</string>
Expand All @@ -559,10 +563,12 @@
<dict>
<key>match</key>
<string>(?x)((?&lt;=(\.|\]|\)))(
apply|call|concat|every|filter|forEach|from|hasOwnProperty|indexOf|
isPrototypeOf|join|lastIndexOf|map|of|pop|propertyIsEnumerable|push|
reduce(Right)?|reverse|shift|slice|some|sort|splice|to(Locale)?String|
unshift|valueOf
apply|call|concat|every|filter|for(Each|-each)|
from|has(Own|-own)(Property|-property)|index(Of|-of)|
is(Prototype|-prototype)(Of|-of)|join|last(Index|-index)(Of|-of)|
map|of|pop|property(Is|-is)(Enumerable|-enumerable)|push|
reduce(Right|-right)?|reverse|shift|slice|some|sort|
splice|to(Locale|-locale)?(String|-string)|unshift|valueOf
))\b(?!-) </string>
<key>name</key>
<string>support.function.method.array.livescript</string>
Expand All @@ -578,9 +584,11 @@
<dict>
<key>match</key>
<string>(?x)((?&lt;=Object\.)(
create|definePropert(ies|y)|freeze|getOwnProperty(Descriptors?|Names)|
getProperty(Descriptor|Names)|getPrototypeOf|is(Extensible|Frozen|Sealed)?|
keys|preventExtensions|seal
create|define(Propert|-propert)(ies|y)|freeze|
get(Own|-own)(Property|-property)(Descriptors?|Names)|
get(Property|-property)(Descriptor|Names)|getPrototypeOf|
is((Extensible|-extensible)|(Frozen|-frozen)|(Sealed|-sealed))?|
keys|prevent(Extensions|-extensions)|seal
))\b</string>
<key>name</key>
<string>support.function.static.object.livescript</string>
Expand All @@ -598,7 +606,7 @@
<dict>
<key>match</key>
<string>(?x)((?&lt;=Number\.)(
is(Finite|Integer|NaN)|toInteger
is(Finite|Integer|NaN)|to(Integer|-integer)
))\b</string>
<key>name</key>
<string>support.function.static.number.livescript</string>
Expand Down
19 changes: 9 additions & 10 deletions live_script.py
Expand Up @@ -15,10 +15,10 @@ def run(self, edit):
text = text.encode('utf8')
window = self.view.window()
js, error = self._compile(text)
self._write_to_window(window, js, error)
self._write_to_window(window, edit, js, error)

def _args(self):
return self.LIVESCRIPT, '--stdin', '--compile'
return self.LIVESCRIPT, '--stdin', '--compile', '--bare'

def _compile(self, text):
path = self._path()
Expand Down Expand Up @@ -54,21 +54,20 @@ def _text_to_compile(self):

return self.view.substr(region)

def _write_to_panel(self, panel, text):
def _write_to_panel(self, panel, edit, text):
panel.set_read_only(False)
edit = panel.begin_edit()
panel.insert(edit, 0, text)
panel.end_edit(edit)
panel.sel().clear()
panel.set_read_only(True)

def _write_to_window(self, window, js, error):
def _write_to_window(self, window, edit, js, error):
panel = window.get_output_panel(self.WINDOW_NAME)
panel.set_syntax_file('Packages/JavaScript/JavaScript.tmLanguage')

text = js or str(error)
text.decode('utf8')
self._write_to_panel(panel, text)
text = js or error
text = text.decode('utf8')

self._write_to_panel(panel, edit, text)

window.run_command('show_panel',
{'panel': 'output.{0}'.format(self.WINDOW_NAME)})
{'panel': 'output.{0}'.format(self.WINDOW_NAME)})

0 comments on commit 38b1e13

Please sign in to comment.