Alien-LibJIT

 view release on metacpan or  search on metacpan

libjit/tools/gen-ops-scanner.l  view on Meta::CPAN

}

/*
 * Read a literal string from the input stream.
 */
static char *genops_read_literal()
{
	char *buf = 0;
	int buflen = 0;
	int bufmax = 0;
	int escape = 0;
	int ch;
	for(;;)
	{
		ch = input();
		if(ch == EOF)
		{
			fprintf(stderr, "Unexpected EOF in string literal\n");
			exit(1);
		}
		if(ch == '\n')
		{
			fprintf(stderr, "Unexpected newline in string literal\n");
			exit(1);
		}
		if(escape)
		{
			escape = 0;
			if(ch == 'n')
			{
				ch = '\n';
			}
			else if(ch == 't')
			{
				ch = '\t';
			}
		}
		else
		{
			if(ch == '\\')
			{
				escape = 1;
				continue;
			}
			if(ch == '"')
			{
				break;
			}
		}
		ADD_CH(ch);
	}
	return buf;

libjit/tools/gen-rules-scanner.l  view on Meta::CPAN

}

/*
 * Read a literal string from the input stream.
 */
static char *gensel_read_literal()
{
	char *buf = 0;
	int buflen = 0;
	int bufmax = 0;
	int escape = 0;
	int ch;
	for(;;)
	{
		ch = input();
		if(ch == EOF)
		{
			fprintf(stderr, "Unexpected EOF in string literal\n");
			exit(1);
		}
		if(ch == '\n')
		{
			fprintf(stderr, "Unexpected newline in string literal\n");
			exit(1);
		}
		if(escape)
		{
			escape = 0;
			if(ch == 'n')
			{
				ch = '\n';
			}
			else if(ch == 't')
			{
				ch = '\t';
			}
		}
		else
		{
			if(ch == '\\')
			{
				escape = 1;
				continue;
			}
			if(ch == '"')
			{
				break;
			}
		}
		ADD_CH(ch);
	}
	return buf;



( run in 0.619 second using v1.01-cache-2.11-cpan-c21f80fb71c )