Add parser

Move echodoc
Move mappings API
This commit is contained in:
Shougo Matsushita 2013-11-21 18:10:26 +09:00
parent 374a77c59d
commit 038d75ce58
5 changed files with 322 additions and 285 deletions

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: neosnippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 20 Nov 2013.
" Last Modified: 21 Nov 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -38,285 +38,14 @@ call neosnippet#util#set_default(
\ 'g:neosnippet#enable_snipmate_compatibility', 0)
"}}}
" For echodoc. "{{{
let s:doc_dict = {
\ 'name' : 'neosnippet',
\ 'rank' : 100,
\ 'filetypes' : {},
\ }
function! s:doc_dict.search(cur_text) "{{{
if mode() !=# 'i'
return []
endif
let snippets = neosnippet#get_snippets()
let cur_word = neosnippet#get_cursor_snippet(snippets, a:cur_text)
if cur_word == ''
return []
endif
let snip = snippets[cur_word]
let ret = []
call add(ret, { 'text' : snip.word, 'highlight' : 'String' })
call add(ret, { 'text' : ' ' })
call add(ret, { 'text' : snip.menu_abbr, 'highlight' : 'Special' })
return ret
endfunction"}}}
"}}}
function! neosnippet#expandable_or_jumpable() "{{{
return neosnippet#expandable() || neosnippet#jumpable()
return neosnippet#mappings#expandable_or_jumpable()
endfunction"}}}
function! neosnippet#expandable() "{{{
" Check snippet trigger.
return neosnippet#get_cursor_snippet(
\ neosnippet#get_snippets(), neosnippet#util#get_cur_text()) != ''
return neosnippet#mappings#expandable()
endfunction"}}}
function! neosnippet#jumpable() "{{{
" Found snippet placeholder.
return search(neosnippet#get_placeholder_marker_pattern(). '\|'
\ .neosnippet#get_sync_placeholder_marker_pattern(), 'nw') > 0
endfunction"}}}
function! neosnippet#caching() "{{{
call neosnippet#commands#_make_cache(&filetype)
endfunction"}}}
function! neosnippet#recaching() "{{{
call neosnippet#variables#set_snippets({})
endfunction"}}}
function! s:set_snippet_dict(snippet_dict, snippets, dup_check, snippets_file) "{{{
if empty(a:snippet_dict)
return
endif
let action_pattern = '^snippet\s\+' . a:snippet_dict.name . '$'
let snippet = s:initialize_snippet(
\ a:snippet_dict, a:snippets_file,
\ a:snippet_dict.linenr, action_pattern,
\ a:snippet_dict.name)
let a:snippets[a:snippet_dict.name] = snippet
let a:dup_check[a:snippet_dict.name] = snippet
for alias in get(a:snippet_dict, 'alias', [])
let alias_snippet = copy(snippet)
let alias_snippet.word = alias
let a:snippets[alias] = alias_snippet
let a:dup_check[alias] = alias_snippet
endfor
endfunction"}}}
function! s:initialize_snippet(dict, path, line, pattern, name) "{{{
let a:dict.word = substitute(a:dict.word, '\n\+$', '', '')
if a:dict.word !~
\ neosnippet#get_placeholder_marker_substitute_pattern()
" Add placeholder.
let a:dict.word .= '${0}'
endif
let menu_prefix = '[nsnip] '
if !has_key(a:dict, 'abbr') || a:dict.abbr == ''
" Set default abbr.
let abbr = substitute(a:dict.word,
\ neosnippet#get_placeholder_marker_pattern(). '\|'.
\ neosnippet#get_mirror_placeholder_marker_pattern().
\ '\|\s\+\|\n\|TARGET', ' ', 'g')
let a:dict.abbr = a:dict.name
else
let abbr = a:dict.abbr
endif
let snippet = {
\ 'word' : a:dict.name, 'snip' : a:dict.word,
\ 'description' : a:dict.word,
\ 'menu_template' : menu_prefix . abbr,
\ 'menu_abbr' : abbr,
\ 'options' : a:dict.options,
\ 'action__path' : a:path, 'action__line' : a:line,
\ 'action__pattern' : a:pattern, 'real_name' : a:name,
\}
if has_key(a:dict, 'regexp')
let snippet.regexp = a:dict.regexp
endif
return snippet
endfunction"}}}
function! s:initialize_snippet_options() "{{{
return { 'head' : 0, 'word' : 0, 'indent' : 0 }
endfunction"}}}
function! s:initialize_options(options) "{{{
let default_options = {
\ 'runtime' : 0,
\ 'vertical' : 0,
\ 'direction' : 'below',
\ 'split' : 0,
\ }
let options = extend(default_options, a:options)
" Complex initializer.
if has_key(options, 'horizontal')
" Disable vertically.
let options.vertical = 0
endif
return options
endfunction"}}}
function! neosnippet#_parse_snippets_file(snippets, snippets_file) "{{{
let dup_check = {}
let snippet_dict = {}
let linenr = 1
if !filereadable(a:snippets_file)
call neosnippet#util#print_error(
\ printf('snippet file "%s" is not found.', a:snippets_file))
return a:snippets
endif
for line in readfile(a:snippets_file)
if line =~ '^\h\w*.*\s$'
" Delete spaces.
let line = substitute(line, '\s\+$', '', '')
endif
if line =~ '^#'
" Ignore.
elseif line =~ '^include'
" Include snippets.
let filename = matchstr(line, '^include\s\+\zs.*$')
for snippets_file in split(globpath(join(
\ neosnippet#get_snippets_directory(), ','),
\ filename), '\n')
call neosnippet#_parse_snippets_file(a:snippets, snippets_file)
endfor
elseif line =~ '^delete\s'
let name = matchstr(line, '^delete\s\+\zs.*$')
if name != '' && has_key(a:snippets, name)
call filter(a:snippets, 'v:val.real_name !=# name')
endif
elseif line =~ '^snippet\s'
if !empty(snippet_dict)
" Set previous snippet.
call s:set_snippet_dict(snippet_dict,
\ a:snippets, dup_check, a:snippets_file)
endif
let snippet_dict = s:parse_snippet_name(
\ a:snippets_file, line, linenr, dup_check)
elseif !empty(snippet_dict)
if line =~ '^\s' || line == ''
if snippet_dict.word == ''
" Substitute head tab character.
let line = substitute(line, '^\t', '', '')
endif
let snippet_dict.word .=
\ substitute(line, '^ *', '', '') . "\n"
else
call s:add_snippet_attribute(
\ a:snippets_file, line, linenr, snippet_dict)
endif
endif
let linenr += 1
endfor
if !empty(snippet_dict)
" Set previous snippet.
call s:set_snippet_dict(snippet_dict,
\ a:snippets, dup_check, a:snippets_file)
endif
return a:snippets
endfunction"}}}
function! s:parse_snippet_name(snippets_file, line, linenr, dup_check) "{{{
" Initialize snippet dict.
let snippet_dict = { 'word' : '', 'linenr' : a:linenr,
\ 'options' : s:initialize_snippet_options() }
" Try using the name without the description (abbr).
let snippet_dict.name = matchstr(a:line, '^snippet\s\+\zs\S\+')
" Fall back to using the name and description (abbr) combined.
" SnipMate snippets may have duplicate names, but different
" descriptions (abbrs).
let description = matchstr(a:line, '^snippet\s\+\S\+\s\+\zs.*$')
if description != '' && description !=# snippet_dict.name
" Convert description.
let snippet_dict.name .= '_' .
\ substitute(substitute(
\ description, '\W\+', '_', 'g'), '_\+$', '', '')
endif
" Collect the description (abbr) of the snippet, if set on snippet line.
" This is for compatibility with SnipMate-style snippets.
let snippet_dict.abbr = matchstr(a:line,
\ '^snippet\s\+\S\+\s\+\zs.*$')
" Check for duplicated names.
if has_key(a:dup_check, snippet_dict.name)
let dup = a:dup_check[snippet_dict.name]
call neosnippet#util#print_error(printf(
\ 'Warning: %s:%d is overriding `%s` from %s:%d',
\ a:snippets_file, a:linenr, snippet_dict.name,
\ dup.action__path, dup.action__line))
call neosnippet#util#print_error(printf(
\ 'Please rename the snippet name or use `delete %s`.',
\ snippet_dict.name))
endif
return snippet_dict
endfunction"}}}
function! s:add_snippet_attribute(snippets_file, line, linenr, snippet_dict) "{{{
" Allow overriding/setting of the description (abbr) of the snippet.
" This will override what was set via the snippet line.
if a:line =~ '^abbr\s'
let a:snippet_dict.abbr = matchstr(a:line, '^abbr\s\+\zs.*$')
elseif a:line =~ '^alias\s'
let a:snippet_dict.alias = split(matchstr(a:line,
\ '^alias\s\+\zs.*$'), '[,[:space:]]\+')
elseif a:line =~ '^prev_word\s'
let prev_word = matchstr(a:line,
\ '^prev_word\s\+[''"]\zs.*\ze[''"]$')
if prev_word == '^'
" For backward compatibility.
let a:snippet_dict.options.head = 1
else
call neosnippet#util#print_error(
\ 'prev_word must be "^" character.')
endif
elseif a:line =~ '^regexp\s'
let a:snippet_dict.regexp = matchstr(a:line,
\ '^regexp\s\+[''"]\zs.*\ze[''"]$')
elseif a:line =~ '^options\s\+'
for option in split(matchstr(a:line,
\ '^options\s\+\zs.*$'), '[,[:space:]]\+')
if !has_key(a:snippet_dict.options, option)
call neosnippet#util#print_error(
\ printf('[neosnippet] %s:%d', a:snippets_file, a:linenr))
call neosnippet#util#print_error(
\ printf('[neosnippet] Invalid option name : "%s"', option))
else
let a:snippet_dict.options[option] = 1
endif
endfor
else
call neosnippet#util#print_error(
\ printf('[neosnippet] %s:%d', a:snippets_file, a:linenr))
call neosnippet#util#print_error(
\ printf('[neosnippet] Invalid syntax : "%s"', a:line))
endif
return neosnippet#mappings#jumpable()
endfunction"}}}
function! s:is_beginning_of_line(cur_text) "{{{
@ -572,10 +301,10 @@ function! neosnippet#register_oneshot_snippet() "{{{
\'^' . base_indent, '', 'g')
let neosnippet = neosnippet#get_current_neosnippet()
let options = s:initialize_snippet_options()
let options = neosnippet#parser#_initialize_snippet_options()
let options.word = 1
let neosnippet.snippets[trigger] = s:initialize_snippet(
let neosnippet.snippets[trigger] = neosnippet#parser#_initialize_snippet(
\ { 'name' : trigger, 'word' : selected_text, 'options' : options },
\ '', 0, '', trigger)

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: commands.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 19 Nov 2013.
" Last Modified: 21 Nov 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -109,7 +109,7 @@ function! neosnippet#commands#_make_cache(filetype) "{{{
\ + split(globpath(join(snippets_dir, ','),
\ filetype . '/**/*.snip*'), '\n')
for snippets_file in reverse(snippets_files)
call neosnippet#_parse_snippets_file(snippet, snippets_file)
call neosnippet#parser#_parse(snippet, snippets_file)
endfor
let snippets = neosnippet#variables#get_snippets()
@ -120,7 +120,7 @@ function! neosnippet#commands#_source(filename) "{{{
call neosnippet#init#check()
let neosnippet = neosnippet#get_current_neosnippet()
call neosnippet#_parse_snippets_file(neosnippet.snippets, a:filename)
call neosnippet#parser#_parse(neosnippet.snippets, a:filename)
endfunction"}}}
function! neosnippet#commands#_edit_complete(arglead, cmdline, cursorpos) "{{{
@ -129,6 +129,25 @@ function! neosnippet#commands#_edit_complete(arglead, cmdline, cursorpos) "{{{
\ 'stridx(v:val, a:arglead) == 0')
endfunction"}}}
function! s:initialize_options(options) "{{{
let default_options = {
\ 'runtime' : 0,
\ 'vertical' : 0,
\ 'direction' : 'below',
\ 'split' : 0,
\ }
let options = extend(default_options, a:options)
" Complex initializer.
if has_key(options, 'horizontal')
" Disable vertically.
let options.vertical = 0
endif
return options
endfunction"}}}
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: init.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 19 Nov 2013.
" Last Modified: 21 Nov 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -72,16 +72,16 @@ function! s:initialize_cache() "{{{
call neosnippet#commands#_make_cache('_')
" Initialize check.
call neosnippet#caching()
call neosnippet#commands#_make_cache(&filetype)
endfunction"}}}
function! s:initialize_others() "{{{
augroup neosnippet "{{{
autocmd!
" Set caching event.
autocmd FileType * call neosnippet#caching()
autocmd FileType * call neosnippet#commands#_make_cache(&filetype)
" Recaching events
autocmd BufWritePost *.snip,*.snippets
\ call neosnippet#recaching()
\ call neosnippet#variables#set_snippets({})
autocmd BufEnter *
\ call neosnippet#mappings#_clear_select_mode_mappings()
autocmd InsertLeave * call s:on_insert_leave()
@ -161,6 +161,34 @@ function! s:on_insert_leave() "{{{
endtry
endfunction"}}}
" For echodoc. "{{{
let s:doc_dict = {
\ 'name' : 'neosnippet',
\ 'rank' : 100,
\ 'filetypes' : {},
\ }
function! s:doc_dict.search(cur_text) "{{{
if mode() !=# 'i'
return []
endif
let snippets = neosnippet#get_snippets()
let cur_word = neosnippet#get_cursor_snippet(snippets, a:cur_text)
if cur_word == ''
return []
endif
let snip = snippets[cur_word]
let ret = []
call add(ret, { 'text' : snip.word, 'highlight' : 'String' })
call add(ret, { 'text' : ' ' })
call add(ret, { 'text' : snip.menu_abbr, 'highlight' : 'Special' })
return ret
endfunction"}}}
"}}}
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: mappings.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 20 Nov 2013.
" Last Modified: 21 Nov 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -27,6 +27,20 @@
let s:save_cpo = &cpo
set cpo&vim
function! neosnippet#mappings#expandable_or_jumpable() "{{{
return neosnippet#mappings#expandable() || neosnippet#mappings#jumpable()
endfunction"}}}
function! neosnippet#mappings#expandable() "{{{
" Check snippet trigger.
return neosnippet#get_cursor_snippet(
\ neosnippet#get_snippets(), neosnippet#util#get_cur_text()) != ''
endfunction"}}}
function! neosnippet#mappings#jumpable() "{{{
" Found snippet placeholder.
return search(neosnippet#get_placeholder_marker_pattern(). '\|'
\ .neosnippet#get_sync_placeholder_marker_pattern(), 'nw') > 0
endfunction"}}}
function! neosnippet#mappings#_get_cursor_snippet(snippets, cur_text) "{{{
let cur_word = matchstr(a:cur_text, '\S\+$')
if cur_word != '' && has_key(a:snippets, cur_word)

View File

@ -0,0 +1,247 @@
"=============================================================================
" FILE: parser.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 21 Nov 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to
" permit persons to whom the Software is furnished to do so, subject to
" the following conditions:
"
" The above copyright notice and this permission notice shall be included
" in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
" }}}
"=============================================================================
let s:save_cpo = &cpo
set cpo&vim
function! neosnippet#parser#_parse(snippets, snippets_file) "{{{
let dup_check = {}
let snippet_dict = {}
let linenr = 1
if !filereadable(a:snippets_file)
call neosnippet#util#print_error(
\ printf('snippet file "%s" is not found.', a:snippets_file))
return a:snippets
endif
for line in readfile(a:snippets_file)
if line =~ '^\h\w*.*\s$'
" Delete spaces.
let line = substitute(line, '\s\+$', '', '')
endif
if line =~ '^#'
" Ignore.
elseif line =~ '^include'
" Include snippets.
let filename = matchstr(line, '^include\s\+\zs.*$')
for snippets_file in split(globpath(join(
\ neosnippet#get_snippets_directory(), ','),
\ filename), '\n')
call neosnippet#parser#_parse(a:snippets, snippets_file)
endfor
elseif line =~ '^delete\s'
let name = matchstr(line, '^delete\s\+\zs.*$')
if name != '' && has_key(a:snippets, name)
call filter(a:snippets, 'v:val.real_name !=# name')
endif
elseif line =~ '^snippet\s'
if !empty(snippet_dict)
" Set previous snippet.
call s:set_snippet_dict(snippet_dict,
\ a:snippets, dup_check, a:snippets_file)
endif
let snippet_dict = s:parse_snippet_name(
\ a:snippets_file, line, linenr, dup_check)
elseif !empty(snippet_dict)
if line =~ '^\s' || line == ''
if snippet_dict.word == ''
" Substitute head tab character.
let line = substitute(line, '^\t', '', '')
endif
let snippet_dict.word .=
\ substitute(line, '^ *', '', '') . "\n"
else
call s:add_snippet_attribute(
\ a:snippets_file, line, linenr, snippet_dict)
endif
endif
let linenr += 1
endfor
if !empty(snippet_dict)
" Set previous snippet.
call s:set_snippet_dict(snippet_dict,
\ a:snippets, dup_check, a:snippets_file)
endif
return a:snippets
endfunction"}}}
function! s:parse_snippet_name(snippets_file, line, linenr, dup_check) "{{{
" Initialize snippet dict.
let snippet_dict = { 'word' : '', 'linenr' : a:linenr,
\ 'options' : neosnippet#parser#_initialize_snippet_options() }
" Try using the name without the description (abbr).
let snippet_dict.name = matchstr(a:line, '^snippet\s\+\zs\S\+')
" Fall back to using the name and description (abbr) combined.
" SnipMate snippets may have duplicate names, but different
" descriptions (abbrs).
let description = matchstr(a:line, '^snippet\s\+\S\+\s\+\zs.*$')
if description != '' && description !=# snippet_dict.name
" Convert description.
let snippet_dict.name .= '_' .
\ substitute(substitute(
\ description, '\W\+', '_', 'g'), '_\+$', '', '')
endif
" Collect the description (abbr) of the snippet, if set on snippet line.
" This is for compatibility with SnipMate-style snippets.
let snippet_dict.abbr = matchstr(a:line,
\ '^snippet\s\+\S\+\s\+\zs.*$')
" Check for duplicated names.
if has_key(a:dup_check, snippet_dict.name)
let dup = a:dup_check[snippet_dict.name]
call neosnippet#util#print_error(printf(
\ 'Warning: %s:%d is overriding `%s` from %s:%d',
\ a:snippets_file, a:linenr, snippet_dict.name,
\ dup.action__path, dup.action__line))
call neosnippet#util#print_error(printf(
\ 'Please rename the snippet name or use `delete %s`.',
\ snippet_dict.name))
endif
return snippet_dict
endfunction"}}}
function! s:add_snippet_attribute(snippets_file, line, linenr, snippet_dict) "{{{
" Allow overriding/setting of the description (abbr) of the snippet.
" This will override what was set via the snippet line.
if a:line =~ '^abbr\s'
let a:snippet_dict.abbr = matchstr(a:line, '^abbr\s\+\zs.*$')
elseif a:line =~ '^alias\s'
let a:snippet_dict.alias = split(matchstr(a:line,
\ '^alias\s\+\zs.*$'), '[,[:space:]]\+')
elseif a:line =~ '^prev_word\s'
let prev_word = matchstr(a:line,
\ '^prev_word\s\+[''"]\zs.*\ze[''"]$')
if prev_word == '^'
" For backward compatibility.
let a:snippet_dict.options.head = 1
else
call neosnippet#util#print_error(
\ 'prev_word must be "^" character.')
endif
elseif a:line =~ '^regexp\s'
let a:snippet_dict.regexp = matchstr(a:line,
\ '^regexp\s\+[''"]\zs.*\ze[''"]$')
elseif a:line =~ '^options\s\+'
for option in split(matchstr(a:line,
\ '^options\s\+\zs.*$'), '[,[:space:]]\+')
if !has_key(a:snippet_dict.options, option)
call neosnippet#util#print_error(
\ printf('[neosnippet] %s:%d', a:snippets_file, a:linenr))
call neosnippet#util#print_error(
\ printf('[neosnippet] Invalid option name : "%s"', option))
else
let a:snippet_dict.options[option] = 1
endif
endfor
else
call neosnippet#util#print_error(
\ printf('[neosnippet] %s:%d', a:snippets_file, a:linenr))
call neosnippet#util#print_error(
\ printf('[neosnippet] Invalid syntax : "%s"', a:line))
endif
endfunction"}}}
function! s:set_snippet_dict(snippet_dict, snippets, dup_check, snippets_file) "{{{
if empty(a:snippet_dict)
return
endif
let action_pattern = '^snippet\s\+' . a:snippet_dict.name . '$'
let snippet = neosnippet#parser#_initialize_snippet(
\ a:snippet_dict, a:snippets_file,
\ a:snippet_dict.linenr, action_pattern,
\ a:snippet_dict.name)
let a:snippets[a:snippet_dict.name] = snippet
let a:dup_check[a:snippet_dict.name] = snippet
for alias in get(a:snippet_dict, 'alias', [])
let alias_snippet = copy(snippet)
let alias_snippet.word = alias
let a:snippets[alias] = alias_snippet
let a:dup_check[alias] = alias_snippet
endfor
endfunction"}}}
function! neosnippet#parser#_initialize_snippet(dict, path, line, pattern, name) "{{{
let a:dict.word = substitute(a:dict.word, '\n\+$', '', '')
if a:dict.word !~
\ neosnippet#get_placeholder_marker_substitute_pattern()
" Add placeholder.
let a:dict.word .= '${0}'
endif
let menu_prefix = '[nsnip] '
if !has_key(a:dict, 'abbr') || a:dict.abbr == ''
" Set default abbr.
let abbr = substitute(a:dict.word,
\ neosnippet#get_placeholder_marker_pattern(). '\|'.
\ neosnippet#get_mirror_placeholder_marker_pattern().
\ '\|\s\+\|\n\|TARGET', ' ', 'g')
let a:dict.abbr = a:dict.name
else
let abbr = a:dict.abbr
endif
let snippet = {
\ 'word' : a:dict.name, 'snip' : a:dict.word,
\ 'description' : a:dict.word,
\ 'menu_template' : menu_prefix . abbr,
\ 'menu_abbr' : abbr,
\ 'options' : a:dict.options,
\ 'action__path' : a:path, 'action__line' : a:line,
\ 'action__pattern' : a:pattern, 'real_name' : a:name,
\}
if has_key(a:dict, 'regexp')
let snippet.regexp = a:dict.regexp
endif
return snippet
endfunction"}}}
function! neosnippet#parser#_initialize_snippet_options() "{{{
return { 'head' : 0, 'word' : 0, 'indent' : 0 }
endfunction"}}}
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: foldmethod=marker