Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@bmk Pragma broken since 0.139 #656

Open
Scaremonger opened this issue Apr 7, 2024 · 0 comments
Open

@bmk Pragma broken since 0.139 #656

Scaremonger opened this issue Apr 7, 2024 · 0 comments

Comments

@Scaremonger
Copy link

Bug Report

Consider the following code that includes simple Pragmas:
`SuperStrict

' @bmk echo
' @bmk echo *******************************
?Debug
' @bmk echo **** DEBUG MODE
?Not Debug
' @bmk echo **** RELEASE MODE
?
' @bmk echo *******************************

Print "Hello World"`

Expected Behavior

In version 0.138 this would print "DEBUG MODE" or "RELEASE MODE" during compilation, but since 0.139 this no longer works.

Actual Behavior

Compile Error: Expecting expression but encountered '' @bmk echo

[/home/si/dev/Blitzmax-Language-Server/bls-test.bmx;3;0]
Build Error: failed to compile (65280) /home/si/dev/Blitzmax-Language-Server/bls-test.bmx
Process complete

Environment

  • Operating System: Linux x64
  • Output of bcc -v:
    I have tried versions 0.136 (working), 0.138 (working/official), 0.139 (broken), 0.140 (broken), 0.142 (broken) and 0.143 (latest/broken)
  • Optional additional info, download, project links, etc

Investigation

In file parser.bmx within method TParser.ParseMain():
Existing Code in 0.143

		'Parse header - imports etc.
		While _toke
			SetErr
			Select _toke.ToLower()
...
			Case "moduleinfo"
				NextToke
				Local info:String = ParseStringLit()
				_module.modInfo.AddLast(info)
			Default
				Exit
			End Select

			If _tokeType = TOKE_PRAGMA Then
				ParsePragmaStmt()
				NextToke
			End If
		Wend

The Default at the end of the select..case, exits before it gets to the PRAGMA parser. I fixed it by moving the pragma parser into the default like this:
Potential fix

		'Parse header - imports etc.
		While _toke
			SetErr
			Select _toke.ToLower()
...
			Case "moduleinfo"
				NextToke
				Local info:String = ParseStringLit()
				_module.modInfo.AddLast(info)
			Default
				If _tokeType = TOKE_PRAGMA Then
					ParsePragmaStmt()
					NextToke
				Else
					Exit
				End If
			End Select
		Wend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant