Mercurial > vim
comparison runtime/indent/erlang.vim @ 25773:11b656e74444
Update runtime files
Commit: https://github.com/vim/vim/commit/6c391a74fe90190796ca0b0c010112948a6e75d7
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 9 21:55:11 2021 +0200
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 09 Sep 2021 22:00:10 +0200 |
parents | 75ff30a78189 |
children | f68f43043842 |
comparison
equal
deleted
inserted
replaced
25772:55753c17b73d | 25773:11b656e74444 |
---|---|
55 | 55 |
56 " Line tokenizer library {{{1 | 56 " Line tokenizer library {{{1 |
57 " ====================== | 57 " ====================== |
58 | 58 |
59 " Indtokens are "indentation tokens". See their exact format in the | 59 " Indtokens are "indentation tokens". See their exact format in the |
60 " documentaiton of the s:GetTokensFromLine function. | 60 " documentation of the s:GetTokensFromLine function. |
61 | 61 |
62 " Purpose: | 62 " Purpose: |
63 " Calculate the new virtual column after the given segment of a line. | 63 " Calculate the new virtual column after the given segment of a line. |
64 " Parameters: | 64 " Parameters: |
65 " line: string | 65 " line: string |
73 " " index: 0 12 34567 | 73 " " index: 0 12 34567 |
74 " " vcol: 0 45 89 | 74 " " vcol: 0 45 89 |
75 " s:CalcVCol("\t'\tx', b", 1, 4, 4) -> 10 | 75 " s:CalcVCol("\t'\tx', b", 1, 4, 4) -> 10 |
76 function! s:CalcVCol(line, first_index, last_index, vcol, tabstop) | 76 function! s:CalcVCol(line, first_index, last_index, vcol, tabstop) |
77 | 77 |
78 " We copy the relevent segment of the line, otherwise if the line were | 78 " We copy the relevant segment of the line, otherwise if the line were |
79 " e.g. `"\t", term` then the else branch below would consume the `", term` | 79 " e.g. `"\t", term` then the else branch below would consume the `", term` |
80 " part at once. | 80 " part at once. |
81 let line = a:line[a:first_index : a:last_index] | 81 let line = a:line[a:first_index : a:last_index] |
82 | 82 |
83 let i = 0 | 83 let i = 0 |
602 " should_return: bool -- if true, the caller should return `indent` to Vim | 602 " should_return: bool -- if true, the caller should return `indent` to Vim |
603 " indent -- integer | 603 " indent -- integer |
604 function! s:BeginElementFoundIfEmpty(stack, token, curr_vcol, stored_vcol, sw) | 604 function! s:BeginElementFoundIfEmpty(stack, token, curr_vcol, stored_vcol, sw) |
605 if empty(a:stack) | 605 if empty(a:stack) |
606 if a:stored_vcol ==# -1 | 606 if a:stored_vcol ==# -1 |
607 call s:Log(' "' . a:token . '" directly preceeds LTI -> return') | 607 call s:Log(' "' . a:token . '" directly precedes LTI -> return') |
608 return [1, a:curr_vcol + a:sw] | 608 return [1, a:curr_vcol + a:sw] |
609 else | 609 else |
610 call s:Log(' "' . a:token . | 610 call s:Log(' "' . a:token . |
611 \'" token (whose expression includes LTI) found -> return') | 611 \'" token (whose expression includes LTI) found -> return') |
612 return [1, a:stored_vcol] | 612 return [1, a:stored_vcol] |
823 let [ret, res] = s:BeginningOfClauseFound(stack, token, stored_vcol, | 823 let [ret, res] = s:BeginningOfClauseFound(stack, token, stored_vcol, |
824 \lnum, i) | 824 \lnum, i) |
825 if ret | return res | endif | 825 if ret | return res | endif |
826 | 826 |
827 if stored_vcol ==# -1 | 827 if stored_vcol ==# -1 |
828 call s:Log(' End of clause directly preceeds LTI -> return') | 828 call s:Log(' End of clause directly precedes LTI -> return') |
829 return 0 | 829 return 0 |
830 else | 830 else |
831 call s:Log(' End of clause (but not end of line) -> return') | 831 call s:Log(' End of clause (but not end of line) -> return') |
832 return stored_vcol | 832 return stored_vcol |
833 endif | 833 endif |