Kaynağa Gözat

Add support for C-style comments to NJSON

Daniele Bartolini 10 yıl önce
ebeveyn
işleme
fd67750026
1 değiştirilmiş dosya ile 17 ekleme ve 3 silme
  1. 17 3
      src/core/json/njson.cpp

+ 17 - 3
src/core/json/njson.cpp

@@ -65,9 +65,23 @@ namespace njson
 
 		if (*json == '/')
 		{
-			json = next(json, '/');
-			json = next(json, '/');
-			while (*json && *json != '\n') json = next(json);
+			json = next(json);
+			if (*json == '/')
+			{
+				json = next(json, '/');
+				while (*json && *json != '\n')
+					json = next(json);
+			}
+			else if (*json == '*')
+			{
+				json = next(json);
+				while (*json && *json != '*')
+					json = next(json);
+				json = next(json, '*');
+				json = next(json, '/');
+			}
+			else
+				CE_FATAL("Bad comment");
 		}
 
 		return json;