aboutsummaryrefslogtreecommitdiff
path: root/qobject/json-lexer.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-08-23 18:40:04 +0200
committerMarkus Armbruster <armbru@redhat.com>2018-08-24 20:26:37 +0200
commit61030280ca2d67bd63cb068250aee55849cd38ca (patch)
treeb00ba231a2efc8d35fcd002764013227c5aa360e /qobject/json-lexer.c
parent269e57ae28599b07368134a64452674009491593 (diff)
json: Rename token JSON_ESCAPE & friends to JSON_INTERP
The JSON parser optionally supports interpolation. The code calls it "escape". Awkward, because it uses the same term for escape sequences within strings. The latter usage is consistent with RFC 8259 "The JavaScript Object Notation (JSON) Data Interchange Format" and ISO C. Call the former "interpolation" instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180823164025.12553-38-armbru@redhat.com>
Diffstat (limited to 'qobject/json-lexer.c')
-rw-r--r--qobject/json-lexer.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/qobject/json-lexer.c b/qobject/json-lexer.c
index 17272a3874..5436809be6 100644
--- a/qobject/json-lexer.c
+++ b/qobject/json-lexer.c
@@ -115,12 +115,12 @@ enum json_lexer_state {
IN_NONZERO_NUMBER,
IN_NEG_NONZERO_NUMBER,
IN_KEYWORD,
- IN_ESCAPE,
- IN_ESCAPE_L,
- IN_ESCAPE_LL,
- IN_ESCAPE_I,
- IN_ESCAPE_I6,
- IN_ESCAPE_I64,
+ IN_INTERP,
+ IN_INTERP_L,
+ IN_INTERP_LL,
+ IN_INTERP_I,
+ IN_INTERP_I6,
+ IN_INTERP_I64,
IN_WHITESPACE,
IN_START,
};
@@ -221,40 +221,40 @@ static const uint8_t json_lexer[][256] = {
['\n'] = IN_WHITESPACE,
},
- /* escape */
- [IN_ESCAPE_LL] = {
- ['d'] = JSON_ESCAPE,
- ['u'] = JSON_ESCAPE,
+ /* interpolation */
+ [IN_INTERP_LL] = {
+ ['d'] = JSON_INTERP,
+ ['u'] = JSON_INTERP,
},
- [IN_ESCAPE_L] = {
- ['d'] = JSON_ESCAPE,
- ['l'] = IN_ESCAPE_LL,
- ['u'] = JSON_ESCAPE,
+ [IN_INTERP_L] = {
+ ['d'] = JSON_INTERP,
+ ['l'] = IN_INTERP_LL,
+ ['u'] = JSON_INTERP,
},
- [IN_ESCAPE_I64] = {
- ['d'] = JSON_ESCAPE,
- ['u'] = JSON_ESCAPE,
+ [IN_INTERP_I64] = {
+ ['d'] = JSON_INTERP,
+ ['u'] = JSON_INTERP,
},
- [IN_ESCAPE_I6] = {
- ['4'] = IN_ESCAPE_I64,
+ [IN_INTERP_I6] = {
+ ['4'] = IN_INTERP_I64,
},
- [IN_ESCAPE_I] = {
- ['6'] = IN_ESCAPE_I6,
+ [IN_INTERP_I] = {
+ ['6'] = IN_INTERP_I6,
},
- [IN_ESCAPE] = {
- ['d'] = JSON_ESCAPE,
- ['i'] = JSON_ESCAPE,
- ['p'] = JSON_ESCAPE,
- ['s'] = JSON_ESCAPE,
- ['u'] = JSON_ESCAPE,
- ['f'] = JSON_ESCAPE,
- ['l'] = IN_ESCAPE_L,
- ['I'] = IN_ESCAPE_I,
+ [IN_INTERP] = {
+ ['d'] = JSON_INTERP,
+ ['i'] = JSON_INTERP,
+ ['p'] = JSON_INTERP,
+ ['s'] = JSON_INTERP,
+ ['u'] = JSON_INTERP,
+ ['f'] = JSON_INTERP,
+ ['l'] = IN_INTERP_L,
+ ['I'] = IN_INTERP_I,
},
/* top level rule */
@@ -271,7 +271,7 @@ static const uint8_t json_lexer[][256] = {
[','] = JSON_COMMA,
[':'] = JSON_COLON,
['a' ... 'z'] = IN_KEYWORD,
- ['%'] = IN_ESCAPE,
+ ['%'] = IN_INTERP,
[' '] = IN_WHITESPACE,
['\t'] = IN_WHITESPACE,
['\r'] = IN_WHITESPACE,
@@ -311,7 +311,7 @@ static void json_lexer_feed_char(JSONLexer *lexer, char ch, bool flush)
case JSON_RSQUARE:
case JSON_COLON:
case JSON_COMMA:
- case JSON_ESCAPE:
+ case JSON_INTERP:
case JSON_INTEGER:
case JSON_FLOAT:
case JSON_KEYWORD: