Skip to content

Commit

Permalink
Support single character strings using escaped characters
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Dec 6, 2013
1 parent f983a92 commit eb13fcb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -51,6 +51,8 @@
* Fix bug where sometimes the wrong regexp flags would be generated in the
output javascript.

* Support single character strings (using ? prefix) with escaped characters.

## 0.5.5 2013-11-25

* Fix regression: add `%i[foo bar]` style words back to lexer
Expand Down
12 changes: 8 additions & 4 deletions lib/opal/parser/lexer.rb
Expand Up @@ -1071,14 +1071,18 @@ def yylex
return :tEH
end

unless check(/\ |\t|\r|\s/)
if check(/\ |\t|\r|\s/)
@lex_state = :expr_beg
return :tEH
elsif scan(/\\/)
@lex_state = :expr_end
self.yylval = scan(/./)
self.yylval = self.read_escape
return :tSTRING
end

@lex_state = :expr_beg
return :tEH
@lex_state = :expr_end
self.yylval = scan(/./)
return :tSTRING

elsif scan(/\~/)
self.set_arg_state
Expand Down

0 comments on commit eb13fcb

Please sign in to comment.