Updates to fix issues with multi line enum

[Scripter]
* BUG: Fix incorrect processing of multi line enum, when main is not defined in the script
This commit is contained in:
Brian G 2021-11-15 12:42:27 -08:00
parent 79ff9b9f2d
commit ee203da640
3 changed files with 14 additions and 5 deletions

View file

@ -1,3 +1,9 @@
* Mon Nov 15 2021 benoit <benoit@localhost> 3.16.90
* Mon Nov 15 2021 benoit <benoit@localhost> 3.16.90
* Mon Nov 15 2021 benoit <benoit@localhost> 3.16.90
* Sun Aug 08 2021 benoit <benoit@localhost> 3.16.90
* Sun Aug 08 2021 benoit <benoit@localhost> 3.16.90

View file

@ -8,8 +8,7 @@ Component=gb.eval
Component=gb.pcre
Description="Gambas Script"
Authors="Fabien Bodard, Benoit Minisini, Brian G"
Arguments=[["--help"],["--use","'gb.notify,gb.web'","-e","For i as Integer = 0 To 10:Print \"Hello World\":Next"],["~/bin/who"],["-c","-T","~/bin/mytest"],["-v","TestApp"],["--verbose","TestAppWithMain"],["--verbose","TestLazyApp"],["-c","~/testerror.gbs"],["~/Scripts/TestQuoteAtEnd"],["-c","~/Scripts/AForm"],["-c","-v","-w","~/Scripts/GambasHelpSearch"],["-c","-v","-w","~/Scripts/AMain"],["-c","-v","-w","~/Scripts/gshoutput"],["-c","-v","-w","~/Scripts/TestSets/TestWebApp.gbs"],["--convert-project","~/Projects/TestPrograms/testerror"],["-v","--convert-project","~/Projects/TestPrograms/testusingtxthighlight","~/Scripts/TestSets2"],["-c","-v","~/Scripts/TestSets/testusingtxthighlight.gbs"],["-l","library"],["-c","-v","-w","~/Scripts/TestScripterNoMain"],["-c","-v","-w","~/Scripts/TestGUI.gbs"],["-c","-v","-w","~/Scripts/TestSets/CPU_Test.gbs"],["-c","-v","-w","~/Scripts/TestSets/TestWebPage.gbs"],["-c","-v","-w","--convert-script","~/Scripts/TestSets/CPU_Test.gbs","~/Scripts"],["-c","-v","-w","~/Scripts/CPU_Test"],["-c","-v","-w","-p","~/Scripts/TestPlugin","~/myplugins"],["-c","-v","-w","~/Scripts/RunComponent"],["-c","-v","-w","~/Scripts/TestTestAppIncludes"],["-v","~/Projects/TestTimer"],["-c","-v","-w","~/gbs3testwithclass.gbs"],["-c","-v","-w","/home/brian/Scripts/testLocalStatic.gbs"],["-c","-v","-w","TestExternStructNoMain.gbs"],["-c","-v","-w","TestExternStructWithMain.gbs"]]
CurrentArgumentList=["-v","--convert-project","~/Projects/TestPrograms/testusingtxthighlight","~/Scripts/TestSets2"]
Arguments=[["--help"],["--use","'gb.notify,gb.web'","-e","For i as Integer = 0 To 10:Print \"Hello World\":Next"],["~/bin/who"],["-c","-T","~/bin/mytest"],["-v","TestApp"],["--verbose","TestAppWithMain"],["--verbose","TestLazyApp"],["-c","~/testerror.gbs"],["~/Scripts/TestQuoteAtEnd"],["-c","~/Scripts/testenum"],["-c","-v","-w","~/Scripts/GambasHelpSearch"],["-c","-v","-w","~/Scripts/AMain"],["-c","-v","-w","~/Scripts/gshoutput"],["-c","-v","-w","~/Scripts/TestSets/TestWebApp.gbs"],["--convert-project","~/Projects/TestPrograms/testerror"],["-v","--convert-project","~/Projects/TestPrograms/testusingtxthighlight","~/Scripts/TestSets2"],["-c","-v","~/Scripts/TestSets/testusingtxthighlight.gbs"],["-l","library"],["-c","-v","-w","~/Scripts/TestScripterNoMain"],["-c","-v","-w","~/Scripts/TestGUI.gbs"],["-c","-v","-w","~/Scripts/TestSets/CPU_Test.gbs"],["-c","-v","-w","~/Scripts/TestSets/TestWebPage.gbs"],["-c","-v","-w","--convert-script","~/Scripts/TestSets/CPU_Test.gbs","~/Scripts"],["-c","-v","-w","~/Scripts/CPU_Test"],["-c","-v","-w","-p","~/Scripts/TestPlugin","~/myplugins"],["-c","-v","-w","~/Scripts/RunComponent"],["-c","-v","-w","~/Scripts/TestTestAppIncludes"],["-v","~/Projects/TestTimer"],["-c","-v","-w","~/gbs3testwithclass.gbs"],["-c","-v","-w","/home/brian/Scripts/testLocalStatic.gbs"],["-c","-v","-w","TestExternStructNoMain.gbs"],["-c","-v","-w","TestExternStructWithMain.gbs"]]
TabSize=2
Translate=1
Language=en_US

View file

@ -43,7 +43,7 @@ Public Sub _call(oContext As Context, Program As Reader) As String
Endif
Else If aSpecial[s] Then
If s = "ENUM" Then
Dim DefEnum As String = ProcessVariable(Program, i - $iAdjustedOffset)
Dim DefEnum As String = ProcessVariable(Program, i - $iAdjustedOffset, True)
If Upper(DefEnum) Begins "ENUM" Then DefEnum = "Public " & DefEnum
oContext.$sProgramHeader &= DefEnum & "\n"
Break
@ -116,13 +116,17 @@ Public Sub AdjustProgram(Program As Reader, EndIndex As Integer, StartIndex As I
End
Private Sub ProcessVariable(Program As Reader, index As Integer) As String
Private Sub ProcessVariable(Program As Reader, index As Integer, Optional force As Boolean = False) As String
Dim DefOutPut As String = ""
Dim aSymbols As String[] = Program.ProgramSymbols[index]
Dim aTypes As Integer[] = Program.ProgramTypes[index]
For i As Integer = 0 To aSymbols.max
If aTypes[i] = Highlight.operator And If aSymbols[i] = "=" Then
If force Then
DefOutPut = ProcessAssignment(Program, index, i)
Return DefOutPut
Else If aTypes[i] = Highlight.operator And If aSymbols[i] = "=" Then
DefOutPut = ProcessAssignment(Program, index, i)
Return DefOutPut
Endif