Compiler syntax check: correct line, wrong marker

Post bugs related to the IDE here
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Compiler syntax check: correct line, wrong marker

Post by IdeasVacuum »

PB5.43LTS x86 Win7

This does not happen often but sometimes the compiler identifies a faulty code line, but displays the marker on a different line.
Image
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Fred
Administrator
Administrator
Posts: 18349
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Compiler syntax check: correct line, wrong marker

Post by Fred »

If you can reproduce it we could to take a closer look.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Compiler syntax check: correct line, wrong marker

Post by Dude »

IdeasVacuum, are you using line continuation? I think it's related to that.
mestnyi
Addict
Addict
Posts: 1102
Joined: Mon Nov 25, 2013 6:41 am

Re: Compiler syntax check: correct line, wrong marker

Post by mestnyi »

The problem with "SetGadgetText()" now look at an example that demonstrates this.

Code: Select all

OpenWindow(0,0,0,400,400,"")
EditorGadget(1,10,10,50,30)
 
Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_Gadget 
      SetGadgetText(1,"Синий")
      
      Debug "Somehow it includes cycle"
  EndSelect
Until Event = #PB_Event_CloseWindow
End
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Compiler syntax check: correct line, wrong marker

Post by infratec »

@mestny
What has your code to do with the problem?

You get a loop because always a #PB_EventType_Change is produced.
Maybe that's not correct, because when I set a text via program, I know that it is changed.
But that's an other thing.

Bernd
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Compiler syntax check: correct line, wrong marker

Post by IdeasVacuum »

...not using line continuation (never have).

You have to be several hours in before the error occurs. I'd been working for about 10 hours (with breaks), then the complier marker became out of synch with the erroneous line. I reported it because this is not the first time (I know, hard to believe I get anything wrong eh? :D ), but it is not so important of course.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
mestnyi
Addict
Addict
Posts: 1102
Joined: Mon Nov 25, 2013 6:41 am

Re: Compiler syntax check: correct line, wrong marker

Post by mestnyi »

You get a loop because always a #PB_EventType_Change is produced.
It is not true.
I do not know how you check but I believe that this is a bug because of this all Bedi
In "EditorGadget" there is no such event in 1024 and why there?

Code: Select all

OpenWindow(0,0,0,400,400,"")
EditorGadget(1,10,10,50,30)
EditorGadget(2,110,110,50,30)

;  The following events are supported through EventType(): 
;   768 #PB_EventType_Change   : the Text has been modified by the user.
;   14000 #PB_EventType_Focus    : the editor has got the focus.
;   14001 #PB_EventType_LostFocus: the editor has lost the focus.

Debug #PB_EventType_LostFocus
Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_Gadget 
         Debug "Somehow it includes cycle "+EventType() ; 1024 Why?????????????????????
           SetGadgetText(1,"Blue")
              
;       Select EventType()
;         Case #PB_EventType_Change
;           Select EventGadget()
;             Case 1
;               SetGadgetText(1,"Blue")
;             Case 2
;               SetGadgetText(2,"Red")
;           EndSelect
;       EndSelect
  
      Debug "Somehow it includes cycle "+EventGadget()
  EndSelect
Until Event = #PB_Event_CloseWindow
End
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Compiler syntax check: correct line, wrong marker

Post by infratec »

@mestnyi

1. But still: What have your code to do with the problem of IdeasVacuum

2. You have always to check the type of an event.
So your code in general is not correct.
If you check for the valid EventTypes you don't run in a loop.

You can not rely on events which are not 'valid' for the gadget.

Code: Select all

OpenWindow(0,0,0,400,400,"")
EditorGadget(1,10,10,50,30)
ButtonGadget(2,110,110,80,30, "SetText")

Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 1
          Debug "EditorGadget event: " + Str(EventType())
          Select EventType()
            Case #PB_EventType_Change
              Debug "Changed"
            Case #PB_EventType_Focus
              Debug "Focus"
            Case #PB_EventType_LostFocus
              Debug "LostFocus"
          EndSelect
        Case 2
          SetGadgetText(1,"Test")
      EndSelect
  EndSelect
Until Event = #PB_Event_CloseWindow
End
Bernd
mestnyi
Addict
Addict
Posts: 1102
Joined: Mon Nov 25, 2013 6:41 am

Re: Compiler syntax check: correct line, wrong marker

Post by mestnyi »

:) :) :) As if I do not know. :shock:
I just wanted to PB was an ideal rather than an unpredictable. :wink:
Post Reply