Lines Matching refs:lnum

19 setlocal indentexpr=FalconGetIndent(v:lnum)
76 " Check if the character at lnum:col is inside a string, comment, or is ascii.
77 function s:IsInStringOrComment(lnum, col) argument
78 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom
81 " Check if the character at lnum:col is inside a string.
82 function s:IsInString(lnum, col) argument
83 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
86 " Check if the character at lnum:col is inside a string delimiter
87 function s:IsInStringDelimiter(lnum, col) argument
88 return synIDattr(synID(a:lnum, a:col, 1), 'name') == 'falconStringDelimiter'
91 " Find line above 'lnum' that isn't empty, in a comment, or in a string.
92 function s:PrevNonBlankNonString(lnum) argument
94 let lnum = prevnonblank(a:lnum)
95 while lnum > 0
98 let line = getline(lnum)
107 elseif !in_block && line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1)
108 \ && s:IsInStringOrComment(lnum, strlen(line)))
111 let lnum = prevnonblank(lnum - 1)
113 return lnum
116 " Find line above 'lnum' that started the continuation 'lnum' may be part of.
117 function s:GetMSL(lnum) argument
119 let msl = a:lnum
121 let lnum = s:PrevNonBlankNonString(a:lnum - 1)
122 while lnum > 0
125 let line = getline(lnum)
137 let msl = lnum
138 elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
149 return lnum
150 elseif s:Match(lnum, s:bracket_continuation_regex) &&
160 elseif s:Match(lnum, s:block_regex) &&
173 if (col > 0 && !s:IsInStringOrComment(lnum, col))
174 \ || s:IsInString(lnum, strlen(line))
175 let msl = lnum
182 let lnum = s:PrevNonBlankNonString(lnum - 1)
187 " Check if line 'lnum' has more opening brackets than closing ones.
188 function s:ExtraBrackets(lnum) argument
192 let line = getline(a:lnum)
199 if !s:IsInStringOrComment(a:lnum, pos + 1)
250 function s:Match(lnum, regex) argument
251 let col = match(getline(a:lnum), '\C'.a:regex) + 1
252 return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0
255 function s:MatchLast(lnum, regex) argument
256 let line = getline(a:lnum)
258 while col != -1 && s:IsInStringOrComment(a:lnum, col)
269 " For the current line, use the first argument if given, else v:lnum
270 let clnum = a:0 ? a:1 : v:lnum
324 let lnum = s:PrevNonBlankNonString(clnum - 1)
327 if line =~ '^\s*$' && lnum != prevnonblank(clnum - 1)
332 if lnum == 0
337 let line = getline(lnum)
338 let ind = indent(lnum)
341 if s:Match(lnum, s:block_regex)
342 return indent(s:GetMSL(lnum)) + shiftwidth()
348 let [opening, closing] = s:ExtraBrackets(lnum)
362 call cursor(lnum, closing.pos + 1)
377 let col = s:Match(lnum, '\%(^\|[^.:@$]\)\<end\>\s*\%(#.*\)\=$')
379 call cursor(lnum, col)
392 let col = s:Match(lnum, s:falcon_indent_keywords)
394 call cursor(lnum, col)
399 if s:Match(lnum, s:end_end_regex)
406 let p_lnum = lnum
407 let lnum = s:GetMSL(lnum)
411 if p_lnum != lnum
418 let line = getline(lnum)
419 let msl_ind = indent(lnum)
424 if s:Match(lnum, s:falcon_indent_keywords)
426 if s:Match(lnum, s:end_end_regex)
434 if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
435 if lnum == p_lnum