Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select expression breaks if you have dot character on the second line of any branch #342

Open
slavafomin opened this issue Dec 23, 2021 · 2 comments

Comments

@slavafomin
Copy link

Hello!

Consider the following example:

shared-photos =
  {$photoCount ->
    *[one]
      .
  }
  "

https://projectfluent.org/play/?id=fcbc0ff1daf506a0e6943ab9658b1340

This causes a syntax error. However, if you would replace dot character with any other one, it's working OK.

These also causes errors:

shared-photos =
  "
  {$photoCount ->
    *[one]
      A
      .
  }
  "
shared-photos =
  "
  {$photoCount ->
    *[one]
      .A
  }
  "

It looks like first character of the line can't be a dot. Why is that?

@slavafomin
Copy link
Author

Now, I'm guessing that this relates to the attributes feature, however, this shouldn't be a problem, because parser shouldn't expect attributes in the middle of select expression. I think it's a parser bug.

@zbraniecki
Copy link
Collaborator

It is not. FTL syntax focuses on error recoverability from any syntactic error ensuring that the parser can find the start of the next entry.

In result a compromise had to be made for multi-line values - several characters have to be escaped - https://github.com/projectfluent/fluent/blob/master/spec/fluent.ebnf#L110

You need { "." } if you need . character at the beginning of an intended line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants