@@ -106,7 +106,7 @@ def get_entry(self, ps):
106106 return ast .GroupComment (comment .content )
107107 return None
108108
109- if ps .is_message_id_start () \
109+ if ps .is_entry_id_start () \
110110 and (comment is None or isinstance (comment , ast .Comment )):
111111 return self .get_message (ps , comment )
112112
@@ -200,7 +200,7 @@ def skip_section(self, ps):
200200
201201 @with_span
202202 def get_message (self , ps , comment ):
203- id = self .get_private_identifier (ps )
203+ id = self .get_entry_identifier (ps )
204204
205205 ps .skip_inline_ws ()
206206
@@ -215,9 +215,15 @@ def get_message(self, ps, comment):
215215 ps .skip_indent ()
216216 pattern = self .get_pattern (ps )
217217
218+ if id .name .startswith ('-' ) and pattern is None :
219+ raise ParseError ('E0006' , id .name )
220+
218221 if ps .is_peek_next_line_attribute_start ():
219222 attrs = self .get_attributes (ps )
220223
224+ if id .name .startswith ('-' ):
225+ return ast .Term (id , pattern , attrs , comment )
226+
221227 if pattern is None and attrs is None :
222228 raise ParseError ('E0005' , id .name )
223229
@@ -228,7 +234,7 @@ def get_attribute(self, ps):
228234 ps .expect_indent ()
229235 ps .expect_char ('.' )
230236
231- key = self .get_public_identifier (ps )
237+ key = self .get_identifier (ps )
232238
233239 ps .skip_inline_ws ()
234240 ps .expect_char ('=' )
@@ -238,7 +244,7 @@ def get_attribute(self, ps):
238244 value = self .get_pattern (ps )
239245 return ast .Attribute (key , value )
240246
241- raise ParseError ('E0006' , 'value ' )
247+ raise ParseError ('E0012 ' )
242248
243249 def get_attributes (self , ps ):
244250 attrs = []
@@ -251,18 +257,14 @@ def get_attributes(self, ps):
251257 break
252258 return attrs
253259
254- @with_span
255- def get_private_identifier (self , ps ):
260+ def get_entry_identifier (self , ps ):
256261 return self .get_identifier (ps , True )
257262
258263 @with_span
259- def get_public_identifier (self , ps ):
260- return self .get_identifier (ps , False )
261-
262- def get_identifier (self , ps , allow_private ):
264+ def get_identifier (self , ps , allow_term = False ):
263265 name = ''
264266
265- name += ps .take_id_start (allow_private )
267+ name += ps .take_id_start (allow_term )
266268
267269 ch = ps .take_id_char ()
268270 while ch :
@@ -306,7 +308,7 @@ def get_variant(self, ps, has_default):
306308 value = self .get_pattern (ps )
307309 return ast .Variant (key , value , default_index )
308310
309- raise ParseError ('E0006' , 'value ' )
311+ raise ParseError ('E0012 ' )
310312
311313 def get_variants (self , ps ):
312314 variants = []
@@ -501,7 +503,7 @@ def get_selector_expression(self, ps):
501503
502504 if (ch == '.' ):
503505 ps .next ()
504- attr = self .get_public_identifier (ps )
506+ attr = self .get_identifier (ps )
505507 return ast .AttributeExpression (literal .id , attr )
506508
507509 if (ch == '[' ):
@@ -574,7 +576,7 @@ def get_arg_val(self, ps):
574576 return self .get_number (ps )
575577 elif ps .current_is ('"' ):
576578 return self .get_string (ps )
577- raise ParseError ('E0006' , 'value ' )
579+ raise ParseError ('E0012 ' )
578580
579581 @with_span
580582 def get_string (self , ps ):
@@ -603,10 +605,10 @@ def get_literal(self, ps):
603605
604606 if ch == '$' :
605607 ps .next ()
606- name = self .get_public_identifier (ps )
608+ name = self .get_identifier (ps )
607609 return ast .ExternalArgument (name )
608- elif ps .is_message_id_start ():
609- name = self .get_private_identifier (ps )
610+ elif ps .is_entry_id_start ():
611+ name = self .get_entry_identifier (ps )
610612 return ast .MessageReference (name )
611613 elif ps .is_number_start ():
612614 return self .get_number (ps )
0 commit comments