88 }
99}
1010
11+ /*
12+ * Project: point of entry from pbxproj file
13+ */
1114Project
1215 = headComment :SingleLineComment ? obj :Object NewLine
1316 {
@@ -21,6 +24,9 @@ Project
2124 return proj;
2225 }
2326
27+ /*
28+ * Object: basic hash data structure with Assignments
29+ */
2430Object
2531 = "{" obj :(AssignmentList / EmptyBody ) "}"
2632 { return obj }
@@ -40,6 +46,11 @@ AssignmentList
4046 return section
4147 }
4248
49+ /*
50+ * Assignments
51+ * can be simple "key = value"
52+ * or commented "key /* real key * / = value"
53+ */
4354Assignment
4455 = SimpleAssignment / CommentedAssignment
4556
@@ -95,6 +106,9 @@ InlineCommentOpen
95106InlineCommentClose
96107 = "*/"
97108
109+ /*
110+ * DelimitedSection - ad hoc project structure pbxproj files use
111+ */
98112DelimitedSection
99113 = begin :DelimitedSectionBegin _ fields :(AssignmentList / EmptyBody ) _ DelimitedSectionEnd
100114 {
@@ -112,33 +126,36 @@ DelimitedSectionEnd
112126 = "/* End " sectionName :Identifier " section */" NewLine
113127 { return { name: sectionName } }
114128
129+ /*
130+ * Arrays: lists of values, possible wth comments
131+ */
132+ Array
133+ = "(" [^)]+ ")"
134+
135+ /*
136+ * Identifiers and Values
137+ */
115138Identifier
116139 = id :[A-Za-z0-9]+
117140 { return id .join (' ' ) }
118141
119142Value
120143 = Object / Array / NumberValue / StringValue
121144
122- Array
123- = "(" [^)]+ ")"
124-
125145NumberValue
126146 = ! Alpha number :Digit + ! Alpha
127147 { return parseInt (number, 10 ) }
128148
129- Digit
130- = [0-9]
131-
132- Alpha
133- = [A-Za-z]
134-
135149StringValue
136150 = literal :LiteralChar + { return literal .join (' ' ) }
137151
138152LiteralChar
139153 = ! InlineCommentOpen ! LineTerminator char :[^;\n ]
140154 { return char }
141155
156+ /*
157+ * SingleLineComment - used for the encoding comment
158+ */
142159SingleLineComment
143160 = "//" _ contents :OneLineString NewLine
144161 { return contents }
@@ -147,6 +164,15 @@ OneLineString
147164 = contents :NonLine *
148165 { return contents .join (' ' ) }
149166
167+ /*
168+ * Simple character checking rules
169+ */
170+ Digit
171+ = [0-9]
172+
173+ Alpha
174+ = [A-Za-z]
175+
150176_ "whitespace"
151177 = whitespace *
152178
0 commit comments