History | View | Annotate | Download (9.3 kB)
Add 'fall through' comments to case statements without break
These comments are used by static code analysis tools and in code reviewsto avoid false warnings because of missing break statements.
The case statements handled here were reported by coverity....
json-lexer: limit the maximum size of a given token
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
json-lexer: reset the lexer state on an invalid token
json-lexer: fix flushing logic to not always go to error state
Currently we flush the lexer by passing in a NULL character. Thisgenerally forces the lexer to go to the corresponding TERMINAL statefor whatever token type it is currently parsing, emits the token to the...
json-lexer: make lexer error-recovery more deterministic
Currently when we reach an error state we effectively flush everythingfed to the lexer, which can put us in a state where we keep feedingtokens into the parser at arbitrary offsets in the stream. This makes it...
json-lexer: fix conflict with mingw32 ERROR definition
The name ERROR is too generic, it conflicts with mingw32 ERROR definition.
Replace ERROR with IN_ERROR.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
json-lexer: Initialize 'x' and 'y'
The 'lexer' variable is passed by the caller, it can contain anything(eg. garbage).
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
json-lexer: Handle missing escapes
The JSON escape sequence "\/" and "\\" are valid and should behandled.
json-lexer: Drop 'buf'
QString supports adding a single char, 'buf' is unneeded.
implement optional lookahead in json lexer
Not requiring one extra character when lookahead is not necessaryensures that clients behave properly even if they, for example,send QMP requests without a trailing newline.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
remove unnecessary lookaheads
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
json: fix PRId64 on Win32
OK we are fooled by the json lexer and parser. As we use %I64d toprint 'long long' variables in Win32, but lexer and parser only dealwith %lld but not %I64d, this patch add support for %I64d and solve'info pci', 'powser_reset' and 'power_powerdown' assert failure in...
Add a lexer for JSON
Our JSON parser is a three stage parser. The first stage tokenizes the streaminto a set of lexical tokens. Since the lexical grammar is regular, we canuse a finite state machine to model it. The state machine will emit tokensas they are identified....