Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Buckminster » How to deal with partitions when partition is not terminal
How to deal with partitions when partition is not terminal [message #652311] Thu, 03 February 2011 09:38 Go to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
Registered: July 2009
Senior Member
Hi,
The implementation of ITokenTypeToPartitionTypeMapper
creates text partitions based on lexer tokens (i.e. for comments or
strings). My strings are not a single terminal and are instead handled
as data type rules.

I created my own implementation of ITokenTypeToPartitionTypeMapper and
by marking all parts included in strings (except WS) auto edits work a
lot better. I would however like to protect against insertion of ML
comments when seeing /* in a string even if caret is after a WS in the
string.

I am wondering if I can assume that the #getPartitionType(int
antlrToken) will be called with *all* tokens thus making it possible to
detect the start and end of strings. However since the default
implementation of ITokenTypeToPartitionTypeMapper is marked as
@Singleton it makes me wonder if it is possible to maintain state.
If I mark it as a non singleton, will it be recreated lots and lots of
times? etc.

Any other suggestions how to handle non terminal string partitions?

Regards
- henrik
Re: How to deal with partitions when partition is not terminal [message #652413 is a reply to message #652311] Thu, 03 February 2011 14:06 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
Registered: July 2009
Senior Member
Sorry, obviously sent to the wrong forum :)
Now reposted where it was supposed to be sent... (tmf).

Sorry for the noise...
- henrik

On 2/3/11 3:38 PM, Henrik Lindberg wrote:
> Hi,
> The implementation of ITokenTypeToPartitionTypeMapper
> creates text partitions based on lexer tokens (i.e. for comments or
> strings). My strings are not a single terminal and are instead handled
> as data type rules.
>
> I created my own implementation of ITokenTypeToPartitionTypeMapper and
> by marking all parts included in strings (except WS) auto edits work a
> lot better. I would however like to protect against insertion of ML
> comments when seeing /* in a string even if caret is after a WS in the
> string.
>
> I am wondering if I can assume that the #getPartitionType(int
> antlrToken) will be called with *all* tokens thus making it possible to
> detect the start and end of strings. However since the default
> implementation of ITokenTypeToPartitionTypeMapper is marked as
> @Singleton it makes me wonder if it is possible to maintain state.
> If I mark it as a non singleton, will it be recreated lots and lots of
> times? etc.
>
> Any other suggestions how to handle non terminal string partitions?
>
> Regards
> - henrik
Previous Topic:Problem signing jar locally with custom keystore
Next Topic:NullPointerException in GenericSession
Goto Forum:
  


Current Time: Sat Aug 30 04:33:54 EDT 2014

Powered by FUDForum. Page generated in 0.01554 seconds