all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Matching of template <> in C++ mode
@ 2007-02-20  0:46 lutorm
  2007-02-20 13:04 ` rgb
  0 siblings, 1 reply; 3+ messages in thread
From: lutorm @ 2007-02-20  0:46 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,
I'm wondering if it's possible to extend the emacs paren matching
functionality to the less-than/greater-than that's used in template
expressions in C++? With recent developments in C++ it's easy to get
messages like:

test.o: In function `w77run(double, double, double, double, double,
double, int, double, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, bool, bool)':
/home/patrik/sunrise.realpoly/src/test.cc:184: undefined reference to
`bool
mcrx::shoot<mcrx::xfer<mcrx::dust_model<mcrx::scatterer<mcrx::polychromatic_scatterer_policy,
mcrx::local_random>, mcrx::cumulative_sampling, mcrx::local_random>,
mcrx::adaptive_grid<mcrx::absorber<blitz::Array<double, 1> >,
mcrx::dynamic_grid<mcrx::absorber<blitz::Array<double, 1> >,
mcrx::octogrid<mcrx::absorber<blitz::Array<double, 1> > > > >,
mcrx::local_random>, mcrx::scatter_shooter<mcrx::polychromatic_biaser>
>(mcrx::xfer<mcrx::dust_model<mcrx::scatterer<mcrx::polychromatic_scatterer_policy,
mcrx::local_random>, mcrx::cumulative_sampling, mcrx::local_random>,
mcrx::adaptive_grid<mcrx::absorber<blitz::Array<double, 1> >,
mcrx::dynamic_grid<mcrx::absorber<blitz::Array<double, 1> >,
mcrx::octogrid<mcrx::absorber<blitz::Array<double, 1> > > > >,
mcrx::local_random>&,
mcrx::scatter_shooter<mcrx::polychromatic_biaser>, mcrx::terminator
const&, std::vector<ranlib::MersenneTwister::mt_state,
std::allocator<ranlib::MersenneTwister::mt_state> >&, long, long&,
int, int, std::basic_string<char, std::char_traits<char>,
std::allocator<char> >)'

which would be infinitely more easy to parse if the matching pairs of
angle brackets were highlighted...

I browsed around the sources and couldn't find where the list of which
characters are considered "parenthesis" characters is stored. (Of
course it's a little more complicated since ideally it shoudn't think
that << are 2 nested parentheses. However, since neither << or
unmatched < as conditionals are allowed within template declarations,
it would just give an annoying "unmatched paren" message in these
cases. It would still be useful.)

Regards,

/Patrik J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Matching of template <> in C++ mode
  2007-02-20  0:46 Matching of template <> in C++ mode lutorm
@ 2007-02-20 13:04 ` rgb
  2007-02-20 19:57   ` lutorm
  0 siblings, 1 reply; 3+ messages in thread
From: rgb @ 2007-02-20 13:04 UTC (permalink / raw)
  To: help-gnu-emacs

> course it's a little more complicated since ideally it shoudn't think
> that << are 2 nested parentheses. However, since neither << or
> unmatched < as conditionals are allowed within template declarations,
> it would just give an annoying "unmatched paren" message in these
> cases. It would still be useful.)

Actually it would totally wreck real paren class matching.
The characters < and > are typically used all over and if
they had paren syntax then the parens in (x > y) would not
match any more.  The implementation would need to be careful
not to give < or > characters paren syntax except under the
specific template conditions you've described.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Matching of template <> in C++ mode
  2007-02-20 13:04 ` rgb
@ 2007-02-20 19:57   ` lutorm
  0 siblings, 0 replies; 3+ messages in thread
From: lutorm @ 2007-02-20 19:57 UTC (permalink / raw)
  To: help-gnu-emacs

On Feb 20, 5:04 am, "rgb" <rbiel...@i1.net> wrote:
> Actually it would totally wreck real paren class matching.
> The characters < and > are typically used all over and if
> they had paren syntax then the parens in (x > y) would not
> match any more.  The implementation would need to be careful
> not to give < or > characters paren syntax except under the
> specific template conditions you've described.

Yeah, you're right. I guess I'm thinking of it as two separate
functions, the blinking of matching parens and the determining if they
are mismatched. It would still be useful if it would blink matching
pairs of <> even if doing nothing else. However, this is not a new
problem, it already has to figure out if a paren character is in a
string or comment. I was going to say that the syntax highlighting has
to have solved it, too, but upon closer inspection it has not...

Anyway, it seems the number of people writing C++ with emacs must be
pretty large so I can't be the first one to think of this?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-20 19:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-20  0:46 Matching of template <> in C++ mode lutorm
2007-02-20 13:04 ` rgb
2007-02-20 19:57   ` lutorm

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.