Skip to content

Commit 14bc713

Browse files
committed
v9.4
Lexical error fixed.
1 parent 618db68 commit 14bc713

7 files changed

Lines changed: 10 additions & 9 deletions

File tree

JSONFox.PJT

165 Bytes
Binary file not shown.

JSONFox.pjx

0 Bytes
Binary file not shown.

jsonfox.app

47 Bytes
Binary file not shown.

src/arraytocursor.prg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,10 @@ Define Class ArrayToCursor As Session
283283
If .check(tnTokenType)
284284
Return .advance()
285285
EndIf
286-
if empty(tcErrorMessage)
287-
tcErrorMessage = "Parser Error: expected token '" + _screen.jsonUtils.tokenTypeToStr(tnTokenType) + "' got = '" + _screen.jsonUtils.tokenTypeToStr(.peek.type) + "'"
286+
if empty(tcMessage)
287+
tcMessage = "Parser Error: expected token '" + _screen.jsonUtils.tokenTypeToStr(tnTokenType) + "' got = '" + _screen.jsonUtils.tokenTypeToStr(.peek.type) + "'"
288288
endif
289-
error tcErrorMessage
289+
error tcMessage
290290
endwith
291291
endfunc
292292

src/frmjsonviewer.scx

0 Bytes
Binary file not shown.

src/jsonclass.prg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ define class JSONClass as session
44
LastErrorText = ""
55
lError = .f.
66
lShowErrors = .t.
7-
version = "9.3"
7+
version = "9.4"
88
hidden lInternal
99
hidden lTablePrompt
1010
Dimension aCustomArray[1]

src/tokenizer.prg

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,12 @@ define class Tokenizer as custom
7979

8080
Hidden Function skipWhitespace
8181
With this
82+
LOCAL ch
8283
Do while InList(.peek(), Chr(9), Chr(10), Chr(13), Chr(32))
83-
If .peek() == Chr(10)
84+
ch = .advance()
85+
If ch == Chr(10)
8486
.line = .line + 1
8587
endif
86-
.advance()
8788
EndDo
8889
endwith
8990
endfunc
@@ -229,7 +230,7 @@ define class Tokenizer as custom
229230
if At(ch, .letters) > 0
230231
Return .identifier()
231232
endif
232-
.showError(0, "Lexer Error: Unknown character '" + transform(ch) + "'")
233+
.showError(.line, "Unknown character ['" + transform(ch) + "'], ascii: [" + TRANSFORM(ASC(ch)) + "]")
233234
EndCase
234235
EndWith
235236
EndFunc
@@ -262,12 +263,12 @@ define class Tokenizer as custom
262263
endfunc
263264

264265
function showError(tnLine, tcMessage)
265-
error "[line" + alltrim(str(tnLine)) + "] Error: " + tcMessage
266+
error "SYNTAX ERROR: (" + TRANSFORM(tnLine) + ":" + TRANSFORM(this.current) + ")" + tcMessage
266267
endfunc
267268

268269
function isAtEnd
269270
With this
270-
return .current > .sourceLen
271+
return .current >= .sourceLen
271272
EndWith
272273
endfunc
273274

0 commit comments

Comments
 (0)