Commit Graph

70 Commits

Author SHA1 Message Date
Chadtech
212523fa08
Merge branch 'trunk' into ct/multi-line-if-condition-1 2020-01-01 04:04:14 -05:00
Richard Feldman
56df170be6 Reproduce parsing failure on [ ] 2019-12-31 20:20:58 -05:00
Chad Stearns
b6086a0b0f List formatting basics 2019-12-31 02:44:51 -05:00
Chad Stearns
9ebf931577 multi-line if condition formatting and some new commented out tests 2019-12-31 01:25:51 -05:00
Richard Feldman
34e039bef6
Merge branch 'trunk' into ct/multi-line-if-condition 2019-12-23 23:52:01 -08:00
Chad Stearns
844ca0a50e Changed instances of 'Case' in the code to 'When' 2019-12-23 17:41:19 -05:00
Chad Stearns
62a004c103 Case is to when is 2019-12-23 17:17:04 -05:00
Chad Stearns
9a5b6a03b4 case when to case is 2019-12-23 17:08:53 -05:00
Chad Stearns
239a275bf6 Commented out more tests 2019-12-23 12:45:17 -05:00
Chad Stearns
954f6f7d7e Commented out test for newline and comment formatting in if statements 2019-12-23 12:40:41 -05:00
Chad Stearns
141ad1757b Added test for case with many lines 2019-12-21 13:48:44 -05:00
Chad Stearns
68236aa10b Combine format_newlines_after and format_newlines_before into just format_newlines 2019-12-21 13:32:14 -05:00
Chad Stearns
48a9d898fc Handle excessive newlines below then and else cases 2019-12-21 13:28:34 -05:00
Chad Stearns
858764ac27 Format changes 2019-12-21 02:11:14 -05:00
Chad Stearns
d6186f38ed cargo fmt and clippy 2019-12-20 16:16:45 -05:00
Chad Stearns
32a6afb817 Multi-line if statement 2019-12-20 16:04:09 -05:00
Richard Feldman
d0fa8bf857 Use commas between function arguments 2019-12-18 21:50:45 -05:00
Richard Feldman
3e64447c08 Revise a comment 2019-12-16 21:30:24 -05:00
Chad Stearns
faee0a657d Format code 2019-12-16 13:35:30 -05:00
Chad Stearns
01a283c121 Complicated multiline pattern code with comment 2019-12-16 13:33:13 -05:00
Chad Stearns
5a383b81b8 Commented out failing test 2019-12-16 13:29:09 -05:00
Chad Stearns
d6a3f2cfe9 Removed denest and stopped manually newlining 2019-12-16 13:21:25 -05:00
Chad Stearns
1c64c8088f Handle and format multiline patterns 2019-12-16 12:51:13 -05:00
Chad Stearns
7714639a45 Added test for when lamda arrow is on new line 2019-12-14 22:24:31 -05:00
Chad Stearns
e0ca4ec355 Ran formatter 2019-12-09 06:41:42 -05:00
Chad Stearns
3c8d678c18 New commented out test that is currently breaking under parser errors 2019-12-08 21:51:44 -05:00
Chad Stearns
6e91339700 Format code and tests for newline before return 2019-12-08 21:35:51 -05:00
Chad Stearns
2b58604719 Deleted commented out failing tests, and ran cargo fmt 2019-12-07 00:34:56 -05:00
Chad Stearns
c8acb705f8 Added failing test, removed comment 2019-12-04 22:48:28 -05:00
Chad Stearns
5bc8f24d7f Clarified example 2019-12-04 22:44:59 -05:00
Chad Stearns
7a2fd182df Cohere naming with rest of modul 2019-12-04 22:38:57 -05:00
Chad Stearns
ff6e08daf6 Clarify and comment test. 2019-12-04 22:36:28 -05:00
Chad Stearns
edd8877865 Format tests for comment position and new lines 2019-12-04 22:33:02 -05:00
Richard Feldman
ef7dd313ed Decouple parsing module headers from defs 2019-11-26 20:55:46 -05:00
Richard Feldman
67cceec8ad Format imports 2019-11-25 21:08:20 -05:00
Richard Feldman
4566d15526 Format exposes 2019-11-25 20:52:54 -05:00
Richard Feldman
4926bfbc3a Reorganize fmt and module 2019-11-25 20:42:44 -05:00
Folkert de Vries
4ed1c98881
Merge pull request #9 from rtfeldman/record-patterns
Add record patterns
2019-11-21 13:10:13 +01:00
Richard Feldman
5504b52039 Use assert_formats_same 2019-11-20 18:14:33 -05:00
Richard Feldman
3bc974ab06 Merge branch 'trunk' into format-case 2019-11-20 18:00:07 -05:00
Richard Feldman
c3ecac5abf Reproduce parsing bug 2019-11-20 17:52:50 -05:00
Folkert
d3c14d16d1 parse all records as patterns
This makes the following parse

    # assuming
    Opaque : Opaque Int

    { x: (Opaque y) } = foo

In most cases a pattern of this kind will not be exhaustive, but it
should be syntactically valid.

Couple of things

- conversion of the value (in `key: value`) requires converting from
expr into a pattern, which returns a `Result` which now propagates. A
comment notes though that the cases for which it gives Err should not
parse. so, is the Result useful here?

- AssignedField constructors have a field for spaces, but also a
SpacesAfter constructor. Are they different? it seems like the spaces
field could be removed in favor of using SpacesAfter.
2019-11-20 15:03:58 +01:00
Folkert de Vries
af86b23ab5 Use the RecordField in conversion from assignedField 2019-11-20 15:03:58 +01:00
Folkert de Vries
b44e5e7d94 add RecordField pattern
this will allow pattern matches like

    case foo of
        { x : Just 4 } -> ...
        _ -> ...
2019-11-20 15:03:58 +01:00
Folkert de Vries
3d584a53b0 Use the RecordField in conversion from assignedField 2019-11-20 14:51:06 +01:00
Folkert de Vries
97e8600cdf add RecordField pattern
this will allow pattern matches like

    case foo of
        { x : Just 4 } -> ...
        _ -> ...
2019-11-20 14:51:06 +01:00
Folkert
2af14921a7 add test for nested case 2019-11-20 14:44:32 +01:00
Folkert
53c7fdf52c Implement formatting for case expressions
I hope we can find some better abstractions for this, as it is quite
messy. But this seems to handle comments correctly so far.
2019-11-20 14:37:44 +01:00
Folkert de Vries
8ce7a8e6ed partial formatting of case & comments/newlines 2019-11-20 14:37:44 +01:00
Richard Feldman
76b815ab77 Use $crate in loc macro instead of outside imports 2019-11-20 07:10:31 -05:00