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

Re: [jasspa] java indent and highligting

Expand Messages
  • Jon Green
    ... ... and, what is is supposed to look like? How should this indentation be performed? Are there any other problems with the indentation or is this the only
    Message 1 of 29 , Oct 4, 2006
    • 0 Attachment
      Bryan Schofield wrote:
      > It's a start but not complete... the indentation still can't handle annotations.
      >
      > Consider how ME indents the following contribed method:
      >
      > @Deprecated
      > @Test(expected=IllegalArgumentException.class)
      > public <T extends Object> T
      > ack(T aType,
      > Foo foo)
      > throws RuntimeException,
      > IllegalArgumentException {
      > return aType;
      > }
      >
      > A little work to be done still.
      >

      ... and, what is is supposed to look like?
      How should this indentation be performed?
      Are there any other problems with the indentation or is this the only issue?

      In order to fix this then we need examples of what is causing the
      problem (with as much surrounding context as possible) and the layout
      style that is required or expected i.e. how it is supposed to look. We
      only fix what we use or what is obvious but if this is not our primary
      file type then it only gets fixed when we are made aware of the problem
      through examples or when somebody else submits a solution to us.

      Thanks
      Jon.
    • Bryan Schofield
      Sorry, I should have been more clear... A little work to be done still... by me :) When I get it worked out, I ll submit a patch.
      Message 2 of 29 , Oct 4, 2006
      • 0 Attachment
        Sorry, I should have been more clear...

        A little work to be done still... by me :)

        When I get it worked out, I'll submit a patch.

        On 10/4/06, Jon Green <jnaught@...> wrote:
        > Bryan Schofield wrote:
        > > It's a start but not complete... the indentation still can't handle annotations.
        > >
        > > Consider how ME indents the following contribed method:
        > >
        > > @Deprecated
        > > @Test(expected=IllegalArgumentException.class)
        > > public <T extends Object> T
        > > ack(T aType,
        > > Foo foo)
        > > throws RuntimeException,
        > > IllegalArgumentException {
        > > return aType;
        > > }
        > >
        > > A little work to be done still.
        > >
        >
        > ... and, what is is supposed to look like?
        > How should this indentation be performed?
        > Are there any other problems with the indentation or is this the only issue?
        >
        > In order to fix this then we need examples of what is causing the
        > problem (with as much surrounding context as possible) and the layout
        > style that is required or expected i.e. how it is supposed to look. We
        > only fix what we use or what is obvious but if this is not our primary
        > file type then it only gets fixed when we are made aware of the problem
        > through examples or when somebody else submits a solution to us.
        >
        > Thanks
        > Jon.
        >
        >
        >
        >
        > __________________________________________________________________________
        >
        > This is an unmoderated list. JASSPA is not responsible for the content of
        > any material posted to this list.
        >
        > To unsubscribe, send a mail message to
        >
        > mailto:jasspa-unsubscribe@yahoogroups.com
        >
        > or visit http://groups.yahoo.com/group/jasspa and
        > modify your account settings manually.
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
      • jon@jasspa.com
        ... I like this answer, that is good. Be aware we are very close to a final release cut which is likely to be complete in the next few days. There is a little
        Message 3 of 29 , Oct 4, 2006
        • 0 Attachment
          > Sorry, I should have been more clear...
          >
          > A little work to be done still... by me :)
          >
          > When I get it worked out, I'll submit a patch.
          >

          I like this answer, that is good.

          Be aware we are very close to a final release cut which is likely to be
          complete in the next few days. There is a little more documentation to be
          fixed and then we will be finished for 2006 - the 2006 binraries have
          already been finalised and checked. Obviously we will issue post release
          patches if necessary - macros are not a problem but any source code
          changes are.

          Thanks
          Jon.
        • Bryan Schofield
          Yowza.... this was rather complicated, but I have an indentation scheme for java that seems to handle most things I could throw at it with the exceptions I
          Message 4 of 29 , Oct 4, 2006
          • 0 Attachment
            Yowza.... this was rather complicated, but I have an indentation
            scheme for java that seems to handle most things I could throw at it
            with the exceptions I noted. Below is my myjava.emf. If you find
            something that this doesn't work well with, please let me know and I
            will try to figure it out.
            Cheers
            -- bryan


            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            ;
            ; Author : $Author$
            ; Created By : Bryan Schofield
            ; Created : Thu Sep 8 23:59:49 2005
            ; Last Modified : <061004.1659>
            ;
            ; Description
            ;
            ; Notes
            ;
            ; History
            ;
            ; Copyright (c) 2005 company.
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            define-macro my-fhook-java
            ; override the default c-mode indentation scheme to use the revamped
            ; "simple" java indent scheme
            set-variable $buffer-indent .indent.java
            !emacro

            ; tweak standard c-mode indent to look a little better
            ; ... but this doesn't handle some things very well, like annotations
            set-variable .hilight.real-java &add .hilight.java 1
            indent .hilight.real-java "s" t
            indent .hilight.real-java "c" t
            indent .hilight.real-java "x" t
            indent .hilight.real-java "b" 0
            indent .hilight.real-java "e" t
            indent .hilight.real-java "w" 0
            indent .hilight.real-java "a" -t
            indent .hilight.real-java "m" -1
            indent .hilight.real-java "u" " * "

            ; Additional highlighting
            ; annotations
            hilight .hilight.java 4 "@" "\\}\\W" "" .scheme.prepro


            ; Override the simple java indentation scheme to handle more situations
            ; we'll also define a "java comment" indentation scheme, this will help
            ; with comment content from intefering with the code indentation.
            ;
            ; Indentation Limitation
            ; 1. Braceless conditionals are not handled. This is considered bad style
            ; by many, so use braces. Change
            ; if (true)
            ; foo();
            ; To
            ; if (true) {
            ; foo();
            ; }
            ; 2. Continued lines are partially handled. Only lines that begin with
            ; "." and basic math operators except * which inteferes with comments
            ; are understood to be part of the previous line. For example:
            ; int x = foo
            ; .getThing()
            ; .getX()
            ; + 4;
            ;
            set-variable .indent.java-comm &pinc .hilight.next 1
            set-variable .indent.javaT &pinc .hilight.next 1

            0 indent .indent.java-comm 1 20
            0 indent .indent.java-enum 1 20
            0 indent .indent.javaT 1 500
            0 indent .indent.java 2 20 .indent.javaT

            ; standard braces
            indent .indent.java n "{" t
            indent .indent.java o "}" -t
            indent .indent.java n "(" 3/2t
            indent .indent.java o ")" -3/2t

            ; line continuation
            indent .indent.java s "^\\s*[\\.\\+-/%][^\\*/]" t

            ; switch to comment indentation mode
            indent .indent.javaT t "/\\*" .indent.java-comm
            indent .indent.java x "/\\*" 1 .indent.java-comm
            indent .indent.java-comm x "\\*/" -1 0
            indent .indent.javaT t "\\*/" 0
            indent .indent.java o "\\*/" -1

            ; ignore line comments
            indent .indent.java i "//"

            ; ignore anotations that are on a line by themselves
            indent .indent.java i "^\\s*@\\w+$"
            indent .indent.java i "^\\s*@\\w+\\s*(.+)$"

            ; fix switch/case statements
            indent .indent.java s "^\\s*case\\s[^:]+:" -t
            indent .indent.java s "^\\s*default\\s*:" -t


            On 10/4/06, jon@... <jon@...> wrote:
            > > Sorry, I should have been more clear...
            > >
            > > A little work to be done still... by me :)
            > >
            > > When I get it worked out, I'll submit a patch.
            > >
            >
            > I like this answer, that is good.
            >
            > Be aware we are very close to a final release cut which is likely to be
            > complete in the next few days. There is a little more documentation to be
            > fixed and then we will be finished for 2006 - the 2006 binraries have
            > already been finalised and checked. Obviously we will issue post release
            > patches if necessary - macros are not a problem but any source code
            > changes are.
            >
            > Thanks
            > Jon.
            >
            >
            >
            > __________________________________________________________________________
            >
            > This is an unmoderated list. JASSPA is not responsible for the content of
            > any material posted to this list.
            >
            > To unsubscribe, send a mail message to
            >
            > mailto:jasspa-unsubscribe@yahoogroups.com
            >
            > or visit http://groups.yahoo.com/group/jasspa and
            > modify your account settings manually.
            >
            >
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
            >
            >
            >
            >
            >
          • Bryan Schofield
            crap... I pasted in a line accidentally... delete the following: 0 indent .indent.java-enum 1 20
            Message 5 of 29 , Oct 4, 2006
            • 0 Attachment
              crap... I pasted in a line accidentally...
              delete the following:

              0 indent .indent.java-enum 1 20
            • Jon Green
              ... That was quick! - Thanks Bryan Jon.
              Message 6 of 29 , Oct 4, 2006
              • 0 Attachment
                Bryan Schofield wrote:
                > crap... I pasted in a line accidentally...
                > delete the following:
                >
                > 0 indent .indent.java-enum 1 20
                >

                That was quick! - Thanks Bryan
                Jon.
              • Jon Green
                ... Would you want to add this as well? Jon. ; fix throws indent at start of line, typically a statement ; continuation. indent .indent.java s ^ s*throws s
                Message 7 of 29 , Oct 4, 2006
                • 0 Attachment
                  Bryan Schofield wrote:
                  > crap... I pasted in a line accidentally...
                  > delete the following:
                  >
                  > 0 indent .indent.java-enum 1 20
                  >

                  Would you want to add this as well?
                  Jon.

                  ; fix throws indent at start of line, typically a statement
                  ; continuation.
                  indent .indent.java s "^\\s*throws\\s" t
                • Jon Green
                  ... A few more to add to that maybe? ; fix throws/implements/extends indent at start of line, typically a ; statement continuation. indent .indent.java s
                  Message 8 of 29 , Oct 4, 2006
                  • 0 Attachment
                    Jon Green wrote:
                    > Bryan Schofield wrote:
                    >> crap... I pasted in a line accidentally...
                    >> delete the following:
                    >>
                    >> 0 indent .indent.java-enum 1 20
                    >>
                    >
                    > Would you want to add this as well?
                    > Jon.
                    >
                    > ; fix throws indent at start of line, typically a statement
                    > ; continuation.
                    > indent .indent.java s "^\\s*throws\\s" t
                    >

                    A few more to add to that maybe?

                    ; fix throws/implements/extends indent at start of line, typically a
                    ; statement continuation.
                    indent .indent.java s "^\\s*throws\\s" t
                    indent .indent.java s "^\\s*implements\\s" t
                    indent .indent.java s "^\\s*extends\\s" t
                  • Bryan Schofield
                    I took a look at the java hilighting. It was missing some java keywords and it had a bunch of c keywords that don t really apply. Below is a suggestion for
                    Message 9 of 29 , Oct 5, 2006
                    • 0 Attachment
                      I took a look at the java hilighting. It was missing some java
                      keywords and it had a bunch of c keywords that don't really apply.
                      Below is a suggestion for hilighting. In hkjava.emf if you replace
                      from around line 60
                      hilight .hilight.java 0x12 "import" .scheme.prepro
                      to around line 131
                      hilight .hilight.java 1 "virtual" .scheme.type



                      ; annotations
                      hilight .hilight.java 4 "@" "\\}\\W" "" .scheme.prepro
                      ; constants: A_CONSTANT_VARAIBLE
                      hilight .hilight.java 1 "[A-Z_]+" .scheme.constant
                      ; class names: AJavaClassName
                      hilight .hilight.java 1 "[A-Z]+[a-z]+\\w*" .scheme.type

                      ; Java keywords
                      ; The following conventions are used:
                      ; .scheme.type primitive types
                      ; .scheme.operator flow control keywords
                      ; .scheme.prepro package declaration and imports
                      ; .scheme.error reserved keywords that have not been implemented
                      ; .scheme.keyword other java keywords that are not covered above
                      hilight .hilight.java 1 "abstract" .scheme.keyword
                      hilight .hilight.java 1 "assert" .scheme.keyword
                      hilight .hilight.java 1 "boolean" .scheme.type
                      hilight .hilight.java 1 "break" .scheme.operator
                      hilight .hilight.java 1 "byte" .scheme.type
                      hilight .hilight.java 1 "case" .scheme.operator
                      hilight .hilight.java 1 "catch" .scheme.operator
                      hilight .hilight.java 1 "char" .scheme.type
                      hilight .hilight.java 1 "class" .scheme.keyword
                      hilight .hilight.java 1 "const" .scheme.error ; reserved but
                      not implemented in java
                      hilight .hilight.java 1 "continue" .scheme.operator
                      hilight .hilight.java 1 "default" .scheme.operator
                      hilight .hilight.java 1 "do" .scheme.operator
                      hilight .hilight.java 1 "double" .scheme.type
                      hilight .hilight.java 1 "else" .scheme.operator
                      hilight .hilight.java 1 "enum" .scheme.keyword
                      hilight .hilight.java 1 "extends" .scheme.keyword
                      hilight .hilight.java 1 "false" .scheme.constant
                      hilight .hilight.java 1 "final" .scheme.keyword
                      hilight .hilight.java 1 "finally" .scheme.operator
                      hilight .hilight.java 1 "float" .scheme.type
                      hilight .hilight.java 1 "for" .scheme.operator
                      hilight .hilight.java 1 "goto" .scheme.error ; reserved but
                      not implemented
                      hilight .hilight.java 1 "if" .scheme.operator
                      hilight .hilight.java 1 "implements" .scheme.keyword
                      hilight .hilight.java 0x12 "import" .scheme.prepro
                      hilight .hilight.java 1 "instanceof" .scheme.keyword
                      hilight .hilight.java 1 "int" .scheme.type
                      hilight .hilight.java 1 "interface" .scheme.keyword
                      hilight .hilight.java 1 "long" .scheme.type
                      hilight .hilight.java 1 "native" .scheme.keyword
                      hilight .hilight.java 1 "new" .scheme.keyword
                      hilight .hilight.java 1 "null" .scheme.constant
                      hilight .hilight.java 0x12 "package" .scheme.prepro
                      hilight .hilight.java 1 "private" .scheme.keyword
                      hilight .hilight.java 1 "protected" .scheme.keyword
                      hilight .hilight.java 1 "public" .scheme.keyword
                      hilight .hilight.java 1 "return" .scheme.keyword
                      hilight .hilight.java 1 "short" .scheme.type
                      hilight .hilight.java 1 "static" .scheme.keyword
                      hilight .hilight.java 1 "strictfp" .scheme.keyword
                      hilight .hilight.java 1 "super" .scheme.keyword
                      hilight .hilight.java 1 "switch" .scheme.operator
                      hilight .hilight.java 1 "synchronized" .scheme.keyword
                      hilight .hilight.java 1 "this" .scheme.keyword
                      hilight .hilight.java 1 "throw" .scheme.keyword
                      hilight .hilight.java 1 "throws" .scheme.keyword
                      hilight .hilight.java 1 "transient" .scheme.keyword
                      hilight .hilight.java 1 "true" .scheme.constant
                      hilight .hilight.java 1 "try" .scheme.operator
                      hilight .hilight.java 1 "void" .scheme.keyword
                      hilight .hilight.java 1 "volatile" .scheme.keyword
                      hilight .hilight.java 1 "while " .scheme.operator
                    • Jon Green
                      ... Thanks Bryan, I have re-worked hkjava.emf with all of the suggestions received to date. If you install this then delete the myjava.emf file (or rename to
                      Message 10 of 29 , Oct 5, 2006
                      • 0 Attachment
                        Bryan Schofield wrote:
                        > I took a look at the java hilighting. It was missing some java
                        > keywords and it had a bunch of c keywords that don't really apply.
                        > Below is a suggestion for hilighting. In hkjava.emf if you replace

                        Thanks Bryan,

                        I have re-worked hkjava.emf with all of the suggestions received to
                        date. If you install this then delete the myjava.emf file (or rename to
                        myjava-1.emf so that it is not picked up) and then execute the file (or
                        restart the editor).

                        This includes the token highlighting as suggested and the indent as
                        suggested. The language template includes the new indent method and the
                        existing 'C' method. The indent mode may be changed with
                        esc-x major-mode-setup.

                        I am proposing that this gets shipped with the next release. Is this OK
                        with everybody? Does this solve the Java problems that people are
                        experiencing?

                        Thanks
                        Jon.
                      • Thomas Hundt
                        Hold it. This release is unusable. Basic functionality has been broken: private static final Logger LOG = Logger.getLogger(PeakHourReportRunner.class); now
                        Message 11 of 29 , Oct 5, 2006
                        • 0 Attachment
                          Hold it. This release is unusable.

                          Basic functionality has been broken:

                          private static final Logger LOG =
                          Logger.getLogger(PeakHourReportRunner.class);

                          now comes out as

                          private static final Logger LOG =
                          Logger.getLogger(PeakHourReportRunner.class);

                          and if-else statements come out as

                          if (something)
                          do_something();
                          else
                          do_something_else();

                          (Bryan feels the whole world should have to put in braces, but --
                          idealism aside -- I know I'm going to be editing plenty of peoples' code
                          without all the braces where he would like them. It IS a legitimate
                          Java feature not to have to put in extra braces where they aren't
                          necessary, and having the editor properly indent them will allow one to
                          find out where one screwed it up, right? I mean that is why we are
                          doing this, yes?)

                          I'm rather have it work the way it used to, minus any of the new
                          "improvements", if basic functionality like this goes out the window.

                          Sorry, Jon. It was looking great there for a while, but this is too much.

                          Regards,

                          -Th


                          Jon Green wrote:
                          > Bryan Schofield wrote:
                          >> I took a look at the java hilighting. It was missing some java
                          >> keywords and it had a bunch of c keywords that don't really apply.
                          >> Below is a suggestion for hilighting. In hkjava.emf if you replace
                          >
                          > Thanks Bryan,
                          >
                          > I have re-worked hkjava.emf with all of the suggestions received to
                          > date. If you install this then delete the myjava.emf file (or rename to
                          > myjava-1.emf so that it is not picked up) and then execute the file (or
                          > restart the editor).
                          >
                          > This includes the token highlighting as suggested and the indent as
                          > suggested. The language template includes the new indent method and the
                          > existing 'C' method. The indent mode may be changed with
                          > esc-x major-mode-setup.
                          >
                          > I am proposing that this gets shipped with the next release. Is this OK
                          > with everybody? Does this solve the Java problems that people are
                          > experiencing?
                          >
                          > Thanks
                          > Jon.


                          --
                          Thomas Hundt <tom@...> +1-415-867-6698
                        • Jon Green
                          ... Hi Thomas, Thanks for the info and knee jerk reaction, just what I was looking for. M-x major-mode-setup will allow you to turn on C indentation again
                          Message 12 of 29 , Oct 5, 2006
                          • 0 Attachment
                            Thomas Hundt wrote:
                            > Hold it. This release is unusable.
                            >
                            > Basic functionality has been broken:
                            >
                            > private static final Logger LOG =
                            > Logger.getLogger(PeakHourReportRunner.class);
                            >
                            > now comes out as
                            >
                            > private static final Logger LOG =
                            > Logger.getLogger(PeakHourReportRunner.class);
                            >
                            > and if-else statements come out as
                            >
                            > if (something)
                            > do_something();
                            > else
                            > do_something_else();
                            >
                            > (Bryan feels the whole world should have to put in braces, but --
                            > idealism aside -- I know I'm going to be editing plenty of peoples' code
                            > without all the braces where he would like them. It IS a legitimate
                            > Java feature not to have to put in extra braces where they aren't
                            > necessary, and having the editor properly indent them will allow one to
                            > find out where one screwed it up, right? I mean that is why we are
                            > doing this, yes?)
                            >
                            > I'm rather have it work the way it used to, minus any of the new
                            > "improvements", if basic functionality like this goes out the window.
                            >
                            > Sorry, Jon. It was looking great there for a while, but this is too much.
                            >
                            > Regards,
                            >
                            > -Th
                            >

                            Hi Thomas,

                            Thanks for the info and knee jerk reaction, just what I was looking for.

                            M-x major-mode-setup

                            will allow you to turn on 'C' indentation again this should restore what
                            you had before. I'll make C mode the default and then leave the other
                            method in for the 'Java pure' people.

                            Regards
                            Jon.
                          • Jon Green
                            ... OK, here is the next one! This time the default mode of operation is the built in indentation with the bracket alignment disabled. Note that your history
                            Message 13 of 29 , Oct 5, 2006
                            • 0 Attachment
                              Thomas Hundt wrote:
                              > Hold it. This release is unusable.
                              >
                              > Basic functionality has been broken:
                              >
                              > private static final Logger LOG =
                              > Logger.getLogger(PeakHourReportRunner.class);
                              >
                              > now comes out as
                              >
                              > private static final Logger LOG =
                              > Logger.getLogger(PeakHourReportRunner.class);
                              >
                              > and if-else statements come out as
                              >
                              > if (something)
                              > do_something();
                              > else
                              > do_something_else();
                              >
                              > (Bryan feels the whole world should have to put in braces, but --
                              > idealism aside -- I know I'm going to be editing plenty of peoples' code
                              > without all the braces where he would like them. It IS a legitimate
                              > Java feature not to have to put in extra braces where they aren't
                              > necessary, and having the editor properly indent them will allow one to
                              > find out where one screwed it up, right? I mean that is why we are
                              > doing this, yes?)
                              >
                              > I'm rather have it work the way it used to, minus any of the new
                              > "improvements", if basic functionality like this goes out the window.
                              >
                              > Sorry, Jon. It was looking great there for a while, but this is too much.
                              >
                              > Regards,
                              >
                              > -Th
                              >

                              OK, here is the next one!

                              This time the default mode of operation is the built in indentation with
                              the bracket alignment disabled.

                              Note that your history will likely be retained so you will have to
                              reconfigure the major mode to return to some default using

                              M-x major-mode-setup

                              The defaults are:

                              Brace Hilighting:OFF
                              Enable Bracket Alignment:OFF (Enables old brace alignment)
                              Alternative Indent Mode:OFF (Pure Java mode)

                              I understand that neither method is ideal. With the 'C' type indent then
                              there are issues with "@" statements. These are not present in the
                              Alternative indent - but this then needs to be fully bracketed.

                              Regards
                              Jon.
                            • Bryan Schofield
                              unfortunately, the indent syntax isn t powerful enough to describe the situtations needed. For example... if (true) continuedStatement(); if (true) {
                              Message 14 of 29 , Oct 6, 2006
                              • 0 Attachment
                                unfortunately, the indent syntax isn't powerful enough to describe the
                                situtations needed.

                                For example...

                                if (true)
                                continuedStatement();

                                if (true) {
                                indentedStatement();
                                }

                                if (true)
                                {
                                indentedStatement();
                                }

                                I do not know how to tell indent that the next line is a continuation,
                                unless it is a "{". I can write indent rules to handle the first 2 or
                                the last 2 but not all 3 at the same time.


                                indent .indent.java c "=\\s*$" t

                                handles:

                                private static final Logger LOG =
                                Logger.getLogger(PeakHourReportRunner.class);
                              • jon@jasspa.com
                                ... Hi Bryan, We are aware of the short comings of the indentation. We have yet to come up with a better way of describing the indentation in terms of its
                                Message 15 of 29 , Oct 6, 2006
                                • 0 Attachment
                                  > unfortunately, the indent syntax isn't powerful enough to describe the
                                  > situtations needed.
                                  >
                                  > For example...
                                  >
                                  > if (true)
                                  > continuedStatement();
                                  >
                                  > if (true) {
                                  > indentedStatement();
                                  > }
                                  >
                                  > if (true)
                                  > {
                                  > indentedStatement();
                                  > }
                                  >
                                  > I do not know how to tell indent that the next line is a continuation,
                                  > unless it is a "{". I can write indent rules to handle the first 2 or
                                  > the last 2 but not all 3 at the same time.
                                  >
                                  >
                                  > indent .indent.java c "=\\s*$" t
                                  >
                                  > handles:
                                  >
                                  > private static final Logger LOG =
                                  > Logger.getLogger(PeakHourReportRunner.class);
                                  >

                                  Hi Bryan,

                                  We are aware of the short comings of the indentation. We have yet to come
                                  up with a better way of describing the indentation in terms of its
                                  grammer. At the moment we seem to do reasonably well with very little
                                  knowledge of the language in the template. All of the items that you have
                                  raised above require a little more information about the syntax in order
                                  to make them work properly. This is actually why C is burnt in because it
                                  is easier to handle it like this than coming up with all of the correct
                                  rules that are programmable.

                                  We have considered how we might express this, but so far have not come up
                                  with a sufficiently good way of minimally and generically describing the
                                  syntax of the target language for indentation.

                                  If anybody has any thoughts on how we can do this I would like to hear
                                  them because it is not trivial.

                                  Anybody looking for a Comp. Sci. project at University????

                                  Regards
                                  Jon.
                                • Bryan Schofield
                                  I see I missed the official release... but the java indentation needs a little something to fix handling of Strings indent .indent.java e indent
                                  Message 16 of 29 , Oct 9, 2006
                                  • 0 Attachment
                                    I see I missed the official release... but the java indentation needs
                                    a little something to fix handling of Strings

                                    indent .indent.java e "\"" "\"" "\\"
                                    indent .indent.java e "\'" "\'" "\\"



                                    On 10/6/06, jon@... <jon@...> wrote:
                                    > > unfortunately, the indent syntax isn't powerful enough to describe the
                                    > > situtations needed.
                                    > >
                                    > > For example...
                                    > >
                                    > > if (true)
                                    > > continuedStatement();
                                    > >
                                    > > if (true) {
                                    > > indentedStatement();
                                    > > }
                                    > >
                                    > > if (true)
                                    > > {
                                    > > indentedStatement();
                                    > > }
                                    > >
                                    > > I do not know how to tell indent that the next line is a continuation,
                                    > > unless it is a "{". I can write indent rules to handle the first 2 or
                                    > > the last 2 but not all 3 at the same time.
                                    > >
                                    > >
                                    > > indent .indent.java c "=\\s*$" t
                                    > >
                                    > > handles:
                                    > >
                                    > > private static final Logger LOG =
                                    > > Logger.getLogger(PeakHourReportRunner.class);
                                    > >
                                    >
                                    > Hi Bryan,
                                    >
                                    > We are aware of the short comings of the indentation. We have yet to come
                                    > up with a better way of describing the indentation in terms of its
                                    > grammer. At the moment we seem to do reasonably well with very little
                                    > knowledge of the language in the template. All of the items that you have
                                    > raised above require a little more information about the syntax in order
                                    > to make them work properly. This is actually why C is burnt in because it
                                    > is easier to handle it like this than coming up with all of the correct
                                    > rules that are programmable.
                                    >
                                    > We have considered how we might express this, but so far have not come up
                                    > with a sufficiently good way of minimally and generically describing the
                                    > syntax of the target language for indentation.
                                    >
                                    > If anybody has any thoughts on how we can do this I would like to hear
                                    > them because it is not trivial.
                                    >
                                    > Anybody looking for a Comp. Sci. project at University????
                                    >
                                    > Regards
                                    > Jon.
                                    >
                                    >
                                    >
                                    > __________________________________________________________________________
                                    >
                                    > This is an unmoderated list. JASSPA is not responsible for the content of
                                    > any material posted to this list.
                                    >
                                    > To unsubscribe, send a mail message to
                                    >
                                    > mailto:jasspa-unsubscribe@yahoogroups.com
                                    >
                                    > or visit http://groups.yahoo.com/group/jasspa and
                                    > modify your account settings manually.
                                    >
                                    >
                                    >
                                    > Yahoo! Groups Links
                                    >
                                    >
                                    >
                                    >
                                    >
                                    >
                                    >
                                    >
                                    >
                                    >
                                  • Bryan Schofield
                                    Perhaps you add in a hook to allow a function to specified as the last argument in an indent rule. This function would return an indicator on whether the
                                    Message 17 of 29 , Oct 9, 2006
                                    • 0 Attachment
                                      Perhaps you add in a hook to allow a function to specified as the last
                                      argument in an indent rule. This function would return an indicator on
                                      whether the indent rule should actually be applied. The function could
                                      be passed the line number and do whatever language-specific analysis
                                      is required.

                                      indent .indent.java c "if.*)\\s*$" t java-check-if

                                      define-macro java-check-if
                                      ; @1 = line number
                                      ; ...
                                      set-variable $result true
                                      !emacro
                                    • jon@jasspa.com
                                      ... OK Thanks, As it turns out it looks like we need a patch to jst.etf so I can slip this one in as well as they are both macro problems. Fortunately there
                                      Message 18 of 29 , Oct 9, 2006
                                      • 0 Attachment
                                        > I see I missed the official release... but the java indentation needs
                                        > a little something to fix handling of Strings
                                        >
                                        > indent .indent.java e "\"" "\"" "\\"
                                        > indent .indent.java e "\'" "\'" "\\"
                                        >

                                        OK Thanks,

                                        As it turns out it looks like we need a patch to jst.etf so I can slip
                                        this one in as well as they are both macro problems. Fortunately there are
                                        no binary problems at the moment, but does mean that some of the packages
                                        have to be re-built.

                                        This is why one release per year is more than enough for us! As usual it
                                        does look like there are some more sweeping changes in the pipeline that
                                        will come fairly soon after the release on the development side however we
                                        cannot afford to delay this release any longer because of the amount of
                                        time it takes us to prove it is stable.

                                        As an aside: In building the 2006 release I was forced back to 20050505 on
                                        some platforms where I had not installed 2006 yet and was surprised by
                                        some of the features that were missing (e.g. being able to delete
                                        directories in the file browser, infact all of the file browser controls).
                                        Obviously most users will not be aware of this but we have been using
                                        these internally for the last year and miss them when they are not there -
                                        hence we really cannot delay this release any more.

                                        Regards
                                        Jon.
                                      • jon@jasspa.com
                                        ... I think you are right. I did try and prototype this type of schema about a year ago and got into a real mess because of problems with the macro context
                                        Message 19 of 29 , Oct 9, 2006
                                        • 0 Attachment
                                          > Perhaps you add in a hook to allow a function to specified as the last
                                          > argument in an indent rule. This function would return an indicator on
                                          > whether the indent rule should actually be applied. The function could
                                          > be passed the line number and do whatever language-specific analysis
                                          > is required.
                                          >
                                          > indent .indent.java c "if.*)\\s*$" t java-check-if
                                          >
                                          > define-macro java-check-if
                                          > ; @1 = line number
                                          > ; ...
                                          > set-variable $result true
                                          > !emacro

                                          I think you are right.

                                          I did try and prototype this type of schema about a year ago and got into
                                          a real mess because of problems with the macro context (i.e. you are in a
                                          macro that then calls back into native and then want to come out and run a
                                          macro again) - anyway I ran out of time doing some other stuff. I do
                                          believe that this is the way to go but have not found enough time to
                                          follow it through to a conclusion and get it working.

                                          The only problem with this type of scheme is if you mess up in your macro
                                          the editor will die a horrible death - error recovery is likely to be
                                          difficult.

                                          Jon.
                                        Your message has been successfully submitted and would be delivered to recipients shortly.