static void get_string (void) { char *start = input; while (is_filenamechar (*input)){ input++; } if (value != NULL) g_free (value); value = g_malloc (input - start + 1); strncpy (value, start, input-start); value [input-start] = 0; }
static int get_token (void) { while (input [0] == '+') input++; if (input [0] == '\0') { return TOKEN_END; } if (input [0] == 'M' && input [1] == ':'){ input += 2; get_string (); return TOKEN_METHOD; } if (input [0] == 'N' && input [1] == ':'){ input += 2; get_string (); return TOKEN_NAMESPACE; } if (input [0] == 'T' && input [1] == ':'){ input += 2; get_string (); return TOKEN_CLASS; } if (input [0] == 'E' && input [1] == ':'){ input += 2; get_string (); return TOKEN_EXCEPTION; } if (*input == '-'){ input++; return TOKEN_EXCLUDE; } if (is_filenamechar (*input)){ get_string (); if (strcmp (value, "all") == 0) return TOKEN_ALL; if (strcmp (value, "program") == 0) return TOKEN_PROGRAM; if (strcmp (value, "wrapper") == 0) return TOKEN_WRAPPER; if (strcmp (value, "disabled") == 0) return TOKEN_DISABLED; return TOKEN_STRING; } if (*input == ','){ input++; return TOKEN_SEPARATOR; } fprintf (stderr, "Syntax error at or around '%s'\n", input); return TOKEN_ERROR; }