<commit_before>/*
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.

Author: <NAME>
*/
#include <utility>
#include <fstream>
#include <string>
#include "util/sstream.h"
#include "util/lean_path.h"
#include "frontends/lean/scanner.h"

namespace lean {
void display_deps(environment const & env, std::ostream & out, char const * fname) {
    name import("import");
    std::ifstream in(fname);
    if (in.bad() || in.fail())
        throw exception(sstream() << "failed to open file '" << fname << "'");
    scanner s(in, fname);
    bool import_args = false;
    while (true) {
        scanner::token_kind t;
        try {
            t = s.scan(env);
        } catch (exception &) {}
        if (t == scanner::token_kind::Eof) {
            return;
        } else if (t == scanner::token_kind::CommandKeyword && s.get_token_info().value() == import) {
            import_args = true;
        } else if (import_args == true && t == scanner::token_kind::Identifier) {
            std::string m_name = find_file(name_to_file(s.get_name_val()), {".lean", ".olean", ".lua"});
            int last_idx = m_name.find_last_of(".");
            std::string rawname = m_name.substr(0, last_idx);
            std::string ext = m_name.substr(last_idx);
            if (ext == ".lean")<commit_msg>fix(frontends/lean/dependencies): warning message<commit_after>/*
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.

Author: <NAME>
*/
#include <utility>
#include <fstream>
#include <string>
#include "util/sstream.h"
#include "util/lean_path.h"
#include "frontends/lean/scanner.h"

namespace lean {
void display_deps(environment const & env, std::ostream & out, char const * fname) {
    name import("import");
    std::ifstream in(fname);
    if (in.bad() || in.fail())
        throw exception(sstream() << "failed to open file '" << fname << "'");
    scanner s(in, fname);
    bool import_args = false;
    while (true) {
        scanner::token_kind t = scanner::token_kind::Identifier;
        try {
            t = s.scan(env);
        } catch (exception &) {
            continue;
        }
        if (t == scanner::token_kind::Eof) {
            return;
        } else if (t == scanner::token_kind::CommandKeyword && s.get_token_info().value() == import) {
            import_args = true;
        } else if (import_args == true && t == scanner::token_kind::Identifier) {
            std::string m_name = find_file(name_to_file(s.get_name_val()), {".lean", ".olean", ".lua"});
            int last_idx = m_name.find_last_of(".");
            std::string rawname = m_name.substr(0, last_idx);
            std::string ext = m_name.substr(last_idx);
            if (ext == ".lean")
{'fraction_non_alphanumeric': 0.15506888025432708, 'fraction_numerical': 0.004945249028611798, 'mean_word_length': 2.863574351978172, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7040864', 'n_tokens_mistral': 904, 'n_tokens_neox': 896, 'n_words': 225}