Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E492: Not an editor command: when parsing a long regular expression #87

Closed
trey-pindrop opened this issue Apr 7, 2023 · 5 comments
Closed

Comments

@trey-pindrop
Copy link

Describe the bug
I'm not sure why this error is being thrown, it seems to be throwing an error at a specific point and I don't understand why. I have a long regex pattern which is designed to match a timestamp string (%Y-%m-%d %H:%M:%S), and a negation to flag invalid timestamps as errors. The syntax line in question:

syntax region errTimestamp     matchgroup=timestamp start="^\%(\d\{4}-\%(0[135789]-\%([0-2]\d\|3[01]\)\|\%(1[02]-\%([0-2]\d\|3[01]\)\)\|0[46]-\%([0-2]\d\|30\)\|11-\%([0-2]\d\|30\)\|02-[0-2]\d\) \%([01]\d\|2[0-3]\)\%(:[0-5]\d\)\{2}\)\@!"         end=":  "  

It generates the following error:

E492: Not an editor command: [0-3]\)\%(:[0-5]\d\)\{2}\)\@!"         end=":  "  

I have vim-language-parser installed using vim-lsp (which itself is installed via vim-plug)

Here's a screenshot of the error:
Screen Shot 2023-04-07 at 16 05 06

Here's the full copy of my syntax file:
timetracker.txt

Here's an example log file the syntax file highlights:
example.log

This file loads successfully, vim doesn't make a similar complaint when applying the syntax highlighting to my log file.

To Reproduce
Steps to reproduce the behavior:

  1. Rename timetracker.txt to timetracker.vim, and ensure vim-language-server parses the file
  2. On errTimestamp line, vim-language-server throws an error.

At first I thought it might be too many capture groups, but I replaced all the nested \(...\) with \%(...\). An interesting thing about this, the character it highlights is the last character of the visual line before it line wraps, or the last visible character of the line with :set nowrap set.

Expected behavior
I don't expect vim to show an error on this line, not when vim itself can parse this line correctly (and not throw an error).

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS Monterey 12.6.3
  • vim 9.0.1-1400 (installed via Homebrew)
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar 11 2023 13:55:53)
macOS version - x86_64
Included patches: 1-1400
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        +lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      +sodium            -X11
+digraphs          +mouse             +sound             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        -mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary
-farsi             -mouse_sysmouse    -tag_old_static
  system vimrc file: "$VIM/vimrc"
    user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
     user exrc file: "$HOME/.exrc"
      defaults file: "$VIMRUNTIME/defaults.vim"
 fall-back for $VIM: "/Users/tblancher/homebrew/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L/usr/local/lib -o vim -lm -lncurses -lsodium -liconv -lintl -framework AppKit -L/Users/tblancher/homebrew/opt/lua/lib -llua5.4 -mmacosx-version-min=11.7 -fstack-protector-strong -L/usr/local/lib -L/Users/tblancher/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE -lperl -L/Users/tblancher/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin -lpython3.11 -lintl -framework CoreFoundation -lruby.3.2 -L/Users/tblancher/homebrew/Cellar/ruby/3.2.1/lib
  • vim-language-server (re-)installed today, vim-lsp uses npm for this
  • vim-lsp installed via vim-plug

Log:

Not sure how to capture logs from vim-language-server. enabling logging in vim-lsp doesn't appear to log the error.

@iamcco
Copy link
Owner

iamcco commented Apr 8, 2023

Bug of viml-parser

@trey-pindrop
Copy link
Author

OK, I'll try to follow up on that repo/project.

@trey-pindrop
Copy link
Author

@iamcco Do you have a link to the viml-parser project? Searching GitHub looks like it finds a few results.

@iamcco
Copy link
Owner

iamcco commented Apr 18, 2023

@iamcco Do you have a link to the viml-parser project? Searching GitHub looks like it finds a few results.

https://github.com/vim-jp/vim-vimlparser

@trey-pindrop
Copy link
Author

I posted this issue to the vim-vimlparser issue. Thanks for directing me there. I'll go ahead and close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants