Skip to content

Instantly share code, notes, and snippets.

@Zoxc
Created May 3, 2012 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zoxc/2585797 to your computer and use it in GitHub Desktop.
Save Zoxc/2585797 to your computer and use it in GitHub Desktop.
Parsing error comparison
> ::hi()
mirb:
Parsing Error: Can only reference constants when leaving out the lookup expression (Use ::Object to access non-constants)
Input[1]: ::hi()
~~~~~~
mri:
SyntaxError: (irb):6: syntax error, unexpected tIDENTIFIER, expecting tCONSTANT
::hi()
^
> def ().hi; end
mirb:
Parsing Error: Expected expression
Input[1]: def ().hi; end
^
mri:
SyntaxError: (irb):3: syntax error, unexpected ')'
def ().hi; end
^
(irb):3: syntax error, unexpected keyword_end, expecting $end
>def test a=3, &b, b; end
mirb:
Parsing Error: Parameters with default values must come after regular parameters
Input[1]: def test a=3, &b, b; end
^
Parsing Error: Block parameters must be last in the parameter list
Input[1]: def test a=3, &b, b; end
~~
Parsing Error: Variable b already defined
Input[1]: def test a=3, &b, b; end
^
mri:
SyntaxError: (irb):32: syntax error, unexpected ',', expecting ';' or '\n'
def test a=3, &b, b; end
^
(irb):32: syntax error, unexpected keyword_end, expecting $end
>a, b + 2 = 1
mirb:
Parsing Error: Not an assignable expression
Input[1]: a, b + 2 = 1
~~~~~
mri:
SyntaxError: (irb):11: syntax error, unexpected '+', expecting '='
a, b + 2 = 1
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment