Skip to content

Commit

Permalink
Fix lexing bug to allow ! as def name
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Dec 6, 2013
1 parent 7473df7 commit 71bc4a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -23,6 +23,8 @@
* Add `time.rb` to stdlib and moved `Time.parse()` and `Time.iso8601()`
methods there.

* Fix bug to allow `!` as def name.

* Moved `native.rb` to stdlib. Native support must now be explicitly required
into Opal. `Native` is also now a module, instead of a top level class.
Also added `Native::Object#respond_to?`.
Expand Down
8 changes: 3 additions & 5 deletions lib/opal/parser/lexer.rb
Expand Up @@ -660,23 +660,21 @@ def yylex
end

elsif scan(/\!/)
c = scan(/./)
if after_operator?
@lex_state = :expr_arg
if c == "@"
if scan(/@/)
return :tBANG, '!'
end
else
@lex_state = :expr_beg
end

if c == '='
if scan(/\=/)
return :tNEQ
elsif c == '~'
elsif scan(/\~/)
return :tNMATCH
end

pushback(1)
return :tBANG

elsif scan(/\=/)
Expand Down

0 comments on commit 71bc4a6

Please sign in to comment.