Skip to content

Commit 03d30c5

Browse files
committed
[parser] support for numeric literals
1 parent 4bc12ff commit 03d30c5

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

pbxproj.pegjs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ CommentedValue
8484
{
8585
var result = Object.create(null)
8686
result.comment = comment.trim();
87-
result.value = literal.trim();
87+
result.value = literal;
8888
return result;
8989
}
9090

@@ -117,12 +117,19 @@ Identifier
117117
{ return id.join('') }
118118

119119
Value
120-
= obj:Object { return obj }
121-
/ literal:Literal { return literal }
120+
= obj:Object { return obj } / NumberValue / StringValue
122121

123122
Literal
124-
= literal:LiteralChar+
125-
{ return literal.join('') }
123+
= StringValue
124+
125+
NumberValue
126+
= number:Digit+ { return parseInt(number, 10) }
127+
128+
Digit
129+
= [0-9]
130+
131+
StringValue
132+
= literal:LiteralChar+ { return literal.join('') }
126133

127134
LiteralChar
128135
= !InlineCommentOpen char:[^;\n]

0 commit comments

Comments
 (0)