Created
November 24, 2016 15:28
-
-
Save haya14busa/7dcd4a2ef5b9c0b84225ca50be3f34a8 to your computer and use it in GitHub Desktop.
parse by syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:func() abort | |
" hoge | |
endfunction | |
function! ParseBySyntax() abort | |
let lines = getline(1, '$') | |
for [lnum, l] in map(lines, {i,l -> [i+1, l]}) | |
echo '---' | |
echo lnum l | |
for col in range(1, len(l)) | |
" let synname = synIDattr(synID(lnum, col, 1), 'name') | |
" let transname = synIDattr(synIDtrans(synID(lnum, col, 1)), 'name') | |
" echo synname transname | |
echo getline(lnum)[col-1] map(synstack(lnum, col), {i,id-> synIDattr(id, 'name')}) | |
endfor | |
endfor | |
endfunction | |
call ParseBySyntax() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment