File tree Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -25,30 +25,52 @@ Anything
2525 = Char / EOF
2626
2727Object
28- = "{" obj :(Definition / EmptyBody ) "}"
28+ = "{" obj :(AssignmentList / EmptyBody ) "}"
2929 { return obj }
3030
3131EmptyBody
3232 = _
3333 { return Object .create (null ) }
3434
35- Definition
36- = _ head :Assignment _ tail :((Definition )* ) _
35+ AssignmentList
36+ = _ head :Assignment _ tail :((AssignmentList )* ) _
3737 {
3838 if (tail) return merge (head,tail)
3939 else return head
4040 }
41+ / _ section :DelimitedSection _
42+ {
43+ return section
44+ }
4145
4246Assignment
4347 = id :Identifier _ "=" _ val :Value ";"
4448 {
4549 var result = Object .create (null );
46- result[id . join ( ' ' ) ] = val
50+ result[id] = val
4751 return result
4852 }
4953
54+ DelimitedSection
55+ = begin :DelimitedSectionBegin _ fields :(AssignmentList / EmptyBody ) _ DelimitedSectionEnd
56+ {
57+ var section = {}
58+ section[begin .name ] = fields
59+
60+ return section
61+ }
62+
63+ DelimitedSectionBegin
64+ = "/* Begin " sectionName :Identifier " section */" NewLine
65+ { return { name: sectionName } }
66+
67+ DelimitedSectionEnd
68+ = "/* End " sectionName :Identifier " section */" NewLine
69+ { return { name: sectionName } }
70+
5071Identifier
51- = [A-Za-z0-9]+
72+ = id :[A-Za-z0-9]+
73+ { return id .join (' ' ) }
5274
5375Value
5476 = obj :Object { return obj }
You can’t perform that action at this time.
0 commit comments