mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-24 09:21:16 -03:00
Reflect newlines after pipes in fish grammar
The previous attempt to support newlines after pipes changed the lexer to swallow newlines after encountering a pipe. This has two problems that are difficult to fix: 1. comments cannot be placed after the pipe 2. fish_indent won't know about the newlines, so it will erase them Address these problems by removing the lexer behavior, and replacing it with a new parser symbol "optional_newlines" allowing the newlines to be reflected directly in the fish grammar.
This commit is contained in:
@@ -739,6 +739,18 @@ static void test_parser() {
|
||||
err(L"leading pipe not reported properly");
|
||||
}
|
||||
|
||||
if (parse_util_detect_errors(L"true | # comment") != PARSER_TEST_INCOMPLETE) {
|
||||
err(L"comment after pipe not reported as incomplete");
|
||||
}
|
||||
|
||||
if (parse_util_detect_errors(L"true | # comment \n false ")) {
|
||||
err(L"comment and newline after pipe wrongly reported as error");
|
||||
}
|
||||
|
||||
if (parse_util_detect_errors(L"true | ; false ") != PARSER_TEST_ERROR) {
|
||||
err(L"semicolon after pipe not detected as error");
|
||||
}
|
||||
|
||||
if (detect_argument_errors(L"foo")) {
|
||||
err(L"simple argument reported as error");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user