]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/file_analysis.c
tools: don't abort on malformed documentation lines.
[ccan] / tools / ccanlint / file_analysis.c
index d915b7ed8f59b131851621e9078410af93784fc1..852ecbfce851c31d85078d4a21d3e7657dcc6e8d 100644 (file)
@@ -27,7 +27,7 @@ struct list_head *get_ccan_file_docs(struct ccan_file *f)
 {
        if (!f->doc_sections) {
                get_ccan_file_lines(f);
-               f->doc_sections = extract_doc_sections(f->lines);
+               f->doc_sections = extract_doc_sections(f->lines, f->name);
        }
        return f->doc_sections;
 }
@@ -105,40 +105,6 @@ static bool continues(const char *line)
        return strends(line, "\\");
 }
 
-/* Get token if it's equal to token. */
-bool get_token(const char **line, const char *token)
-{
-       unsigned int toklen;
-
-       *line += strspn(*line, " \t");
-       if (cisalnum(token[0]) || token[0] == '_')
-               toklen = strspn(*line, IDENT_CHARS);
-       else {
-               /* FIXME: real tokenizer handles ++ and other multi-chars.  */
-               toklen = strlen(token);
-       }
-
-       if (toklen == strlen(token) && !strncmp(*line, token, toklen)) {
-               *line += toklen;
-               return true;
-       }
-       return false;
-}
-
-char *get_symbol_token(void *ctx, const char **line)
-{
-       unsigned int toklen;
-       char *ret;
-
-       *line += strspn(*line, " \t");
-       toklen = strspn(*line, IDENT_CHARS);
-       if (!toklen)
-               return NULL;
-       ret = talloc_strndup(ctx, *line, toklen);
-       *line += toklen;
-       return ret;
-}
-
 static bool parse_hash_if(struct pp_conditions *cond, const char **line)
 {
        bool brackets, defined;
@@ -428,3 +394,13 @@ void score_file_error(struct score *score, struct ccan_file *f, unsigned line,
                score->error = talloc_append_string(score->error,
                                    "... more (use -vv to see them all)\n");
 }
+
+char *get_or_compile_info(const void *ctx, const char *dir)
+{
+       struct manifest *m = get_manifest(NULL, dir);
+
+       if (!m->info_file->compiled[COMPILE_NORMAL])
+               m->info_file->compiled[COMPILE_NORMAL] = compile_info(m, dir);
+
+       return m->info_file->compiled[COMPILE_NORMAL];
+}