Lines Matching full:input
3 * is a filesystem based input set and all the characters in the filestream
7 * sets can be supported from input files. The ANTLR3 C runtime expects
49 static void setupInputStream (pANTLR3_INPUT_STREAM input);
56 pANTLR3_INPUT_STREAM input; in antlr3FileStreamNew() local
63 input = antlr3CreateFileStream(fileName); in antlr3FileStreamNew()
64 if (input == NULL) in antlr3FileStreamNew()
72 input->encoding = encoding; in antlr3FileStreamNew()
77 setupInputStream(input); in antlr3FileStreamNew()
81 input->istream->streamName = input->strFactory->newStr8(input->strFactory, fileName); in antlr3FileStreamNew()
82 input->fileName = input->istream->streamName; in antlr3FileStreamNew()
84 return input; in antlr3FileStreamNew()
91 pANTLR3_INPUT_STREAM input; in antlr3StringStreamNew() local
97 input = antlr3CreateStringStream(data); in antlr3StringStreamNew()
98 if (input == NULL) in antlr3StringStreamNew()
105 input->sizeBuf = size; in antlr3StringStreamNew()
110 input->encoding = encoding; in antlr3StringStreamNew()
115 setupInputStream(input); in antlr3StringStreamNew()
119 input->istream->streamName = input->strFactory->newStr8(input->strFactory, name); in antlr3StringStreamNew()
120 input->fileName = input->istream->streamName; in antlr3StringStreamNew()
122 return input; in antlr3StringStreamNew()
126 /// Determine endianess of the input stream and install the
130 setupInputStream(pANTLR3_INPUT_STREAM input) in setupInputStream() argument
155 switch (input->encoding) in setupInputStream()
164 if ( (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar)) == 0xEF in setupInputStream()
165 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0xBB in setupInputStream()
166 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+2)) == 0xBF in setupInputStream()
171 input->nextChar = (void *)((pANTLR3_UINT8)input->nextChar + 3); in setupInputStream()
174 // Install the UTF8 input routines in setupInputStream()
176 antlr3UTF8SetupStream(input); in setupInputStream()
181 // See if there is a BOM at the start of the input. If not then in setupInputStream()
186 if ( (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar)) == 0xFE in setupInputStream()
187 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0xFF in setupInputStream()
192 input->nextChar = (void *)((pANTLR3_UINT8)input->nextChar + 2); in setupInputStream()
194 antlr3UTF16SetupStream(input, isBigEndian, ANTLR3_TRUE); in setupInputStream()
196 else if ( (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar)) == 0xFF in setupInputStream()
197 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0xFE in setupInputStream()
202 input->nextChar = (void *)((pANTLR3_UINT8)input->nextChar + 2); in setupInputStream()
204 antlr3UTF16SetupStream(input, isBigEndian, ANTLR3_FALSE); in setupInputStream()
210 antlr3UTF16SetupStream(input, isBigEndian, isBigEndian); in setupInputStream()
216 // See if there is a BOM at the start of the input. If not then in setupInputStream()
221 if ( (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar)) == 0x00 in setupInputStream()
222 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0x00 in setupInputStream()
223 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+2)) == 0xFE in setupInputStream()
224 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+3)) == 0xFF in setupInputStream()
229 input->nextChar = (void *)((pANTLR3_UINT8)input->nextChar + 4); in setupInputStream()
231 antlr3UTF32SetupStream(input, isBigEndian, ANTLR3_TRUE); in setupInputStream()
233 else if ( (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar)) == 0xFF in setupInputStream()
234 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0xFE in setupInputStream()
235 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0x00 in setupInputStream()
236 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0x00 in setupInputStream()
241 input->nextChar = (void *)((pANTLR3_UINT8)input->nextChar + 4); in setupInputStream()
243 antlr3UTF32SetupStream(input, isBigEndian, ANTLR3_FALSE); in setupInputStream()
249 antlr3UTF32SetupStream(input, isBigEndian, isBigEndian); in setupInputStream()
257 antlr3UTF16SetupStream(input, isBigEndian, ANTLR3_TRUE); in setupInputStream()
264 antlr3UTF16SetupStream(input, isBigEndian, ANTLR3_FALSE); in setupInputStream()
271 antlr3UTF32SetupStream(input, isBigEndian, ANTLR3_TRUE); in setupInputStream()
278 antlr3UTF32SetupStream(input, isBigEndian, ANTLR3_FALSE); in setupInputStream()
286 antlr3EBCDICSetupStream(input); in setupInputStream()
294 antlr38BitSetupStream(input); in setupInputStream()
299 /** \brief Use the contents of an operating system file as the input
300 * for an input stream.
304 * - Pointer to new input stream context upon success
310 // Pointer to the input stream we are going to create in antlr3CreateFileStream()
312 pANTLR3_INPUT_STREAM input; in antlr3CreateFileStream() local
320 // Allocate memory for the input stream structure in antlr3CreateFileStream()
322 input = (pANTLR3_INPUT_STREAM) in antlr3CreateFileStream()
325 if (input == NULL) in antlr3CreateFileStream()
332 status = antlr3read8Bit(input, fileName); in antlr3CreateFileStream()
334 // Call the common 8 bit input stream handler in antlr3CreateFileStream()
337 antlr3GenericSetupStream(input); in antlr3CreateFileStream()
345 input->close(input); in antlr3CreateFileStream()
349 return input; in antlr3CreateFileStream()
353 antlr3read8Bit(pANTLR3_INPUT_STREAM input, pANTLR3_UINT8 fileName) in antlr3read8Bit() argument
371 fSize = antlr3Fsize(fileName); /* Size of input file */ in antlr3read8Bit()
373 /* Allocate buffer for this input set in antlr3read8Bit()
375 input->data = ANTLR3_MALLOC((size_t)fSize); in antlr3read8Bit()
376 input->sizeBuf = fSize; in antlr3read8Bit()
378 if (input->data == NULL) in antlr3read8Bit()
383 input->isAllocated = ANTLR3_TRUE; in antlr3read8Bit()
388 antlr3Fread(infile, fSize, input->data); in antlr3read8Bit()
434 /** \brief Use the supplied 'string' as input to the stream
436 * \param data Pointer to the input data
438 * - Pointer to new input stream context upon success
444 // Pointer to the input stream we are going to create in antlr3CreateStringStream()
446 pANTLR3_INPUT_STREAM input; in antlr3CreateStringStream() local
453 // Allocate memory for the input stream structure in antlr3CreateStringStream()
455 input = (pANTLR3_INPUT_STREAM) in antlr3CreateStringStream()
458 if (input == NULL) in antlr3CreateStringStream()
465 input->data = data; in antlr3CreateStringStream()
466 input->isAllocated = ANTLR3_FALSE; in antlr3CreateStringStream()
468 // Call the common 8 bit input stream handler in antlr3CreateStringStream()
471 antlr3GenericSetupStream(input); in antlr3CreateStringStream()
473 return input; in antlr3CreateStringStream()