json-lexer: fix flushing logic to not always go to error state
authorMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 1 Jun 2011 17:14:57 +0000 (12:14 -0500)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 7 Jun 2011 18:52:11 +0000 (13:52 -0500)
commit20a18b698efaf9c220eae6614aa07cdc5d0c07bc
tree1f5858de694e809fd9275c23701a63fba02f40d6
parent802aba23d2ee3995a70d0647ebb3eece5d78c7b7
json-lexer: fix flushing logic to not always go to error state

Currently we flush the lexer by passing in a NULL character. This
generally forces the lexer to go to the corresponding TERMINAL() state
for whatever token type it is currently parsing, emits the token to the
parser, then puts the lexer back into IN_START state. However, since a
NULL character causes char_consumed to be 0, we always do a second pass
after this, which puts us in the IN_ERROR state. Fix this behavior by
adding a "flush" flag that tells the lexer not to do a more than 1
iteration.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
json-lexer.c