Skip to content

Commit

Permalink
json: Improve names of lexer states related to numbers
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180823164025.12553-43-armbru@redhat.com>
  • Loading branch information
Markus Armbruster committed Aug 24, 2018
1 parent 53a0d61 commit 4d40066
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions qobject/json-lexer.c
Expand Up @@ -108,13 +108,13 @@ enum json_lexer_state {
IN_SQ_STRING_ESCAPE,
IN_SQ_STRING,
IN_ZERO,
IN_DIGITS,
IN_DIGIT,
IN_EXP_DIGITS,
IN_EXP_SIGN,
IN_EXP_E,
IN_MANTISSA,
IN_MANTISSA_DIGITS,
IN_NONZERO_NUMBER,
IN_NEG_NONZERO_NUMBER,
IN_DIGITS,
IN_SIGN,
IN_KEYWORD,
IN_INTERP,
IN_WHITESPACE,
Expand Down Expand Up @@ -164,19 +164,19 @@ static const uint8_t json_lexer[][256] = {
},

/* Float */
[IN_DIGITS] = {
[IN_EXP_DIGITS] = {
TERMINAL(JSON_FLOAT),
['0' ... '9'] = IN_DIGITS,
['0' ... '9'] = IN_EXP_DIGITS,
},

[IN_DIGIT] = {
['0' ... '9'] = IN_DIGITS,
[IN_EXP_SIGN] = {
['0' ... '9'] = IN_EXP_DIGITS,
},

[IN_EXP_E] = {
['-'] = IN_DIGIT,
['+'] = IN_DIGIT,
['0' ... '9'] = IN_DIGITS,
['-'] = IN_EXP_SIGN,
['+'] = IN_EXP_SIGN,
['0' ... '9'] = IN_EXP_DIGITS,
},

[IN_MANTISSA_DIGITS] = {
Expand All @@ -191,17 +191,17 @@ static const uint8_t json_lexer[][256] = {
},

/* Number */
[IN_NONZERO_NUMBER] = {
[IN_DIGITS] = {
TERMINAL(JSON_INTEGER),
['0' ... '9'] = IN_NONZERO_NUMBER,
['0' ... '9'] = IN_DIGITS,
['e'] = IN_EXP_E,
['E'] = IN_EXP_E,
['.'] = IN_MANTISSA,
},

[IN_NEG_NONZERO_NUMBER] = {
[IN_SIGN] = {
['0'] = IN_ZERO,
['1' ... '9'] = IN_NONZERO_NUMBER,
['1' ... '9'] = IN_DIGITS,
},

/* keywords */
Expand Down Expand Up @@ -236,8 +236,8 @@ static const uint8_t json_lexer[][256] = {
['"'] = IN_DQ_STRING,
['\''] = IN_SQ_STRING,
['0'] = IN_ZERO,
['1' ... '9'] = IN_NONZERO_NUMBER,
['-'] = IN_NEG_NONZERO_NUMBER,
['1' ... '9'] = IN_DIGITS,
['-'] = IN_SIGN,
['{'] = JSON_LCURLY,
['}'] = JSON_RCURLY,
['['] = JSON_LSQUARE,
Expand Down

0 comments on commit 4d40066

Please sign in to comment.