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

Remove support for CR #161

Merged
merged 1 commit into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions spec/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

## Unreleased

- …

- Remove support for CR as a line ending. (#154)

## 0.6.0 (July 24, 2018)

Expand Down
1 change: 0 additions & 1 deletion spec/fluent.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ digit ::= [0-9]
inline_space ::= ("\u0020" | "\u0009")+
line_end ::= "\u000D\u000A"
| "\u000A"
| "\u000D"
| EOF
blank_line ::= inline_space? line_end
break_indent ::= line_end blank_line* inline_space
Expand Down
18 changes: 7 additions & 11 deletions syntax/abstract.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,16 @@ export function into(Type) {
case FTL.GroupComment:
case FTL.ResourceComment:
return content => {
if (content.endsWith("\n")) {
if (content.endsWith("\r\n")) {
var offset = -2;
} else {
var offset = -1;
}
} else if (content.endsWith("\r")) {
var offset = -1;
} else {
if (!content.endsWith("\n")) {
// The comment ended with the EOF; don't trim it.
return always(new Type(content));
}
// Trim the EOL from the end of the comment.
return always(new Type(content.slice(0, offset)));
if (content.endsWith("\r\n")) {
// Trim the CRLF from the end of the comment.
return always(new Type(content.slice(0, -2)));
}
// Trim the LF from the end of the comment.
return always(new Type(content.slice(0, -1)));
};
case FTL.Placeable:
return expression => {
Expand Down
1 change: 0 additions & 1 deletion syntax/grammar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ let line_end =
either(
string("\u000D\u000A"),
string("\u000A"),
string("\u000D"),
eof());

let blank_line =
Expand Down