Loading ...
Sorry, an error occurred while loading the content.

Adding a new language via Ctags.

Expand Messages
  • Bill Guindon
    I think I ve pretty much tried everything I can, and still, I m stumped. http://ctags.sourceforge.net/EXTENDING.html Offers this fairly simple example:
    Message 1 of 5 , May 10, 2007
    View Source
    • 0 Attachment
      I think I've pretty much tried everything I can, and still, I'm stumped.


      http://ctags.sourceforge.net/EXTENDING.html
      Offers this fairly simple example:
      --langdef=swine
      --langmap=swine:.swn
      --regex-swine=/^def[ \t]*([a-zA-Z0-9_]+)/\1/d,definition/

      It seems I can either build my own, and add it to the paramaters
      within Boxer, using the Advanced tab (Tools - Ctags... - Settings -
      Advanced), or I'm supposed to put it into the '.ctags' file (I've been
      told on the ctags-user list that this is 'ctags.cnf' on windows).
      Since I can't find either of these files, I've tried adding it via the
      Advanced tab, but I've had no luck.

      Here are the params I'm trying:
      --langdef=miva
      --langmap=miva:.mv
      --regex-miva=/^\s*<MvFUNCTION\s+NAME\s*=\s*"([a-zA-Z0-9_]+)"/\1/f,function/

      Here's a sample tag from one of my files:
      <MvFUNCTION NAME="GDB_FieldList" PARAMETERS="query VAR" STANDARDOUTPUTLEVEL="">

      When I try running a file through using those on the command line, I
      either get nothing but a header (ie: no functions listed), or I get an
      error. When I put that into a 'ctags.cnf' file in the ctags
      directory, and try running with those flags, I get a "Warning:
      Language "miva" already defined"

      Has anybody successfully added a language? Any idea where Boxer would
      look for the ctags.cnf file?

      Dave: any chance that ctags errors can be passed back in the future?

      Reference:
      http://ctags.sourceforge.net/ctags.html

      --
      Bill Guindon (aka aGorilla)
      The best answer to most questions is "it depends".
    • Daniel van Rooijen
      B I think I ve pretty much tried everything I can, and still, I m B stumped. Did you see Configure | Ctags | Tab: Advanced?
      Message 2 of 5 , May 10, 2007
      View Source
      • 0 Attachment
        B> I think I've pretty much tried everything I can, and still, I'm
        B> stumped.

        Did you see Configure | Ctags | Tab: Advanced?
      • Bill Guindon
        ... Yep, no luck there. Tried passing them as parameters, but I end up with an empty list, and it doesn t seem to show any errors from Ctags. -- Bill Guindon
        Message 3 of 5 , May 10, 2007
        View Source
        • 0 Attachment
          On 5/10/07, Daniel van Rooijen <copycats@...> wrote:


          B> I think I've pretty much tried everything I can, and still, I'm
          B> stumped.

          Did you see Configure | Ctags | Tab: Advanced?








          Yep, no luck there.  Tried passing them as parameters, but I end up with an empty list, and it doesn't seem to show any errors from Ctags. 

          --
          Bill Guindon (aka aGorilla)
          The best answer to most questions is "it depends".
        • Bill Guindon
          A quick update... ... With some help from the ctags-users list, I found out that they don t use perl regular expressions, instead, they re using Gnu regex,
          Message 4 of 5 , May 11, 2007
          View Source
          • 0 Attachment
            A quick update...

            On 5/10/07, Bill Guindon <agorilla@...> wrote:
            > I think I've pretty much tried everything I can, and still, I'm stumped.
            >
            >
            > http://ctags.sourceforge.net/EXTENDING.html
            > Offers this fairly simple example:
            > --langdef=swine
            > --langmap=swine:.swn
            > --regex-swine=/^def[ \t]*([a-zA-Z0-9_]+)/\1/d,definition/
            >
            > It seems I can either build my own, and add it to the paramaters
            > within Boxer, using the Advanced tab (Tools - Ctags... - Settings -
            > Advanced), or I'm supposed to put it into the '.ctags' file (I've been
            > told on the ctags-user list that this is 'ctags.cnf' on windows).
            > Since I can't find either of these files, I've tried adding it via the
            > Advanced tab, but I've had no luck.
            >
            > Here are the params I'm trying:
            > --langdef=miva
            > --langmap=miva:.mv
            > --regex-miva=/^\s*<MvFUNCTION\s+NAME\s*=\s*"([a-zA-Z0-9_]+)"/\1/f,function/

            With some help from the ctags-users list, I found out that they don't
            use perl regular expressions, instead, they're using Gnu regex, which
            doesn't support '\s' for whitespace.

            I replaced the '\s' with a character class instead, so now my ctags.cnf has:
            --langdef=miva
            --langmap=miva:.mv
            --regex-miva=/^[ ]*<MvFUNCTION[ ]+NAME[ ]*=[ ]*"([a-zA-Z0-9_]+)"/\1/f,function/

            WIth that setup, I can run it from the command prompt, and it works
            correctly. I still haven't got it working from inside Boxer, but it's
            a start.

            It _seems_ like Boxer is reading the ctags.cnf file, because if I add
            the language definition options in the Advanced tab, then it breaks
            for all languages (Ruby and Python functions are no longer listed), so
            I'm guessing that the double definition is causing an error that
            prevents those files from being indexed. That said, it's still not
            parsing my '.mv' files.

            > Here's a sample tag from one of my files:
            > <MvFUNCTION NAME="GDB_FieldList" PARAMETERS="query VAR" STANDARDOUTPUTLEVEL="">
            >
            > When I try running a file through using those on the command line, I
            > either get nothing but a header (ie: no functions listed), or I get an
            > error. When I put that into a 'ctags.cnf' file in the ctags
            > directory, and try running with those flags, I get a "Warning:
            > Language "miva" already defined"
            >
            > Has anybody successfully added a language? Any idea where Boxer would
            > look for the ctags.cnf file?
            >
            > Dave: any chance that ctags errors can be passed back in the future?
            >
            > Reference:
            > http://ctags.sourceforge.net/ctags.html
            >
            > --
            > Bill Guindon (aka aGorilla)
            > The best answer to most questions is "it depends".
            >


            --
            Bill Guindon (aka aGorilla)
            The best answer to most questions is "it depends".
          • David Hamel, Boxer Software
            Hi Bill, ... Well, this has been a real brain twister. I ve always felt the CTags syntax was pretty obscure. I had to work with it when adding CTags support
            Message 5 of 5 , May 11, 2007
            View Source
            • 0 Attachment
              Hi Bill,

              >> It _seems_ like Boxer is reading the ctags.cnf file, because if I add the
              >> language definition options in the Advanced tab, then it breaks for all
              >> languages (Ruby and Python functions are no longer listed), so I'm
              >> guessing that the double definition is causing an error that prevents
              >> those files from being indexed. That said, it's still not parsing my
              >> '.mv' files.

              Well, this has been a real brain twister. I've always felt the CTags syntax
              was pretty obscure. I had to work with it when adding CTags support to Boxer,
              of course, and also when adding the Boxer Macro language (.bm) to CTags' set of
              recognized languages. That was a little different from this puzzle, though, as
              I was able to tell CTags that "bm" was just another eligible file extension
              for a language that was to be treated like C.

              So, I never did actually prove that new languages could be added, only that a
              new extension could be added for a known language. I took it on faith that if
              someone could devise (or find) the proper regexp strings for a new langauge,
              that everything would work. That was mistake on my part. More on that in a
              minute.

              Here's what I have found: Your settings are right. CTags does read from the
              ctags.cnf file, but only when it appears in the current directory. I tried
              using the CTags "--options" flag to force recognition of a ctags.cnf file in
              some distant directory, but Ctags reports that the file can't be found, even
              though the file DOES exist, and the path is properly specified. That one
              remains a mystery to me; maybe the CTags people have an answer.

              Another complication seems to be that your regular expression contains the "<"
              character. When I tried to supply your language definition to CTags via the
              command line, that character was interpreted as a redirection character. That
              might be why that method is failing when passed as a parameter from Boxer's
              advanced settings dialog, thought I wouldn't have expected that. I tried
              replacing that character with [.], just to get it running, but then CTags
              reported an incomplete regexp. I don't know enough about Gnu regexps to guess
              what's wrong.

              On the Boxer side, there's also trouble: Boxer doesn't know that Miva is an
              eligible file for CTags indexing. Rather than just passing all types of files
              off to CTags for processing, which would be wasteful, Boxer uses a list of
              supported file extensions to decide whether CTags should be called. But I took
              that list from the standard CTags configuration, and forgot to consider that new
              languages might be added at run-time.

              I'll get to you in email with some other fine details, but after that, we
              should have you up and running.

              Best,

              David.



              Boxer Text Editor: 2006 SIAF Award Winner - "BEST APPLICATION"
              --------------------------------------------------------------
              email: sales@... http://www.boxersoftware.com
              voice: 602-485-1635 fax: 602-485-1636 sales: 800-982-6937
              Boxer Software, P.O. Box 14545, Scottsdale, AZ 85267-4545 USA
            Your message has been successfully submitted and would be delivered to recipients shortly.