yes, this patch works, but with a problem. it fails
when there is whitespace (space(s) or tab(s)) before
the macros, as in (here . means space or tab):
stuff
....#region name
some code here
....#endregion
stuff
though, with the \\s-*, it should be catching the
whitespace, but it doesnt. i tried to fiddle around
with the regex but to no avail.
amit
--- "Eric M. Ludlam" <eric@...> wrote:
> After installing the patch into wisent-csharp.el,
> you would need to
> rebuild semantic, and then restart Emacs.
>
> If you wrap a region of code that contains a #region
> macro in a Region
> (using mark and point) then do:
>
> M-x semantic-lex-test RET
>
> you can find out if it successfully removed it from
> the token stream.
>
> If it did not, you would need to fiddle the regexp
> till it worked.
>
> Looking at the patch, I see I put in one too many
> ">". I had also
> forgotten about the regionname that also
> (presumably) needs to be
> removed.
>
> Find a new patch below.
>
> Eric
>
> *** wisent-csharp.el 30 Sep 2005 15:50:54 -0400 1.4
> --- wisent-csharp.el 19 Mar 2006 15:04:35 -0500
> ***************
> *** 1,6 ****
> --- 1,8 ----
> ;;; wisent-csharp.el --- LALR grammar for C#
> ;;
> ;; Copyright (C) 2003 David Shilvock
> + ;; Some Changes Copyright (C) 2006 Eric M. Ludlam
> +
> ;; Time-stamp: <2003-12-08 19:11:48 dave>
> ;;
> ;; Author: David Shilvock <davels@...>
> ***************
> *** 244,249 ****
> --- 246,265 ----
> ;;; * Lexer
>
>
;;;----------------------------------------------------------------------
>
> + (define-lex-regex-analyzer
> wisent-csharp-lex-ignore-region
> + "Ignore # type macros for C sharp."
> + "^\\s-*#region\\>"
> + (goto-char (match-end 0))
> + (forward-word 1)
> + (setq semantic-lex-end-point (point))
> + nil)
> +
> + (define-lex-regex-analyzer
> wisent-csharp-lex-ignore-endregion
> + "Ignore # type macros for C sharp."
> + "^\\s-*#endregion\\>"
> + (setq semantic-lex-end-point (match-end 0))
> + nil)
> +
> (define-lex-analyzer wisent-csharp-lex-string
> "Detect and create a string token for csharp
> strings."
> (looking-at wisent-csharp-string-re)
> ***************
> *** 284,289 ****
> --- 300,307 ----
> semantic-lex-ignore-whitespace
> semantic-lex-ignore-newline
> semantic-lex-ignore-comments
> + wisent-csharp-lex-ignore-region
> + wisent-csharp-lex-ignore-endregion
> wisent-csharp-lex-number
> wisent-csharp-lex-string
> wisent-csharp-lex-symbol
>
>
>
> >>> Amit Lath <amit_lath@...> seems to think
> that:
> >Hi,
> >
> >i tried to run the patch but it doesnt work. let
> me
> >once more show how these tags look:
> >
> >#region regionName
> >....some code here
> >#endregion
> >
> >so VS.Net will fold the code within these two with
> the
> >label "regionName".
> >
> >i dont know any emacs-lisp but i feel that maybe
> the
> >regex provided by you isnt compatible with the
> above
> >(i could be wrong in this though).
> >
> >i tried to write a regex of my own:
> >
> >^\\s*#(end)?region
> >
> >but that didnt work either (maybe i am missing some
> >required escape chars according to emacs-lisp
> syntax).
> >
> >thanks
> >amit
> >
> >--- "Eric M. Ludlam" <eric@...> wrote:
> >
> >> Hi,
> >>
> >> The macro things I had checked into CVS would
> not
> >> work with C sharp
> >> as they exist only in the C/C++ parser. I've
> made
> >> the below patch
> >> which I would guess will solve the #region
> problem.
> >> It would be great
> >> if someone could try it out and let me know if
> this
> >> patch works.
> >>
> >> I have since written a generic lexical
> >> pre-processor, but I don't
> >> like the first implementation. Also, I do need
> to
> >> focus more on
> >> making a real release of cedet before delving
> into
> >> such interesting
> >> things much more.
> >>
> >> Thanks
> >> Eric
> >>
> >> ----------------
> >> *** wisent-csharp.el 30 Sep 2005 15:50:54 -0400
> 1.4
> >> --- wisent-csharp.el 19 Mar 2006 11:05:53 -0500
> >> ***************
> >> *** 1,6 ****
> >> --- 1,8 ----
> >> ;;; wisent-csharp.el --- LALR grammar for C#
> >> ;;
> >> ;; Copyright (C) 2003 David Shilvock
> >> + ;; Some Changes Copyright (C) 2006 Eric M.
> Ludlam
> >> +
> >> ;; Time-stamp: <2003-12-08 19:11:48 dave>
> >> ;;
> >> ;; Author: David Shilvock <davels@...>
> >> ***************
> >> *** 244,249 ****
> >> --- 246,257 ----
> >> ;;; * Lexer
> >>
> >>
>
>;;;----------------------------------------------------------------------
> >>
> >> + (define-lex-regex-analyzer
> >> wisent-csharp-lex-ignore-macro
> >> + "Ignore # type macros for C sharp."
> >> + "^\\s-*#\\(end\\)>region\\>"
> >> + (setq semantic-lex-end-point (match-end 0))
> >> + nil)
> >> +
> >> (define-lex-analyzer wisent-csharp-lex-string
> >> "Detect and create a string token for csharp
> >> strings."
> >> (looking-at wisent-csharp-string-re)
> >> ***************
> >> *** 284,289 ****
> >> --- 292,298 ----
> >> semantic-lex-ignore-whitespace
> >> semantic-lex-ignore-newline
> >> semantic-lex-ignore-comments
> >> + wisent-csharp-lex-ignore-macro
> >> wisent-csharp-lex-number
> >> wisent-csharp-lex-string
> >> wisent-csharp-lex-symbol
> >>
> >>
> >>
> >>
> >> >>> <klaus.berndl@...> seems to think that:
> >> >>" But i think this problem could be solved
> via
> >> an appropriate setting =
> >> >of the option
> >> `semantic-lex-c-preprocessor-symbol-map' - see
> the =
> >> >documentation or search the=20
> >> >>semantic mailing-list - there was a thread
> which
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|