Skip to content

Commit ec64826

Browse files
committed
Fix projectfluent#7. Introduce tags
Tags are binary values attached to messages. They are language-specific and can be used to describe grammatical characteristics of the message. brand-name = Firefox #masculine brand-name = Aurora #feminine #vowel Tags can be used in select expressions by matching a hashtag name to the message: has-updated = { brand-name -> [masculine] … [feminine] … *[other] … } Tags can only be defined on messages which have a value and don't have any attributes.
1 parent 17b4df8 commit ec64826

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

syntax/fluent.asdl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module Fluent
2323
{
2424
res = Resource(entry* body, comment? comment)
2525

26-
entry = Message(iden id, pat? value, attr* attributes, comment? comment)
26+
entry = Message(iden id, pat? value, attr* attributes, tag* tags, comment? comment)
2727
| Section(symb name, comment? comment)
2828
| Comment(comment)
2929
| Junk(string content)
@@ -45,6 +45,9 @@ module Fluent
4545
-- Attributes of Message
4646
attr = Attribute(iden id, pat value)
4747

48+
-- Tags of Message
49+
tag = Tag(symb name)
50+
4851
-- Variants of SelectExpression
4952
var = Variant(varkey key, pat value, bool default)
5053
varkey = Number(number)

syntax/fluent.ebnf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ variant ::= NL __ '[' _? variant-key _? ']' __ pattern
3434
default-variant ::= NL __ '*[' _? variant-key _? ']' __ pattern
3535
variant-list ::= variant* default-variant variant*
3636

37+
tag ::= '#' word
38+
tag-list ::= NL (__ tag)+
39+
3740
attribute ::= NL __ '.' identifier value
3841
attribute-list ::= attribute+
3942

40-
message ::= identifier (value attribute-list? | attribute-list)
43+
message ::= identifier ((value tag-list?) | (value? attribute-list))
4144
value ::= _? '=' __? pattern
4245
pattern ::= (text | placeable)+
4346
text ::= ((char - line-break) - special | break-indent | '\' special)+

0 commit comments

Comments
 (0)