package com.ifpdos.udi.sdk.kotlin.comment.parser;

import com.ifpdos.udi.sdk.kotlin.comment.parser.CommentDetails;
import f.a.y.a;
import g.h0.c.l;
import g.i;
import java.io.File;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/* JADX INFO: compiled from: CommentParser.kt */
/* JADX INFO: loaded from: classes.dex */
@i
public final class CommentParser {
    public static final CommentParser INSTANCE = new CommentParser();

    private CommentParser() {
    }

    private final Map<String, CommentDetails> parserElementComments(Map<String, String> map) {
        LinkedHashMap linkedHashMap = new LinkedHashMap(a.x0(map.size()));
        Iterator<T> it = map.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry entry = (Map.Entry) it.next();
            linkedHashMap.put(entry.getKey(), CommentDetails.Companion.parseComment((String) entry.getValue()));
        }
        return linkedHashMap;
    }

    public final Comment parser(File file) {
        l.f(file, "source");
        List<Token> listAnalyse = new LexicalAnalyzer().analyse(file);
        SyntacticAnalyzer syntacticAnalyzer = new SyntacticAnalyzer();
        syntacticAnalyzer.analyse(listAnalyse);
        CommentDetails.Companion companion = CommentDetails.Companion;
        String documentComment = syntacticAnalyzer.getDocumentComment();
        l.c(documentComment);
        return new Comment(companion.parseComment(documentComment), INSTANCE.parserElementComments(syntacticAnalyzer.getElementComments()));
    }
}
