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

2549Re: [jasspa] Re: More indent questions

Expand Messages
  • Jeremy Cowgar
    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.


    • Show all 11 messages in this topic