File tree Expand file tree Collapse file tree 4 files changed +293
-8
lines changed Expand file tree Collapse file tree 4 files changed +293
-8
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ Resource ::= (Entry | blank_block | junk_line)*
1111Entry ::= (Message line_end )
1212 | (Term line_end )
1313 | CommentLine
14- Message ::= Identifier blank_inline ? " =" blank_inline ? ((Pattern Attribute * ) | ( Attribute + ))
14+ Message ::= Identifier (( blank_inline ? " =" blank_inline ? ((Pattern ? Attribute + ) | Pattern )) | ( blank_inline ? Attribute + ))
1515Term ::= " -" Identifier blank_inline ? " =" blank_inline ? Value Attribute *
1616
1717/* Adjacent comment lines of the same comment type are joined together during
Original file line number Diff line number Diff line change @@ -40,17 +40,27 @@ let Entry = defer(() =>
4040let Message = defer ( ( ) =>
4141 sequence (
4242 Identifier . abstract ,
43- maybe ( blank_inline ) ,
44- string ( "=" ) ,
45- maybe ( blank_inline ) ,
4643 either (
4744 sequence (
48- Pattern . abstract ,
49- repeat ( Attribute ) . abstract ) ,
45+ maybe ( blank_inline ) ,
46+ string ( "=" ) ,
47+ maybe ( blank_inline ) ,
48+ either (
49+ sequence (
50+ maybe ( Pattern ) . abstract ,
51+ repeat1 ( Attribute ) . abstract ,
52+ ) ,
53+ Pattern . abstract ,
54+ ) ,
55+ ) ,
5056 sequence (
57+ maybe ( blank_inline ) ,
5158 always ( null ) . abstract ,
52- repeat1 ( Attribute ) . abstract ) ) )
53- . map ( flatten ( 1 ) )
59+ repeat1 ( Attribute ) . abstract ,
60+ ) ,
61+ )
62+ )
63+ . map ( flatten ( 2 ) )
5464 . map ( keep_abstract )
5565 . chain ( list_into ( FTL . Message ) ) ) ;
5666
Original file line number Diff line number Diff line change 1+ key01 = Value
2+
3+ key02 = Value
4+ .attr = Attribute
5+
6+ key02 = Value
7+ .attr1 = Attribute 1
8+ .attr2 = Attribute 2
9+
10+ key03
11+ .attr = Attribute
12+
13+ key04
14+ .attr1 = Attribute 1
15+ .attr2 = Attribute 2
16+
17+ # < whitespace >
18+ key05
19+ .attr1 = Attribute 1
20+
21+ key06 = { " " }
22+
23+ # JUNK Missing value
24+ key07 =
25+
26+ # JUNK Missing =
27+ key08
Original file line number Diff line number Diff line change 1+ {
2+ "type" : " Resource" ,
3+ "body" : [
4+ {
5+ "type" : " Message" ,
6+ "id" : {
7+ "type" : " Identifier" ,
8+ "name" : " key01"
9+ },
10+ "value" : {
11+ "type" : " Pattern" ,
12+ "elements" : [
13+ {
14+ "type" : " TextElement" ,
15+ "value" : " Value"
16+ }
17+ ]
18+ },
19+ "attributes" : [],
20+ "comment" : null
21+ },
22+ {
23+ "type" : " Message" ,
24+ "id" : {
25+ "type" : " Identifier" ,
26+ "name" : " key02"
27+ },
28+ "value" : {
29+ "type" : " Pattern" ,
30+ "elements" : [
31+ {
32+ "type" : " TextElement" ,
33+ "value" : " Value"
34+ }
35+ ]
36+ },
37+ "attributes" : [
38+ {
39+ "type" : " Attribute" ,
40+ "id" : {
41+ "type" : " Identifier" ,
42+ "name" : " attr"
43+ },
44+ "value" : {
45+ "type" : " Pattern" ,
46+ "elements" : [
47+ {
48+ "type" : " TextElement" ,
49+ "value" : " Attribute"
50+ }
51+ ]
52+ }
53+ }
54+ ],
55+ "comment" : null
56+ },
57+ {
58+ "type" : " Message" ,
59+ "id" : {
60+ "type" : " Identifier" ,
61+ "name" : " key02"
62+ },
63+ "value" : {
64+ "type" : " Pattern" ,
65+ "elements" : [
66+ {
67+ "type" : " TextElement" ,
68+ "value" : " Value"
69+ }
70+ ]
71+ },
72+ "attributes" : [
73+ {
74+ "type" : " Attribute" ,
75+ "id" : {
76+ "type" : " Identifier" ,
77+ "name" : " attr1"
78+ },
79+ "value" : {
80+ "type" : " Pattern" ,
81+ "elements" : [
82+ {
83+ "type" : " TextElement" ,
84+ "value" : " Attribute 1"
85+ }
86+ ]
87+ }
88+ },
89+ {
90+ "type" : " Attribute" ,
91+ "id" : {
92+ "type" : " Identifier" ,
93+ "name" : " attr2"
94+ },
95+ "value" : {
96+ "type" : " Pattern" ,
97+ "elements" : [
98+ {
99+ "type" : " TextElement" ,
100+ "value" : " Attribute 2"
101+ }
102+ ]
103+ }
104+ }
105+ ],
106+ "comment" : null
107+ },
108+ {
109+ "type" : " Message" ,
110+ "id" : {
111+ "type" : " Identifier" ,
112+ "name" : " key03"
113+ },
114+ "value" : null ,
115+ "attributes" : [
116+ {
117+ "type" : " Attribute" ,
118+ "id" : {
119+ "type" : " Identifier" ,
120+ "name" : " attr"
121+ },
122+ "value" : {
123+ "type" : " Pattern" ,
124+ "elements" : [
125+ {
126+ "type" : " TextElement" ,
127+ "value" : " Attribute"
128+ }
129+ ]
130+ }
131+ }
132+ ],
133+ "comment" : null
134+ },
135+ {
136+ "type" : " Message" ,
137+ "id" : {
138+ "type" : " Identifier" ,
139+ "name" : " key04"
140+ },
141+ "value" : null ,
142+ "attributes" : [
143+ {
144+ "type" : " Attribute" ,
145+ "id" : {
146+ "type" : " Identifier" ,
147+ "name" : " attr1"
148+ },
149+ "value" : {
150+ "type" : " Pattern" ,
151+ "elements" : [
152+ {
153+ "type" : " TextElement" ,
154+ "value" : " Attribute 1"
155+ }
156+ ]
157+ }
158+ },
159+ {
160+ "type" : " Attribute" ,
161+ "id" : {
162+ "type" : " Identifier" ,
163+ "name" : " attr2"
164+ },
165+ "value" : {
166+ "type" : " Pattern" ,
167+ "elements" : [
168+ {
169+ "type" : " TextElement" ,
170+ "value" : " Attribute 2"
171+ }
172+ ]
173+ }
174+ }
175+ ],
176+ "comment" : null
177+ },
178+ {
179+ "type" : " Message" ,
180+ "id" : {
181+ "type" : " Identifier" ,
182+ "name" : " key05"
183+ },
184+ "value" : null ,
185+ "attributes" : [
186+ {
187+ "type" : " Attribute" ,
188+ "id" : {
189+ "type" : " Identifier" ,
190+ "name" : " attr1"
191+ },
192+ "value" : {
193+ "type" : " Pattern" ,
194+ "elements" : [
195+ {
196+ "type" : " TextElement" ,
197+ "value" : " Attribute 1"
198+ }
199+ ]
200+ }
201+ }
202+ ],
203+ "comment" : {
204+ "type" : " Comment" ,
205+ "content" : " < whitespace >"
206+ }
207+ },
208+ {
209+ "type" : " Message" ,
210+ "id" : {
211+ "type" : " Identifier" ,
212+ "name" : " key06"
213+ },
214+ "value" : {
215+ "type" : " Pattern" ,
216+ "elements" : [
217+ {
218+ "type" : " Placeable" ,
219+ "expression" : {
220+ "type" : " StringLiteral" ,
221+ "value" : " "
222+ }
223+ }
224+ ]
225+ },
226+ "attributes" : [],
227+ "comment" : null
228+ },
229+ {
230+ "type" : " Comment" ,
231+ "content" : " JUNK Missing value"
232+ },
233+ {
234+ "type" : " Junk" ,
235+ "annotations" : [],
236+ "content" : " key07 =\n "
237+ },
238+ {
239+ "type" : " Comment" ,
240+ "content" : " JUNK Missing ="
241+ },
242+ {
243+ "type" : " Junk" ,
244+ "annotations" : [],
245+ "content" : " key08\n "
246+ }
247+ ]
248+ }
You can’t perform that action at this time.
0 commit comments