Issue #13 new

rule rewrite produces syntax error

Ernie Rael
created an issue

I've got a static method, vim_strchr. Since jVi is a port of vim ("C" code) it's core is static methods. I've started using "import static x.y.*", so in the code there is both vim_strchr and Util.vim_strchr. With the following rule {{{ com.raelity.jvi.core.Util.vim_strchr($str, $chr) != null => vim_strchr($str, 0, $chr) >= 0 ;; }}}

both with and without Util. this rule produces (note lonely '.') {{{ .vim_strchr(escape, 0, c) >= 0 }}} Changing the rewrite to {{{ => Util.vim_strchr(... }}} produces {{{ .Util.vim_strchr(... }}}

BTW, I need to use the full "com.raelity.jvi.core.Util.vim_strchr" in the pattern. Maybe a "Custom Import" would solve the problem, but I didn't see one in any of the online examples AFAICT.

Comments (1)

  1. Ernie Rael reporter

    My problem is solved using

    <?
    import static com.raelity.jvi.core.Util.vim_strchr;
    ?>
    vim_strchr($str, $chr) != null
    => vim_strchr($str, 0, $chr) >= 0
    ;;
    

    Very cool.

    Using

    import static com.raelity.jvi.core.Util.*;
    

    also works.

    BTW, both Util.vim_strchr and vim_strchr match with both Custom Imports.

    I'll leave the bug open and you can decide if the generated syntax error is an issue.

  2. Log in to comment