l20n / spec

Specification and design documents for L20n
http://l20n.github.com/spec/
10 stars 6 forks source link

incomplete unquoted-text definition #15

Closed GlenDC closed 7 years ago

GlenDC commented 7 years ago

Currently the definition of an unquoted-text is as follows:

unquoted-text        ::= ([^{] | '\{')+;

source: https://github.com/l20n/spec/blob/master/grammar.ebnf#L28

For most cases this is fine, however when just relying on this definition it breaks in following example:

opened-new-window = { brandName[gender] ->
 *[masculine] { brandName } otworzyl nowe okno.
  [feminine] { brandName } otworzyla nowe okno. }

In the example given above, it will read the entire line, including the '}' character, which is actually the closing bracket of the root placeable. This problem is fixed if you define an unquoted-text as follows:

unquoted-text        ::= ([^{}] | '\{' | '\}')+;

For that matter, this definition (even the new one), does still not define that it should stop reading at a newline and thus perhaps the actual definition should be:

unquoted-text        ::= ([^{}\n\r] | '\{' | '\}' | '\\n' | '\\r')+;
GlenDC commented 7 years ago

@stasm should I re-open this issue in http://github.com/projectfluent/syntax as this still seems to be an issue in its fluent.ebnf file.

stasm commented 7 years ago

@GlenDC Yes please! Sorry for a bit of additional work. Let's continue discussing this in the new issue.