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()
149 …input->istream->consume = antlr38BitConsume; // Consume the next 8 bit character in the bu… in antlr3GenericSetupStream()
150 …input->istream->_LA = antlr38BitLA; // Return the UTF32 character at offset n (1 … in antlr3GenericSetupStream()
151 …input->istream->index = antlr38BitIndex; // Current index (offset from first chara… in antlr3GenericSetupStream()
152 …input->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()
155 …input->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()
157 …input->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()
164 …input->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()
168 …input->getLine = antlr38BitGetLine; // Return the current line number in the input strea… in antlr3GenericSetupStream()
169 …input->getLineBuf = antlr38BitGetLineBuf; // Return a pointer to the start of the curren… in antlr3GenericSetupStream()
170 …input->getCharPositionInLine = antlr38BitGetCharPosition; // Return the offset into the curr… in antlr3GenericSetupStream()
171 …input->setLine = antlr38BitSetLine; // Set the input stream line number (does not set bu… in antlr3GenericSetupStream()
172 …input->setCharPositionInLine = antlr38BitSetCharPosition; // Set the offset in to the curren… in antlr3GenericSetupStream()
173 …input->SetNewLineChar = antlr38BitSetNewLineChar; // Set the value of the newline trigger … in antlr3GenericSetupStream()
174 …input->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 = 0; 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()
299 …input->istream->streamName = input->strFactory->newStr(input->strFactory, name == NULL ? (pANTLR3_… in antlr38BitReuse()
300 input->fileName = input->istream->streamName; in antlr38BitReuse()
304 …input->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()
465 --input->markDepth; in antlr38BitMark()
471 …input->markers->add(input->markers, state, ANTLR3_FREE_FUNC); /* No special structure, just free()… in antlr38BitMark()
475 state = (pANTLR3_LEX_STATE)input->markers->get(input->markers, input->markDepth - 1); in antlr38BitMark()
485 state->charPositionInLine = input->charPositionInLine; in antlr38BitMark()
486 state->currentLine = input->currentLine; in antlr38BitMark()
487 state->line = input->line; in antlr38BitMark()
488 state->nextChar = input->nextChar; in antlr38BitMark()
490 is->lastMarker = input->markDepth; in antlr38BitMark()
494 return input->markDepth; in antlr38BitMark()
496 /** \brief Rewind the lexer input to the state specified by the last produced mark.
498 * \param[in] input Input stream context pointer
501 * Assumes 8 Bit input stream.
509 /** \brief Rewind the lexer input to the state specified by the supplied mark.
511 * \param[in] input Input stream context pointer
514 * Assumes 8 Bit input stream.
520 pANTLR3_INPUT_STREAM input; in antlr38BitRewind() local
522 input = ((pANTLR3_INPUT_STREAM) is->super); in antlr38BitRewind()
526 input->istream->release(input->istream, mark); in antlr38BitRewind()
530 state = (pANTLR3_LEX_STATE)input->markers->get(input->markers, (ANTLR3_UINT32)(mark - 1)); in antlr38BitRewind()
533 /* Seek input pointer to the requested point (note we supply the void *pointer in antlr38BitRewind()
540 input->charPositionInLine = state->charPositionInLine; in antlr38BitRewind()
541 input->currentLine = state->currentLine; in antlr38BitRewind()
542 input->line = state->line; in antlr38BitRewind()
543 input->nextChar = state->nextChar; in antlr38BitRewind()
549 /** \brief Rewind the lexer input to the state specified by the supplied mark.
551 * \param[in] input Input stream context pointer
554 * Assumes 8 Bit input stream.
559 pANTLR3_INPUT_STREAM input; in antlr38BitRelease() local
561 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr38BitRelease()
566 input->markDepth = (ANTLR3_UINT32)(mark - 1); in antlr38BitRelease()
569 /** \brief Rewind the lexer input to the state specified by the supplied mark.
571 * \param[in] input Input stream context pointer
574 * Assumes 8 Bit input stream.
580 pANTLR3_INPUT_STREAM input; in antlr38BitSeek() local
582 input = (pANTLR3_INPUT_STREAM)ANTLR3_FUNC_PTR(((pANTLR3_INPUT_STREAM) is->super)); in antlr38BitSeek()
585 * input point, then we assume that we are resetting from a mark in antlr38BitSeek()
588 if (seekPoint <= (ANTLR3_MARKER)(input->nextChar)) in antlr38BitSeek()
590 input->nextChar = ((pANTLR3_UINT8) seekPoint); in antlr38BitSeek()
594 count = (ANTLR3_UINT32)(seekPoint - (ANTLR3_MARKER)(input->nextChar)); in antlr38BitSeek()
602 /** Return a substring of the 8 bit input stream in
605 * \param input Input stream context pointer
606 * \param start Offset in input stream where the string starts
607 * \param stop Offset in the input stream where the string ends.
610 antlr38BitSubstr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) in antlr38BitSubstr() argument
612 …return input->strFactory->newPtr(input->strFactory, (pANTLR3_UINT8)start, (ANTLR3_UINT32)(stop - … in antlr38BitSubstr()
615 /** \brief Return the line number as understood by the 8 bit input stream.
617 * \param input Input stream context pointer
618 * \return Line number in input stream that we believe we are working on.
621 antlr38BitGetLine (pANTLR3_INPUT_STREAM input) in antlr38BitGetLine() argument
623 return input->line; in antlr38BitGetLine()
626 /** Return a pointer into the input stream that points at the start
627 * of the current input line as triggered by the end of line character installed
630 * \param[in] input
633 antlr38BitGetLineBuf (pANTLR3_INPUT_STREAM input) in antlr38BitGetLineBuf() argument
635 return input->currentLine; in antlr38BitGetLineBuf()
638 /** Return the current offset in to the current line in the input stream.
640 * \param input Input stream context pointer
644 antlr38BitGetCharPosition (pANTLR3_INPUT_STREAM input) in antlr38BitGetCharPosition() argument
646 return input->charPositionInLine; in antlr38BitGetCharPosition()
649 /** Set the current line number as understood by the input stream.
651 * \param input Input stream context pointer
652 * \param line Line number to tell the input stream we are on
661 antlr38BitSetLine (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 line) in antlr38BitSetLine() argument
663 input->line = line; in antlr38BitSetLine()
668 * \param[in] input Input stream context pointer
672 * This does not set the actual pointers in the input stream, it is purely for reporting
676 antlr38BitSetCharPosition (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 position) in antlr38BitSetCharPosition() argument
678 input->charPositionInLine = position; in antlr38BitSetCharPosition()
681 /** Set the newline trigger character in the input stream to the supplied parameter.
683 * \param[in] input Input stream context pointer
688 * are the same encodings), but the input stream catered to by this function is 8 bit
692 antlr38BitSetNewLineChar (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 newlineChar) in antlr38BitSetNewLineChar() argument
694 input->newlineChar = newlineChar; in antlr38BitSetNewLineChar()
698 /// \brief Common function to setup function interface for a UTF16 or UCS2 input stream.
700 /// \param input Input stream context pointer
703 /// - Strictly speaking, there is no such thing as a UCS2 input stream as the term
706 /// input stream is able to handle it without any special code.
709 antlr3UTF16SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN… in antlr3UTF16SetupStream() argument
715 input->strFactory = antlr3StringFactoryNew(input->encoding); in antlr3UTF16SetupStream()
719 …input->istream->index = antlr3UTF16Index; // Calculate current index in input stre… in antlr3UTF16SetupStream()
720 input->substr = antlr3UTF16Substr; // Return a string from the input stream in antlr3UTF16SetupStream()
721 … input->istream->seek = antlr3UTF16Seek; // How to seek to a specific point in the stream in antlr3UTF16SetupStream()
723 // We must install different UTF16 routines according to whether the input in antlr3UTF16SetupStream()
732 // Machine is Big Endian, if the input is also then install the in antlr3UTF16SetupStream()
733 // methods that do not access input by bytes and reverse them. in antlr3UTF16SetupStream()
738 // Input is machine compatible in antlr3UTF16SetupStream()
740 …input->istream->consume = antlr3UTF16Consume; // Consume the next UTF16 character in the … in antlr3UTF16SetupStream()
741 …input->istream->_LA = antlr3UTF16LA; // Return the UTF32 character at offset n (1 ba… in antlr3UTF16SetupStream()
745 // Need to use methods that know that the input is little endian in antlr3UTF16SetupStream()
747 …input->istream->consume = antlr3UTF16ConsumeLE; // Consume the next UTF16 character in th… in antlr3UTF16SetupStream()
748 …input->istream->_LA = antlr3UTF16LALE; // Return the UTF32 character at offset n (1 … in antlr3UTF16SetupStream()
754 // Machine is Little Endian, if the input is also then install the in antlr3UTF16SetupStream()
755 // methods that do not access input by bytes and reverse them. in antlr3UTF16SetupStream()
760 // Input is machine compatible in antlr3UTF16SetupStream()
762 …input->istream->consume = antlr3UTF16Consume; // Consume the next UTF16 character in the … in antlr3UTF16SetupStream()
763 …input->istream->_LA = antlr3UTF16LA; // Return the UTF32 character at offset n (1 ba… in antlr3UTF16SetupStream()
767 // Need to use methods that know that the input is Big Endian in antlr3UTF16SetupStream()
769 …input->istream->consume = antlr3UTF16ConsumeBE; // Consume the next UTF16 character in th… in antlr3UTF16SetupStream()
770 …input->istream->_LA = antlr3UTF16LABE; // Return the UTF32 character at offset n (1 … in antlr3UTF16SetupStream()
776 input->charByteSize = 2; // Size in bytes of characters in this stream. in antlr3UTF16SetupStream()
780 /// \brief Consume the next character in a UTF16 input stream
782 /// \param input Input stream context pointer
787 pANTLR3_INPUT_STREAM input; in antlr3UTF16Consume() local
791 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16Consume()
795 if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16Consume()
799 input->charPositionInLine++; in antlr3UTF16Consume()
801 if ((ANTLR3_UCHAR)(*((pANTLR3_UINT16)input->nextChar)) == input->newlineChar) in antlr3UTF16Consume()
803 // Reset for start of a new line of input in antlr3UTF16Consume()
805 input->line++; in antlr3UTF16Consume()
806 input->charPositionInLine = 0; in antlr3UTF16Consume()
807 input->currentLine = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16Consume()
814 ch = *((UTF16*)input->nextChar); in antlr3UTF16Consume()
818 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16Consume()
827 … if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16Consume()
831 ch2 = *((UTF16*)input->nextChar); in antlr3UTF16Consume()
839 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16Consume()
856 /// \brief Return the input element assuming an 8 bit ascii input
858 /// \param[in] input Input stream context pointer
859 /// \param[in] la 1 based offset of next input stream element
861 /// \return Next input character in internal ANTLR3 encoding (UTF32)
866 pANTLR3_INPUT_STREAM input; in antlr3UTF16LA() local
871 // Find the input interface and where we are currently pointing to in antlr3UTF16LA()
872 // in the input stream in antlr3UTF16LA()
874 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16LA()
875 nextChar = (UTF16*)input->nextChar; in antlr3UTF16LA()
881 … while (--la > 0 && (pANTLR3_UINT8)nextChar < ((pANTLR3_UINT8)input->data) + input->sizeBuf ) in antlr3UTF16LA()
883 // Advance our copy of the input pointer in antlr3UTF16LA()
896 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LA()
926 // We need to go backwards from our input point in antlr3UTF16LA()
928 while (la++ < 0 && (pANTLR3_UINT8)nextChar > (pANTLR3_UINT8)input->data ) in antlr3UTF16LA()
952 // Input buffer size is always in bytes in antlr3UTF16LA()
954 if ( (pANTLR3_UINT8)nextChar >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LA()
971 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LA()
1000 /// \param[in] input Input stream context pointer
1005 pANTLR3_INPUT_STREAM input; in antlr3UTF16Index() local
1007 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16Index()
1009 return (ANTLR3_MARKER)(input->nextChar); in antlr3UTF16Index()
1012 /// \brief Rewind the lexer input to the state specified by the supplied mark.
1014 /// \param[in] input Input stream context pointer
1017 /// Assumes UTF16 input stream.
1022 pANTLR3_INPUT_STREAM input; in antlr3UTF16Seek() local
1024 input = ((pANTLR3_INPUT_STREAM) is->super); in antlr3UTF16Seek()
1027 // input point, then we assume that we are resetting from a mark in antlr3UTF16Seek()
1031 if (seekPoint <= (ANTLR3_MARKER)(input->nextChar)) in antlr3UTF16Seek()
1033 input->nextChar = (void *)seekPoint; in antlr3UTF16Seek()
1039 … while (is->_LA(is, 1) != ANTLR3_CHARSTREAM_EOF && seekPoint < (ANTLR3_MARKER)input->nextChar) in antlr3UTF16Seek()
1045 /// \brief Return a substring of the UTF16 input stream in
1048 /// \param input Input stream context pointer
1049 /// \param start Offset in input stream where the string starts
1050 /// \param stop Offset in the input stream where the string ends.
1053 antlr3UTF16Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) in antlr3UTF16Substr() argument
1055 …return input->strFactory->newPtr(input->strFactory, (pANTLR3_UINT8)start, ((ANTLR3_UINT32_CAST(st… in antlr3UTF16Substr()
1058 /// \brief Consume the next character in a UTF16 input stream when the input is Little Endian and t…
1059 /// Note that the UTF16 routines do not do any substantial verification of the input stream as for …
1060 /// sake, we assume it is validly encoded. So if a low surrogate is found at the curent input posit…
1061 …nsume it. Surrogate pairs should be seen as Hi, Lo. So if we have a Lo first, then the input stream
1064 /// \param input Input stream context pointer
1069 pANTLR3_INPUT_STREAM input; in antlr3UTF16ConsumeLE() local
1073 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16ConsumeLE()
1077 if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16ConsumeLE()
1081 input->charPositionInLine++; in antlr3UTF16ConsumeLE()
1083 if ((ANTLR3_UCHAR)(*((pANTLR3_UINT16)input->nextChar)) == input->newlineChar) in antlr3UTF16ConsumeLE()
1085 // Reset for start of a new line of input in antlr3UTF16ConsumeLE()
1087 input->line++; in antlr3UTF16ConsumeLE()
1088 input->charPositionInLine = 0; in antlr3UTF16ConsumeLE()
1089 input->currentLine = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeLE()
1096 … ch = *((pANTLR3_UINT8)input->nextChar) + (*((pANTLR3_UINT8)input->nextChar + 1) <<8); in antlr3UTF16ConsumeLE()
1100 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeLE()
1109 … if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16ConsumeLE()
1111 … ch2 = *((pANTLR3_UINT8)input->nextChar) + (*((pANTLR3_UINT8)input->nextChar + 1) <<8); in antlr3UTF16ConsumeLE()
1119 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeLE()
1136 /// \brief Return the input element assuming a UTF16 input when the input is Little Endian and the …
1138 /// \param[in] input Input stream context pointer
1139 /// \param[in] la 1 based offset of next input stream element
1141 /// \return Next input character in internal ANTLR3 encoding (UTF32)
1146 pANTLR3_INPUT_STREAM input; in antlr3UTF16LALE() local
1151 // Find the input interface and where we are currently pointing to in antlr3UTF16LALE()
1152 // in the input stream in antlr3UTF16LALE()
1154 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16LALE()
1155 nextChar = (pANTLR3_UCHAR)input->nextChar; in antlr3UTF16LALE()
1161 … while (--la > 0 && (pANTLR3_UINT8)nextChar < ((pANTLR3_UINT8)input->data) + input->sizeBuf ) in antlr3UTF16LALE()
1163 // Advance our copy of the input pointer in antlr3UTF16LALE()
1177 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LALE()
1207 // We need to go backwards from our input point in antlr3UTF16LALE()
1209 while (la++ < 0 && (pANTLR3_UINT8)nextChar > (pANTLR3_UINT8)input->data ) in antlr3UTF16LALE()
1234 // Input buffer size is always in bytes in antlr3UTF16LALE()
1236 if ( (pANTLR3_UINT8)nextChar >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LALE()
1254 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LALE()
1281 /// \brief Consume the next character in a UTF16 input stream when the input is Big Endian and the …
1283 /// \param input Input stream context pointer
1288 pANTLR3_INPUT_STREAM input; in antlr3UTF16ConsumeBE() local
1292 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16ConsumeBE()
1296 if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16ConsumeBE()
1300 input->charPositionInLine++; in antlr3UTF16ConsumeBE()
1302 if ((ANTLR3_UCHAR)(*((pANTLR3_UINT16)input->nextChar)) == input->newlineChar) in antlr3UTF16ConsumeBE()
1304 // Reset for start of a new line of input in antlr3UTF16ConsumeBE()
1306 input->line++; in antlr3UTF16ConsumeBE()
1307 input->charPositionInLine = 0; in antlr3UTF16ConsumeBE()
1308 input->currentLine = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeBE()
1315 … ch = *((pANTLR3_UINT8)input->nextChar + 1) + (*((pANTLR3_UINT8)input->nextChar ) <<8); in antlr3UTF16ConsumeBE()
1319 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeBE()
1328 … if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16ConsumeBE()
1332 … ch2 = *((pANTLR3_UINT8)input->nextChar + 1) + (*((pANTLR3_UINT8)input->nextChar ) <<8); in antlr3UTF16ConsumeBE()
1340 input->nextChar = (void *)(((pANTLR3_UINT16)input->nextChar) + 1); in antlr3UTF16ConsumeBE()
1357 /// \brief Return the input element assuming a UTF16 input when the input is Little Endian and the …
1359 /// \param[in] input Input stream context pointer
1360 /// \param[in] la 1 based offset of next input stream element
1362 /// \return Next input character in internal ANTLR3 encoding (UTF32)
1367 pANTLR3_INPUT_STREAM input; in antlr3UTF16LABE() local
1372 // Find the input interface and where we are currently pointing to in antlr3UTF16LABE()
1373 // in the input stream in antlr3UTF16LABE()
1375 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF16LABE()
1376 nextChar = (pANTLR3_UCHAR)input->nextChar; in antlr3UTF16LABE()
1382 … while (--la > 0 && (pANTLR3_UINT8)nextChar < ((pANTLR3_UINT8)input->data) + input->sizeBuf ) in antlr3UTF16LABE()
1384 // Advance our copy of the input pointer in antlr3UTF16LABE()
1398 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LABE()
1428 // We need to go backwards from our input point in antlr3UTF16LABE()
1430 while (la++ < 0 && (pANTLR3_UINT8)nextChar > (pANTLR3_UINT8)input->data ) in antlr3UTF16LABE()
1455 // Input buffer size is always in bytes in antlr3UTF16LABE()
1457 if ( (pANTLR3_UINT8)nextChar >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LABE()
1475 if ((pANTLR3_UINT8)(nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF16LABE()
1502 /// \brief Common function to setup function interface for a UTF3 input stream.
1504 /// \param input Input stream context pointer
1507 antlr3UTF32SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN… in antlr3UTF32SetupStream() argument
1513 input->strFactory = antlr3StringFactoryNew(input->encoding); in antlr3UTF32SetupStream()
1517 …input->istream->index = antlr3UTF32Index; // Calculate current index in input stre… in antlr3UTF32SetupStream()
1518 input->substr = antlr3UTF32Substr; // Return a string from the input stream in antlr3UTF32SetupStream()
1519 … input->istream->seek = antlr3UTF32Seek; // How to seek to a specific point in the stream in antlr3UTF32SetupStream()
1520 …input->istream->consume = antlr3UTF32Consume; // Consume the next UTF32 character in the … in antlr3UTF32SetupStream()
1522 // We must install different UTF32 LA routines according to whether the input in antlr3UTF32SetupStream()
1530 // Machine is Big Endian, if the input is also then install the in antlr3UTF32SetupStream()
1531 // methods that do not access input by bytes and reverse them. in antlr3UTF32SetupStream()
1536 // Input is machine compatible in antlr3UTF32SetupStream()
1538 …input->istream->_LA = antlr3UTF32LA; // Return the UTF32 character at offset n (1 ba… in antlr3UTF32SetupStream()
1542 // Need to use methods that know that the input is little endian in antlr3UTF32SetupStream()
1544 …input->istream->_LA = antlr3UTF32LALE; // Return the UTF32 character at offset n (1 … in antlr3UTF32SetupStream()
1550 // Machine is Little Endian, if the input is also then install the in antlr3UTF32SetupStream()
1551 // methods that do not access input by bytes and reverse them. in antlr3UTF32SetupStream()
1556 // Input is machine compatible in antlr3UTF32SetupStream()
1558 …input->istream->_LA = antlr3UTF32LA; // Return the UTF32 character at offset n (1 ba… in antlr3UTF32SetupStream()
1562 // Need to use methods that know that the input is Big Endian in antlr3UTF32SetupStream()
1564 …input->istream->_LA = antlr3UTF32LABE; // Return the UTF32 character at offset n (1 … in antlr3UTF32SetupStream()
1569 input->charByteSize = 4; // Size in bytes of characters in this stream. in antlr3UTF32SetupStream()
1572 /** \brief Consume the next character in a UTF32 input stream
1574 * \param input Input stream context pointer
1579 pANTLR3_INPUT_STREAM input; in antlr3UTF32Consume() local
1581 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF32Consume()
1585 if ((pANTLR3_UINT8)(input->nextChar) < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF32Consume()
1589 input->charPositionInLine++; in antlr3UTF32Consume()
1591 if ((ANTLR3_UCHAR)(*((pANTLR3_UINT32)input->nextChar)) == input->newlineChar) in antlr3UTF32Consume()
1593 /* Reset for start of a new line of input in antlr3UTF32Consume()
1595 input->line++; in antlr3UTF32Consume()
1596 input->charPositionInLine = 0; in antlr3UTF32Consume()
1597 input->currentLine = (void *)(((pANTLR3_UINT32)input->nextChar) + 1); in antlr3UTF32Consume()
1602 input->nextChar = (void *)(((pANTLR3_UINT32)input->nextChar) + 1); in antlr3UTF32Consume()
1607 /// \param[in] input Input stream context pointer
1612 pANTLR3_INPUT_STREAM input; in antlr3UTF32Index() local
1614 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF32Index()
1616 return (ANTLR3_MARKER)(input->nextChar); in antlr3UTF32Index()
1619 /// \brief Return a substring of the UTF16 input stream in
1622 /// \param input Input stream context pointer
1623 /// \param start Offset in input stream where the string starts
1624 /// \param stop Offset in the input stream where the string ends.
1627 antlr3UTF32Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) in antlr3UTF32Substr() argument
1629 …return input->strFactory->newPtr(input->strFactory, (pANTLR3_UINT8)start, ((ANTLR3_UINT32_CAST(st… in antlr3UTF32Substr()
1632 /// \brief Rewind the lexer input to the state specified by the supplied mark.
1634 /// \param[in] input Input stream context pointer
1637 /// Assumes UTF32 input stream.
1642 pANTLR3_INPUT_STREAM input; in antlr3UTF32Seek() local
1644 input = ((pANTLR3_INPUT_STREAM) is->super); in antlr3UTF32Seek()
1647 // input point, then we assume that we are resetting from a mark in antlr3UTF32Seek()
1651 if (seekPoint <= (ANTLR3_MARKER)(input->nextChar)) in antlr3UTF32Seek()
1653 input->nextChar = (void *)seekPoint; in antlr3UTF32Seek()
1659 … while (is->_LA(is, 1) != ANTLR3_CHARSTREAM_EOF && seekPoint < (ANTLR3_MARKER)input->nextChar) in antlr3UTF32Seek()
1666 /** \brief Return the input element assuming a UTF32 input in natural machine byte order
1668 * \param[in] input Input stream context pointer
1669 * \param[in] la 1 based offset of next input stream element
1671 * \return Next input character in internal ANTLR3 encoding (UTF32)
1676 pANTLR3_INPUT_STREAM input; in antlr3UTF32LA() local
1678 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF32LA()
1680 …if (( ((pANTLR3_UINT8)input->nextChar) + la - 1) >= (((pANTLR3_UINT8)input->data) + input->sizeBuf… in antlr3UTF32LA()
1686 return (ANTLR3_UCHAR)(*((pANTLR3_UINT32)input->nextChar + la - 1)); in antlr3UTF32LA()
1690 /** \brief Return the input element assuming a UTF32 input in little endian byte order
1692 * \param[in] input Input stream context pointer
1693 * \param[in] la 1 based offset of next input stream element
1695 * \return Next input character in internal ANTLR3 encoding (UTF32)
1700 pANTLR3_INPUT_STREAM input; in antlr3UTF32LALE() local
1702 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF32LALE()
1704 …if (( ((pANTLR3_UINT8)input->nextChar) + la - 1) >= (((pANTLR3_UINT8)input->data) + input->sizeBuf… in antlr3UTF32LALE()
1712 c = (ANTLR3_UCHAR)(*((pANTLR3_UINT32)input->nextChar + la - 1)); in antlr3UTF32LALE()
1720 /** \brief Return the input element assuming a UTF32 input in big endian byte order
1722 * \param[in] input Input stream context pointer
1723 * \param[in] la 1 based offset of next input stream element
1725 * \return Next input character in internal ANTLR3 encoding (UTF32)
1731 pANTLR3_INPUT_STREAM input; in antlr3UTF32LABE() local
1733 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF32LABE()
1735 …if (( ((pANTLR3_UINT8)input->nextChar) + la - 1) >= (((pANTLR3_UINT8)input->data) + input->sizeBuf… in antlr3UTF32LABE()
1743 c = (ANTLR3_UCHAR)(*((pANTLR3_UINT32)input->nextChar + la - 1)); in antlr3UTF32LABE()
1752 /// \brief Common function to setup function interface for a UTF8 input stream.
1754 /// \param input Input stream context pointer
1757 antlr3UTF8SetupStream (pANTLR3_INPUT_STREAM input) in antlr3UTF8SetupStream() argument
1763 input->strFactory = antlr3StringFactoryNew(input->encoding); in antlr3UTF8SetupStream()
1767 input->istream->consume = antlr3UTF8Consume; // Consume the next UTF32 character in the buffer in antlr3UTF8SetupStream()
1768 …input->istream->_LA = antlr3UTF8LA; // Return the UTF32 character at offset n (1 b… in antlr3UTF8SetupStream()
1769 input->charByteSize = 0; // Size in bytes of characters in this stream. in antlr3UTF8SetupStream()
1806 /** \brief Consume the next character in a UTF8 input stream
1808 * \param input Input stream context pointer
1813 pANTLR3_INPUT_STREAM input; in antlr3UTF8Consume() local
1818 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF8Consume()
1820 nextChar = (pANTLR3_UINT8)input->nextChar; in antlr3UTF8Consume()
1822 if (nextChar < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF8Consume()
1826 input->charPositionInLine++; in antlr3UTF8Consume()
1832 if (nextChar + extraBytesToRead >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF8Consume()
1834 input->nextChar = (((pANTLR3_UINT8)input->data) + input->sizeBuf); in antlr3UTF8Consume()
1852 // Magically correct the input value in antlr3UTF8Consume()
1855 if (ch == input->newlineChar) in antlr3UTF8Consume()
1857 /* Reset for start of a new line of input in antlr3UTF8Consume()
1859 input->line++; in antlr3UTF8Consume()
1860 input->charPositionInLine = 0; in antlr3UTF8Consume()
1861 input->currentLine = (void *)nextChar; in antlr3UTF8Consume()
1864 // Update input pointer in antlr3UTF8Consume()
1866 input->nextChar = nextChar; in antlr3UTF8Consume()
1869 /** \brief Return the input element assuming a UTF8 input
1871 * \param[in] input Input stream context pointer
1872 * \param[in] la 1 based offset of next input stream element
1874 * \return Next input character in internal ANTLR3 encoding (UTF32)
1879 pANTLR3_INPUT_STREAM input; in antlr3UTF8LA() local
1884 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3UTF8LA()
1886 nextChar = (pANTLR3_UINT8)input->nextChar; in antlr3UTF8LA()
1899 if (nextChar < (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF8LA()
1913 if (nextChar >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF8LA()
1928 while (nextChar > (pANTLR3_UINT8)input->data && la++ < 0) in antlr3UTF8LA()
1950 if (nextChar + extraBytesToRead >= (((pANTLR3_UINT8)input->data) + input->sizeBuf)) in antlr3UTF8LA()
1967 // Magically correct the input value in antlr3UTF8LA()
2015 /// \brief Common function to setup function interface for a EBCDIC input stream.
2017 /// \param input Input stream context pointer
2020 antlr3EBCDICSetupStream (pANTLR3_INPUT_STREAM input) in antlr3EBCDICSetupStream() argument
2024 input->strFactory = antlr3StringFactoryNew(input->encoding); in antlr3EBCDICSetupStream()
2028 …input->istream->_LA = antlr3EBCDICLA; // Return the UTF32 character at offset n (1 b… in antlr3EBCDICSetupStream()
2029 input->charByteSize = 1; // Size in bytes of characters in this stream. in antlr3EBCDICSetupStream()
2032 /// \brief Return the input element assuming an 8 bit EBCDIC input
2034 /// \param[in] input Input stream context pointer
2035 /// \param[in] la 1 based offset of next input stream element
2037 /// \return Next input character in internal ANTLR3 encoding (UTF32) after translation
2043 pANTLR3_INPUT_STREAM input; in antlr3EBCDICLA() local
2045 input = ((pANTLR3_INPUT_STREAM) (is->super)); in antlr3EBCDICLA()
2047 …if (( ((pANTLR3_UINT8)input->nextChar) + la - 1) >= (((pANTLR3_UINT8)input->data) + input->sizeBuf… in antlr3EBCDICLA()
2055 return e2a[(*((pANTLR3_UINT8)input->nextChar + la - 1))]; in antlr3EBCDICLA()