Skip to content

Instantly share code, notes, and snippets.

@53cr
Created October 5, 2010 02:31
Show Gist options
  • Save 53cr/610867 to your computer and use it in GitHub Desktop.
Save 53cr/610867 to your computer and use it in GitHub Desktop.
rbx-1.0.0-rc2 > "not(false\n1)".to_ast.ascii_graph Not
@line: 2
@value: \
Block
@line: 1
@array: \
False
@line: 1
FixnumLiteral
@line: 2
@value: 1
rbx-1.0.0-rc2 > "not(false;1)".to_ast.ascii_graphNot
@line: 1
@value: \
Block
@line: 1
@array: \
False
@line: 1
FixnumLiteral
@line: 1
@value: 1
# Now here's the weird part.
rbx-1.0.0-rc2 > "puts(false;1)".to_ast
SyntaxError: (eval):1: expecting ')'
from Rubinius::Melbourne#syntax_error at lib/melbourne.rb:52
# Guess it's because not() is actually a keyword, handled by the lexer, which is a little bit dumber than normal method call semantics...
http://github.com/ruby/ruby/blob/trunk/lex.c.blt#L131
Cool.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment