Menu

Parser for Tags file creation

2008-09-29
2013-05-23
  • Denis Golovan

    Denis Golovan - 2008-09-29

    Hi.

    I use jcf for several weeks already and I think I find one more great useful usage for it.

    Let's see from the beginning.
    1. As I use emacs for development in free pascal/delphi project, I need to nagivate it somehow. Google says I am not alone in emacs+free pascal area :)
    2. AFAIK, most advanced tag creation program for pascal is ctags. For c/c++ it does wonderful job and produces results of best quality.
    3. For Pascal/Object Pascal/Free pascal/Delphi it's results are at least compared to manual regexp extraction/parsing of source code.
    4. Navigation in emacs is just a matter of finding a line correspoding to any text "tag" (class name, type name, global variable and etc.)
    5. Tag file itself is simply a sorted file with table in it. One field is tag, the second is file name, the third is line number.
    6. We have a wonderful pascal parser (as I understand) in jcf. It is capable of full parsing the code, not just applying some fancy regexp on line level.

    So technically we can just use jcf parser for emitting parsed info collected by its parser.
    Now, I'd to ask how difficult it can be to implement such behaviour?
    Maybe you might want just another project for this, using jcf parser engine?

    P.S. At least one tester for this project you already have :)

    Best regards,
    Denis

     
    • Anthony Steele

      Anthony Steele - 2008-09-29

      I think it would be easily doable to fit in a parse tree visitor that records all user identifiers in the format described.
      I don't know if I will have time to do that though.

       
      • Denis Golovan

        Denis Golovan - 2008-09-29

        >I think it would be easily doable to fit in a parse tree visitor that records all >user identifiers in the format described.

        I'm glad to hear this :)

        >I don't know if I will have time to do that though.

        Ok, I see. Maybe you can pinpoint a place where it can be done?
        I could try to implement it myself, with your consultations of course.

        Best regards,
        Denis

         
        • Anthony Steele

          Anthony Steele - 2008-09-29

          Well, you will need a class that descends from TBaseTreeNodeVisitor.  Every process that inspects or changes the parse tree descends from this class.

          Override VisitSourceToken and inspect the tokens as they are fed to you. Look at the Source token's TokenType and WordType.

           
          • Denis Golovan

            Denis Golovan - 2008-09-30

            Thanks, Anthony.
            I'll try to implement it asap and contact you for further assistance.

            Best regards,
            Denis

             
            • Denis Golovan

              Denis Golovan - 2008-10-05

              Some questions already appeared. See developer's forum.

              Thanks.

               

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.