bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pic2plot: detecting label problems


From: Ron Burk
Subject: pic2plot: detecting label problems
Date: Sun, 13 Jan 2002 18:20:57 GMT

pic2plot would be much more pleasant to use
if it diagnosed common syntax errors in human-understandable
terms.

One common error is forgetting the "unusual" rule that
anything starting with an uppercase letter is a label.
Adding the following production for the non-terminal
"placeless_element" in gram.yy ameliorates the problem:

    | LABEL '='
        {
        /* If they already defined it, probably just forgot it */
        if(lookup_label($1))
            {
            lex_error("`%1' is a label -- you can't assign to it", $1);
            YYABORT;
            }
        /* else, it's more likely they don't know variable naming rule */
        else
            {
            lex_error("`%1' is a label (starts with uppercase character)",
$1);
            YYABORT;
            }
        }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]