Hi,
The use of regexp grouping constructs such as \( and \) when
defining lexical analyzers can be used however you need. I don't
think the positions of these entries is ever used by some secret part
of semantic. For example, define-lex-simple-regex-analyzer
specifically has an argument specifying a match index. Other basic
analyzers provide a place to write your own code where you can use
the group entries however you like.
When it comes right down to it, a typical analyzer is not regexp
based. See `define-lex-analyzer'. There are convenience macros for
creating regexp based analyzers that can then use groups, or not.
This is because regexps are a logical way to identify specific types
of text. Each analyzer creation macro must document itself as to how
the regexp is used. If there are specific macros with confusing
documentation, I can try and rectify that problem.
Lastly, I'm not entirely sure of what you are asking in your last
paragraph.
Good Luck
Eric
>>> Marcus Harnisch <marcus.harnisch@...> seems to think that:
>Hi there,
>
>When I looked at some default regular expressions defined for the
>semantic lexer, I wondered whether some groups [\(, \) pairs] could be
>saved. While I am not so much concerned about optimization, to me it
>is not always clear (w/o looking into semantic source code) in which
>places the groups are really necessary for back references (or because
>they are used as sub-groups) and in which places they are
>redundant. Same with word-(begin|end) matches. There are certainly
>places where these make sense, but are they always necessary?
>
>When I came up with my number-regexp for a language definition I am
>working on, I wasn't quite sure where/whether I could safely use my
>own sub-groups. Blindly following the way other language definitions
>went is potentially dangerous. Dumb copy&paste, while sometimes
>sufficient for a start, have seldomly proved to be right.
>
>Can someone give me some general advice? Will semantic encapsulate all
>regexps appropriately by itself or do I have to watch out for any
>pitfalls?
>
>Thanks,
>Marcus
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: SF.net Giveback Program.
>Does SourceForge.net help you be more productive? Does it
>help you create better code? SHARE THE LOVE, and help us help
>YOU! Click Here: http://sourceforge.net/donate/
>_______________________________________________
>cedet-semantic mailing list
>cedet-semantic@...
>https://lists.sourceforge.net/lists/listinfo/cedet-semantic
>
--
Eric Ludlam: zappo@..., eric@...
Home: http://www.ludlam.net Siege: http://www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org
|