Attila Csosz <[EMAIL PROTECTED]> writes:
> How can I get the column position using flex? (for better error handling)

I don't see any obvious way to, which seems a little surprising.  You
might try redefining the YY_USER_ACTION macro, though (see
(flex)Miscellaneous in the Info docs):

%{
int line = 0;
int frcol = 0;
int tocol = 0;
#define YY_USER_ACTION { frcol = tocol; tocol += yyleng; }
%}

%%

\n      line++; frcol = tocol = 0;

(%option yylineno will keep track of the line number for you, see
(flex)Options, but there's not an equivalent column number option that
I see.  Since you need a rule for \n anyways, you might as well track
the line number by hand.)

-- 
David Maze         [EMAIL PROTECTED]      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
        -- Abra Mitchell


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to