diff options
author | Emmanuele Bassi <ebassi@openedhand.com> | 2008-02-29 12:24:14 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@openedhand.com> | 2008-02-29 12:24:14 +0000 |
commit | a475b0896d5760c893a099c9411f9790e5c492ba (patch) | |
tree | 181b99e9e46f8a1595586651cadd810046f8f8df /json-glib/json-scanner.c | |
parent | 10ac1734b326700257ef318d9a2000c538b5cd38 (diff) | |
download | json-glib-a475b0896d5760c893a099c9411f9790e5c492ba.tar.gz |
Update the JsonScanner default configuration
Diffstat (limited to 'json-glib/json-scanner.c')
-rw-r--r-- | json-glib/json-scanner.c | 84 |
1 files changed, 36 insertions, 48 deletions
diff --git a/json-glib/json-scanner.c b/json-glib/json-scanner.c index 90b7744..f23e12d 100644 --- a/json-glib/json-scanner.c +++ b/json-glib/json-scanner.c @@ -92,75 +92,66 @@ struct _JsonScannerConfig guint padding_dummy; }; -/* --- defines --- */ -#define to_lower(c) ( \ - (guchar) ( \ - ( (((guchar)(c))>='A' && ((guchar)(c))<='Z') * ('a'-'A') ) | \ - ( (((guchar)(c))>=192 && ((guchar)(c))<=214) * (224-192) ) | \ - ( (((guchar)(c))>=216 && ((guchar)(c))<=222) * (248-216) ) | \ - ((guchar)(c)) \ - ) \ -) -#define READ_BUFFER_SIZE (4000) - - -/* --- typedefs --- */ -typedef struct _GScannerKey GScannerKey; - -struct _GScannerKey -{ - guint scope_id; - gchar *symbol; - gpointer value; -}; - - -/* --- variables --- */ -static const GScannerConfig g_scanner_config_template = +static const JsonScannerConfig json_scanner_config_template = { + ( " \t\r\n" ) /* cset_skip_characters */, ( - " \t\r\n" - ) /* cset_skip_characters */, - ( - G_CSET_a_2_z "_" + G_CSET_a_2_z G_CSET_A_2_Z - ) /* cset_identifier_first */, + ) /* cset_identifier_first */, ( + G_CSET_DIGITS + "-_" G_CSET_a_2_z - "_" G_CSET_A_2_Z - G_CSET_DIGITS - G_CSET_LATINS - G_CSET_LATINC - ) /* cset_identifier_nth */, - ( "#\n" ) /* cpair_comment_single */, - - FALSE /* case_sensitive */, - + ) /* cset_identifier_nth */, + ( "//\n" ) /* cpair_comment_single */, + TRUE /* case_sensitive */, TRUE /* skip_comment_multi */, TRUE /* skip_comment_single */, - TRUE /* scan_comment_multi */, + FALSE /* scan_comment_multi */, TRUE /* scan_identifier */, - FALSE /* scan_identifier_1char */, + TRUE /* scan_identifier_1char */, FALSE /* scan_identifier_NULL */, TRUE /* scan_symbols */, - FALSE /* scan_binary */, + TRUE /* scan_binary */, TRUE /* scan_octal */, TRUE /* scan_float */, TRUE /* scan_hex */, - FALSE /* scan_hex_dollar */, + TRUE /* scan_hex_dollar */, TRUE /* scan_string_sq */, TRUE /* scan_string_dq */, TRUE /* numbers_2_int */, FALSE /* int_2_float */, FALSE /* identifier_2_string */, TRUE /* char_2_token */, - FALSE /* symbol_2_token */, + TRUE /* symbol_2_token */, FALSE /* scope_0_fallback */, - FALSE /* store_int64 */, }; +/* --- defines --- */ +#define to_lower(c) ( \ + (guchar) ( \ + ( (((guchar)(c))>='A' && ((guchar)(c))<='Z') * ('a'-'A') ) | \ + ( (((guchar)(c))>=192 && ((guchar)(c))<=214) * (224-192) ) | \ + ( (((guchar)(c))>=216 && ((guchar)(c))<=222) * (248-216) ) | \ + ((guchar)(c)) \ + ) \ +) + +#define READ_BUFFER_SIZE (4000) + + +/* --- typedefs --- */ +typedef struct _JsonScannerKey JsonScannerKey; + +struct _JsonScannerKey +{ + guint scope_id; + gchar *symbol; + gpointer value; +}; /* --- prototypes --- */ static inline @@ -1804,6 +1795,3 @@ g_scanner_get_token_ll (GScanner *scanner, *token_p = token; *value_p = value; } - -#define __G_SCANNER_C__ -#include "galiasdef.c" |