Skip to content

Commit

Permalink
Merge pull request #340 from eventualbuddha/fix-empty-interpolation-p…
Browse files Browse the repository at this point in the history
…refix-raw

Ensure string interpolations with empty prefixes have raw values.
  • Loading branch information
michaelficarra committed Jan 22, 2015
2 parents b31ccfb + 9fdedda commit 95409d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/grammar.pegcoffee
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
expr

createInterpolation = (es) ->
init = new CS.String('').g()
init = new CS.String('').g().r('')
foldl ((memo, s) ->
if s instanceof CS.String
left = memo
Expand Down
4 changes: 4 additions & 0 deletions test/parser.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ suite 'Parser', ->
eq 'aaaaaa', ast.body.statements[0].left.left.raw
eq 'cccccc', ast.body.statements[0].right.raw

test 'empty string interpolation prefix', ->
ast = parse '"#{0}"', raw: yes
eq '', ast.body.statements[0].left.raw

suite 'position/offset preservation', ->

test 'basic indentation', ->
Expand Down

0 comments on commit 95409d6

Please sign in to comment.