7 Replies Latest reply on May 29, 2006 10:16 AM by maxandersen

    HQLAnalyzer ?

    maxandersen


      I've been looking at the HQLAnalyzer in org.hibernate.netbeans.console.editor.hql.completion and it looks great and with all that code I would hate to repeat that in the eclipse editor.

      I've been wondering if it was feasible for me to migrate this code to something that is just dependent on the int token values and some Lexer interface that just give your nextToken(), characterPositiion and tokenlength ?

      This api could then be implemented by our netbeans syntax and eclipse scanner - allowing us to share this "hairy" completion logic.

      And we already have a good deal of unittests to verify it...what do you say ?

        • 1. Re: HQLAnalyzer ?
          leonceeo

          Max, it should be pretty straightforward..

          I just need the lexer interface which you've mentioned looking aprox. like below. A good deal of code for the lexer can be taken from HqlSyntax. At a later point maybe even HqlSyntax could reuse the same lexer....


          But for now, this is the minimal interface which the HqlAnalyzer needs:

          HqlLexer {
          int SELECT_ID; // Take them from HqlTokenContext
          int FROM_ID;
          .....
          int nextTokenId()
          int getTokenOffset()
          int getTokenLength();
          void load(String)
          }

          That's all. The harder part is understanding HqlAnalyzer I think ;)

          • 2. Re: HQLAnalyzer ?
            leonceeo

            BTW, we will need some commons module where to put that code. Most probably, I will reuse it as a library.

            • 3. Re: HQLAnalyzer ?
              maxandersen

              I were thinking of putting it in

              org.hibernate.tools.ide.completion (which would become part of hibernate-tools.jar)

              ...i'm looking into if we can/should use the hqllexer we have in the hibernate core.

              • 4. Re: HQLAnalyzer ?
                maxandersen

                leon, you said something about components not being properly completed....I can't seem to find a problem with those. Could you elaborate on it ?

                • 5. Re: HQLAnalyzer ?
                  leonceeo

                  sorry max, i'm in romania right and don't have my laptop with me, so i cannot reproduce it properly ;).

                  i remember that i had some problems with a collection of values (select organization join organization.members member where member.| => member attributes were not displayed).

                  hope that i remember correctly, and that was the problem

                  • 6. Re: HQLAnalyzer ?
                    maxandersen

                    it seems like there is an issue with this...so you remembered correctly ;)

                    • 7. Re: HQLAnalyzer ?
                      maxandersen

                      ...and it is now fixed ;)