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

Re: More indent questions

Expand Messages
  • Jeremy Cowgar
    No input on this? Just to make sure formatting was correct, period = space say-hello .... Hello println say-hello-10-times ....10 times ........say-hello
    Message 1 of 11 , Apr 20, 2010
    • 0 Attachment
      No input on this? Just to make sure formatting was correct, period = space

      say-hello
      ...."Hello" println

      say-hello-10-times
      ....10 times
      ........say-hello
      ....next

      main
      ....say-hello-10-times

      I can make the things such as 10 times ... say-hello indent properly,
      but how do I make things such as say-hello, then the next line (and all
      subsequent lines) be indented?

      Jeremy

      On 4/12/2010 1:34 PM, Jeremy Cowgar wrote:
      > I am trying to write a mode for the Josl programming language,
      > http://www.josl.org
      >
      > I can get everything to indent, i.e.
      >
      > is-person? if
      > "Hello, Person!" println
      > end
      >
      > except for the new words...
      >
      > say-hello
      > "Hello" println
      >
      > main
      > say-hello
      > say-hello
      > 10 times
      > say-hello
      > next
      >
      > So, if a word starts in column 1, then it's a new top level word. That
      > top level word's definition continues until a new top level word
      > begins. Now, in practical use, you separate two top level words by two
      > blank lines, so that could be used to detect the end of a word for
      > indentation.
      >
      > Does anyone have an idea on how this can be accomplished?
      >
      > Jeremy
      >
    • Jon Green
      ... Hi Jeremy, Sorry I have not had a lot of time and to help you then we have to actually write a complete template and find some examples. After looking at
      Message 2 of 11 , Apr 20, 2010
      • 0 Attachment
        Jeremy Cowgar wrote:
        > No input on this? Just to make sure formatting was correct, period = space
        >
        > say-hello
        > ...."Hello" println
        >
        > say-hello-10-times
        > ....10 times
        > ........say-hello
        > ....next
        >
        > main
        > ....say-hello-10-times
        >
        > I can make the things such as 10 times ... say-hello indent properly,
        > but how do I make things such as say-hello, then the next line (and all
        > subsequent lines) be indented?
        >
        > Jeremy

        Hi Jeremy,

        Sorry I have not had a lot of time and to help you then we have to actually
        write a complete template and find some examples.

        After looking at the examples on the web page then I am struggling because
        there is no clear anchor in the syntax to determine when the indent is supposed
        to end.

        Anyway I had a play around and have so far come up with nothing that works
        every case of your examples and the document on josl. When I look at your
        example below I am wondering how you got the indent working at all?

        My implementation is so far this:

        !if &sin "d" .fhook-josl.setup
        0 indent .hilight.josl 0 10
        indent .hilight.josl u "^\\w+" -t t
        indent .hilight.josl n "if" t
        ; indent .hilight.josl n "is" t
        ; indent .hilight.josl n "do" t
        indent .hilight.josl s "else" -t
        indent .hilight.josl o "end" -t
        ; indent .hilight.josl o "until" -t
        ; indent .hilight.josl n "begin" t
        indent .hilight.josl e "\"" "\"" "\\"
        indent .hilight.josl i "#"
        !endif

        And I am struggling.


        Regards
        Jon.



        >
        > On 4/12/2010 1:34 PM, Jeremy Cowgar wrote:
        >> I am trying to write a mode for the Josl programming language,
        >> http://www.josl.org
        >>
        >> I can get everything to indent, i.e.
        >>
        >> is-person? if
        >> "Hello, Person!" println
        >> end
        >>
        >> except for the new words...
        >>
        >> say-hello
        >> "Hello" println
        >>
        >> main
        >> say-hello
        >> say-hello
        >> 10 times
        >> say-hello
        >> next
        >>
        >> So, if a word starts in column 1, then it's a new top level word. That
        >> top level word's definition continues until a new top level word
        >> begins. Now, in practical use, you separate two top level words by two
        >> blank lines, so that could be used to detect the end of a word for
        >> indentation.
        >>
        >> Does anyone have an idea on how this can be accomplished?
        >>
        >> Jeremy
        >>
        >
        >
        >
        > ------------------------------------
        >
        > __________________________________________________________________________
        >
        > This is an unmoderated list, but new members are moderated to ensure that there are no spam users. JASSPA is not responsible for the content of
        > any material posted to this list.
        >
        > To un-subscribe, 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 Green
        ... Actually this line works better for keeping the first 0 column line indent. You must start in the margin but once it is there then it sticks irrespective
        Message 3 of 11 , Apr 20, 2010
        • 0 Attachment
          Jon Green wrote:
          > Jeremy Cowgar wrote:
          >> No input on this? Just to make sure formatting was correct, period = space
          >>
          >> say-hello
          >> ...."Hello" println
          >>
          >> say-hello-10-times
          >> ....10 times
          >> ........say-hello
          >> ....next
          >>
          >> main
          >> ....say-hello-10-times
          >>
          >> I can make the things such as 10 times ... say-hello indent properly,
          >> but how do I make things such as say-hello, then the next line (and all
          >> subsequent lines) be indented?
          >>
          >> Jeremy
          >
          > Hi Jeremy,
          >
          > Sorry I have not had a lot of time and to help you then we have to actually
          > write a complete template and find some examples.
          >
          > After looking at the examples on the web page then I am struggling because
          > there is no clear anchor in the syntax to determine when the indent is supposed
          > to end.
          >
          > Anyway I had a play around and have so far come up with nothing that works
          > every case of your examples and the document on josl. When I look at your
          > example below I am wondering how you got the indent working at all?
          >
          > My implementation is so far this:
          >
          > !if &sin "d" .fhook-josl.setup
          > 0 indent .hilight.josl 0 10
          > indent .hilight.josl u "^\\w+" -t t
          > indent .hilight.josl n "if" t
          > ; indent .hilight.josl n "is" t
          > ; indent .hilight.josl n "do" t
          > indent .hilight.josl s "else" -t
          > indent .hilight.josl o "end" -t
          > ; indent .hilight.josl o "until" -t
          > ; indent .hilight.josl n "begin" t
          > indent .hilight.josl e "\"" "\"" "\\"
          > indent .hilight.josl i "#"
          > !endif
          >
          > And I am struggling.
          >
          >
          > Regards
          > Jon.
          >


          Actually this line works better for keeping the first 0 column line indent. You
          must start in the margin but once it is there then it sticks irrespective of
          the indent in the previous block (assuming it is not more than 5 - could put 9
          here).

          indent .hilight.josl u "^\\w+" -5t t

          Noted for the following:

          is-person? if
          "Hello, Person!" println
          end

          Then I think the following is more correct because the 'if' causes another
          indent and the 'end' is indented in the correct place.

          is-person? if
          "Hello, Person!" println
          end

          except for the new words...

          say-hello
          "Hello" println


          Regards
          Jon.
        • Jeremy Cowgar
          Jon, I am leaving for the evening but will look at the code in tonight. I did not intend on anyone having to write the indentation themselves, I was simply
          Message 4 of 11 , Apr 20, 2010
          • 0 Attachment
            Jon,

            I am leaving for the evening but will look at the code in tonight. I did not intend on anyone having to write the indentation themselves, I was simply looking for guidance :-)...

            As for the rule... The rule for Josl is that a new word begins when a non-space/non-comment character is in column 1. Josl has very minimal syntax requirements by design. The words (function in other languages) continues until the next one begins. So...

            hello-world 10 times
            ........"Hello" println
            ....next

            goodbye-word 10 times
            ........"Hello" println
            ....next

            main hello-world
            ....goodbye-world

            That defines 3 words, the "main" word being the entry point. In Josl, the only separator is a space. There is a special syntax for strings, "... content ... ". Other than that, anything is valid in a word name, for example:

            [10-{times},do-a()] 10 times a next

            defines a new word that is perfectly valid and would be called as "[10-{times},do-a()]". I understand this complicates the indentation in any editor. I am thankful that you wrote some code but did not mean to place that burden on you.

            Thanks, will get back with you later this evening.

            Jeremy

            On 4/20/2010 4:13 PM, Jon Green wrote:
             

            Jon Green wrote:
            > Jeremy Cowgar wrote:
            >> No input on this? Just to make sure formatting was correct, period = space
            >>
            >> say-hello
            >> ...."Hello" println
            >>
            >> say-hello-10- times
            >> ....10 times
            >> ........say- hello
            >> ....next
            >>
            >> main
            >> ....say-hello- 10-times
            >>
            >> I can make the things such as 10 times ... say-hello indent properly,
            >> but how do I make things such as say-hello, then the next line (and all
            >> subsequent lines) be indented?
            >>
            >> Jeremy
            >
            > Hi Jeremy,
            >
            > Sorry I have not had a lot of time and to help you then we have to actually
            > write a complete template and find some examples.
            >
            > After looking at the examples on the web page then I am struggling because
            > there is no clear anchor in the syntax to determine when the indent is supposed
            > to end.
            >
            > Anyway I had a play around and have so far come up with nothing that works
            > every case of your examples and the document on josl. When I look at your
            > example below I am wondering how you got the indent working at all?
            >
            > My implementation is so far this:
            >
            > !if &sin "d" .fhook-josl. setup
            > 0 indent .hilight.josl 0 10
            > indent .hilight.josl u "^\\w+" -t t
            > indent .hilight.josl n "if" t
            > ; indent .hilight.josl n "is" t
            > ; indent .hilight.josl n "do" t
            > indent .hilight.josl s "else" -t
            > indent .hilight.josl o "end" -t
            > ; indent .hilight.josl o "until" -t
            > ; indent .hilight.josl n "begin" t
            > indent .hilight.josl e "\"" "\"" "\\"
            > indent .hilight.josl i "#"
            > !endif
            >
            > And I am struggling.
            >
            >
            > Regards
            > Jon.
            >

            Actually this line works better for keeping the first 0 column line indent. You
            must start in the margin but once it is there then it sticks irrespective of
            the indent in the previous block (assuming it is not more than 5 - could put 9
            here).

            indent .hilight.josl u "^\\w+" -5t t

            Noted for the following:

            is-person? if
            "Hello, Person!" println
            end

            Then I think the following is more correct because the 'if' causes another
            indent and the 'end' is indented in the correct place.

            is-person? if
            "Hello, Person!" println
            end

            except for the new words...

            say-hello
            "Hello" println

            Regards
            Jon.


          • Jeremy Cowgar
            ... Oh... My indentation was only working for the constructs which was pretty easy, obviously: TRUE if .... Hello println end I did not get anything working
            Message 5 of 11 , Apr 20, 2010
            • 0 Attachment
              On 4/20/2010 4:00 PM, Jon Green wrote:  

              Hi Jeremy,

              Sorry I have not had a lot of time and to help you then we have to actually
              write a complete template and find some examples.

              After looking at the examples on the web page then I am struggling because
              there is no clear anchor in the syntax to determine when the indent is supposed
              to end.

              Anyway I had a play around and have so far come up with nothing that works
              every case of your examples and the document on josl. When I look at your
              example below I am wondering how you got the indent working at all?


              Oh... My indentation was only working for the constructs which was pretty easy, obviously:

              TRUE if
              ...."Hello" println
              end

              I did not get anything working for indenting a word definition properly. So, for me things would indent like this:

              main
              TRUE if
              ...."Hello" println
              end

              which is wrong in Josl, as *any* non-space, non-comment in column 1 defines a new word (function). The above should look like:

              main
              ....TRUE if
              ........"Hello" println
              ....end

              Jeremy

            • Jon Green
              ... OK, seems that I have solved this problem then with my abuse of the indent u which should sort this out as it will cause an indent to start on the next
              Message 6 of 11 , Apr 20, 2010
              • 0 Attachment
                Jeremy Cowgar wrote:
                > On 4/20/2010 4:00 PM, Jon Green wrote:
                >>
                >> Hi Jeremy,
                >>
                >> Sorry I have not had a lot of time and to help you then we have to
                >> actually
                >> write a complete template and find some examples.
                >>
                >> After looking at the examples on the web page then I am struggling
                >> because
                >> there is no clear anchor in the syntax to determine when the indent is
                >> supposed
                >> to end.
                >>
                >> Anyway I had a play around and have so far come up with nothing that
                >> works
                >> every case of your examples and the document on josl. When I look at your
                >> example below I am wondering how you got the indent working at all?
                >>
                >
                > Oh... My indentation was only working for the constructs which was
                > pretty easy, obviously:
                >
                > TRUE if
                > ...."Hello" println
                > end
                >
                > I did not get anything working for indenting a word definition properly.
                > So, for me things would indent like this:
                >
                > main
                > TRUE if
                > ...."Hello" println
                > end
                >
                > which is wrong in Josl, as *any* non-space, non-comment in column 1
                > defines a new word (function). The above should look like:
                >
                > main
                > ....TRUE if
                > ........"Hello" println
                > ....end
                >

                OK, seems that I have solved this problem then with my abuse of the 'indent
                "u"' which should sort this out as it will cause an indent to start on the next
                line.

                Best of luck.

                Regards
                Jon.

                > Jeremy
                >
              • Jeremy Cowgar
                Jon, Thank you. It seems to be working great. What I have thus far is: http://fossil.josl.org/finfo?name=support/editors/microemacs/hkjosl.emf I m very happy
                Message 7 of 11 , Apr 20, 2010
                • 0 Attachment
                  Jon,

                  Thank you. It seems to be working great. What I have thus far is:

                  http://fossil.josl.org/finfo?name=support/editors/microemacs/hkjosl.emf

                  I'm very happy to have a working mode now for MicroEmacs. It's just so
                  nice to have indentation, the tools pane (displaying buffer items). The
                  ease of creating these modes (albeit indentation sometimes gets tricky)
                  in MicroEmacs is just awesome.

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