Skip to content

Commit 29cfc8b

Browse files
committed
[grammar] handle QuotedStrings and DecimalValues
1 parent c3c56d0 commit 29cfc8b

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

pbxproj.pegjs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,38 @@ CommentedArrayEntry
166166
* Identifiers and Values
167167
*/
168168
Identifier
169-
= id:[A-Za-z0-9]+
170-
{ return id.join('') }
169+
= id:[A-Za-z0-9_]+ { return id.join('') }
170+
/ QuotedString
171171

172172
Value
173173
= Object / Array / NumberValue / StringValue
174174

175175
NumberValue
176+
= DecimalValue / IntegerValue
177+
178+
DecimalValue
179+
= IntegerValue "." IntegerValue
180+
181+
IntegerValue
176182
= !Alpha number:Digit+ !Alpha
177183
{ return parseInt(number, 10) }
178184

179185
StringValue
186+
= QuotedString / LiteralString
187+
188+
QuotedString
189+
= DoubleQuote str:QuotedBody DoubleQuote { return str }
190+
191+
QuotedBody
192+
= str:NonQuote+ { return str.join('') }
193+
194+
NonQuote
195+
= EscapedQuote / !DoubleQuote char:. { return char }
196+
197+
EscapedQuote
198+
= "\\" DoubleQuote { return '\"' }
199+
200+
LiteralString
180201
= literal:LiteralChar+ { return literal.join('') }
181202

182203
LiteralChar
@@ -203,6 +224,9 @@ Digit
203224
Alpha
204225
= [A-Za-z]
205226

227+
DoubleQuote
228+
= '"'
229+
206230
_ "whitespace"
207231
= whitespace*
208232

0 commit comments

Comments
 (0)