Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-07

Some strange effects in the IDE

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner
to Hans-Peter Diettrich: The code tools seem to have problems in parsing "case" statements, and with debugging…
Show quoted text 27 lines
The code tools seem to have problems in parsing "case" statements, and with debugging "while" statements. See this code snippet: //determine XML lines to copy while PFirst < XLast do begin //copy until PFirst while XFirst < PFirst do begin dst.Add(Strings[XFirst]); inc(XFirst); end; //merge patch dst.Add(DiffFile.Strings[DFirst]); inc(DFirst); //copy diff range header case DiffSec.c of 'a', 'c', 'd': //delete P (insert Diff lines before P?) begin // <---------------- this is line 134 -------------- while DFirst <= DLast do begin ... When navigating in this file (e.g. CTRL-SHIFT up/dn), the cursor is positioned at the marked line, at the "in" of "begin". The error message is: uxml.pas(134,10) Error: identifier expected, but in found (complete file uploaded with Mantis #19783) Does the parser have problems with character literals (and other expressions) as case labels?

The codetools itself uses a lot of them.

Can you reproduce it? For example edit something in front, so that the parser reparses the code in question.

I think I saw something fishy with undo that sometimes the source editor does not commit the changes to the codetools. Maybe this is the case here.

BTW the unit compiles, i.e. contains no real syntax errors. [...]

Mattias

Reply by email

Hans-Peter Diettrich

The code tools seem to have problems in parsing "case" statements, and with debugging "while" statements. See this code snippet:

//determine XML lines to copy
   while PFirst < XLast do begin
   //copy until PFirst
     while XFirst < PFirst do begin
       dst.Add(Strings[XFirst]); inc(XFirst);
     end;
   //merge patch
     dst.Add(DiffFile.Strings[DFirst]); inc(DFirst); //copy diff range
header
     case DiffSec.c of
     'a',
     'c',
     'd': //delete P (insert Diff lines before P?)
       begin // <---------------- this is line 134 --------------
         while DFirst <= DLast do begin
...

When navigating in this file (e.g. CTRL-SHIFT up/dn), the cursor is positioned at the marked line, at the "in" of "begin". The error message is: uxml.pas(134,10) Error: identifier expected, but in found (complete file uploaded with Mantis #19783)

Does the parser have problems with character literals (and other expressions) as case labels?
BTW the unit compiles, i.e. contains no real syntax errors.

As another strange effect the first "while" above is not marked with a dot at runtime, so that it's impossible to set an breakpoint on that line. Other "while" statements (e.g. last line above) have such dots. This may be a problem with compiler optimization?

DoDi

Reply by email

Hans-Peter Diettrich
to Mattias Gaertner: On Thu, 21 Jul 2011 19:15:50 +0100 The codetools itself uses a lot of them. Can you…
Can you reproduce it? For example edit something in front, so that the parser reparses the code in question.

Bingo, a change to the file solved the problem :-)

I think I saw something fishy with undo that sometimes the source editor does not commit the changes to the codetools. Maybe this is the case here.

Switching between editor files or windows frequently causes trouble. When moving the focus to an file in a different window, it often is required to also switch to another tab and back again, before the Code Explorer synchronizes with the newly selected file.

Related problem: code templates sometimes expand into an file in a different window (maybe last active there?). There could exist a bug with switching between multiple editor windows?

DoDi

Reply by email