/** \brief Rewind the lexer input to the state specified by the supplied mark. * * \param[in] input Input stream context pointer * * \remark * Assumes ASCII (or at least, 8 Bit) input stream. */ static void antlr3AsciiSeek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint) { ANTLR3_INT32 count; pANTLR3_INPUT_STREAM input; input = ANTLR3_FUNC_PTR(((pANTLR3_INPUT_STREAM) is->super)); /* If the requested seek point is less than the current * input point, then we assume that we are resetting from a mark * and do not need to scan, but can just set to there. */ if (seekPoint <= (ANTLR3_MARKER)(input->nextChar)) { input->nextChar = ((pANTLR3_UINT8) seekPoint); } else { count = (ANTLR3_UINT32)(seekPoint - (ANTLR3_MARKER)(input->nextChar)); while (count--) { is->consume(is); } } }
/// \brief Rewind the lexer input to the state specified by the supplied mark. /// /// \param[in] input Input stream context pointer /// /// \remark /// Assumes ASCII (or at least, 8 Bit) input stream. /// static void antlr3UCS2Seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint) { ANTLR3_INT32 count; pANTLR3_INPUT_STREAM input; input = ((pANTLR3_INPUT_STREAM) is->super); // If the requested seek point is less than the current // input point, then we assume that we are resetting from a mark // and do not need to scan, but can just set to there. // if (seekPoint <= (ANTLR3_MARKER)(input->nextChar)) { input->nextChar = (void *)seekPoint; } else { count = (ANTLR3_UINT32)((seekPoint - (ANTLR3_MARKER)(input->nextChar)) / 2); // 16 bits per character in UCS2 while (count--) { is->consume(is); } } }