Huge thanks for working on this. It's difficult and tedious but sorely 
needed. 

Here's some bad indentation cases I found:
      sortdef even = { i:int | i mod 2 == 0  }
                       sortdef agz = {l:addr | l > null}


implement main0 () =
          let
            ...
          in
            ...
          end


On Thursday, October 12, 2017 at 12:47:24 PM UTC-5, Andrew Knapp wrote:
>
> Taking a closer look, there are definitely cases I didn't use that behave 
> strangely. As I see it, there are four causes for this.
>
> The first is an incomplete treatment of similar constructs that should be 
> indented the same way, e.g. datatype, dataprop, dataviewtype... I thought I 
> had gotten this working, but I didn't test every keyword.
>
> The second is things that indent strangely at first, but indent correctly 
> after entering calling newline-and-indent. This behavior is mildly 
> annoying, but it is also inherited from the original SML mode and can be 
> fixed with semicolon usage. I'm not sure SMIE is powerful enough to 
> eradicate this behavior.
>
> The third is flat out bugs. For example, different styles of datatype 
> declaration break indentation (i.e. | Foo of (a,b) vs | Foo() of (a,b)).
>
> The fourth is my preferred indentation style, which uses much longer lines 
> than yours. I find it painful to read such short lines of code, and so I 
> didn't test that case very much. For example, I would write
>
> fun {n:nat} factorial(n:int(n)): [r:int] (FACTORIAL(n,r) | int(r))
>
> Do you have any particular examples that stood out as being incorrect? I 
> will continue working on this for my own use, at least :)
>
> On Thursday, October 12, 2017 at 5:58:02 AM UTC-7, gmhwxi wrote:
>>
>> I gave it a try last night. I encountered many cases of excessive 
>> indentation.
>>
>> The syntax of ATS is rich and complex. So it makes sense to require the 
>> programmer
>> to manually add indentation. With the current ats-mode, you get two 
>> spaces if you hit the
>> tab key. So you are pretty much in control of indentation. As far as I 
>> know, a lot of programmers
>> want this kind of control :)
>>
>>
>> On Wed, Oct 11, 2017 at 3:43 PM, Andrew Knapp <andy.j...@gmail.com> 
>> wrote:
>>
>>> Hello all,
>>>
>>> By cannibalizing sml.el, I have largely gotten automatic indentation 
>>> working in ATS.
>>>
>>> After a few months of sporadic use, the only problem I couldn't fix is 
>>> excessive indentation after a function has ended.
>>> This can be fixed by terminating all functions with semicolons, which is 
>>> ugly, but it seems to work.
>>> If you don't do this, you have to type "fun" and then hit tab to indent 
>>> properly.
>>>
>>> Perhaps someone with more experience with programming languages can fix 
>>> this, since I have no background with parsers.
>>> (The code is based on Emacs' SMIE, which uses operator precedence 
>>> grammars.)
>>>
>>> Here is the temporary link. Let me know what I need to do to get this 
>>> upstream.
>>>
>>> https://github.com/ajknapp/ats-mode-indent
>>>
>>> Best,
>>> Andrew Knapp
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "ats-lang-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to ats-lang-user...@googlegroups.com.
>>> To post to this group, send email to ats-lan...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/ats-lang-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ats-lang-users/ad0158e6-35c0-4a98-9aff-13d9a27578a6%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ats-lang-users/ad0158e6-35c0-4a98-9aff-13d9a27578a6%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/864a410c-815b-4096-a613-607eadab272e%40googlegroups.com.

Reply via email to