style fixups, unbreaking print

This commit is contained in:
Paul R. Tagliamonte 2013-03-10 15:39:27 -04:00
parent bce14c18a4
commit 2b908254ac
3 changed files with 17 additions and 3 deletions

View File

@ -107,6 +107,14 @@ class HyASTCompiler(object):
lineno=expr.start_line,
col_offset=expr.start_column)
@builds("print")
def compile_print_expression(self, expr):
expr.pop(0) # print
return ast.Print(
dest=None,
values=[self.compile(x) for x in expr],
nl=True)
@builds("assert")
def compile_assert_expression(self, expr):
expr.pop(0) # assert
@ -170,7 +178,7 @@ class HyASTCompiler(object):
ctx=ast.Load())
@builds("assoc")
def compile_index_expression(self, expr):
def compile_assoc_expression(self, expr):
expr.pop(0) # assoc
# (assoc foo bar baz) => foo[bar] = baz
target = expr.pop(0)

View File

@ -66,7 +66,7 @@ class PygmentsExtension(Extension):
body = parser.parse_statements(['name:endcode'], drop_needle=True)
return nodes.CallBlock(self.call_method('_pygmentize', args),
[], [], body).set_lineno(lineno)
[], [], body).set_lineno(lineno)
def _pygmentize(self, lang_type, caller):
lexer = None

View File

@ -12,7 +12,13 @@
<div class = 'popover' >
<div class = 'focus' >
<div class = 'repl' >
<textarea id = 'repl-input' class = 'repl-pane repl-left' >
<textarea id = 'repl-input' class = 'repl-pane repl-left' >
; This is an example of some of the things that Hy can do
(defn hello-world [who] (print (.join ", " ["Hello" who])))
(hello-world "Paul")
; Hello, Paul!
</textarea>
<pre id = 'repl-output' class = 'repl-pane repl-right' ></pre>
</div>