[Gambas-user] Scripter swallows #Endif?

Tobias Boege taboege at ...626...
Sat Feb 14 15:31:04 CET 2015


Hi Benoit,

the scripter seems to have a problem when #Endif is the last line in a
script. This is the source code I consider:

  #If True
  Public Sub Main()
    Print "True is true"
  End
  #Else
  Public Sub Main()
    Print "True is false"
  End
  #Endif

If this is inside a Gambas project, it will compile and execute perfectly.
But if this is inside a script file, I get:

  $ ./endif-script.gbs3
  MMain.module:20:2: error: Missing #Endif

  # Gambas Project File 3.0
  Title=Gambas Script
  Startup=MMain

  ' Gambas module file

  #If True
  Public Sub Main()
    Print "True is true"
  End

  #Else
  Public Sub Main()
    Print "True is false"
  End


Indeed, the #Endif is missing in the output, but not in the sources. As you
can see in the script I sent along with the mail about "VarPtr() on array
syntax" a few minutes ago, this does not happen when #Endif is not the last
line in the script. To summarise:

                 |  Scripter  |  Without scripter
  ---------------+------------+--------------------
  Last line      |   Not OK   |         OK
  Not last line  |     OK     |         OK

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: endif-project-0.0.1.tar.gz
Type: application/octet-stream
Size: 3718 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20150214/c16b2288/attachment.obj>
-------------- next part --------------
#!/usr/bin/gbs3

#If True
Public Sub Main()
  Print "True is true"
End
#Else
Public Sub Main()
  Print "True is false"
End
#Endif


More information about the User mailing list