Skip to content

Forbid tabs as inline blanks - #167

Merged
stasm merged 2 commits into
projectfluent:masterfrom
stasm:forbid-tab-as-blank
Aug 20, 2018
Merged

Forbid tabs as inline blanks#167
stasm merged 2 commits into
projectfluent:masterfrom
stasm:forbid-tab-as-blank

Conversation

@stasm

Copy link
Copy Markdown
Contributor

Fix#165.

Comment threadtest/fixtures/tab.ftl
# Partial Error (tab is not a valid indent)
key04 =
This line is indented by 4 spaces,
whereas this line by 1 tab.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exhibits the same behavior as when a broken attribute is encountered. The body of the message up until the syntax error parses fine. Essentially, it's the same situation as:

key04 =
This line is indented by 4 spaces,
junk here

@stasm
stasm requested a review from PikeAugust 17, 2018 14:55

@PikePike left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add the tab character back to text_char.

That also means that one of the testcases should actually pass.

Comment threadtest/fixtures/tab.ftl
@@ -0,0 +1,14 @@
# Error (tab after =)
key01 = Value 01

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a success.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the tab be trimmed from the value or kept verbatim?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it makes sense to only trim syntax whitespace. I'd keep it.

Comment threadtest/fixtures/tab.ftl
key01 = Value 01

# Error (tab before =)
key02 = Value 02

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This failing is right, as are the ones below.

@stasm

stasm commented Aug 20, 2018

Copy link
Copy Markdown
ContributorAuthor

Thanks, @Pike. I made the tab character a text_char and also changed the whitespace trimming logic to keep it as part of the value.

@stasm
stasm requested a review from PikeAugust 20, 2018 07:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@stasm@Pike