Provide a hint to users that file is coming with CRLF line terminators,
maybe from a non-Linux OS.
Extend scanner.l to provide hint on CRLF in files:
# file test.nft
test.nft: ASCII text, with CRLF, LF line terminators
# nft -f test.nft
test.nft:1:13-14: Error: syntax error, unexpected CRLF line terminators
table ip x {
^^
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
%token TOKEN_EOF 0 "end of file"
%token JUNK "junk"
+%token CRLF "CRLF line terminators"
%token NEWLINE "newline"
%token COLON "colon"
space [ ]
tab \t
+newline_crlf \r\n
newline \n
digit [0-9]
hexdigit [0-9a-fA-F]
return STRING;
}
+{newline_crlf} { return CRLF; }
+
\\{newline} {
reset_pos(yyget_extra(yyscanner), yylloc);
}