10 November 2008

"Error detected while processing ../php.vim"

Here's a minor irritation with the vim port (editors/vim-lite, and probably the others). When I go to edit a php file I get this non-fatal error:

"~/somefile.php" 99 lines, 2345 characters
Error detected while processing /usr/local/share/vim/vim72/syntax/php.vim:
line 479:
E10: \ should be followed by /, ? or &
line 482:
E10: \ should be followed by /, ? or &
line 488:
E10: \ should be followed by /, ? or &
line 489:
E10: \ should be followed by /, ? or &
line 490:
E10: \ should be followed by /, ? or &
Press ENTER or type command to continue

This is with vim-lite-7.2.14, but it was happening on vim-lite-7.1.x too. The fix is pretty easy, we just have to edit the php.vim file and remove the syntax errors. All of the errors reported are the same and look like they were intended to be line continuations for neatness (that vim just does not like). I saved a copy of the original before I did this and here a snippet of the diff:

< syntax keyword phpSpecialFunction containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle,phpIdentifier
< \ __construct __destruct __call __toString __sleep __wakeup __set __get __unset __isset __clone __set_state
> syntax keyword phpSpecialFunction containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle,phpIdentifier __construct __destruct __call __toString __sleep __wakeup __set __get __unset __isset __clone __set_state

That's probably going to be hard to read. But, the issue is that all the lines beginning with " \ " need to be joined to the line before them and the "\" should be removed. That's it. In the case where there are several of these lines in a row, they should all be joined to the line preceding them, and all of the backslashes removed. (Into one really long line, yes.)

I guess I'll be a good user and submit a patch. :P

See this update, with new information (including a better solution).



At 21/12/08 19:51, Anonymous Anonymous said...

This is still an issue it seems

I actually found this blog just trying to find out how to enable php highlighting and closed it once i did not find what i wanted

Once i found out how (Type : then type syntax enable

To recap that is :syntax enable) and then i noticed these errors also and came back


At 3/1/09 12:06, Blogger kace said...

Glad to help.

Notice there's an update to this issue -- with a simpler solution!

At 22/3/10 02:21, Blogger Erik Hansen said...

I had this issue. Your blog post helped me resolve it. Thanks!

At 2/10/10 02:26, Anonymous ryu said...

thanks, this post is very helpful for me.

if you have vi editor,
you can fix this problem like this

:478,535s/\n \\//g


Post a Comment

<< Home