Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313938 - bracket matching fails to match in many cases
Summary: bracket matching fails to match in many cases
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.0   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: M2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 323817
Blocks:
  Show dependency tree
 
Reported: 2010-05-21 12:29 EDT by Henrik Lindberg CLA
Modified: 2017-09-19 16:22 EDT (History)
2 users (show)

See Also:
sven.efftinge: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Lindberg CLA 2010-05-21 12:29:34 EDT
Hi,
the automatic bracket matching (i.e. matching bracket being highlighted)
only works for me in some situations.

As an example - in this b3 text:

repository svn MyRepo { connection : "http://abc.org"; }
resolution {
select-first {
repository MyRepo { path : "/features" ; }
}
}

the matching does not work for the outermost brackets.
(In fact, this part was the only part where it actually managed to match
brackets).

Wonders if the bracket matching is done with aid from the grammar and that the problems occur because of backtracking...

Seems like the matching of brackets should be done at the lexical level so should not really be affected by a complicated grammar.

The matching also breaks if there are syntax errors:
Here matching works (using | to highlight what it matches, and what I expect:
  select-first {
    repository  MyRepo {| path : "features" ; }|
  }

But not here:
  select-first {|
    repository  MyRepo  path : "features" ; }|
  }

I assume it is supposed to really show the lexical matching as this is very useful when there are matching errors.

Problem can be observed with latest b3, and input like:
function foo() { }
Comment 1 Henrik Lindberg CLA 2010-06-07 21:49:23 EDT
I think this is related to Unordered Group issues (bug 315581, bug 315335) since matching brackets works after I modified the grammar to not use Unordered Groups (the use of the unordered group is described in the two issues).
Comment 2 Sven Efftinge CLA 2010-08-03 05:17:27 EDT
We should rewrite bracket matching such that it doesn't rely on tokens but on simple characters and strings. Also we should have something like partitions, i.e. handling comments and string literals separately. Rescheduling for Indigo
Comment 3 Sven Efftinge CLA 2010-09-03 14:40:37 EDT
Bracket matching is now based on JFace's DefaultCharacterPairMatcher.
Comment 4 Karsten Thoms CLA 2017-09-19 16:22:37 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.