3

Heres an example rule for oct values. Instead of using YYTEXT i'd like to get the value, letter and the # at end (8,...64). How might i get them? I guessed printf("%s", $1) to see if i'd get the value but lex gave me a compile error instead

0([0-7]+)(([us])(8|16|32|64))?

Also it appears "group" isn't in the manual.

rici
  • 234,347
  • 28
  • 237
  • 341
  • 2
    I don't think you can use capturing groups in flex, see http://stackoverflow.com/questions/3901835/how-do-i-use-regular-expression-capturing-groups-with-jflex/5088605#5088605. – Andy May 19 '11 at 02:31

1 Answers1

8

There are no capturing groups in flex.

I think this would best be represented as several states, with separate matching rules and state transitions.

bukzor
  • 37,539
  • 11
  • 77
  • 111