Lines Matching full:input

2 /// Base functions to initialize and manipulate any input stream
37 // Generic 8 bit input such as latin-1
55 static void antlr3InputClose (pANTLR3_INPUT_STREAM input);
56 static void antlr3InputReset (pANTLR3_INPUT_STREAM input);
57 static void antlr38BitReuse (pANTLR3_INPUT_STREAM input, pANTLR3_UINT8 i…
58 static void * antlr38BitLT (pANTLR3_INPUT_STREAM input, ANTLR3_INT32 lt);
59 static ANTLR3_UINT32 antlr38BitSize (pANTLR3_INPUT_STREAM input);
60 static pANTLR3_STRING antlr38BitSubstr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTL…
61 static ANTLR3_UINT32 antlr38BitGetLine (pANTLR3_INPUT_STREAM input);
62 static void * antlr38BitGetLineBuf (pANTLR3_INPUT_STREAM input);
63 static ANTLR3_UINT32 antlr38BitGetCharPosition (pANTLR3_INPUT_STREAM input);
64 static void antlr38BitSetLine (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 line);
65 static void antlr38BitSetCharPosition (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 position);
66 static void antlr38BitSetNewLineChar (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 newlineChar…
67 static void antlr38BitSetUcaseLA (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN flag);
85 static pANTLR3_STRING antlr3UTF16Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR…
101 static pANTLR3_STRING antlr3UTF32Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER sta…
114 /// \brief Common function to setup function interface for an 8 bit input stream.
116 /// \param input Input stream context pointer
120 /// by any or at least some, other input streams. Therefore it is perfectly acceptable
122 /// that would not work for the particular input encoding, such as consume for instance.
125 antlr38BitSetupStream (pANTLR3_INPUT_STREAM input) in antlr38BitSetupStream() argument
129 input->strFactory = antlr3StringFactoryNew(input->encoding); in antlr38BitSetupStream()
136 antlr3GenericSetupStream (pANTLR3_INPUT_STREAM input) in antlr3GenericSetupStream() argument
138 /* Install function pointers for an 8 bit input in antlr3GenericSetupStream()
143 input->istream = antlr3IntStreamNew(); in antlr3GenericSetupStream()
144 input->istream->type = ANTLR3_CHARSTREAM; in antlr3GenericSetupStream()
145 input->istream->super = input; in antlr3GenericSetupStream()
149input->istream->consume = antlr38BitConsume; // Consume the next 8 bit character in the bu… in antlr3GenericSetupStream()
150input->istream->_LA = antlr38BitLA; // Return the UTF32 character at offset n (1 … in antlr3GenericSetupStream()
151input->istream->index = antlr38BitIndex; // Current index (offset from first chara… in antlr3GenericSetupStream()
152input->istream->mark = antlr38BitMark; // Record the current lex state for later restore … in antlr3GenericSetupStream()
153 input->istream->rewind = antlr38BitRewind; // How to rewind the input in antlr3GenericSetupStream()
154 input->istream->rewindLast = antlr38BitRewindLast; // How to rewind the input in antlr3GenericSetupStream()
155input->istream->seek = antlr38BitSeek; // How to seek to a specific point in the stream … in antlr3GenericSetupStream()
156 input->istream->release = antlr38BitRelease; // Reset marks after mark n in antlr3GenericSetupStream()
157input->istream->getSourceName = antlr38BitGetSourceName; // Return a string that names the in antlr3GenericSetupStream()
161 input->close = antlr3InputClose; // Close down the stream completely in antlr3GenericSetupStream()
162 input->free = antlr3InputClose; // Synonym for free in antlr3GenericSetupStream()
163 input->reset = antlr3InputReset; // Reset input to start in antlr3GenericSetupStream()
164input->reuse = antlr38BitReuse; // Install a new input string and … in antlr3GenericSetupStream()
165 input->_LT = antlr38BitLT; // Same as _LA for 8 bit file in antlr3GenericSetupStream()
166 input->size = antlr38BitSize; // Return the size of the input buffer in antlr3GenericSetupStream()
167 input->substr = antlr38BitSubstr; // Return a string from the input stream in antlr3GenericSetupStream()
168input->getLine = antlr38BitGetLine; // Return the current line number in the input strea… in antlr3GenericSetupStream()
169input->getLineBuf = antlr38BitGetLineBuf; // Return a pointer to the start of the curren… in antlr3GenericSetupStream()
170input->getCharPositionInLine = antlr38BitGetCharPosition; // Return the offset into the curr… in antlr3GenericSetupStream()
171input->setLine = antlr38BitSetLine; // Set the input stream line number (does not set bu… in antlr3GenericSetupStream()
172input->setCharPositionInLine = antlr38BitSetCharPosition; // Set the offset in to the curren… in antlr3GenericSetupStream()
173input->SetNewLineChar = antlr38BitSetNewLineChar; // Set the value of the newline trigger … in antlr3GenericSetupStream()
174input->setUcaseLA = antlr38BitSetUcaseLA; // Changes the LA function to return upper … in antlr3GenericSetupStream()
176 input->charByteSize = 1; // Size in bytes of characters in this stream. in antlr3GenericSetupStream()
180 input->markers = NULL; in antlr3GenericSetupStream()
182 /* Set up the input stream brand new in antlr3GenericSetupStream()
184 input->reset(input); in antlr3GenericSetupStream()
189 input->SetNewLineChar(input, (ANTLR3_UCHAR)'\n'); in antlr3GenericSetupStream()
198 /** \brief Close down an input stream and free any memory allocated by it.
200 * \param input Input stream context pointer
203 antlr3InputClose(pANTLR3_INPUT_STREAM input) in antlr3InputClose() argument
205 // Close any markers in the input stream in antlr3InputClose()
207 if (input->markers != NULL) in antlr3InputClose()
209 input->markers->free(input->markers); in antlr3InputClose()
210 input->markers = NULL; in antlr3InputClose()
215 if (input->strFactory != NULL) in antlr3InputClose()
217 input->strFactory->close(input->strFactory); in antlr3InputClose()
220 // Free the input stream buffer if we allocated it in antlr3InputClose()
222 if (input->isAllocated && input->data != NULL) in antlr3InputClose()
224 ANTLR3_FREE(input->data); in antlr3InputClose()
225 input->data = NULL; in antlr3InputClose()
228 input->istream->free(input->istream); in antlr3InputClose()
232 ANTLR3_FREE(input); in antlr3InputClose()
239 antlr38BitSetUcaseLA (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN flag) in antlr38BitSetUcaseLA() argument
245 input->istream->_LA = antlr38BitLA_ucase; in antlr38BitSetUcaseLA()
251 input->istream->_LA = antlr38BitLA; in antlr38BitSetUcaseLA()
256 /** \brief Reset a re-startable input stream to the start
258 * \param input Input stream context pointer
261 antlr3InputReset(pANTLR3_INPUT_STREAM input) in antlr3InputReset() argument
264 input->nextChar = input->data; /* Input at first character */ in antlr3InputReset()
265 input->line = 1; /* starts at line 1 */ in antlr3InputReset()
266 input->charPositionInLine = -1; in antlr3InputReset()
267 input->currentLine = input->data; in antlr3InputReset()
268 input->markDepth = 0; /* Reset markers */ in antlr3InputReset()
272 if (input->markers != NULL) in antlr3InputReset()
274 input->markers->clear(input->markers); in antlr3InputReset()
280 input->markers = antlr3VectorNew(0); in antlr3InputReset()
284 /** Install a new source code in to a working input stream so that the
285 * input stream can be reused.
288 antlr38BitReuse(pANTLR3_INPUT_STREAM input, pANTLR3_UINT8 inString, ANTLR3_UINT32 size, pANTLR3_UIN… in antlr38BitReuse() argument
290 input->isAllocated = ANTLR3_FALSE; in antlr38BitReuse()
291 input->data = inString; in antlr38BitReuse()
292 input->sizeBuf = size; in antlr38BitReuse()
297 if (input->istream->streamName == NULL) in antlr38BitReuse()
299input->istream->streamName = input->strFactory->newStr(input->strFactory, name == NULL ? (pANTLR3_… in antlr38BitReuse()
300 input->fileName = input->istream->streamName; in antlr38BitReuse()
304input->istream->streamName->set(input->istream->streamName, (name == NULL ? (const char *)"-memor… in antlr38BitReuse()
307 input->reset(input); in antlr38BitReuse()
310 /** \brief Consume the next character in an 8 bit input stream
312 * \param input Input stream context pointer
317 pANTLR3_INPUT_STREAM input; in antlr38BitConsume() local
319 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr38BitConsume()
321 if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr38BitConsume()
325 input->charPositionInLine++; in antlr38BitConsume()
327 if ((ANTLR3_UCHAR)(*((pANTLR3_UINT8)input->nextChar)) == input->newlineChar) in antlr38BitConsume()
329 /* Reset for start of a new line of input in antlr38BitConsume()
331 input->line++; in antlr38BitConsume()
332 input->charPositionInLine = 0; in antlr38BitConsume()
333 input->currentLine = (void *)(((pANTLR3_UINT8)input->nextChar) + 1); in antlr38BitConsume()
338 input->nextChar = (void *)(((pANTLR3_UINT8)input->nextChar) + 1); in antlr38BitConsume()
342 /** \brief Return the input element assuming an 8 bit ascii input
344 * \param[in] input Input stream context pointer
345 * \param[in] la 1 based offset of next input stream element
347 * \return Next input character in internal ANTLR3 encoding (UTF32)
352 pANTLR3_INPUT_STREAM input; in antlr38BitLA() local
354 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr38BitLA()
356 …if (( ((pANTLR3_UINT8)input->nextChar) + la - 1) >= (((pANTLR3_UINT8)input->data) + input->sizeBuf… in antlr38BitLA()
362 return (ANTLR3_UCHAR)(*((pANTLR3_UINT8)input->nextChar + la - 1)); in antlr38BitLA()
366 /** \brief Return the input element assuming an 8 bit input and
371 * \param[in] input Input stream context pointer
372 * \param[in] la 1 based offset of next input stream element
374 * \return Next input character in internal ANTLR3 encoding (UTF32)
379 pANTLR3_INPUT_STREAM input; in antlr38BitLA_ucase() local
381 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr38BitLA_ucase()
383 …if (( ((pANTLR3_UINT8)input->nextChar) + la - 1) >= (((pANTLR3_UINT8)input->data) + input->sizeBuf… in antlr38BitLA_ucase()
389 return (ANTLR3_UCHAR)toupper((*((pANTLR3_UINT8)input->nextChar + la - 1))); in antlr38BitLA_ucase()
394 /** \brief Return the input element assuming an 8 bit ascii input
396 * \param[in] input Input stream context pointer
397 * \param[in] lt 1 based offset of next input stream element
399 * \return Next input character in internal ANTLR3 encoding (UTF32)
402 antlr38BitLT(pANTLR3_INPUT_STREAM input, ANTLR3_INT32 lt) in antlr38BitLT() argument
409 return (ANTLR3_FUNC_PTR(input->istream->_LA(input->istream, lt))); in antlr38BitLT()
413 * \param[in] input Input stream context pointer
418 pANTLR3_INPUT_STREAM input; in antlr38BitIndex() local
420 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr38BitIndex()
422 return (ANTLR3_MARKER)(((pANTLR3_UINT8)input->nextChar)); in antlr38BitIndex()
425 /** \brief Return the size of the current input stream, as an 8Bit file
426 * which in this case is the total input. Other implementations may provide
430 * \param[in] input Input stream context pointer
433 antlr38BitSize(pANTLR3_INPUT_STREAM input) in antlr38BitSize() argument
435 return input->sizeBuf; in antlr38BitSize()
438 /** \brief Mark the current input point in an 8Bit 8 bit stream
439 * such as a file stream, where all the input is available in the
442 * \param[in] is Input stream context pointer
448 pANTLR3_INPUT_STREAM input; in antlr38BitMark() local
450 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr38BitMark()
454 input->markDepth++; in antlr38BitMark()
459 if (input->markDepth > input->markers->count) in antlr38BitMark()
465input->markers->add(input->markers, state, ANTLR3_FREE_FUNC); /* No special structure, just free()… in antlr38BitMark()
469 state = (pANTLR3_LEX_STATE)input->markers->get(input->markers, input->markDepth - 1); in antlr38BitMark()
479 state->charPositionInLine = input->charPositionInLine; in antlr38BitMark()
480 state->currentLine = input->currentLine; in antlr38BitMark()
481 state->line = input->line; in antlr38BitMark()
482 state->nextChar = input->nextChar; in antlr38BitMark()
484 is->lastMarker = input->markDepth; in antlr38BitMark()
488 return input->markDepth; in antlr38BitMark()
490 /** \brief Rewind the lexer input to the state specified by the last produced mark.
492 * \param[in] input Input stream context pointer
495 * Assumes 8 Bit input stream.
503 /** \brief Rewind the lexer input to the state specified by the supplied mark.
505 * \param[in] input Input stream context pointer
508 * Assumes 8 Bit input stream.
514 pANTLR3_INPUT_STREAM input; in antlr38BitRewind() local
516 input = ((pANTLR3_INPUT_STREAM) is->super); in antlr38BitRewind()
520 input->istream->release(input->istream, mark); in antlr38BitRewind()
524 state = (pANTLR3_LEX_STATE)input->markers->get(input->markers, (ANTLR3_UINT32)(mark - 1)); in antlr38BitRewind()
526 /* Seek input pointer to the requested point (note we supply the void *pointer in antlr38BitRewind()
533 input->charPositionInLine = state->charPositionInLine; in antlr38BitRewind()
534 input->currentLine = state->currentLine; in antlr38BitRewind()
535 input->line = state->line; in antlr38BitRewind()
536 input->nextChar = state->nextChar; in antlr38BitRewind()
542 /** \brief Rewind the lexer input to the state specified by the supplied mark.
544 * \param[in] input Input stream context pointer
547 * Assumes 8 Bit input stream.
552 pANTLR3_INPUT_STREAM input; in antlr38BitRelease() local
554 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr38BitRelease()
559 input->markDepth = (ANTLR3_UINT32)(mark - 1); in antlr38BitRelease()
562 /** \brief Rewind the lexer input to the state specified by the supplied mark.
564 * \param[in] input Input stream context pointer
567 * Assumes 8 Bit input stream.
573 pANTLR3_INPUT_STREAM input; in antlr38BitSeek() local
575 input = ANTLR3_FUNC_PTR(((pANTLR3_INPUT_STREAM) is->super)); in antlr38BitSeek()
578 * input point, then we assume that we are resetting from a mark in antlr38BitSeek()
581 if (seekPoint <= (ANTLR3_MARKER)(input->nextChar)) in antlr38BitSeek()
583 input->nextChar = ((pANTLR3_UINT8) seekPoint); in antlr38BitSeek()
587 count = (ANTLR3_UINT32)(seekPoint - (ANTLR3_MARKER)(input->nextChar)); in antlr38BitSeek()
595 /** Return a substring of the 8 bit input stream in
598 * \param input Input stream context pointer
599 * \param start Offset in input stream where the string starts
600 * \param stop Offset in the input stream where the string ends.
603 antlr38BitSubstr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) in antlr38BitSubstr() argument
605 …return input->strFactory->newPtr(input->strFactory, (pANTLR3_UINT8)start, (ANTLR3_UINT32)(stop - … in antlr38BitSubstr()
608 /** \brief Return the line number as understood by the 8 bit input stream.
610 * \param input Input stream context pointer
611 * \return Line number in input stream that we believe we are working on.
614 antlr38BitGetLine (pANTLR3_INPUT_STREAM input) in antlr38BitGetLine() argument
616 return input->line; in antlr38BitGetLine()
619 /** Return a pointer into the input stream that points at the start
620 * of the current input line as triggered by the end of line character installed
623 * \param[in] input
626 antlr38BitGetLineBuf (pANTLR3_INPUT_STREAM input) in antlr38BitGetLineBuf() argument
628 return input->currentLine; in antlr38BitGetLineBuf()
631 /** Return the current offset in to the current line in the input stream.
633 * \param input Input stream context pointer
637 antlr38BitGetCharPosition (pANTLR3_INPUT_STREAM input) in antlr38BitGetCharPosition() argument
639 return input->charPositionInLine; in antlr38BitGetCharPosition()
642 /** Set the current line number as understood by the input stream.
644 * \param input Input stream context pointer
645 * \param line Line number to tell the input stream we are on
654 antlr38BitSetLine (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 line) in antlr38BitSetLine() argument
656 input->line = line; in antlr38BitSetLine()
661 * \param[in] input Input stream context pointer
665 * This does not set the actual pointers in the input stream, it is purely for reporting
669 antlr38BitSetCharPosition (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 position) in antlr38BitSetCharPosition() argument
671 input->charPositionInLine = position; in antlr38BitSetCharPosition()
674 /** Set the newline trigger character in the input stream to the supplied parameter.
676 * \param[in] input Input stream context pointer
681 * are the same encodings), but the input stream catered to by this function is 8 bit
685 antlr38BitSetNewLineChar (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 newlineChar) in antlr38BitSetNewLineChar() argument
687 input->newlineChar = newlineChar; in antlr38BitSetNewLineChar()
691 /// \brief Common function to setup function interface for a UTF16 or UCS2 input stream.
693 /// \param input Input stream context pointer
696 /// - Strictly speaking, there is no such thing as a UCS2 input stream as the term
699 /// input stream is able to handle it without any special code.
702 antlr3UTF16SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN… in antlr3UTF16SetupStream() argument
708 input->strFactory = antlr3StringFactoryNew(input->encoding); in antlr3UTF16SetupStream()
712input->istream->index = antlr3UTF16Index; // Calculate current index in input stre… in antlr3UTF16SetupStream()
713 input->substr = antlr3UTF16Substr; // Return a string from the input stream in antlr3UTF16SetupStream()
714input->istream->seek = antlr3UTF16Seek; // How to seek to a specific point in the stream in antlr3UTF16SetupStream()
716 // We must install different UTF16 routines according to whether the input in antlr3UTF16SetupStream()
725 // Machine is Big Endian, if the input is also then install the in antlr3UTF16SetupStream()
726 // methods that do not access input by bytes and reverse them. in antlr3UTF16SetupStream()
731 // Input is machine compatible in antlr3UTF16SetupStream()
733input->istream->consume = antlr3UTF16Consume; // Consume the next UTF16 character in the … in antlr3UTF16SetupStream()
734input->istream->_LA = antlr3UTF16LA; // Return the UTF32 character at offset n (1 ba… in antlr3UTF16SetupStream()
738 // Need to use methods that know that the input is little endian in antlr3UTF16SetupStream()
740input->istream->consume = antlr3UTF16ConsumeLE; // Consume the next UTF16 character in th… in antlr3UTF16SetupStream()
741input->istream->_LA = antlr3UTF16LALE; // Return the UTF32 character at offset n (1 … in antlr3UTF16SetupStream()
747 // Machine is Little Endian, if the input is also then install the in antlr3UTF16SetupStream()
748 // methods that do not access input by bytes and reverse them. in antlr3UTF16SetupStream()
753 // Input is machine compatible in antlr3UTF16SetupStream()
755input->istream->consume = antlr3UTF16Consume; // Consume the next UTF16 character in the … in antlr3UTF16SetupStream()
756input->istream->_LA = antlr3UTF16LA; // Return the UTF32 character at offset n (1 ba… in antlr3UTF16SetupStream()
760 // Need to use methods that know that the input is Big Endian in antlr3UTF16SetupStream()
762input->istream->consume = antlr3UTF16ConsumeBE; // Consume the next UTF16 character in th… in antlr3UTF16SetupStream()
763input->istream->_LA = antlr3UTF16LABE; // Return the UTF32 character at offset n (1 … in antlr3UTF16SetupStream()
769 input->charByteSize = 2; // Size in bytes of characters in this stream. in antlr3UTF16SetupStream()
773 /// \brief Consume the next character in a UTF16 input stream
775 /// \param input Input stream context pointer
780 pANTLR3_INPUT_STREAM input; in antlr3UTF16Consume() local
784 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16Consume()
788 if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16Consume()
792 input->charPositionInLine++; in antlr3UTF16Consume()
794 if ((ANTLR3_UCHAR)(*((pANTLR3_UINT16)input->nextChar)) == input->newlineChar) in antlr3UTF16Consume()
796 // Reset for start of a new line of input in antlr3UTF16Consume()
798 input->line++; in antlr3UTF16Consume()
799 input->charPositionInLine = 0; in antlr3UTF16Consume()
800 input->currentLine = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16Consume()
807 ch = *((UTF16*)input->nextChar); in antlr3UTF16Consume()
811 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16Consume()
820 … if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16Consume()
824 ch2 = *((UTF16*)input->nextChar); in antlr3UTF16Consume()
832 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16Consume()
849 /// \brief Return the input element assuming an 8 bit ascii input
851 /// \param[in] input Input stream context pointer
852 /// \param[in] la 1 based offset of next input stream element
854 /// \return Next input character in internal ANTLR3 encoding (UTF32)
859 pANTLR3_INPUT_STREAM input; in antlr3UTF16LA() local
864 // Find the input interface and where we are currently pointing to in antlr3UTF16LA()
865 // in the input stream in antlr3UTF16LA()
867 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16LA()
868 nextChar = input->nextChar; in antlr3UTF16LA()
874 … while (--la > 0 && (pANTLR3_UINT8)nextChar < ((pANTLR3_UINT8)input->data) + input->sizeBuf ) in antlr3UTF16LA()
876 // Advance our copy of the input pointer in antlr3UTF16LA()
889 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LA()
919 // We need to go backwards from our input point in antlr3UTF16LA()
921 while (la++ < 0 && (pANTLR3_UINT8)nextChar > (pANTLR3_UINT8)input->data ) in antlr3UTF16LA()
945 // Input buffer size is always in bytes in antlr3UTF16LA()
947 if ( (pANTLR3_UINT8)nextChar >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LA()
964 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LA()
993 /// \param[in] input Input stream context pointer
998 pANTLR3_INPUT_STREAM input; in antlr3UTF16Index() local
1000 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16Index()
1002 return (ANTLR3_MARKER)(input->nextChar); in antlr3UTF16Index()
1005 /// \brief Rewind the lexer input to the state specified by the supplied mark.
1007 /// \param[in] input Input stream context pointer
1010 /// Assumes UTF16 input stream.
1015 pANTLR3_INPUT_STREAM input; in antlr3UTF16Seek() local
1017 input = ((pANTLR3_INPUT_STREAM) is->super); in antlr3UTF16Seek()
1020 // input point, then we assume that we are resetting from a mark in antlr3UTF16Seek()
1024 if (seekPoint <= (ANTLR3_MARKER)(input->nextChar)) in antlr3UTF16Seek()
1026 input->nextChar = (void *)seekPoint; in antlr3UTF16Seek()
1032 … while (is->_LA(is, 1) != ANTLR3_CHARSTREAM_EOF && seekPoint < (ANTLR3_MARKER)input->nextChar) in antlr3UTF16Seek()
1038 /// \brief Return a substring of the UTF16 input stream in
1041 /// \param input Input stream context pointer
1042 /// \param start Offset in input stream where the string starts
1043 /// \param stop Offset in the input stream where the string ends.
1046 antlr3UTF16Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) in antlr3UTF16Substr() argument
1048 …return input->strFactory->newPtr(input->strFactory, (pANTLR3_UINT8)start, ((ANTLR3_UINT32_CAST(st… in antlr3UTF16Substr()
1051 /// \brief Consume the next character in a UTF16 input stream when the input is Little Endian and t…
1052 /// Note that the UTF16 routines do not do any substantial verification of the input stream as for …
1053 /// sake, we assume it is validly encoded. So if a low surrogate is found at the curent input posit…
1054 …nsume it. Surrogate pairs should be seen as Hi, Lo. So if we have a Lo first, then the input stream
1057 /// \param input Input stream context pointer
1062 pANTLR3_INPUT_STREAM input; in antlr3UTF16ConsumeLE() local
1066 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16ConsumeLE()
1070 if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16ConsumeLE()
1074 input->charPositionInLine++; in antlr3UTF16ConsumeLE()
1076 if ((ANTLR3_UCHAR)(*((pANTLR3_UINT16)input->nextChar)) == input->newlineChar) in antlr3UTF16ConsumeLE()
1078 // Reset for start of a new line of input in antlr3UTF16ConsumeLE()
1080 input->line++; in antlr3UTF16ConsumeLE()
1081 input->charPositionInLine = 0; in antlr3UTF16ConsumeLE()
1082 input->currentLine = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeLE()
1089 … ch = *((pANTLR3_UINT8)input->nextChar) + (*((pANTLR3_UINT8)input->nextChar + 1) <<8); in antlr3UTF16ConsumeLE()
1093 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeLE()
1102 … if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16ConsumeLE()
1104 … ch2 = *((pANTLR3_UINT8)input->nextChar) + (*((pANTLR3_UINT8)input->nextChar + 1) <<8); in antlr3UTF16ConsumeLE()
1112 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeLE()
1129 /// \brief Return the input element assuming a UTF16 input when the input is Little Endian and the …
1131 /// \param[in] input Input stream context pointer
1132 /// \param[in] la 1 based offset of next input stream element
1134 /// \return Next input character in internal ANTLR3 encoding (UTF32)
1139 pANTLR3_INPUT_STREAM input; in antlr3UTF16LALE() local
1144 // Find the input interface and where we are currently pointing to in antlr3UTF16LALE()
1145 // in the input stream in antlr3UTF16LALE()
1147 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16LALE()
1148 nextChar = input->nextChar; in antlr3UTF16LALE()
1154 … while (--la > 0 && (pANTLR3_UINT8)nextChar < ((pANTLR3_UINT8)input->data) + input->sizeBuf ) in antlr3UTF16LALE()
1156 // Advance our copy of the input pointer in antlr3UTF16LALE()
1170 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LALE()
1200 // We need to go backwards from our input point in antlr3UTF16LALE()
1202 while (la++ < 0 && (pANTLR3_UINT8)nextChar > (pANTLR3_UINT8)input->data ) in antlr3UTF16LALE()
1227 // Input buffer size is always in bytes in antlr3UTF16LALE()
1229 if ( (pANTLR3_UINT8)nextChar >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LALE()
1247 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LALE()
1274 /// \brief Consume the next character in a UTF16 input stream when the input is Big Endian and the …
1276 /// \param input Input stream context pointer
1281 pANTLR3_INPUT_STREAM input; in antlr3UTF16ConsumeBE() local
1285 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16ConsumeBE()
1289 if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16ConsumeBE()
1293 input->charPositionInLine++; in antlr3UTF16ConsumeBE()
1295 if ((ANTLR3_UCHAR)(*((pANTLR3_UINT16)input->nextChar)) == input->newlineChar) in antlr3UTF16ConsumeBE()
1297 // Reset for start of a new line of input in antlr3UTF16ConsumeBE()
1299 input->line++; in antlr3UTF16ConsumeBE()
1300 input->charPositionInLine = 0; in antlr3UTF16ConsumeBE()
1301 input->currentLine = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeBE()
1308 … ch = *((pANTLR3_UINT8)input->nextChar + 1) + (*((pANTLR3_UINT8)input->nextChar ) <<8); in antlr3UTF16ConsumeBE()
1312 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeBE()
1321 … if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16ConsumeBE()
1325 … ch2 = *((pANTLR3_UINT8)input->nextChar + 1) + (*((pANTLR3_UINT8)input->nextChar ) <<8); in antlr3UTF16ConsumeBE()
1333 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeBE()
1350 /// \brief Return the input element assuming a UTF16 input when the input is Little Endian and the …
1352 /// \param[in] input Input stream context pointer
1353 /// \param[in] la 1 based offset of next input stream element
1355 /// \return Next input character in internal ANTLR3 encoding (UTF32)
1360 pANTLR3_INPUT_STREAM input; in antlr3UTF16LABE() local
1365 // Find the input interface and where we are currently pointing to in antlr3UTF16LABE()
1366 // in the input stream in antlr3UTF16LABE()
1368 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16LABE()
1369 nextChar = input->nextChar; in antlr3UTF16LABE()
1375 … while (--la > 0 && (pANTLR3_UINT8)nextChar < ((pANTLR3_UINT8)input->data) + input->sizeBuf ) in antlr3UTF16LABE()
1377 // Advance our copy of the input pointer in antlr3UTF16LABE()
1391 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LABE()
1421 // We need to go backwards from our input point in antlr3UTF16LABE()
1423 while (la++ < 0 && (pANTLR3_UINT8)nextChar > (pANTLR3_UINT8)input->data ) in antlr3UTF16LABE()
1448 // Input buffer size is always in bytes in antlr3UTF16LABE()
1450 if ( (pANTLR3_UINT8)nextChar >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LABE()
1468 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LABE()
1495 /// \brief Common function to setup function interface for a UTF3 input stream.
1497 /// \param input Input stream context pointer
1500 antlr3UTF32SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN… in antlr3UTF32SetupStream() argument
1506 input->strFactory = antlr3StringFactoryNew(input->encoding); in antlr3UTF32SetupStream()
1510input->istream->index = antlr3UTF32Index; // Calculate current index in input stre… in antlr3UTF32SetupStream()
1511 input->substr = antlr3UTF32Substr; // Return a string from the input stream in antlr3UTF32SetupStream()
1512input->istream->seek = antlr3UTF32Seek; // How to seek to a specific point in the stream in antlr3UTF32SetupStream()
1513input->istream->consume = antlr3UTF32Consume; // Consume the next UTF32 character in the … in antlr3UTF32SetupStream()
1515 // We must install different UTF32 LA routines according to whether the input in antlr3UTF32SetupStream()
1523 // Machine is Big Endian, if the input is also then install the in antlr3UTF32SetupStream()
1524 // methods that do not access input by bytes and reverse them. in antlr3UTF32SetupStream()
1529 // Input is machine compatible in antlr3UTF32SetupStream()
1531input->istream->_LA = antlr3UTF32LA; // Return the UTF32 character at offset n (1 ba… in antlr3UTF32SetupStream()
1535 // Need to use methods that know that the input is little endian in antlr3UTF32SetupStream()
1537input->istream->_LA = antlr3UTF32LALE; // Return the UTF32 character at offset n (1 … in antlr3UTF32SetupStream()
1543 // Machine is Little Endian, if the input is also then install the in antlr3UTF32SetupStream()
1544 // methods that do not access input by bytes and reverse them. in antlr3UTF32SetupStream()
1549 // Input is machine compatible in antlr3UTF32SetupStream()
1551input->istream->_LA = antlr3UTF32LA; // Return the UTF32 character at offset n (1 ba… in antlr3UTF32SetupStream()
1555 // Need to use methods that know that the input is Big Endian in antlr3UTF32SetupStream()
1557input->istream->_LA = antlr3UTF32LABE; // Return the UTF32 character at offset n (1 … in antlr3UTF32SetupStream()
1562 input->charByteSize = 4; // Size in bytes of characters in this stream. in antlr3UTF32SetupStream()
1565 /** \brief Consume the next character in a UTF32 input stream
1567 * \param input Input stream context pointer
1572 pANTLR3_INPUT_STREAM input; in antlr3UTF32Consume() local
1574 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF32Consume()
1578 if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF32Consume()
1582 input->charPositionInLine++; in antlr3UTF32Consume()
1584 if ((ANTLR3_UCHAR)(*((pANTLR3_UINT32)input->nextChar)) == input->newlineChar) in antlr3UTF32Consume()
1586 /* Reset for start of a new line of input in antlr3UTF32Consume()
1588 input->line++; in antlr3UTF32Consume()
1589 input->charPositionInLine = 0; in antlr3UTF32Consume()
1590 input->currentLine = (void *)(((pANTLR3_UINT32)input->nextChar) + 1); in antlr3UTF32Consume()
1595 input->nextChar = (void *)(((pANTLR3_UINT32)input->nextChar) + 1); in antlr3UTF32Consume()
1600 /// \param[in] input Input stream context pointer
1605 pANTLR3_INPUT_STREAM input; in antlr3UTF32Index() local
1607 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF32Index()
1609 return (ANTLR3_MARKER)(input->nextChar); in antlr3UTF32Index()
1612 /// \brief Return a substring of the UTF16 input stream in
1615 /// \param input Input stream context pointer
1616 /// \param start Offset in input stream where the string starts
1617 /// \param stop Offset in the input stream where the string ends.
1620 antlr3UTF32Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) in antlr3UTF32Substr() argument
1622 …return input->strFactory->newPtr(input->strFactory, (pANTLR3_UINT8)start, ((ANTLR3_UINT32_CAST(st… in antlr3UTF32Substr()
1625 /// \brief Rewind the lexer input to the state specified by the supplied mark.
1627 /// \param[in] input Input stream context pointer
1630 /// Assumes UTF32 input stream.
1635 pANTLR3_INPUT_STREAM input; in antlr3UTF32Seek() local
1637 input = ((pANTLR3_INPUT_STREAM) is->super); in antlr3UTF32Seek()
1640 // input point, then we assume that we are resetting from a mark in antlr3UTF32Seek()
1644 if (seekPoint <= (ANTLR3_MARKER)(input->nextChar)) in antlr3UTF32Seek()
1646 input->nextChar = (void *)seekPoint; in antlr3UTF32Seek()
1652 … while (is->_LA(is, 1) != ANTLR3_CHARSTREAM_EOF && seekPoint < (ANTLR3_MARKER)input->nextChar) in antlr3UTF32Seek()
1659 /** \brief Return the input element assuming a UTF32 input in natural machine byte order
1661 * \param[in] input Input stream context pointer
1662 * \param[in] la 1 based offset of next input stream element
1664 * \return Next input character in internal ANTLR3 encoding (UTF32)
1669 pANTLR3_INPUT_STREAM input; in antlr3UTF32LA() local
1671 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF32LA()
1673 …if (( ((pANTLR3_UINT8)input->nextChar) + la - 1) >= (((pANTLR3_UINT8)input->data) + input->sizeBuf… in antlr3UTF32LA()
1679 return (ANTLR3_UCHAR)(*((pANTLR3_UINT32)input->nextChar + la - 1)); in antlr3UTF32LA()
1683 /** \brief Return the input element assuming a UTF32 input in little endian byte order
1685 * \param[in] input Input stream context pointer
1686 * \param[in] la 1 based offset of next input stream element
1688 * \return Next input character in internal ANTLR3 encoding (UTF32)
1693 pANTLR3_INPUT_STREAM input; in antlr3UTF32LALE() local
1695 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF32LALE()
1697 …if (( ((pANTLR3_UINT8)input->nextChar) + la - 1) >= (((pANTLR3_UINT8)input->data) + input->sizeBuf… in antlr3UTF32LALE()
1705 c = (ANTLR3_UCHAR)(*((pANTLR3_UINT32)input->nextChar + la - 1)); in antlr3UTF32LALE()
1713 /** \brief Return the input element assuming a UTF32 input in big endian byte order
1715 * \param[in] input Input stream context pointer
1716 * \param[in] la 1 based offset of next input stream element
1718 * \return Next input character in internal ANTLR3 encoding (UTF32)
1724 pANTLR3_INPUT_STREAM input; in antlr3UTF32LABE() local
1726 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF32LABE()
1728 …if (( ((pANTLR3_UINT8)input->nextChar) + la - 1) >= (((pANTLR3_UINT8)input->data) + input->sizeBuf… in antlr3UTF32LABE()
1736 c = (ANTLR3_UCHAR)(*((pANTLR3_UINT32)input->nextChar + la - 1)); in antlr3UTF32LABE()
1745 /// \brief Common function to setup function interface for a UTF8 input stream.
1747 /// \param input Input stream context pointer
1750 antlr3UTF8SetupStream (pANTLR3_INPUT_STREAM input) in antlr3UTF8SetupStream() argument
1756 input->strFactory = antlr3StringFactoryNew(input->encoding); in antlr3UTF8SetupStream()
1760 input->istream->consume = antlr3UTF8Consume; // Consume the next UTF32 character in the buffer in antlr3UTF8SetupStream()
1761input->istream->_LA = antlr3UTF8LA; // Return the UTF32 character at offset n (1 b… in antlr3UTF8SetupStream()
1762 input->charByteSize = 0; // Size in bytes of characters in this stream. in antlr3UTF8SetupStream()
1799 /** \brief Consume the next character in a UTF8 input stream
1801 * \param input Input stream context pointer
1806 pANTLR3_INPUT_STREAM input; in antlr3UTF8Consume() local
1811 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF8Consume()
1813 nextChar = input->nextChar; in antlr3UTF8Consume()
1815 if (nextChar < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF8Consume()
1819 input->charPositionInLine++; in antlr3UTF8Consume()
1825 if (nextChar + extraBytesToRead >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF8Consume()
1827 input->nextChar = (((pANTLR3_UINT8)input->data) + input->sizeBuf); in antlr3UTF8Consume()
1845 // Magically correct the input value in antlr3UTF8Consume()
1848 if (ch == input->newlineChar) in antlr3UTF8Consume()
1850 /* Reset for start of a new line of input in antlr3UTF8Consume()
1852 input->line++; in antlr3UTF8Consume()
1853 input->charPositionInLine = 0; in antlr3UTF8Consume()
1854 input->currentLine = (void *)nextChar; in antlr3UTF8Consume()
1857 // Update input pointer in antlr3UTF8Consume()
1859 input->nextChar = nextChar; in antlr3UTF8Consume()
1862 /** \brief Return the input element assuming a UTF8 input
1864 * \param[in] input Input stream context pointer
1865 * \param[in] la 1 based offset of next input stream element
1867 * \return Next input character in internal ANTLR3 encoding (UTF32)
1872 pANTLR3_INPUT_STREAM input; in antlr3UTF8LA() local
1877 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF8LA()
1879 nextChar = input->nextChar; in antlr3UTF8LA()
1892 if (nextChar < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF8LA()
1906 if (nextChar >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF8LA()
1921 while (nextChar > (pANTLR3_UINT8)input->data && la++ < 0) in antlr3UTF8LA()
1943 if (nextChar + extraBytesToRead >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF8LA()
1960 // Magically correct the input value in antlr3UTF8LA()
2008 /// \brief Common function to setup function interface for a EBCDIC input stream.
2010 /// \param input Input stream context pointer
2013 antlr3EBCDICSetupStream (pANTLR3_INPUT_STREAM input) in antlr3EBCDICSetupStream() argument
2017 input->strFactory = antlr3StringFactoryNew(input->encoding); in antlr3EBCDICSetupStream()
2021input->istream->_LA = antlr3EBCDICLA; // Return the UTF32 character at offset n (1 b… in antlr3EBCDICSetupStream()
2022 input->charByteSize = 1; // Size in bytes of characters in this stream. in antlr3EBCDICSetupStream()
2025 /// \brief Return the input element assuming an 8 bit EBCDIC input
2027 /// \param[in] input Input stream context pointer
2028 /// \param[in] la 1 based offset of next input stream element
2030 /// \return Next input character in internal ANTLR3 encoding (UTF32) after translation
2036 pANTLR3_INPUT_STREAM input; in antlr3EBCDICLA() local
2038 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3EBCDICLA()
2040 …if (( ((pANTLR3_UINT8)input->nextChar) + la - 1) >= (((pANTLR3_UINT8)input->data) + input->sizeBuf… in antlr3EBCDICLA()
2048 return e2a[(*((pANTLR3_UINT8)input->nextChar + la - 1))]; in antlr3EBCDICLA()