@property<EOL><INDENT>def nearest(self):<DEDENT>
try:<EOL><INDENT>options = self.jumps[self.current]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise KeyError(<EOL>'<STR_LIT>'<EOL>% (self.current, self.__class__)<EOL>)<EOL><DEDENT>offset = len(self.start)<EOL>index = len(self.pending)<EOL>if self.streaming:<EOL><INDENT>index -= max(map(len, options))<EOL><DEDENT>key = (index, <NUM_LIT:1>)<EOL>result = (index, '<STR_LIT>', None)<EOL>for amark, anext in options.items():<EOL><INDENT>asize = len(amark)<EOL>aindex = self.pending.find(amark, offset, index + asize)<EOL>if aindex > -<NUM_LIT:1>:<EOL><INDENT>index = aindex<EOL>akey = (aindex, -asize)<EOL>if akey < key:<EOL><INDENT>key = akey<EOL>result = (aindex, amark, anext)<EOL><DEDENT><DEDENT><DEDENT>return result<EOL>
Get the next state jump.

The next jump is calculated looking at :attr:`current` state
and its possible :attr:`jumps` to find the nearest and bigger
option in :attr:`pending` data.

If none is found, the returned next state label will be None.

:returns: tuple with index, substring and next state label
:rtype: tuple