Skip to content

Commit

Permalink
Merge pull request #337 from eventualbuddha/fix-string-interpolation-raw
Browse files Browse the repository at this point in the history
Ensure string interpolation segments have `raw' values.
  • Loading branch information
michaelficarra committed Jan 21, 2015
2 parents a40829b + 9434c17 commit b31ccfb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/parser.js

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

1 change: 1 addition & 0 deletions src/grammar.pegcoffee
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
if left instanceof CS.String
if left is init
c left, s
left.raw = s.raw
delete left.generated
left.data = "#{left.data}#{s.data}"
return memo
Expand Down
5 changes: 5 additions & 0 deletions test/parser.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ suite 'Parser', ->
ast = parse '0x0', raw: yes
eq '0x0', ast.body.statements[0].raw

test 'strings', ->
ast = parse '"aaaaaa#{bbbbbb}cccccc"', raw: yes
eq 'aaaaaa', ast.body.statements[0].left.left.raw
eq 'cccccc', ast.body.statements[0].right.raw

suite 'position/offset preservation', ->

test 'basic indentation', ->
Expand Down

0 comments on commit b31ccfb

Please sign in to comment.