Flex++ problem

Tom Heathcote <TomHeathcote@spamcop.net>
3 Dec 2003 20:30:08 -0500

          From comp.compilers

Related articles
Flex++ problem TomHeathcote@spamcop.net (Tom Heathcote) (2003-12-03)
Re: Flex++ problem johnmillaway@yahoo.com (John Millaway) (2003-12-07)
| List of all articles for this month |

From: Tom Heathcote <TomHeathcote@spamcop.net>
Newsgroups: comp.compilers
Date: 3 Dec 2003 20:30:08 -0500
Organization: Compilers Central
Keywords: lex, question
Posted-Date: 03 Dec 2003 20:30:08 EST

I am trying to rebuild an old piece of lexical scanner / analyzer code,
which I believe was generated by flex++/bison++.

The rebuild is required because existing code is only a 7-bit scanner
(uses char rather than unsigned char as its character type, and the
tables only go up to 127) and I need to work with 8-bit input.

However when I try to regenerate the code, flex++ does not seem to
understand some of the syntax in the .l file. The file starts out as

      /* (a load of comments first) */

      %name JobRunScan

      %define LEX_PARAM \
              YY_JobRunParse_STYPE* value, \
              YY_JobRunParse_LTYPE* loc

      %define MEMBERS \
      public: \
          int line() const \
          { return m_line; } \
      private: \
          istream* m_cin; \
          int m_line;

But flex++ just comes up with a load of errors:

      "JobRunScan.l", line 27: bad character: %
      "JobRunScan.l", line 27: unknown error processing section 1
      "JobRunScan.l", line 27: unknown error processing section 1
      "JobRunScan.l", line 27: unknown error processing section 1
      "JobRunScan.l", line 29: unrecognized '%' directive
      "JobRunScan.l", line 33: unrecognized '%' directive
      "JobRunScan.l", line 37: bad character: \

It simply does not recognize either %name or %define as valid.

I have tried searching Google for some relevant information, and I found
some examples that imply that this is correct flex++ syntax. But I
didn't come up with any solutions... (it doesn't help that most search
engines don't let you search for terms containing a percent sign).

Does anyone have any idea what I might be doing wrong?

Tom Heathcote

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.