Problems with BlitzMax 1.22

Miscellaneous Forums/General Discussion/Problems with BlitzMax 1.22

After I just installed the update BlitzMax 1.22 I got the error:
"Expecting expression but encountered ElseIf" for a codeline:
"Elseif state =>10 or state <=20 Then"
while the same code runs within BlitzMax 1.20 without errors.

So I deinstalled BlitzMax totally from my WinXP sytem, deleted the folder, installed BlitzMax 1.18, synchronized modules, updated to BlitzMax 1.20, synchronized the modules:
The code runs with no errors.

I again installed the BlitzMax 1.22 update and already before synchronizing modules (but also after synchronizing) I get again the error described above.

I also don't use any custom mods, so may this be a compiler problem ? I don't expect a solution for this vage thing in a short time, so I go back to BlitzMax 1.20 and mention this problem just for information purposes in case other users make similar experiences.

Interesting may be also that the mouse pointer after error has not the form of a text insertion caret as usual when it is above a code window but stays displaying an arrow left up.

change "Elseif" to "Else If"?

actually this is the second time i've heard of this.

I've used ElseIf without problems so it'll be something else.

Missing EndIfs/Nexts etc often throw errors in parts of code which are nothing to do with the error itself. Post some code then people can have a look.

yeah I raised a topic about this a while ago when I first noticed it. You probably need EndIf on a new line after the ElseIf, if you don't have one already.

yeah and the arrow is screwed in the IDE.

Ah yes, it was Greys thread, I thought the "EndiF/End If" problem was the cause. I was wrong :)

Ok I always used "ElseIf" and not "Else If" and wrote "End If" but not "EndIf". So now I run a "Find a replace" making this expressions to "Else If" and "EndIf".

Now suddenly the error message is: "Else without matching If", which obviously indicates an error of the nested structure (which I haven't found yet).

But this can't be the whole truth, I think: why then BlitzMax 1.20 did not throw a compile error also ? This version used flat assembler 1.64, BlitzMax 1.22 uses flat assembler 1.66. Doesn't this look as if the new assembler version reads the source code in a slightly different way than the previous version ? May be like under some circumstances interpreting "End If" as an "End" followed by "If" or something like that ?

Its 'ElseIf', not 'Else If'!

Doesn't this look as if the new assembler version reads the source code in a slightly different way than the previous version ?
No!

Post the entire (unmolested) section of code.

I found the error triggering code line at last, it has nothing to do with the writing like "Else If" or "ElseIf", "End If" or "End If".

The amazing fact is, that under BlitzMax 1.20 some source code is compiled without error whether you remarked a certain "End If" or not !

(See Code line 657)

Type appDrawing

  Method RefreshState()
 
    ' a Tool Tip has no states or mouse actions to evaluate:
    If drawGuiType =2 Then Return

    ' for drawToggle =TRUE:
    Local mouseIsOver:Int =False

    ' first calculate the current state and add it to the stack
    If drawCurrentState <8 Then
	    ' 8, 9, 10, 11, 12, 13: RETURN-states, overrides mouse actions
      ' 14 : for orientDrawing only: assigned appText currently gets edited
      ' 15, 16, 17, 18, 19, 20: states of an appDrawing serving as a column of a List line 
	    If appMouseFound =False Then
	      If p =1 Then
		      ' Mouse is just over appDrawing

		      ' custom mouse pointer for that appDrawing set ?
	        If drawCustomMouse <>Null Then

	        Else
	
	        End If
	
	        ' updated Tool Tip for that appdrawing ?
	        If drawSpecialToolTip >0 Then
            If drawScrollBar <>Null Then
              If drawScrollBar Then
                If drawSpecialToolTip <5 Then

                Else

                End If

              Else
                If drawSpecialToolTip <5 Then

                Else

                End If
              End If

              If drawSpecialToolTip =2 Or drawSpecialToolTip =6 Then
                If drawGuiType =10 Or drawGuiType =110 Then

                ElseIf (drawGuiType =>11 And drawGuiType <=14) Or (drawGuiType =>111 And drawGuiType <=114) Then

                ElseIf drawGuiType =15 Or drawGuiType =115 Then

                End If
              ElseIf drawSpecialToolTip =3 Or drawSpecialToolTip =7 Then
                If drawGuiType =10 Or drawGuiType =110 Then

                ElseIf (drawGuiType =>11 And drawGuiType <=14) Or (drawGuiType =>111 And drawGuiType <=114) Then

                ElseIf drawGuiType =15 Or drawGuiType =115 Then

                End If
              ElseIf drawSpecialToolTip =4 Or drawSpecialToolTip =8 Then
                If drawGuiType =10 Or drawGuiType =110 Then

                ElseIf (drawGuiType =>11 And drawGuiType <=14) Or (drawGuiType =>111 And drawGuiType <=114) Then

                ElseIf drawGuiType =15 Or drawGuiType =115 Then

                End If 

              End If
              If drawToolTipText <>curTip Then
                If drawToolTipCreated Then DeleteToolTip =1

              End If
            Else
              If drawToolTipCreated Then DeleteToolTip =1

            End If   
	        End If
	        If Not(drawToolTipShown) Then
	          If drawToolTipText <>"" Then
 	            If Not(drawToolTipCreated) Then

              End If
              If appCustomMouseUsed Then

              End If 
              If appMouseX +offsetX +drawToolTipdrawImgWidth >appWidth Then

              Else

              End If
              If appMouseY +offsetY +drawToolTipdrawImgHeight >appHeight Then

              Else              

              End If
            End If
          Else
            If appCustomMouseUsed Then

            End If 
            If appMouseX +offsetX +drawToolTipdrawImgWidth >appWidth Then

            Else

            End If
            If appMouseY +offsetY +drawToolTipdrawImgHeight >appHeight Then

            Else              

            End If
	        End If
	      	If appMouseLeftDown Then
	          If drawLastState =4 Then

            ElseIf drawLastState =2 Then

	          ElseIf drawLastState =1 Then

	          Else
	            ' if mouse is over appDrawing and mouse button was already pressed earlier:
	            ' this is evaluated as a passive situation for the appDrawing !

	          End If
	        ElseIf appMouseRightDown Then
          	If drawLastState =5 Then

	          ElseIf drawLastState =3 Then

	          ElseIf drawLastState =1 Then

	          Else
	            ' if mouse is over appDrawing and mouse button was already pressed earlier:
	            ' this is evaluated as a passive situation for the appDrawing !

	          End If
	        Else
	          If drawLastState =4 Then

	          ElseIf drawLastState =5 Then

	          Else

	          End If
	        End If
	      Else
	        drawCurrentState =0
	        If drawToolTipShown Then

	        End If
	      End If 
	    Else
	      drawCurrentState =0
  	    If drawToolTipShown Then


	      End If
	    End If
     	If Right$(drawAnimStack, 1) <>Trim$(drawCurrentState) Then

      End If

    ElseIf drawCurrentState =>15 And drawCurrentState <=19 Then
      ' 15, 16, 17, 18 19, 20: states of an appDrawing serving as a column of a List line 
      ' (20 : cell without any data)
      If appMouseFound =False Then
	      If p =2 Then
		      ' Mouse is just over appDrawing

		      ' custom mouse pointer for that appDrawing set ?
	        If drawCustomMouse <>Null Then

	        Else

	        End If
	
          If Not(drawToolTipShown) Then
	          If drawToolTipText <>"" Then
 	            If Not(drawToolTipCreated) Then

              End If
              If appCustomMouseUsed Then

              End If 
              If appMouseX +offsetX +drawToolTipdrawImgWidth >appWidth Then

              Else

              End If
              If appMouseY +offsetY +drawToolTipdrawImgHeight >appHeight Then

              Else              

              End If
            End If
          Else
            If appCustomMouseUsed Then

            End If 
            If appMouseX +offsetX +drawToolTipdrawImgWidth >appWidth Then

            Else

            End If
            If appMouseY +offsetY +drawToolTipdrawImgHeight >appHeight Then

            Else              

            End If
	        End If
          If drawListlistEnabled And drawListlistMouseSetActive Then
            If drawListListSetActiveLineColumn Then
              If appActiveList <>drawList Then 
                If appActiveList <>Null Then

                ElseIf appActiveText <>Null Then

                End If 
                If drawList <>Null Then

                End If
              End If
              ' the highlighted active line has changed; to update the other appDrawings of the List line
              ' already in this run through main loop, which run earlier through RefreshState(),
              ' refresh their state again: 
              If drawListlistSelection =0 Then
                For Local z:Int =0 To drawListlistDisplayedColumns -1
                  'drawListlistAppDrawingsdrawListLine -1, zRefreshState()
                Next
              End If
            End If

          End If
          If Not(drawLabelEdited Or drawLabelMultiEdited) Then
            If appMouseLeftDown Then
              If drawListState =1 Then drawListState =2
            Else
              If drawListState =0 Then

              ElseIf drawListState =2 Then

              End If
            End If
          End If 
        Else
  	      If drawToolTipShown Then

	        End If

	      End If
	
	    Else
	      If drawToolTipShown Then

	      End If

	    End If
	
    Else
      If drawToolTipShown Then

	    End If
	  End If

	  '-------------------------------------------------------------------------------------------
	  ' secondly evaluate the state
	  ' (while on the visual level an animation of an earlier state still may be running !)
    Local curVisible:Int =drawVisible
    If drawCurrentState <8 Then
      If drawAutoZ =0 Then      
        If drawZ <0 Then 

        End If 
      ElseIf drawY +drawSurOffsetY >appHeight Then

      ElseIf drawY +drawSurOffsetY +drawSurHeight <0 Then

      End If

      If curVisible Then
        If drawCurrentState =2 Or drawCurrentState =4 Then
          If drawMouseAwareness =1 Or drawMouseAwareness =2 Then
            ' dragging operations with left mouse button hold
            ' this may change the focus of an appDrawing, 
            ' but does NOT change appActiveText or appActiveList !
            ' BUT to an active List keyboard actions are already now not transferred anymore,
            '     because this transfer depends on the appCurFocus !
            If appDrawDragging =Null Then

              If drawIsDraggable >2 Then

              End If
              If drawFocusOrder >0 Then

              Else

              End If          
            End If 
          Else
            ' button to increase/decrease a Scroll Bars value ?
            If drawGuiType =11 Or drawGuiType =111 Then

            ElseIf drawGuiType =12 Or drawGuiType =112 Then

            ElseIf drawIsWord Then 
	            ' if word, also set focus already with starting of text selecting
	            If drawTextAssignedtxtWordsdrawWordIndexwrdSelectable Then
	              If drawTextAssignedtxtOrientDrawing <>Null Then
	                If drawTextAssignedtxtOrientDrawingdrawList =Null Then

                  Else

                  End If
	                If appCurFocus >0 Then

	                Else

	                End If          
	              End If
	            End If
	            ' and set appActiveText
	            If appActiveText <>drawTextAssigned Then

	            End If

	            If Not(appActiveTexttxtHasSelection) Then
	              If appActiveTexttxtCursorWord =-1 Then
	                For Local z2:Int =0 To appActiveTexttxtWordCount -1
	                  If appActiveTexttxtWordszwrdEditable And appActiveTexttxtWordszwrdvisible Then
	                    
	                    Exit
	                  End If
	                Next 
	              End If 
	            End If
	            If appActiveTexttxtOrientDrawing <>Null Then
                If drawTextAssignedtxtOrientDrawingdrawList =Null Then	

	              End If
              	If appActiveList <>appActiveTexttxtOrientDrawingdrawList Then

                End If
              Else

	            End If
              ' calculate cell where mouse is in
	            While curCell <drawCharCellsLength  
	              If appMouseX <=curLeft Then Exit

	            Wend
	            If KeyDown(KEY_LSHIFT) Then

	            ElseIf KeyDown(KEY_LCONTROL) Then

	            Else

	            End If
	          End If  
          End If

        ElseIf drawCurrentState =3 Or drawCurrentState =5 Then
          If drawMouseAwareness =1 Or drawMouseAwareness =3 Then
            ' dragging operations with right mouse button hold
            ' this may change the focus of an appDrawing, 
            ' but does NOT change appActiveText or appActiveList !
            ' BUT to an active List keyboard actions are already now not transferred anymore,
            '     because this transfer depends on the appCurFocus !
            If appDrawDragging =Null Then
              If drawIsDraggable >2 Then

              End If
              If drawFocusOrder >0 Then

              Else

              End If
            End If
          End If

        ElseIf drawCurrentState =6 Then          
          ' click or doubleclick left
          ' here also appActiveText and appActiveList may be changed 
          If drawIsWord Then

          Else
            ' set focus first time here if its not a word or a dragged appDrawing
            If (drawGuiType =>10 And drawGuiType <=15) Or (drawGuiType =>110 And drawGuiType <=115) Then
              ' if it a part of a Scroll Bar serving a List: set focus to the List !
              If drawScrollBarscrollsAppListV <>Null Then
        	      If appActiveList <>drawScrollBarscrollsAppListV Then 
                  If appActiveList <>Null Then

                  ElseIf appActiveText <>Null Then

                  End If 
                End If
              ElseIf drawScrollBarscrollsAppListH <>Null Then
        	      If appActiveList <>drawScrollBarscrollsAppListH Then 
                  If appActiveList <>Null Then

                  ElseIf appActiveText <>Null Then

                  End If 
                End If
              Else
                ' appCurFocus  >0 gets checked below
                If appCurFocus =0 Then
          	      If appActiveList <>drawList Then 
                    If appActiveList <>Null Then
 
                    ElseIf appActiveText <>Null Then

                    End If 
                    If drawList <>Null Then

                    End If
                  End If
                End If
              End If
            Else 
              ' appCurFocus  >0 gets checked below
              If appCurFocus =0 Then
        	      If appActiveList <>drawList Then 
                  If appActiveList <>Null Then

                  ElseIf appActiveText <>Null Then

                  End If 
                  If drawList <>Null Then

                  End If
                End If
              End If
            End If
	          If drawFocusOrder >0 Then
   	          ' is an appLabel assigned which becomes editable on click ?
              If drawGuiType =6 Then 

              ElseIf drawGuiType =106 Then 

   	          ' is an appLabelMulti assigned which becomes editable on click ?
              ElseIf drawGuiType =8 Then 

              ElseIf drawGuiType =108 Then 

              ElseIf Not(drawLabelEdited Or drawLabelMultiEdited) Then
  	            If appActiveText <>drawTextAssigned Then

	              End If
	              If appActiveText <>Null Then
	                If appActiveTexttxtVisible Then
  	                If Not(appActiveTexttxtHasSelection) Then
	                    If appActiveTexttxtCursorWord =-1 Then
	                      For Local z3:Int =0 To appActiveTexttxtWordCount -1
	                        If appActiveTexttxtWordszwrdEditable And appActiveTexttxtWordszwrdvisible Then
	                          
  	                        Exit
	                        End If
	                      Next 
	                    End If
	                  End If 
  	                If appActiveTexttxtOrientDrawing <>Null Then
                      
                    End If
                  Else
                    
                  End If
	              End If
        	      If appActiveList <>drawList Then 
                  If appActiveList <>Null Then
                    
                  ElseIf appActiveText <>Null Then
                   
                  End If 
                  If drawList <>Null Then
                   
                  End If
                End If
              End If
	          Else

  	        End If  
          End If
          If appRunning_ms -appMouseLeftDownTime <=appMouseClickRestTime Then
            ' doubleclick
            ' double click on a selectable word ?
            If drawIsWord Then
              If KeyDown(KEY_LSHIFT) Then

              ElseIf KeyDown(KEY_LCONTROL) Then

              Else

              End If       
            End If
            If drawIsClickable =1 Or drawIsClickable =2 Then
              If drawToggle Then 
                If drawAnimOnMousePressedL >-1 Then

                End If
                Local maxState2:Int =999999
                If drawAnimOnMouseOver >-1 Then

                End If
                If drawClickState >Min(maxState1, maxState2) Then

                End If
              End If
              If drawGuiType =0 Then

              ElseIf drawGuiType <100 Then

              ElseIf drawGuiType >100 And appEditMode Then

              End If
            End If
          Else
            If drawIsWord Then
              If drawTextAssignedtxtMouseSelDone =False Then
                If drawWordEditable Then
                  For Local z4:Int =0 To drawCellDown -1

                  Next
                  ' display cursor cell even though current clicking on it requires displaying already ?
                  ' because current displaying may be only partially !
                End If
              Else

              End If
            End If
            If drawIsClickable =1 Or drawIsClickable =2 Then
              If drawToggle Then 
                If drawAnimOnMousePressedL >-1 Then

                End If
                Local maxState3:Int =999999
                If drawAnimOnMouseOver >-1 Then

                End If
                If drawClickState >Min(maxState1, maxState2) Then

                End If
              End If
              If drawGuiType =0 Then

              Else 
                ' here EVENT_GUICLICKEDLEFT() is not raised now 
                ' but after appText editing is done !!!
                If drawGuiType =5 Then
                  Repeat
                    For Local curLbl2:Int =drawLabelAssignedCount To 1 Step -1
                      If drawLabelAssignedStatecurLbl -1 =targetState Then
                        Exit
                      End If
                    Next
                    If Not(success) Then
                      If targetState =drawCurrentState Then

                      ElseIf targetState =-1 Then

                      End If
                    End If
                  Until success
                ElseIf drawGuiType =6 Then
                  ' see above: click made editable Label edited, does not raise EVENT_CLICK

                ElseIf drawGuiType =7 Then
                  Repeat
                    For Local curLbl3:Int =drawLabelMultiAssignedCount To 1 Step -1
                      If drawLabelMultiAssignedStatecurLbl -1 =targetState Then

                        Exit
                      End If
                    Next
                    If Not(success) Then
                      If targetState =drawCurrentState Then

                      ElseIf targetState =-1 Then

                      End If
                    End If
                  Until success
                ElseIf drawGuiType =8 Then
                  ' see above: click made editable LabelMulti edited, does not raise EVENT_CLICK

                ElseIf drawGuiType <100 Then
                  ' button to set a Scroll Bars value minimal or maximal ?
                  If drawGuiType =13 Then

                  ElseIf drawGuiType =14 Then

                  ElseIf drawGuiType =15 Then
                  ' Scroll bars background 

                  ElseIf drawGuiType =>10 And drawGuiType <=12 Then
                  ' no click event for Scroll Bars button: drag, incr, decr !
                  Else

                  End If
                End If
              End If

              If appEditMode Then
                If drawGuiType =105 Then
                  Repeat
                    For Local curLbl4:Int =drawLabelAssignedCount To 1 Step -1
                      If drawLabelAssignedStatecurLbl -1 =targetState Then

                        Exit
                      End If
                    Next
                    If Not(success) Then
                      If targetState =drawCurrentState Then

                      ElseIf targetState =-1 Then

                      End If
                    End If
                  Until success
                ElseIf drawGuiType =106 Then
                  ' see above: click made editable Label edited, does not raise EVENT_CLICK

                ElseIf drawGuiType =107 Then
                  Repeat
                    For Local curLbl:Int =drawLabelMultiAssignedCount To 1 Step -1
                      If drawLabelMultiAssignedStatecurLbl -1 =targetState Then

                        Exit
                      End If
                    Next
                    If Not(success) Then
                      If targetState =drawCurrentState Then

                      ElseIf targetState =-1 Then

                      End If
                    End If
                  Until success

                ElseIf drawGuiType =108 Then
                  ' see above: click made editable LabelMulti edited, does not raise EVENT_CLICK
   
                ElseIf drawGuiType >100 Then
                  ' button to set a Scroll Bars value minimal or maximal ?
                ElseIf drawGuiType =113 Then

                ElseIf drawGuiType =114 Then

                ElseIf drawGuiType =115 Then
                  'Scroll bars background 

                ElseIf drawGuiType =>110 And drawGuiType <=112 Then
                  ' no click event for Scroll Bars button: drag, incr, decr !
                Else

'REMARK or UNREMARK in both case no error under BlitzMax 1.20'''''''                  'End If
                End If
              End If
            End If
          End If

        ElseIf drawCurrentState =7 Then
          ' single click (only !) right
          ' set focus first time here if its not a word or a dragged appDrawing
          If Not(drawIsWord) Then
            If drawFocusOrder >0 Then

            Else

            End If
            If appActiveText <>drawTextAssigned Then

            End If
	          If appActiveText <>Null Then
	            If appActiveTexttxtVisible Then
  	            If Not(appActiveTexttxtHasSelection) Then
	                If appActiveTexttxtCursorWord =-1 Then
	                  For Local z7:Int =0 To appActiveTexttxtWordCount -1
	                    If appActiveTexttxtWordszwrdEditable And appActiveTexttxtWordszwrdvisible Then
	                      
	                      Exit
	                    End If
	                  Next 
	                End If
	              End If 
	              If appActiveTexttxtOrientDrawing <>Null Then

                End If
              Else

              End If
  	        End If
    	      If appActiveList <>drawList Then 
              If appActiveList <>Null Then

              ElseIf appActiveText <>Null Then

              End If 
              If drawList <>Null Then

              End If
            End If
          End If
          If drawIsClickable =1 Or drawIsClickable =3 Then
            If drawGuiType =0 Then

            ElseIf drawGuiType <100 Then

            ElseIf drawGuiType >100 And appEditMode Then

            End If 
          End If
        End If
      End If 

    ElseIf drawCurrentState =>15 And drawCurrentState <=19 Then
      ' a column of a Lists line
      If drawListState =3 Then
        ' a click happened !
        ' set focus first time here if its not a word or a dragged appDrawing
	      If appCurFocus >0 Then

	      Else 

        End If
        If appActiveList <>drawList Then 
          If appActiveList <>Null Then

          ElseIf appActiveText <>Null Then

          End If 
          If drawList <>Null Then

          End If
        End If
        If drawIsClickable =1 Or drawIsClickable =2 Then
          If drawListlistEnabled Then
            If Not(drawListlistMouseSetActive) Then
              ' set active line/column with a click
              If drawListListSetActiveLineColumn Then

              End If
            End If
            ' listMouseSetActive =TRUE: (only !) EditableOnFocus =TRUE -Label /LabelMulti were set edited 
            '               already with becoming active cell, other Label/appLabelMulti must get a click !
            If drawListlistSelection =1 Then 
              If Not(drawGUIEditOnFocus) Then
	              If drawGuiType =6 Then 

	              ElseIf drawGuiType =106 Then 

	              ' is an appLabelMulti assigned which becomes editable on click ?
	              ElseIf drawGuiType =8 Then 

  	            ElseIf drawGuiType =108 Then 

                End If
	            End If
	          End If
            If drawListDataInvertLineSelection Then
              ' if this an editable appLabel/appLabelMulti, DataInvertLineSelection have returned FALSE !
              If appActiveListlistSelection =0 Then
                If dataIndex >-1 Then
                  If Not(appActiveListlist4Edit) Then 
                    If appActiveListdataLinesdataIndexlineIsSelected Then
                      
                    Else
                      
                    End If
                  ElseIf appEditMode And appActiveListlist4Edit Then
                    If appActiveListdataLinesdataIndexlineIsSelected Then
                      
                    Else
                      
                    End If
                  End If
                End If

              ElseIf appActiveListlistSelection =1 Then 
                If dataIndex >-1 Then
                  If Not(appActiveListlist4Edit) Then 
                    For Local z8:Int =1 To appActiveListdataLinesdataIndexlinesColumnsSelectedLength
                      If appActiveListdataLinesdataIndexlinesColumnsSelectedz -1 Then 

                      Else

                      End If
                    Next
                  
                  ElseIf appEditMode And appActiveListlist4Edit Then 
                    For Local z9:Int =1 To appActiveListdataLinesdataIndexlinesColumnsSelectedLength
                      If appActiveListdataLinesdataIndexlinesColumnsSelectedz -1 Then 

                      Else

                      End If
                    Next
                  End If
                End If
              End If
            End If 
          End If
        End If
      End If
    End If

  End Method
  '---------------------------------------------------------------------------------------------------------------
End Type


my god that code is nested hell haha. Anyway BRL Mark said that the old compiler had a but and allowed ElseIf to be used in an incorrect manner (which I was doing and so were you evidently) and it's now fixed. When you understand the correct way to use it, it's fine.

Mebbe you should consider using Select statements instead of long sections of ElseIf's?
More readable/maintainable...
eg.
Select drawGuiType
  Case 0
  Case 5
    Repeat....

  Case 6
    ' see above: click made editable Label edited, does not raise EVENT_CLICK

  Case 7
    Repeat...

.. etc

End Select


Just an idea :-)

Brucey has made a good point there. ;)