MCPcopy Create free account
hub / github.com/ycm-core/YouCompleteMe / _ExtractKeywordsFromLine

Function _ExtractKeywordsFromLine

python/ycm/syntax_parse.py:183–221  ·  view source on GitHub ↗
( line )

Source from the content-addressed store, hash-verified

181
182
183def _ExtractKeywordsFromLine( line ):
184 if line.startswith( 'links to ' ):
185 return []
186
187 # Ignore "syntax match" lines (see ":h syn-match").
188 if line.startswith( 'match ' ):
189 return []
190
191 words = line.split()
192 if not words:
193 return []
194
195 # Ignore "syntax region" lines (see ":h syn-region"). They always start
196 # with matchgroup= or start= in the syntax list.
197 if SYNTAX_REGION_ARGUMENT_REGEX.match( words[ 0 ] ):
198 return []
199
200 # Ignore "nextgroup=" argument in first position and the arguments
201 # "skipwhite", "skipnl", and "skipempty" that immediately come after.
202 nextgroup_at_start = False
203 if words[ 0 ].startswith( 'nextgroup=' ):
204 nextgroup_at_start = True
205 words = words[ 1: ]
206
207 # Ignore "contained" argument in first position.
208 if words[ 0 ] == 'contained':
209 words = words[ 1: ]
210
211 keywords = []
212 for word in words:
213 if nextgroup_at_start and word in SYNTAX_NEXTGROUP_ARGUMENTS:
214 continue
215
216 nextgroup_at_start = False
217
218 keyword_matched = KEYWORD_REGEX.match( word )
219 if keyword_matched:
220 keywords.append( keyword_matched.group( 1 ) )
221 return keywords
222
223
224def _ExtractKeywordsFromGroup( group ):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected