Hello Phil,

On 07/09/18 02:35, Phil Eaton wrote:
> Hey,
> 
> Doas currently tells you the line but not the column for syntax errors. In
> the case of a missing newline at the end of a line I was confused. So I
> added the column number to the message as well.

I don't care much about the change one way or the other, but your patch
doesn't apply. Also, does this help in other cases that are not POSIX
violations? And if we choose to accept the patch, should this be applied
any or all of our other yyerror implementations?
> 
> Also, is there any interest in relaxing the grammar so a trailing rule
> without a newline is ok?

No, POSIX requires lines to end with a newline.[0]

martijn@
> 
> Let me know what you think.
> 
> diff --git parse.y parse.y
> index fde406bcf5a..f98deb81706 100644
> --- parse.y
> +++ parse.y
> @@ -195,7 +195,7 @@ yyerror(const char *fmt, ...)
>   va_start(va, fmt);
>   vfprintf(stderr, fmt, va);
>   va_end(va);
> - fprintf(stderr, " at line %d\n", yylval.lineno + 1);
> + fprintf(stderr, " at line %d, column %d\n", yylval.lineno + 1,
> yylval.colno);
>   parse_errors++;
>  }
> 
> 
> 
[0] 
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206

Reply via email to