Exemple #1
0
/* Called to get a char that isn't a \newline sequence. */
static int
getsc_bn(void)
{
	int c, c2;

	if (ignore_backslash_newline)
		return (o_getsc_u());

	if (backslash_skip == 1) {
		backslash_skip = 2;
		return (o_getsc_u());
	}

	backslash_skip = 0;

	while (/* CONSTCOND */ 1) {
		c = o_getsc_u();
		if (c == '\\') {
			if ((c2 = o_getsc_u()) == '\n')
				/* ignore the \newline; get the next char... */
				continue;
			ungetsc_i(c2);
			backslash_skip = 1;
		}
		return (c);
	}
}
Exemple #2
0
/* Unget a char: handles case when we are already at the start of the buffer */
static void
ungetsc(int c)
{
	struct sretrace_info *rp = retrace_info;

	if (backslash_skip)
		backslash_skip--;
	/* Don't unget EOF... */
	if (source->str == null && c == '\0')
		return;
	while (rp) {
		if (Xlength(rp->xs, rp->xp))
			rp->xp--;
		rp = rp->next;
	}
	ungetsc_i(c);
}
Exemple #3
0
void
yyskiputf8bom(void)
{
	int c;

	if ((unsigned char)(c = o_getsc_u()) != 0xEF) {
		ungetsc_i(c);
		return;
	}
	if ((unsigned char)(c = o_getsc_u()) != 0xBB) {
		ungetsc_i(c);
		ungetsc_i(0xEF);
		return;
	}
	if ((unsigned char)(c = o_getsc_u()) != 0xBF) {
		ungetsc_i(c);
		ungetsc_i(0xBB);
		ungetsc_i(0xEF);
		return;
	}
	UTFMODE |= 8;
}
Exemple #4
0
void
yyskiputf8bom(void)
{
	int c;

	if (rtt2asc((c = o_getsc_u())) != 0xEF) {
		ungetsc_i(c);
		return;
	}
	if (rtt2asc((c = o_getsc_u())) != 0xBB) {
		ungetsc_i(c);
		ungetsc_i(asc2rtt(0xEF));
		return;
	}
	if (rtt2asc((c = o_getsc_u())) != 0xBF) {
		ungetsc_i(c);
		ungetsc_i(asc2rtt(0xBB));
		ungetsc_i(asc2rtt(0xEF));
		return;
	}
	UTFMODE |= 8;
}