From 354ccb681ad535842539b9f16959a41ac057e5c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Fri, 22 Jul 2011 12:35:25 +0000 Subject: [PATCH] [GB.WEB] * BUG: JSON.Decode() now returns NULL if there is no token in the input string. git-svn-id: svn://localhost/gambas/trunk@3945 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- comp/src/gb.web/.project | 4 ++-- comp/src/gb.web/.src/JSON.module | 2 ++ comp/src/gb.web/.src/Main.module | 27 ++++++++++++++------------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/comp/src/gb.web/.project b/comp/src/gb.web/.project index cad8472de..620a55bf1 100644 --- a/comp/src/gb.web/.project +++ b/comp/src/gb.web/.project @@ -1,8 +1,8 @@ # Gambas Project File 3.0 -# Compiled with Gambas 2.99.1 +# Compiled with Gambas 2.99.2 Title=Web applications tools Startup=Main -Version=2.99.1 +Version=2.99.2 VersionProgram=gbx3 -V Authors="BenoƮt Minisini" TabSize=2 diff --git a/comp/src/gb.web/.src/JSON.module b/comp/src/gb.web/.src/JSON.module index 1acaee88e..e885f07a8 100644 --- a/comp/src/gb.web/.src/JSON.module +++ b/comp/src/gb.web/.src/JSON.module @@ -161,6 +161,8 @@ Private Sub ReadValue() As Variant Return True Else If sCar = "false" Then Return False + Else If Not sCar Then + Return Else Error.Raise("Incorrect token: " & Quote(sCar)) Endif diff --git a/comp/src/gb.web/.src/Main.module b/comp/src/gb.web/.src/Main.module index c712e9f24..48c3ff2ff 100644 --- a/comp/src/gb.web/.src/Main.module +++ b/comp/src/gb.web/.src/Main.module @@ -60,18 +60,19 @@ End Public Sub Main() - Dim hFile As File - Dim aStr As Variant[] = ["la", ["nuit", "tous"], "les", "chats", [3, 4, 5], "sont", "gris"] - Dim cCol As Collection = ["aspic": Pi, "camembert": aStr, "barbapapa": "Gambas !", "zut": String$(100, "Gambas")] - - hFile = Open "~/serialize.txt" For Create - Write #hFile, cCol As Variant - Close #hFile - - hFile = Open "~/serialize.txt" For Read - cCol = Read #hFile As Variant - Close #hFile - - Print cCol.Count + ' Dim hFile As File + ' Dim aStr As Variant[] = ["la", ["nuit", "tous"], "les", "chats", [3, 4, 5], "sont", "gris"] + ' Dim cCol As Collection = ["aspic": Pi, "camembert": aStr, "barbapapa": "Gambas !", "zut": String$(100, "Gambas")] + ' + ' hFile = Open "~/serialize.txt" For Create + ' Write #hFile, cCol As Variant + ' Close #hFile + ' + ' hFile = Open "~/serialize.txt" For Read + ' cCol = Read #hFile As Variant + ' Close #hFile + ' + ' Print cCol.Count + Print JSON.Decode(" ") End