Makefile syntax file throws errors #3

Closed
mikofski opened this Issue Sep 9, 2012 · 14 comments

Comments

Projects
None yet
4 participants

mikofski commented Sep 9, 2012

Thanks for these! FYI this one file seems to have issues

Error in /Users/whoami/.nano/gentoo.nanorc on line 19: Bad regex "<(do|new)(ins|s?bin|doc|lib(|.so|.a)|man|info|exe|initd|confd|envd|pam|menu|icon)>": empty (sub)expression

Error in /Users/whoami/.nano/gentoo.nanorc on line 21: Bad regex "prepall(|docs|info|man|strip)": empty (sub)expression

Error in /Users/whoami/.nano/gentoo.nanorc on line 22: Bad regex "<(|doc|ins|exe)into>": empty (sub)expression

mac os x 10.6.8
nano 2.0.6 (whoa really old could that be it?)

Owner

scopatz commented Sep 10, 2012

Hello @mikofski, thanks! I think that this is probably a version issue as this file works just fine on my machine. If you figure out a fix for this file that works on your version too, I would happily accept it!

Contributor

bowsersenior commented Sep 13, 2012

I get this error as well on OS X Mountain Lion with both the pre-installed nano (v2.0.6) and the latest nano from homebrew (v2.2.6). @scopatz can you tell me which version of nano you use?

Owner

scopatz commented Sep 13, 2012

Hmm very strange. I am on v2.2.6. I wonder if this is a compile-time option that is not being enabled on the macs. Could you maybe run nano -V. When I do this I get:

$ nano -V
 GNU nano version 2.2.6 (compiled 20:32:12, Dec  3 2010)
 (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
 2008, 2009 Free Software Foundation, Inc.
 Email: nano@nano-editor.org    Web: http://www.nano-editor.org/
 Compiled options: --disable-wrapping-as-root --enable-color --enable-extra --enable-multibuffer --enable-nanorc --enable-utf8

The last line is what is important.

scopatz closed this Sep 13, 2012

scopatz reopened this Sep 13, 2012

Owner

scopatz commented Sep 13, 2012

Whoops didn't mean to close ;)

Contributor

bowsersenior commented Sep 13, 2012

Here's what I get:

GNU nano version 2.2.6 (compiled 19:10:55, Sep 12 2012)
(C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009 Free Software Foundation, Inc.
Email: nano@nano-editor.org Web: http://www.nano-editor.org/
Compiled options: --disable-browser --disable-help --disable-justify --disable-mouse --disable-nls --disable-operatingdir --disable-speller --disable-tabcomp --disable-wrapping --enable-color --enable-extra --enable-multibuffer --enable-nanorc --enable-tiny --enable-utf8 --with-slang

I can see that it is a bit different.

Owner

scopatz commented Sep 13, 2012

Hmmm, yeah I bet that some option here is messing up the regex parser. However, since you have --enable-color selected, this really shouldn't. I bet this is a bug. I will forward this information along to the nano people. However, in the mean time if you want to comment out these regexs and PR the change, I would be happy with that.

Contributor

bowsersenior commented Sep 13, 2012

Cool, see #4 for the PR. Thanks for your attention to this!

Owner

scopatz commented Sep 13, 2012

No problem! Software should work ;) I have opened the following ticket for nano https://savannah.gnu.org/bugs/?37339

Bad regex "<(|doc|ins|exe)into>": empty (sub)expression

There's an empty expression ((|) at the start of the sub-expression list. You can just remove the first pipe to fix it (and if you really want to match an empty expression, also add a question mark at the end).

Nano just uses the regex implementation found in the platform's libc. Unless a specific regex engine is bundled with nano, there's no way to solve variabilities like this, except by only using POSIX regex. If a regex library chokes on POSIX expressions, it becomes their bug and not just an edge case.

I had this problem a few times and ended up fixing all the non-POSIX patterns pre-emptively to avoid it happening again.

Thanks! @scopatz here is a patch to try:

--- nanorc.old
+++ nanorc.new
@@ -16,10 +16,10 @@
 color magenta "\<use(_(with|enable))?\> [!a-zA-Z0-9_+ -]*" "inherit.*"
 color brightblue "\<e(begin|end|conf|install|make|warn|infon?|error|log|patch|new(group|user))\>"
 color brightblue "\<die\>" "\<use(_(with|enable))?\>" "\<inherit\>" "\<has\>" "\<(has|best)_version\>" "\<unpack\>"
-# color brightblue "\<(do|new)(ins|s?bin|doc|lib(|\.so|\.a)|man|info|exe|initd|confd|envd|pam|menu|icon)\>"
+color brightblue "\<(do|new)(ins|s?bin|doc|lib(\.so|\.a)|man|info|exe|initd|confd|envd|pam|menu|icon)\>"
 color brightblue "\<do(python|sed|dir|hard|sym|html|jar|mo)\>" "\<keepdir\>"
-# color brightblue "prepall(|docs|info|man|strip)" "prep(info|lib|lib\.(so|a)|man|strip)"
-# color brightblue "\<(|doc|ins|exe)into\>" "\<f(owners|perms)\>" "\<(exe|ins|dir)opts\>"
+color brightblue "prepall(docs|info|man|strip)" "prep(info|lib|lib\.(so|a)|man|strip)"
+color brightblue "\<(doc|ins|exe)into\>" "\<f(owners|perms)\>" "\<(exe|ins|dir)opts\>"
 ## Highlight common commands used in ebuilds
 color blue "\<make\>" "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|let|ln|mkdir|mv|rm|sed|set|tar|touch|unset)\>"
 ## Highlight comments (doesnt work that well)

I removed all of the empty subexpressions on lines 19, 21 and 22. Not sure if that's all of them.

lineoldnew
19`lib(|\.so|\.a)``lib(\.so|\.a)`
21`prepall(|docs|info|man|strip)``prepall(docs|info|man|strip)`
22`(|doc|ins|exe)``(doc|ins|exe)`
Owner

scopatz commented Mar 27, 2013

Hello all, sorry for taking a few days to get around to this.

@craigbarnes Wow, thanks for the information. I'll go through this repo and remove those errant pipes too.

@mikofski Thanks a ton for the patch! I have applied it and push it back here.

Owner

scopatz commented Mar 27, 2013

Actually, this looks like the only place that errant pipes were in this repo. I am closing this issue unless there is a good reason to reopen.

scopatz closed this Mar 27, 2013

Yay! finally tested it out and it works! awesome! now we just need a bunch of git syntax nanorc files like the ones in this post and this will be complete!

Owner

scopatz commented Mar 28, 2013

great find! I have added it to this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment