Lazarus

Programming => Operating Systems => Mac OS X => Topic started by: MISV on March 27, 2019, 03:12:35 pm

Title: Error: Wrong token type: Symbol expected but / found ...
Post by: MISV on March 27, 2019, 03:12:35 pm
I am suddenly getting this error when compiling my project (almost unchanged, only edited some .pas files)

Quote
Error: Wrong token type: Symbol expected but / found (at 9,22, stream offset 000000CD)
XXX.dpr(166,0) Error: Error while compiling resources -> Compile with -vd for more details. Check for duplicates.

However - that error message is with -vd added since if I go to "Project options" and click "Show options" I can see that -vd has been added:

...

One thing I noticed is that if I click "Project options - Test" I get

Quote
HINT: using config file /Users/zzz/lazaruscoc64bit/fpc/bin/x86_64-darwin/fpc.cfg
WARNING: ppu exists twice: /Users/zzz/lazaruscoc64bit/fpc/lib/fpc/3.0.4/units/x86_64-darwin/univint/Dialogs.ppu, /Users/zzz/lazaruscoc64bit/fpc/lib/fpc/3.0.4/units/x86_64-darwin/fv/dialogs.ppu
WARNING: ppu exists twice: /Users/zzz/lazaruscoc64bit/fpc/lib/fpc/3.0.4/units/x86_64-darwin/univint/Menus.ppu, /Users/zzz/lazaruscoc64bit/fpc/lib/fpc/3.0.4/units/x86_64-darwin/fv/menus.ppu
WARNING: ppu exists twice: /Users/zzz/lazaruscoc64bit/fpc/lib/fpc/3.0.4/units/x86_64-darwin/fv/dialogs.ppu, /Users/zzz/lazaruscoc64bit/lazarus/lcl/units/x86_64-darwin/dialogs.ppu
WARNING: ppu exists twice: /Users/zzz/lazaruscoc64bit/fpc/lib/fpc/3.0.4/units/x86_64-darwin/fv/menus.ppu, /Users/zzz/lazaruscoc64bit/lazarus/lcl/units/x86_64-darwin/menus.ppu
WARNING: ppu exists twice: /Users/zzz/lazaruscoc64bit/fpc/lib/fpc/3.0.4/units/x86_64-darwin/univint/Controls.ppu, /Users/zzz/lazaruscoc64bit/lazarus/lcl/units/x86_64-darwin/controls.ppu
WARNING: ppu exists twice: /Users/zzz/lazaruscoc64bit/fpc/lib/fpc/3.0.4/units/x86_64-darwin/univint/Dialogs.ppu, /Users/zzz/lazaruscoc64bit/lazarus/lcl/units/x86_64-darwin/dialogs.ppu
WARNING: ppu exists twice: /Users/zzz/lazaruscoc64bit/fpc/lib/fpc/3.0.4/units/x86_64-darwin/univint/Menus.ppu, /Users/zzz/lazaruscoc64bit/lazarus/lcl/units/x86_64-darwin/menus.ppu

Could that be the reason?
Title: Re: Error: Wrong token type: Symbol expected but / found ...
Post by: MISV on March 27, 2019, 04:17:22 pm
I have been experimenting trying to compile in older Lazarus version and then returning back.

Disabling all filters on "Messages" I now get this:

Quote
Debug: /Volumes/DiskW/shared-code/xxx/UmsSysConvert.pas(1021,1)  (3049) procedure/function msAlignmentToStr(const TAlignment):AnsiString;
Debug: An unhandled exception occurred at $000000010D98DBEE:
Debug: EAccessViolation: Access violation
Debug:   $000000010D98DBEE
Debug:
Verbose: Assembling (pipe) /Volumes/DiskW/yyy/lib/x86_64-darwin/UmsSysConvert.s
Fatal: Compilation aborted
Verbose: /Users/zzz/lazaruscoc64bit/fpc/bin/x86_64-darwin/ppcx64 returned an error exitcode

....

The only worthwhile thing mentioning about declaration:
Code: Pascal  [Select]
  1. function msAlignmentToStr(const Alignment: TAlignment): string;
  2.  

is that it is placed just before implemention

and its implementation is placed just before end.

Code: Pascal  [Select]
  1. function msAlignmentToStr(const Alignment: TAlignment): string;
  2. begin
  3.   case Alignment of
  4.     taLeftJustify: Result := 'left';
  5.     taRightJustify: Result := 'right';
  6.     taCenter: Result := 'center';
  7.     else Result := '';
  8.   end;
  9. end;
  10.  
Title: Re: Error: Wrong token type: Symbol expected but / found ...
Post by: MISV on March 27, 2019, 04:31:18 pm
The error only occurs when building my software. Not if I build a package that contains the unit.

I guess I will try with a trunk version. Does anyone know how I get more information about AccessViolation that happens the compiler? Maybe somehow lldb startlazarus? I will try research that when I get back tonight
Title: Re: Error: Wrong token type: Symbol expected but / found ...
Post by: howardpc on March 27, 2019, 05:47:28 pm
If you remove the const modifier for the TAlignment parameter does it make any difference?
Title: Re: Error: Wrong token type: Symbol expected but / found ...
Post by: MISV on March 27, 2019, 08:23:21 pm
That solved the access violation error in the compiler.

However - the original problem has now returned:

Quote
Error: Wrong token type: Symbol expected but / found (at 9,22, stream offset 000000CD)
XXX.dpr(166,0) Error: Error while compiling resources -> Compile with -vd for more details. Check for duplicates.

My .dpr file is 165 lines - Maybe it is somehow trying to grab .res file twice? I wish I could see the problem though - the -vd does not seem to be working
Title: Re: Error: Wrong token type: Symbol expected but / found ...
Post by: MISV on March 27, 2019, 08:42:17 pm
Nevermind - running with verbose I can see the problem happens for one of my forms. Not quite sure why or how - but opening the form in Lazarus at designtime fails  as well
Title: Re: Error: Wrong token type: Symbol expected but / found ...
Post by: lucamar on March 27, 2019, 09:40:59 pm
Open the .dpr with any text editor and check the offending line(s). It's the only way to see what the compiler is complaining about.

BTW, .DPR? Is that a Delphi project?
Title: Re: Error: Wrong token type: Symbol expected but / found ...
Post by: MISV on March 27, 2019, 11:05:30 pm
I believe this issue has now been resolved - the .dfm file was somehow corrupt - transferring it again worked. Mysterious.