Skip to content

Commit

Permalink
Merge pull request #10 from CocoaPods/seg-unquoted-dash
Browse files Browse the repository at this point in the history
[Reader] Allow reading unquoted string `-`s
  • Loading branch information
segiddins committed Nov 1, 2016
2 parents 7470ca6 + fbb127f commit 859aaee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

##### Bug Fixes

* None.
* Allow reading unquoted strings that contain `-`.
[Samuel Giddins](https://github.com/segiddins)
[Xcodeproj#438](https://github.com/CocoaPods/Xcodeproj/issues/438)


## 0.1.3 (2016-11-01)
Expand Down
2 changes: 1 addition & 1 deletion lib/nanaimo/reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def parse_object

def parse_string
eat_whitespace!
unless match = @scanner.scan(%r{[\w/.$]+})
unless match = @scanner.scan(%r{[\w/.$-]+}o)
raise_parser_error ParseError, "not a valid string at index #{@scanner.pos} (char is #{current_character.inspect})"
end
Nanaimo::String.new(match, nil)
Expand Down
8 changes: 8 additions & 0 deletions spec/nanaimo/reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ module Nanaimo
expect(subject).to eq Nanaimo::Dictionary.new({ Nanaimo::String.new('key', '') => Nanaimo::String.new('$PROJECT_DIR/mogenerator/mogenerator', '') }, '')
end
end

describe 'that contain `-`' do
let(:unquoted_string) { 'foo/bar-baz' }

it 'are parsed correctly' do
expect(subject).to eq Nanaimo::Dictionary.new({ Nanaimo::String.new('key', '') => Nanaimo::String.new('foo/bar-baz', '') }, '')
end
end
end

describe 'quoted strings' do
Expand Down

0 comments on commit 859aaee

Please sign in to comment.