- Improved syntax error.
This commit is contained in:
		
							parent
							
								
									26a8a75a7e
								
							
						
					
					
						commit
						4c605a5d8f
					
				| @ -1,7 +1,7 @@ | |||||||
| "============================================================================= | "============================================================================= | ||||||
| " FILE: neosnippet.vim | " FILE: neosnippet.vim | ||||||
| " AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com> | " AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com> | ||||||
| " Last Modified: 08 Nov 2012. | " Last Modified: 09 Nov 2012. | ||||||
| " License: MIT license  {{{ | " License: MIT license  {{{ | ||||||
| "     Permission is hereby granted, free of charge, to any person obtaining | "     Permission is hereby granted, free of charge, to any person obtaining | ||||||
| "     a copy of this software and associated documentation files (the | "     a copy of this software and associated documentation files (the | ||||||
| @ -371,7 +371,7 @@ function! s:parse_snippets_file(snippets, snippets_file)"{{{ | |||||||
|       endif |       endif | ||||||
| 
 | 
 | ||||||
|       let snippet_dict = s:parse_snippet_name( |       let snippet_dict = s:parse_snippet_name( | ||||||
|             \ line, linenr, dup_check) |             \ a:snippets_file, line, linenr, dup_check) | ||||||
|     elseif !empty(snippet_dict) |     elseif !empty(snippet_dict) | ||||||
|       if line =~ '^\s' || line == '' |       if line =~ '^\s' || line == '' | ||||||
|         if snippet_dict.word == '' |         if snippet_dict.word == '' | ||||||
| @ -382,7 +382,8 @@ function! s:parse_snippets_file(snippets, snippets_file)"{{{ | |||||||
|         let snippet_dict.word .= |         let snippet_dict.word .= | ||||||
|                 \ substitute(line, '^ *', '', '') . "\n" |                 \ substitute(line, '^ *', '', '') . "\n" | ||||||
|       else |       else | ||||||
|         call s:add_snippet_attribute(line, linenr, snippet_dict) |         call s:add_snippet_attribute( | ||||||
|  |               \ a:snippets_file, line, linenr, snippet_dict) | ||||||
|       endif |       endif | ||||||
|     endif |     endif | ||||||
| 
 | 
 | ||||||
| @ -398,7 +399,7 @@ function! s:parse_snippets_file(snippets, snippets_file)"{{{ | |||||||
|   return a:snippets |   return a:snippets | ||||||
| endfunction"}}} | endfunction"}}} | ||||||
| 
 | 
 | ||||||
| function! s:parse_snippet_name(line, linenr, dup_check)"{{{ | function! s:parse_snippet_name(snippets_file, line, linenr, dup_check)"{{{ | ||||||
|   " Initialize snippet dict. |   " Initialize snippet dict. | ||||||
|   let snippet_dict = { 'word' : '', 'linenr' : a:linenr, |   let snippet_dict = { 'word' : '', 'linenr' : a:linenr, | ||||||
|         \ 'options' : s:initialize_snippet_options() } |         \ 'options' : s:initialize_snippet_options() } | ||||||
| @ -435,7 +436,7 @@ function! s:parse_snippet_name(line, linenr, dup_check)"{{{ | |||||||
| 
 | 
 | ||||||
|   return snippet_dict |   return snippet_dict | ||||||
| endfunction"}}} | endfunction"}}} | ||||||
| function! s:add_snippet_attribute(line, linenr, snippet_dict)"{{{ | function! s:add_snippet_attribute(snippets_file, line, linenr, snippet_dict)"{{{ | ||||||
|   " Allow overriding/setting of the description (abbr) of the snippet. |   " Allow overriding/setting of the description (abbr) of the snippet. | ||||||
|   " This will override what was set via the snippet line. |   " This will override what was set via the snippet line. | ||||||
|   if a:line =~ '^abbr\s' |   if a:line =~ '^abbr\s' | ||||||
| @ -461,14 +462,18 @@ function! s:add_snippet_attribute(line, linenr, snippet_dict)"{{{ | |||||||
|           \ '^options\s\+\zs.*$'), '[,[:space:]]\+') |           \ '^options\s\+\zs.*$'), '[,[:space:]]\+') | ||||||
|       if !has_key(a:snippet_dict.options, option) |       if !has_key(a:snippet_dict.options, option) | ||||||
|         call neosnippet#util#print_error( |         call neosnippet#util#print_error( | ||||||
|               \ printf('Invalid option name : %s is detected.', option)) |               \ printf('[neosnippet] %s:%d', a:snippets_file, a:linenr)) | ||||||
|  |         call neosnippet#util#print_error( | ||||||
|  |               \ printf('[neosnippet] Invalid option name : "%s"', option)) | ||||||
|       else |       else | ||||||
|         let a:snippet_dict.options[option] = 1 |         let a:snippet_dict.options[option] = 1 | ||||||
|       endif |       endif | ||||||
|     endfor |     endfor | ||||||
|   else |   else | ||||||
|     call neosnippet#util#print_error( |     call neosnippet#util#print_error( | ||||||
|           \ printf('Invalid syntax : "%s" is detected.', a:line)) |           \ printf('[neosnippet] %s:%d', a:snippets_file, a:linenr)) | ||||||
|  |     call neosnippet#util#print_error( | ||||||
|  |           \ printf('[neosnippet] Invalid syntax : "%s"', a:line)) | ||||||
|   endif |   endif | ||||||
| endfunction"}}} | endfunction"}}} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -712,6 +712,9 @@ A: Please try below settings. It defines snipMate function. | |||||||
| ============================================================================== | ============================================================================== | ||||||
| CHANGELOG			*neosnippet-changelog* | CHANGELOG			*neosnippet-changelog* | ||||||
| 
 | 
 | ||||||
|  | 2012-11-09 | ||||||
|  | - Improved syntax error. | ||||||
|  | 
 | ||||||
| 2012-11-07 | 2012-11-07 | ||||||
| - Fixed s:indent_snippet(). | - Fixed s:indent_snippet(). | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Shougo Matsushita
						Shougo Matsushita