Fixed CerberusX reporting incorrectly number of line.

zuibaf

Member
Joined
Sep 29, 2017
Messages
56
In the code below, the incorrect line is line 96, missing a parenthesis ")", however, CerberusX, reports that the incorrect line is line 95, although, such line 95 is correct.
I spent about 2 minutes trying to understand what was wrong on line 95, so when I went to check line 96, I found the error.

Cerberus:
Import mojo

Class pongo Extends App

    Field pX: Float = 630.0    ' X pos on the right side of canvas.
    Field pY: Float = 240.0    ' Y pos in the middle of canvas.
  
    Field bX: Float = 320.0    ' X pos of the ball in the middle of canvas.
    Field bY: Float = 240.0  ' Y pos in the middle of the canvas.
  
    Field bdX: Float = 3.5    ' X speed of the ball.
    Field bdY: Float = 1.5    ' Y speed of the ball.
  
    Field eX: Float[] = [5.0, 55.0]        ' X pos of both paddles.
    Field eY: Float[] = [240.0, 240.0]     ' Y pos of both paddles.
    Field edY: Float[] = [-10.0, 5.0]     ' Y speed of both paddles.
  
    Field pPoints: Int = 0    ' Player points.
    Field ePoints: Int = 0    ' Enemy points.
    Field gameMode: Int = 0    ' Gamemode 0 = Start game, 1 = Game, 2 = GameOver.
  
    Field modeMessage: Int = 0    ' 0 = Message can be printed.


    Method OnCreate:Int()
        SetUpdateRate(60)
        Return True
    End
  
    Method OnUpdate:Int()
        UpdateGame()
        Return True
    End
  
    Method OnRender:Int()
        Cls                ' Clear the canvas each frame.
        DrawPlayField()    ' this call draws the background.
      
        DrawRect(pX, pY - 30, 5, 60)    ' Draw the player paddle.
        DrawRect(eX[0], eY[0] - 30, 5, 60)    ' Draw the enemy paddle #1.
        DrawRect(eX[1], eY[1] - 30, 5, 60)    ' Draw the enemy paddle #2.
        DrawCircle(bX, bY, 5)
      
        Return True
    End
  
    Method DrawPlayField:Int ()
        ' Draw the top wall with a rectangle.
        DrawRect(0, 0, 640, 5)
      
        ' Bottom wall.
        DrawRect(0, 475, 640, 5)
      
        ' Middle line, 13 pieces, each 10 pixel long.
        For Local i := 5 To 465 Step 20
            DrawRect (318, i, 4, 10)
        Next
        Return True
    End
  
    Method ControlPlayer:Int()
        If KeyDown(KEY_UP) Then
            pY -= 5.0
          
            ' Check if it reaches the top wal.
            If pY < 25.0 Then pY = 25.0
        Endif
      
        If KeyDown(KEY_DOWN) Then
            pY += 5.0
          
            ' Check if it reaches the bottom wall.
            If pY > 455.0 Then pY = 455.0
        Endif
      
        Return True
    End
  
    Method UpdateGame:Int()
        ControlPlayer()
        ControlEnemies()
        UpdateBall()
      
        If CheckPaddleCollP() = True And bdX > 0 Then
            bdX *= -1
          
            If ((bY - pY) > 7) Then bdY = 1.5
            If ((bY - pY) < -7) Then bdY = -1.5
            If ((bY - pY) <= 7) And ((bY - pY) >= -7) Then bdY = 0
        Endif
      
        Local ep:Int = CheckPaddleCollE()
        If ep >= 0 And bdX < 0 Then
            If ((bY - eY[ep]) > 7) Then bdY = 1.5
            If ((bY - eY[ep]) < -7) Then bdY = -1.5  ' CerberusX report this line is incorrect.
            If ((bY - eY[ep]) <= 7) And ((bY - eY[ep]) >= -7 Then bdY = 0 ' This line is incorrect.
        Endif
      
        Return True
    End
  
    Method ControlEnemies:Int()
  
        For Local ep:Int = 0 To 1
            'Update the paddles Y position.
            eY[ep] += edY[ep]
          
            ' Check if paddles reaches top wall.
            If eY[ep] < 25.0 Then
                eY[ep] = 25.0
                edY[ep] *= -1    ' Reverts its Y speed.
            EndIf
          
            ' Check if paddles reaches bottom wall.
            If eY[ep] > 455 Then
                eY[ep] = 455.0
                edY[ep] *= -1
            Endif
        Next
        Return True
  
    End
  
    Method UpdateBall:Int()
        bX += bdX    ' Add the X speed of the ball to its X position.
        bY += bdY     ' Add the Y speed of the ball to its Y position.
      
        If bY < 10.0 Then
            bY = 10.0
            bdY *= -1
        Endif
      
        If bY > 470.0 Then
            bY = 470.0
            bdY *= -1
        Endif
      
        If bX < 5.0 Then
            bX = 5.0
            bdX *= -1
            pPoints += 1
          
            If pPoints >= 10 Then gameMode = 2
            Print (ePoints + ":" + pPoints)
        Endif
      
        If bX > 635.0 Then
            bX = 635.0
            bdX *= -1
            ePoints += 1
          
            If ePoints >= 10 Then gameMode = 2
            Print (ePoints + ":" + pPoints)
        Endif
    End     
  
    Method CheckPaddleCollP:Bool()
        If bX > 625.0 Then
            If ((bY >= pY-25.0) And (bY <= pY + 25.0)) Then
                Return True
            Endif
        Endif
        Return False
    End
  
    Method CheckPaddleCollE:Int()
        For Local ep:Int = 0 To 1
            If (bX > (eX[ep]-5)) And (bX < (eX[ep]+5)) Then
                If ((bY >= eY[ep] - 25.0) And (bY <= eY[ep] + 25.0)) Then
                    Return ep
                Endif
            Endif
        Next
        Return -1
    End
      
End

Function Main:Int()
    New pongo
    Return True
End
 
Last edited:

Rich

Well-known member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
3rd Party Tool Dev
Joined
Sep 9, 2017
Messages
451
my editor is reporting line 96, which is correct
My version of TED is V2019-10-13
 

zuibaf

Member
Joined
Sep 29, 2017
Messages
56
My version is:
Cerberus V2019-10-13b
Trans V2019-10-13
QT V5.9.2
 

zuibaf

Member
Joined
Sep 29, 2017
Messages
56
If you find something interesting, no code in my code has a #rem #end comment and when I posted it, I removed the comment.
As you say that CerberusX reports correctly, I remembered that I had removed the comment before posting on the forum, now that you said that you reported correctly, so I remembered that I had withdrawn the comment, so I took the test without the comment and CerberusX reported correctly.
It looks like CerberusX is reporting the wrong line when there is a comment: #rem #endif

I'm sending the code again, now with the comment, Cerberus is reporting the line incorrectly,
now, the wrong line is 103 and CerberusX says there is no parenthesis on line 102.

Segue o código completo:

Cerberus:
#rem
    Script: Pongo.cxs
    Description: Sample script from chapter #2 of the book "Monkey
    Game Development Beginners guide" by PackPub
    Author:     Michael Hartlef
#end

Import mojo

Class pongo Extends App

    Field pX: Float = 630.0    ' X pos on the right side of canvas.
    Field pY: Float = 240.0    ' Y pos in the middle of canvas.
    
    Field bX: Float = 320.0    ' X pos of the ball in the middle of canvas.
    Field bY: Float = 240.0  ' Y pos in the middle of the canvas.
    
    Field bdX: Float = 3.5    ' X speed of the ball.
    Field bdY: Float = 1.5    ' Y speed of the ball.
    
    Field eX: Float[] = [5.0, 55.0]        ' X pos of both paddles.
    Field eY: Float[] = [240.0, 240.0]     ' Y pos of both paddles.
    Field edY: Float[] = [-10.0, 5.0]     ' Y speed of both paddles.
    
    Field pPoints: Int = 0    ' Player points.
    Field ePoints: Int = 0    ' Enemy points.
    Field gameMode: Int = 0    ' Gamemode 0 = Start game, 1 = Game, 2 = GameOver.
    
    Field modeMessage: Int = 0    ' 0 = Message can be printed.


    Method OnCreate:Int()
        SetUpdateRate(60)
        Return True
    End
    
    Method OnUpdate:Int()
        Select gameMode
            Case 0
                StartGame()
            Case 1
                UpdateGame()
            Case 2
                GameOver()
        End
        Return True
    End
    
    Method OnRender:Int()
        Cls                ' Clear the canvas each frame.
        DrawPlayField()    ' this call draws the background.
        
        DrawRect(pX, pY - 30, 5, 60)    ' Draw the player paddle.
        DrawRect(eX[0], eY[0] - 30, 5, 60)    ' Draw the enemy paddle #1.
        DrawRect(eX[1], eY[1] - 30, 5, 60)    ' Draw the enemy paddle #2.
        DrawCircle(bX, bY, 5)
        
        Return True
    End
    
    Method DrawPlayField:Int ()
        ' Draw the top wall with a rectangle.
        DrawRect(0, 0, 640, 5)
        
        ' Bottom wall.
        DrawRect(0, 475, 640, 5)
        
        ' Middle line, 13 pieces, each 10 pixel long.
        For Local i := 5 To 465 Step 20
            DrawRect (318, i, 4, 10)
        Next
        Return True
    End
    
    Method ControlPlayer:Int()
        If KeyDown(KEY_UP) Then
            pY -= 5.0
            
            ' Check if it reaches the top wal.
            If pY < 25.0 Then pY = 25.0
        Endif
        
        If KeyDown(KEY_DOWN) Then
            pY += 5.0
            
            ' Check if it reaches the bottom wall.
            If pY > 455.0 Then pY = 455.0
        Endif
        
        Return True
    End
    
    Method UpdateGame:Int()
        ControlPlayer()
        ControlEnemies()
        UpdateBall()
        
        If CheckPaddleCollP() = True And bdX > 0 Then
            bdX *= -1
            
            If ((bY - pY) > 7) Then bdY = 1.5
            If ((bY - pY) < -7) Then bdY = -1.5
            If ((bY - pY) <= 7) And ((bY - pY) >= -7 Then bdY = 0
        Endif
        
        Local ep:Int = CheckPaddleCollE()
        If ep >= 0 And bdX < 0 Then
            If ((bY - eY[ep]) > 7) Then bdY = 1.5
            If ((bY - eY[ep]) < -7) Then bdY = -1.5
            If ((bY - eY[ep]) <= 7) And ((bY - eY[ep]) >= -7) Then bdY = 0
        Endif
        
        Return True
    End
    
    Method ControlEnemies:Int()
    
        For Local ep:Int = 0 To 1
            'Update the paddles Y position.
            eY[ep] += edY[ep]
            
            ' Check if paddles reaches top wall.
            If eY[ep] < 25.0 Then
                eY[ep] = 25.0
                edY[ep] *= -1    ' Reverts its Y speed.
            EndIf
            
            ' Check if paddles reaches bottom wall.
            If eY[ep] > 455 Then
                eY[ep] = 455.0
                edY[ep] *= -1
            Endif
        Next
        Return True
    
    End
    
    Method UpdateBall:Int()
        bX += bdX    ' Add the X speed of the ball to its X position.
        bY += bdY     ' Add the Y speed of the ball to its Y position.
        
        If bY < 10.0 Then
            bY = 10.0
            bdY *= -1
        Endif
        
        If bY > 470.0 Then
            bY = 470.0
            bdY *= -1
        Endif
        
        If bX < 5.0 Then
            bX = 5.0
            bdX *= -1
            pPoints += 1
            
            If pPoints >= 10 Then gameMode = 2
            Print (ePoints + ":" + pPoints)
        Endif
        
        If bX > 635.0 Then
            bX = 635.0
            bdX *= -1
            ePoints += 1
            
            If ePoints >= 10 Then gameMode = 2
            Print (ePoints + ":" + pPoints)
        Endif
    End       
    
    Method CheckPaddleCollP:Bool()
        If bX > 625.0 Then
            If ((bY >= pY-25.0) And (bY <= pY + 25.0)) Then
                Return True
            Endif
        Endif
        Return False
    End
    
    Method CheckPaddleCollE:Int()
        For Local ep:Int = 0 To 1
            If (bX > (eX[ep]-5)) And (bX < (eX[ep]+5)) Then
                If ((bY >= eY[ep] - 25.0) And (bY <= eY[ep] + 25.0)) Then
                    Return ep
                Endif
            Endif
        Next
        Return -1
    End
    
    Method StartGame: Int()
        If modeMessage = 0 Then
            modeMessage = 1
            Print ("Press P to start the game")
        Endif
        
        If KeyHit(KEY_P) Then
            modeMessage = 0
            gameMode = 1            ' mode = Game playing.
        Endif
        
        Return True
    End
    
    Method GameOver:Int()
        If modeMessage = 0 Then
            modeMessage = 1
            Print ("G A M E  O V E R")
            
            If ePoints >= 0 Then
                Print ("Don't cry, the computer won! Next time try harder.")
            Else
                Print ("Congratulations, you won! It must be your lucky day.")
            Endif
            
            Print ("Press P to restart the game")
        Endif
        
        If KeyHit(KEY_P) Then
            ePoints = 0
            pPoints = 0
            Print (ePoints + ": " + pPoints)
            pY = 24.0    ' player paddle Y pos.
            bX = 320.0    ' ball X pos.
            bY = 240.0    ' ball Y pos.
            bdX = 3.5    ' ball X speed.
            bdY = 1.5    ' ball Y speed.
            eY[0] = 240.0    ' enemy paddle 1 Y pos.
            eY[1] = 240.0    ' enemy paddle 2 Y pos.
            modeMessage = 0
            gameMode = 1
        Endif
        
        Return True
    End
            
        
        
End

Function Main:Int()
    New pongo
    Return True
End
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
643
I can confirm this bug. Same result as you described.

If you copy paste this rem block multiple times, the error sums up. Maybe it has to do with the content of the rem block. Needs definitely more investigation.

Good find.
 

Rich

Well-known member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
3rd Party Tool Dev
Joined
Sep 9, 2017
Messages
451
I did a but more investigation into the error.. it looks like " chars in comment blocks break things.
You have a newline within your string in your comment block and the translator is not picking the newline up, hence the error line is 1 less than it should be.
If you remove one of the " chars in the comment block, it breaks the code ?!??!!?

v strange
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
643
I guess it hast to do with trans parsing the rem blocks, which was necessary, because trans was used by makedocs for in source documentation before @Holzchopf rewrote makedocs with a modified trans AFAIK
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,165
Just to confirm that it wasn't the changes @Holzchopf did. Monkey 87b behaves the same, reports the wrong line of code.
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
643
it wasn't the changes @Holzchopf did.
I just wanted to point out that parsing of #rem block content might not be needed anymore, because @Holzchopf made it independent from makedocs AFAIK. This could help fixing this bug.
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
852
The bug is more to do with the tokenizer not ignoring what is between #REM/#END.
Remove the quotes from the remark. And the correct line will be highlighted.

Edit:
It should also be noted that conditional pre-processor directives also causes issues when placed within a remark block.
 
Last edited:

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
852
Looks like I have a partial fix that I haven't fully tested, so expect one or two issues. It's not pretty and it doesn't take into account nested preprocessor directives.
I will have to look at this a bit later.

Backup the toker.cxs found in modules/trans, create a new file and copy and paste the code below, the rebuild transcc.
Cerberus:
' Module trans.toker
'
' Placed into the public domain 24/02/2011.
' No warranty implied; use at your own risk.

Import trans

'toke_type
Const TOKE_EOF=0
Const TOKE_SPACE=1
Const TOKE_IDENT=2
Const TOKE_KEYWORD=3
Const TOKE_INTLIT=4
Const TOKE_FLOATLIT=5
Const TOKE_STRINGLIT=6
Const TOKE_STRINGLITEX=7
Const TOKE_SYMBOL=8
Const TOKE_LINECOMMENT=9
Const TOKE_INTLITEX=10

'***** Tokenizer *****
Class Toker

    Global _symbols:StringSet
    Global _keywords:StringSet
 
    ' Flag for multi line comments. This should be used when needing to process tokens that have matching open and closing character such as strings.
    Global _comments:Bool

    Field _path$
    Field _line
    Field _source$
    Field _length
    Field _toke$
    Field _tokeType
    Field _tokePos
 
    Method _init()
        If _keywords Return
     
        Const keywords:="void strict "+
        "public private protected friend property "+
        "bool int float string array object mod continue exit "+
        "include import module extern "+
        "new self super eachin true false null not "+
        "extends abstract final select case default "+
        "const local global field method function class "+
        "and or shl shr end if then else elseif endif while wend repeat until forever "+
        "for to step next return "+
        "interface implements inline alias try catch throw throwable "+
        "enumerate"

        _keywords=New StringSet
        For Local t:=Eachin keywords.Split( " " )
            _keywords.Insert t
        Next
        _symbols=New StringSet
        _symbols.Insert ".."
        _symbols.Insert ":="
        _symbols.Insert "*="
        _symbols.Insert "/="
        _symbols.Insert "+="
        _symbols.Insert "-="
        _symbols.Insert "|="
        _symbols.Insert "&="
        _symbols.Insert "~~="
    End
 
    Method New( path$,source$ )
        _init
        _path=path
        _line=1
        _source=source
        _length=_source.Length
        _toke=""
        _tokeType=TOKE_EOF
        _tokePos=0
    End
 
    Method New( toker:Toker )
        _init
        _path=toker._path
        _line=toker._line
        _source=toker._source
        _length=_source.Length
        _toke=toker._toke
        _tokeType=toker._tokeType
        _tokePos=toker._tokePos
    End
 
    Method Path$()
        Return _path
    End
 
    Method Line:Int()
        Return _line
    End
 
    Method NextToke$()
 
        _toke=""
     
        ' Check for end of file and add a End-Of-File token
        If _tokePos=_length
            _tokeType=TOKE_EOF
            Return _toke
        Endif
     
        ' Preload chr and str with the current character code and it's string representation.
        Local chr:=TCHR()
        Local str:=TSTR()
     
        ' Preserve that current character position before advancing by one.
        Local start:=_tokePos
        _tokePos+=1
     
        ' If the current character is a new line or empty string, then skip.
        If str="~n"
            _tokeType=TOKE_SYMBOL
            _line+=1
     
        ' If the character is a white space character then process until the end or first non-white space character.
        Else If IsSpace( chr )
            _tokeType=TOKE_SPACE
            While _tokePos<_length And IsSpace( TCHR() ) And TSTR()<>"~n"
                _tokePos+=1
            Wend
     
        ' Proces any comments, either single line or multiline. Tricky as multiline comments use the preprocessor token.
        Else If str="'" Or str="#"
     
            ' Capture the single line comment and process
            If str="'"
                _tokeType=TOKE_LINECOMMENT
                While _tokePos<_length And TSTR()<>"~n"
                    _tokePos+=1
                Wend
                If _tokePos<_length
                    _tokePos+=1
                    _line+=1
                Endif
            Else
             
                ' Process the next set of characters to see what we're dealing with
                ' We're after capturing the rem/end to set the comments flag accordingly, while ignoring any #end within the comments.
                Local t:="", cpos=_tokePos, chr:=_source[cpos]
             
                ' Process the next lot of characters without advancing the main token position pointer.
                ' The exit condition may need to moved after the chr or t assignment.
                While cpos<_length
                    If String.FromChar( chr )="~n" Or String.FromChar( chr )=" " Exit ' Exit the loop if a new line or white space is encountered.
                    chr=_source[cpos]
                    t+=String.FromChar( chr )
                    cpos+=1
                Wend
             
                ' Test to see if what we have is either a rem or end.
                ' NOTE: Using Contains is not an elegant solution.
                If t.ToLower().Contains( "rem" ) And _comments=False    ' Only activate multiline comments, if multiline flag is off.
                    _comments=True
                    _tokeType=TOKE_LINECOMMENT
                 
                ' Deactivate multiline comments, if multiline flag is on and end is encountered.
                ' Special note. The last #end will be a full comment in it's self.
                Else If t.ToLower().Contains( "end" ) And _comments=True
                    If String.FromChar( chr )="~n"
                        _comments=False
                    Endif
                    ' NOTE: MAY HAVE TO TEST HERE FOR OTHER TYPES OF PREPROCESSOR NESTING SWITCHES eg. #If/#ELSE
                    ' This may be better handled using a similar method in the preprocess.cxs file.
                Endif
             
                ' Save the current character as a token. This will be "#"
                _toke=_source[start.._tokePos]
             
            Endif
     
        ' If the current character starts with either and underscore or is an alpha-beta character.
        ' Then the following toke will either be a identifier or a keyword
        Else If str="_" Or IsAlpha( chr )
            _tokeType=TOKE_IDENT
            While _tokePos<_length
                Local chr=_source[_tokePos]
                If chr<>95 And Not IsAlpha( chr ) And Not IsDigit( chr ) Exit
'                If chr<>Asc("_") And Not IsAlpha( chr ) And Not IsDigit( chr ) Exit
                _tokePos+=1
            Wend
            _toke=_source[start.._tokePos]
         
            If _keywords.Contains( _toke.ToLower() ) _tokeType=TOKE_KEYWORD
     
        ' Process numerical tokens
        Else If IsDigit( chr ) Or str="." And IsDigit( TCHR() )
            _tokeType=TOKE_INTLIT
            If str="." _tokeType=TOKE_FLOATLIT
            While IsDigit( TCHR() )
                _tokePos+=1
            Wend
         
            If _tokeType=TOKE_INTLIT And TSTR()="." And IsDigit( TCHR(1) )
                _tokeType=TOKE_FLOATLIT
                _tokePos+=2
                While IsDigit( TCHR() )
                    _tokePos+=1
                Wend
            Endif
         
            If TSTR().ToLower()="e"
                _tokeType=TOKE_FLOATLIT
                _tokePos+=1
                If TSTR()="+" Or TSTR()="-" _tokePos+=1
                While IsDigit( TCHR() )
                    _tokePos+=1
                Wend
            Endif
     
        ' Process binary tokens
        Else If str="%" And IsBinDigit( TCHR() )
            _tokeType=TOKE_INTLIT
            _tokePos+=1
            While IsBinDigit( TCHR() )
                _tokePos+=1
            Wend
     
        ' Process hexadecimal tokens
        Else If str="$" And IsHexDigit( TCHR() )
            _tokeType=TOKE_INTLIT
            _tokePos+=1
            While IsHexDigit( TCHR() )
                _tokePos+=1
            Wend
     
        ' Process string tokens
        Else If str="~q"
         
            ' Loop through the characters and depending on if the comments flag is set, check for either a quote or a new line
            _tokeType=TOKE_STRINGLIT
            While _tokePos<_length
                If _comments
                    _tokeType=TOKE_LINECOMMENT
                    If TSTR="~n" Exit
                Else
                    If TSTR="~q" Exit
                Endif
                _tokePos+=1
            Wend
         
            If _tokePos<_length
                _tokePos+=1
            Else
                If Not _comments _tokeType=TOKE_STRINGLITEX
            Endif
     
        ' Process string literal charcters
        Else If str="`"
     
            ' Loop through the characters and depending on if the comments flag is set, check for either a grave accent or a new line
            _tokeType=TOKE_INTLIT
            While _tokePos<_length
                If _comments
                    _tokeType=TOKE_LINECOMMENT
                    If TSTR="~n" Exit
                Else
                    If TSTR="`" Exit
                Endif
                _tokePos+=1
            Wend
         
            If _tokePos<_length
                _tokePos+=1
            Else
                If Not _comments _tokeType=TOKE_INTLITEX
            Endif
     
        ' Process any square bracketed tokens. This should be OK, as it checks for the newline character.
        Else If str="["
            _tokeType=TOKE_SYMBOL
            Local i
            While _tokePos+i<_length
                If TSTR(i)="]"
                    _tokePos+=i+1
                    Exit
                Endif
                If TSTR(i)="~n" Or Not IsSpace( TCHR(i) ) Exit
                i+=1
            Wend
        Else
         
            ' Tokenize anything that not been processed as a symbol token type
            _tokeType=TOKE_SYMBOL
            If _symbols.Contains( _source[_tokePos-1.._tokePos+1] ) _tokePos+=1
        Endif
     
        ' If non of the above was processed, then tokenize whatever was left.
        If Not _toke _toke=_source[start.._tokePos]

        Return _toke
    End
 
    Method Toke$()
        Return _toke
    End
 
    Method TokeType()
        Return _tokeType
    End
 
    Method SkipSpace()
        While _tokeType=TOKE_SPACE
            NextToke
        Wend
    End
 
Private

    Method TCHR( i=0 )
        i+=_tokePos
        If i<_length Return _source[i]
    End
 
    Method TSTR$( i=0 )
        i+=_tokePos
        If i<_length Return _source[i..i+1]
    End
 
End
 
Last edited:

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
852
Capturing the other preprocessor directives within a multiline comment is going to be a bit problematic.
It would have simplified things if a multi-lined remark ended with endrem instead of just end.
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
852
Well I've tried a number of methods from brute to reference counting to try to get the lexer and pre-parser to ignore preprocessor directives within a remark block, but with no success. The only way as I see it is to use a specific block remark terminator.
Would everyone be OK with that?
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
852
Though Ted's highlighter will need to be reworked for the change.
Or the remark block as #Rem,/#Rend?
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
643
Could you explain, what the but is causing and in which files to look for the problem .

Would it still be possible to nest rem blocks, if you change #end to #endRem?
 
Top Bottom