Re: [Flex-help] warning, rule cannot be matched
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Chris v. <che...@gm...> - 2013-10-29 19:59:31
|
I think the default for flex is to understand the full range of 8-bit characters. (See the -7 and -8 switches.) If by "generates an error message" you're talking about the "rule cannot be matched" message, it makes sense to me. [^[:alnum;]] will indeed match \n, so the specific \n pattern is 'redundant' and will never get matched. -Chris On Sun, Oct 27, 2013 at 7:04 AM, Arthur Schwarz <asc...@at...>wrote: > The little code snippet below generates an error message. The reason (I > think) is that the set [^[:alnum:]] contains a '\n' within it. I had > assumed that the character set involved was [:print:] = [\x20-\7E], which > excludes all control characters, [:cntrl:] = [\x00-\x1F\x7F], but > apparently this is not the case. > > > What is the set of characters recognized by flex when an operation like > this is performed? Is it[\x00-\x7F], [\x00-\xFF], or ? > > > %option main > > %{ > #ifndef DEBUG > #define DEBUG(stmt) stmt > #else > #define DEBUG(stmt) > #endif > %} > > %% > > [^[:alnum:]] { DEBUG( ECHO; ) } /* [\x00-\x7F]{-}[:alnum:] ? */ > . { DEBUG( ECHO; ) } > \n { DEBUG( ECHO; ) } /* warning, rule cannot be matched */ > <<EOF>> { return 1; } > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk > _______________________________________________ > Flex-help mailing list > Fle...@li... > https://lists.sourceforge.net/lists/listinfo/flex-help > |