예제 #1
0
파일: filters.c 프로젝트: ricksladkey/vile
void
flt_bfr_error(void)
{
    if (flt_bfr_used) {
	flt_error("unterminated buffer");
	flt_bfr_attr = class_attr(NAME_ERROR);
	flt_bfr_finish();
    }
}
예제 #2
0
static const char *
color_of(char *s, int arg)
{
    const char *result = "";
    char *t;
    int quoted = 0;
    int save;

    s = skip_blanks(s);
    t = skip_ident(s);
    if ((save = *t) != 0)
	*t = 0;

    if (is_class(s)) {
	if (FltOptions('c')) {
	    result = keyword_attr(s);
	    if (result == 0)
		result = class_attr(s);
	    if (result == 0)
		result = Ident2_attr;
	} else {
	    result = Ident2_attr;
	}
    } else if (arg && (*s != 0)) {
	char *base = s;

	if (!FltOptions('c'))
	    result = Action_attr;
	while (*s != 0) {
	    if (quoted) {
		if (*s == QUOTE)
		    quoted = 0;
	    } else if (*s == QUOTE) {
		quoted = 1;
		result = Literal_attr;
	    } else if ((s == base) && color_code(s, &result)) {
		break;
	    }
	    s++;
	}
    }
    if (save)
	*t = (char) save;
    return result;
}
예제 #3
0
static void
do_filter(FILE *input GCC_UNUSED)
{
    static size_t used;
    static char *line;

    char *s;

    (void) input;

    /*
     * Unlike most filters, we make a copy of the attributes, since we will be
     * manipulating the class symbol table.
     */
    Action_attr = strmalloc(class_attr(NAME_ACTION));
    Comment_attr = strmalloc(class_attr(NAME_COMMENT));
    Error_attr = strmalloc(class_attr(NAME_ERROR));
    Ident_attr = strmalloc(class_attr(NAME_IDENT));
    Ident2_attr = strmalloc(class_attr(NAME_IDENT2));
    Literal_attr = strmalloc(class_attr(NAME_LITERAL));

    zero_or_more = '*';
    zero_or_all = '?';
    meta_ch = '.';
    eqls_ch = ':';

    while (flt_gets(&line, &used) != NULL) {
	int ending = chop_newline(line);

	s = flt_put_blanks(line);
예제 #4
0
}

static void
do_filter(FILE *input GCC_UNUSED)
{
    static size_t used;
    static char *line;

    char *s;
    int addresses = 0;
    int escaped_newline;
    States state = LeadingBlanks;

    (void) input;

    Action_attr = class_attr(NAME_ACTION);
    Comment_attr = class_attr(NAME_COMMENT);
    Error_attr = class_attr(NAME_ERROR);
    Ident_attr = class_attr(NAME_IDENT);
    Ident2_attr = class_attr(NAME_IDENT2);
    Literal_attr = class_attr(NAME_LITERAL);
    Number_attr = class_attr(NAME_NUMBER);

    while (flt_gets(&line, &used) != NULL) {
	size_t len = strlen(s = line);

	escaped_newline = (len > 1 && s[len - 2] == BACKSLASH);

	while (*s) {
	    States next = LeadingBlanks;