Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Common difficulty with Flex++

Note: Someone with over 1500 rep.. please add flex++ and bison++ as tags :).

Seems like people all over the Internet have been getting the following errors with Flex++:

scanner.l:1: bad character: %
scanner.l:1: unknown error processing section 1

This happens on any example I give Flex++. The version I have is from here and I have tried the exact examples on that page and I still get these errors. I've tried on Linux and Mac and have completely run out of ideas!

Seems like Flex++ is a name for an old virus out there too so it's particularly hard getting useful discussion!

EDIT:

Here's an example that produces the above error (first few lines from example taken from the link above):

%name CalcScanner
%define IOSTREAM
%define LEX_PARAM YY_CalcParser_STYPE *val, YY_CalcParser_LTYPE *loc
%define MEMBERS public: int line, column;                                                                                               
%define CONSTRUCTOR_INIT : line(1), column(1)

%header{
#include<sstream>
#include "parser.h"
%}

Any help would be more than fantastic.

EDIT 2: Please can people not edit this post by putting the 'flex' tag in? Flex would be what I would use to tag but Flex is also an Adobe technology - it's NOT the tool I am using. The flex tag on SO is for the Adobe product (hence the logo on the tag). Thank you :).

like image 647
ale Avatar asked Nov 05 '22 18:11

ale


1 Answers

Check your line-endings? CR+LF vs NL might make a difference here.

like image 105
Ben Voigt Avatar answered Nov 12 '22 11:11

Ben Voigt