| 110 | } |
| 111 | |
| 112 | void AnalyzeFile::analyze() { |
| 113 | FileSystem* const fileSystem = FileSystem::getInstance(); |
| 114 | SymbolTable* const symbolTable = m_clp->getSymbolTable(); |
| 115 | ErrorContainer* const errors = m_clp->getErrorContainer(); |
| 116 | |
| 117 | std::vector<std::string> allLines; |
| 118 | allLines.emplace_back("FILLER LINE"); |
| 119 | if (m_text.empty()) { |
| 120 | fileSystem->readLines(m_ppFileId, allLines); |
| 121 | } else { |
| 122 | std::string line; |
| 123 | std::stringstream ss(m_text); |
| 124 | while (std::getline(ss, line)) { |
| 125 | while (!line.empty() && |
| 126 | ((line.back() == '\r') || (line.back() == '\n'))) { |
| 127 | line.pop_back(); |
| 128 | } |
| 129 | allLines.emplace_back(line); |
| 130 | } |
| 131 | } |
| 132 | if (allLines.empty()) return; |
| 133 | |
| 134 | uint32_t minNbLineForPartitioning = m_clp->getNbLinesForFileSpliting(); |
| 135 | std::vector<FileChunk> fileChunks; |
| 136 | bool inPackage = false; |
| 137 | int32_t inClass = 0; |
| 138 | int32_t inModule = 0; |
| 139 | bool inProgram = false; |
| 140 | int32_t inInterface = 0; |
| 141 | bool inConfig = false; |
| 142 | bool inChecker = false; |
| 143 | bool inPrimitive = false; |
| 144 | // int32_t inFunction = false; |
| 145 | // int32_t inTask = false; |
| 146 | bool inComment = false; |
| 147 | bool inString = false; |
| 148 | uint32_t lineNb = 0; |
| 149 | uint32_t charNb = 0; |
| 150 | uint32_t startLine = 0; |
| 151 | uint32_t startChar = 0; |
| 152 | uint32_t indexPackage = 0; |
| 153 | uint32_t indexModule = 0; |
| 154 | int32_t nbPackage = 0; |
| 155 | int32_t nbClass = 0; |
| 156 | int32_t nbModule = 0; |
| 157 | int32_t nbProgram = 0; |
| 158 | int32_t nbInterface = 0; |
| 159 | int32_t nbConfig = 0; |
| 160 | int32_t nbChecker = 0; |
| 161 | int32_t nbPrimitive = 0 /*./re , nbFunction = 0, nbTask = 0*/; |
| 162 | std::string prev_keyword; |
| 163 | std::string prev_prev_keyword; |
| 164 | const std::regex import_regex("import[ ]+[a-zA-Z_0-9:\\*]+[ ]*;"); |
| 165 | std::smatch pieces_match; |
| 166 | std::string fileLevelImportSection; |
| 167 | // Parse the file |
| 168 | for (const auto& line : allLines) { |
| 169 | bool inLineComment = false; |
no test coverage detected