Exemplo n.º 1
0
/**
 * Test if we have one char enclosed in single quotes
 * @param value returns the char found
 * @return 1 if we have, 0 otherwise
 */
int quoted_char(int *value) {
    int     k;
    char    c;

    k = 0;
    if (!match ("'"))
        return (0);
    while ((c = gch ()) != '\'') {
        c = (c == '\\') ? spechar(): c;
        k = (k & 255) * 256 + (c & 255);
    }
    *value = k;
    return (1);
}
Exemplo n.º 2
0
asmfunc ()
{
	char	c;

	needbrack ("(");
	if (!match (quote)) {
		error ("Missing opening \" in asm call");
		return;
	}
	do {
		while (ch () != '"') {
			if (ch () == 0)
				break;
			c = gch();
			outbyte (c == '\\' ? spechar() : c);
		}
		gch ();
	} while (match (quote));
	needbrack (")");
	ns ();
}
Exemplo n.º 3
0
/**
 * Test if we have string enclosed in double quotes. e.g. "abc".
 * Load the string into literal pool.
 * @param position returns beginning of the string
 * @return 1 if such string found, 0 otherwise
 */
int quoted_string(int *position) {
    char    c;

    if (!match ("\""))
        return (0);
    *position = litptr;
    while (ch () != '"') {
        if (ch () == 0)
            break;
        if (litptr >= LITMAX) {
            error ("string space exhausted");
            while (!match ("\""))
                if (gch () == 0)
                    break;
            return (1);
        }
        c = gch();
        litq[litptr++] = (c == '\\') ? spechar(): c;
    }
    gch ();
    litq[litptr++] = 0;
    return (1);
}