MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / analyze

Method analyze

src/SourceCompile/AnalyzeFile.cpp:112–698  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void 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;

Callers 1

parseinit_Method · 0.80

Calls 12

StrAppendFunction · 0.85
readLinesMethod · 0.80
addOrderedPackageMethod · 0.80
clearMethod · 0.80
getNbMaxProcessesMethod · 0.80
printMessagesMethod · 0.80
getChunkFileMethod · 0.80
writeContentMethod · 0.80
getSymbolTableMethod · 0.45
getErrorContainerMethod · 0.45
addErrorMethod · 0.45

Tested by

no test coverage detected