[Bro-Dev] BiF parsing index types
Gregor Maier
gregor at icir.org
Wed May 18 02:27:06 PDT 2011
>> .... TOK_RECORD opt_ws { THE_OPAQUE_STRING }
>
> How about something like this:
>
> .... TOK_RECORD opt_ws { opaque_string }
>
> opaque_string : TOK_NO_BRACKET_STRING opaque_string
> | '[' opaque_string ']'
> | '{' opaque_string '}'
> | '(' opaque_string ')'
> |
you probably only need to take care of '{' and '}'. Should be able to
handle brackets and parentheses as opaque as well.
> TOK_NO_BRACKET_STRING is something like '[^{}[]()]+'.
For this to work yacc has to be able to switch the lexer mode. I don't
know whether yacc can to do this (I think only the lexer can switch its
mode/state).
Finally, (although not a show-stopper because unlikely), the above has
problems with quoted strings that have an unmatched number of braces in
them.
cu
Gregor
--
Gregor Maier
<gregor at icir.org> <gregor at icsi.berkeley.edu>
Int. Computer Science Institute (ICSI)
1947 Center St., Ste. 600
Berkeley, CA 94704, USA
http://www.icir.org/gregor/
More information about the bro-dev
mailing list