17 ms·
Simpler thing that can be exploited is indentation: while(1) { if(foo) { if (bar) { ... I'm editing here! } } it is cl
by antirez 18y ago
Simpler thing that can be exploited is indentation:
while(1) {
if(foo) {
if (bar) {
... I'm editing here!
}
}
it is clear from indentation that the unmatch is about if(bar). Of course in order to get the level of the open bracket you need to get the index of the first non blank character of the same line. It's a trick but in the practice may work well.
I could like GCC being able to give me an hint about this instead of pointing to the end of the file... that is, if an unmatched bracket is detected and there is something odd about indentation levels of brackets it could show:
Warning: non closed bracket may be around line ...
It is simple even to understand from the source if it's a program where indentation is usually respected or not.
- jng 18y agoI plan to add indentation support to my system in the future... it's a very interesting area: gathering information from all available sources and using that to help the user. I do believe using the history of edits, as the article describes, has a much, much greater potential.