MCPcopy Create free account
hub / github.com/KDE/kdevelop / readCMakeFunction

Method readCMakeFunction

plugins/cmake/parser/cmakelistsparser.cpp:145–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145bool CMakeListsParser::readCMakeFunction(cmListFileLexer *lexer, CMakeFunctionDesc &func)
146{
147 // Command name has already been parsed. Read the left paren.
148 cmListFileLexer_Token* token;
149 if(!(token = cmListFileLexer_Scan(lexer)))
150 {
151 return false;
152 }
153 if(token->type != cmListFileLexer_Token_ParenLeft)
154 {
155 return false;
156 }
157
158 // Arguments.
159 int parenthesis=1;
160 while((token = cmListFileLexer_Scan(lexer)))
161 {
162 switch(token->type)
163 {
164 case cmListFileLexer_Token_ParenRight:
165 parenthesis--;
166 if(parenthesis==0) {
167 func.endLine=token->line;
168 func.endColumn=token->column;
169 return true;
170 } else if(parenthesis<0)
171 return false;
172 else
173 func.arguments << CMakeFunctionArgument( QString::fromLocal8Bit(token->text, token->length), false, token->line, token->column );
174 break;
175 case cmListFileLexer_Token_ParenLeft:
176 parenthesis++;
177 func.arguments << CMakeFunctionArgument( QString::fromLocal8Bit(token->text, token->length), false, token->line, token->column );
178 break;
179 case cmListFileLexer_Token_Identifier:
180 case cmListFileLexer_Token_ArgumentBracket:
181 case cmListFileLexer_Token_ArgumentUnquoted:
182 func.arguments << CMakeFunctionArgument( QString::fromLocal8Bit(token->text, token->length), false, token->line, token->column );
183 break;
184 case cmListFileLexer_Token_ArgumentQuoted:
185 func.arguments << CMakeFunctionArgument( QString::fromLocal8Bit(token->text, token->length), true, token->line, token->column+1 );
186 break;
187 case cmListFileLexer_Token_Space:
188 case cmListFileLexer_Token_Newline:
189 break;
190 default:
191 return false;
192 }
193 }
194
195 return false;
196}
197
198CMakeFunctionDesc::CMakeFunctionDesc(const QString& name, const QStringList& args)
199 : name(name)

Callers

nothing calls this directly

Calls 2

cmListFileLexer_ScanFunction · 0.85

Tested by

no test coverage detected