In Game Scripting

BlitzMax Forums/BlitzMax Programming/In Game Scripting

No worries.

I did eventually find it, and I'm slowly making a couple improvements. This version might be older than the one you just linked to, it's dated 2005.

Anyway, one big thing (which I decided I just don't have time to do right now), is I'd like to have pass 1 track all tokens so that it can make accurate line error reports for things like invalid escape sequences. After looking at it, I decided it will just have to do the way it is.

I did however fix line reporting for pass 2. It was incrementing TokenLine even when NextToken was called to get the lookahead token. This puts the line number reported for errors way too far out.

My patch is simple, compiler.bmx, line 2556:

If CurrentChar = "~n" Then
  TokenPosition = 0
  If SetAsCurr Then TokenLine:+1
EndIf


And then line 2844 was using NextToken() to get the current token's line number, changed to:
If NextToken().id <> ID Then ..
  Error("Expecting token (~q" + TokenIDToMnemonic(ID) + ..
  "~q) but found (~q" + CurrentToken.Data +"~q) line " + ..
  CurrentToken.Line)


The compiler seems a bit lengthy to me, but the module is a nice piece of code.