Skip to content

Commit 5929503

Browse files
committed
[parser] fix for decimal literals
storing decimals as strings, for the sake of reading and writing (because of JS's numeric failings)
1 parent f799c07 commit 5929503

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

lib/parser/pbxproj.js

Lines changed: 26 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/parser/pbxproj.pegjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ NumberValue
180180
= DecimalValue / IntegerValue
181181

182182
DecimalValue
183-
= IntegerValue "." IntegerValue
183+
= decimal:(IntegerValue "." IntegerValue)
184+
{
185+
// store decimals as strings
186+
// as JS doesn't differentiate bw strings and numbers
187+
return decimal.join('')
188+
}
184189

185190
IntegerValue
186191
= !Alpha number:Digit+ !Alpha

test/parser/build-config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@ exports['should parse the build config section'] = function (test) {
1010
// if it gets this far it's worked
1111
test.done();
1212
}
13+
14+
exports['should read a decimal value correctly'] = function (test) {
15+
var xcbConfig = project.objects['XCBuildConfiguration'],
16+
debugSettings = xcbConfig['1D6058950D05DD3E006BFB54'].buildSettings;
17+
18+
test.strictEqual(debugSettings['IPHONEOS_DEPLOYMENT_TARGET'], '3.0');
19+
test.done();
20+
}

0 commit comments

Comments
 (0)