Commit Graph

276 Commits

Author SHA1 Message Date
ayazhafiz
9f72b2710f Run linter 2022-02-01 22:49:52 -05:00
ayazhafiz
320827167f Parse number literal width suffixes
Supports [u,i][8,16,32,64,128] and [nat,dec]

Part of #2350
2022-02-01 22:48:48 -05:00
Richard Feldman
bfb938914f
Fix some missing indentations 2022-02-01 21:34:18 -05:00
Richard Feldman
200e237393
Add tests for multiline interface and hosted modules 2022-02-01 21:22:35 -05:00
Richard Feldman
34e9b1b73d
Fix module formatting 2022-02-01 21:22:35 -05:00
Richard Feldman
271112fec1
Finish implementing is_multiline for Spaced 2022-02-01 21:18:54 -05:00
Richard Feldman
3b1ca5c310
Refactor is_multiline for collections 2022-02-01 21:18:30 -05:00
Richard Feldman
099a0b5d41
Add formatting test for hosted modules 2022-01-30 20:40:51 -05:00
Richard Feldman
270374044f
Make Buf derive Debug 2022-01-30 20:40:50 -05:00
Richard Feldman
ea5365d6cc
Make Newlines optimize better to bool 2022-01-30 20:40:50 -05:00
Richard Feldman
5c6d2a909e
Make Collection formattable 2022-01-30 20:40:50 -05:00
Richard Feldman
c3123de737
format hosted modules 2022-01-30 20:40:49 -05:00
Folkert
eb08c12099 format as aliases with parens 2022-01-23 21:45:06 +01:00
Folkert
f76a75b00e formatting fixes 2022-01-23 21:25:20 +01:00
Richard Feldman
c1c0ffb25f Use UppercaseIdent over PlatformRigids 2022-01-23 11:13:23 -05:00
Jan Van Bruggen
1e9d2d1239 Remove accidental trailing spaces 2022-01-18 22:25:46 -07:00
Joshua Warner
8d6eb178b1 Fix multiline pattern heuristic 2022-01-01 18:20:05 -08:00
Joshua Warner
443d738f9b Make Position::{line, column} fields private 2022-01-01 18:20:05 -08:00
ayazhafiz
966198a6e7 Coalesce inline and normal alias headers
Unifies `As` annotations and `Alias` defs to use a common struct for
defining alias header information, i.e. the name and type variables of
the alias.
2021-12-26 09:37:56 -06:00
ayazhafiz
597a1cef3b Attach location to alias header name 2021-12-26 09:17:27 -06:00
ayazhafiz
11da888c07 Pull out alias header as its own struct 2021-12-26 09:07:12 -06:00
ayazhafiz
2cd5bf8c03 Parse "as" aliases into tag/args rather than arbitrary annotations 2021-12-26 08:44:09 -06:00
Joshua Warner
8b58d5cbc7 Switch to always encoding package names / paths as strings
This will simplify parsing and make it possible to have a uniform lexer for the language. Previously unquoted package names were allowed to include '-'s, which aren't valid identifiers.

In the future, we'll distinguish local paths from packages in the package-manager by looking for a ".roc" suffix, which should only be present in local paths.
2021-12-23 20:11:14 -08:00
Joshua Warner
22e2545fd6 format 2021-12-22 20:46:42 -08:00
Joshua Warner
4d7070ce3b Always combine line,column into Position 2021-12-22 20:32:46 -08:00
Joshua Warner
f19220473a Rename Located -> Loc 2021-12-22 19:18:22 -08:00
Joshua Warner
825b93696c Improve error message & comment 2021-12-21 18:23:04 -08:00
Joshua Warner
6786acb939 Remove redundant space in aliases 2021-12-21 18:16:58 -08:00
Joshua Warner
4fed812389 add test_fmt_examples 2021-12-21 17:25:36 -08:00
Richard Feldman
3ffe5768e1
Merge pull request #2239 from rtfeldman/joshuawarner32/pipeline-format-fail
Fix formatting of pipelined call exprs
2021-12-20 15:46:23 -05:00
Joshua Warner
48c207bb06 Remove trailing whitespace from the output of the formatter 2021-12-18 17:14:14 -08:00
Joshua Warner
61cdbd1531 Fix formatting of pipelined call exprs 2021-12-18 16:36:51 -08:00
Richard Feldman
cb4a74ac46
Merge pull request #2233 from rtfeldman/joshuawarner32/encapsulate-state
Encapsulate the `bytes` field of State in the parser
2021-12-17 14:42:06 -05:00
Joshua Warner
49818343dd extract state 2021-12-16 17:13:53 -08:00
Joshua Warner
c36b853286 Also assert module formatting is stable 2021-12-16 17:07:05 -08:00
Joshua Warner
0786e554c6 Extract spacing from parse::header::* items into explicit Spaced enum 2021-12-14 19:53:20 -08:00
Joshua Warner
86c8764012 Detangle lifetime annotations for Formattable 2021-12-14 19:52:53 -08:00
Jan Van Bruggen
d03a51c75b Rename base package to pf everywhere, to match tutorial 2021-12-12 05:57:39 -07:00
Joshua Warner
49228c8100 Refactor format_sequence to be a function 2021-12-07 18:53:47 -08:00
Folkert
873ccc5d96 remove incorrect space 2021-12-06 09:45:11 +01:00
Folkert de Vries
8459339230
Merge branch 'trunk' into joshuawarner32/keep-trailing-comments 2021-12-06 09:19:13 +01:00
Joshua Warner
f3ed335a6c Remove unused import 2021-12-05 12:59:15 -08:00
Joshua Warner
e6eb9138f7 Improve TypedIdent spacing in formatting 2021-12-05 12:58:48 -08:00
Joshua Warner
f3dd9e411f Keep trailing comments at the end of a file 2021-12-05 12:19:58 -08:00
Joshua Warner
e3f2f8d9a4 keep indent state in fmt Buf 2021-12-04 18:26:32 -08:00
Joshua Warner
4bbe1d308a rename expect_format_helper and add comment 2021-12-03 19:32:44 -08:00
Joshua Warner
5d3d4467c1 Fix indentation & stability in with formatting 2021-12-03 13:33:25 -08:00
Joshua Warner
270cc49867 Also check formatting is stable in tests; ignore a test that's invalid / incorrect 2021-12-02 17:46:50 -08:00
Richard Feldman
23fda0819f
Merge pull request #2112 from rtfeldman/joshuawarner32/fix-defs-indenting
Fix fmt_spaces indenting in the context of 3 or more newlines
2021-12-01 21:58:58 -05:00
Richard Feldman
ed40a8fc1c
Merge pull request #2114 from rtfeldman/joshuawarner32/fix-det-indentation
Fix indentation within parens
2021-12-01 19:38:07 -05:00
Joshua Warner
6edb376fdd Modify test to make the problem clear 2021-12-01 16:14:27 -08:00
Joshua Warner
c6116ba3ca Fix fmt_spaces indenting in the context of 3 or more newlines 2021-12-01 16:14:27 -08:00
Joshua Warner
8ab7b121eb Use newline in places where it should obviously be used 2021-12-01 16:14:27 -08:00
Folkert de Vries
d37ddeb162
Merge pull request #2113 from rtfeldman/joshuawarner32/fix-indentation-within-parens
Fix formatting of if as an left-hand-side of an operator
2021-12-01 13:38:22 +01:00
Joshua Warner
c0abf86f01 Fix indentation within parens 2021-11-30 17:55:50 -08:00
Joshua Warner
3228a23c98 Fix formatting of if as an left-hand-side of an operator 2021-11-30 17:53:26 -08:00
Joshua Warner
fdeafe4bab Make assert output more understandable 2021-11-30 17:48:24 -08:00
Chelsea Troy
6cf755ad8d Resolve a bunnnch of merge conflicts 2021-11-29 23:14:29 -06:00
Folkert de Vries
d0da22edfa
Merge pull request #2089 from rtfeldman/joshuawarner32/fix-backpassing-formatting
Fix formatting of applies in backpassing
2021-11-27 15:46:10 +01:00
Joshua Warner
02b51bcd37 Fix formatting of applies in backpassing 2021-11-27 06:15:48 -08:00
Joshua Warner
e9d22699ed Make sure unary operators around function calls get parens 2021-11-26 20:01:45 -08:00
Richard Feldman
74b8076bab
Merge pull request #2081 from rtfeldman/joshuawarner32/private-tag-fmt
Fix formatting of private tags
2021-11-26 18:03:31 -05:00
Richard Feldman
e2e095eb69
Merge pull request #2079 from rtfeldman/joshuawarner32/type-apply-package-name-fmt
Fix formatting in the presence of a pkg name in TypeAnnotation::Apply
2021-11-26 18:02:51 -05:00
Joshua Warner
32a8222a37 Add test for formatting package type in TypeAnnotation::Apply 2021-11-26 13:58:17 -08:00
Joshua Warner
799e340c01 Fix formatting of private tags 2021-11-26 13:50:12 -08:00
Richard Feldman
8d668514e4
Merge pull request #2080 from rtfeldman/joshuawarner32/if-else-fmt
Fix formatting of if/else chains
2021-11-26 15:46:18 -05:00
Joshua Warner
a7e4861956 Fix formatting of if/else chains 2021-11-26 11:03:45 -08:00
Joshua Warner
08e8b93bb6 Fix formatting in the presence of a package name in TypeAnnotation::Apply 2021-11-26 11:03:01 -08:00
Joshua Warner
27b83650ba Fix indent formatting in Def::AnnotatedBody 2021-11-26 10:21:38 -08:00
Joshua Warner
f25323e8a7 Implement platform header formatting 2021-11-25 08:19:31 -08:00
Joshua Warner
24f7692a73 Implement [more] app header formatting
Also, refactor out a utility method to format a Collection. This method can currently
replace some of the formatting done in module headers - but the goal is eventually
to be able to replace the code in fmt_list as well, such that there is 'one true way'
to format collections.
2021-11-23 12:19:43 -08:00
ayazhafiz
8b7217847d Rename additional stale roc_module::operator refs and format 2021-11-18 20:20:33 -05:00
ayazhafiz
8a60162a1e Rename roc_module::operator -> roc_module::called_via
A bit of a nit, but this file is now more general than just keeping
track of operator methods.
2021-11-18 20:20:33 -05:00
Joshua Warner
7f5b873357 Parse _ in type annotations as an 'Inferred' type 2021-11-17 17:59:40 -08:00
Joshua Warner
c4e70ca7aa Convert exposes_values to ccollection_trailing_sep_e 2021-11-14 10:14:53 -08:00
Joshua Warner
23c75d2699 Allow trailing comments in imports decl 2021-11-14 10:14:53 -08:00
Joshua Warner
9bf1674946 Shrink Collection to make parse_expr_size test pass 2021-11-13 16:17:44 -08:00
Joshua Warner
1fabc64fdf Use Collection in Expr::TagUnion 2021-11-13 07:38:39 -08:00
Joshua Warner
d63405d824 Make Expr::List use a Collection 2021-11-13 07:38:11 -08:00
Joshua Warner
a4ca6a31a6 Use Collection in Expr::Record and related places 2021-11-13 07:36:05 -08:00
Joshua Warner
4df0880e7a Commit local changes (whoops!) 2021-11-11 18:57:26 -08:00
Joshua Warner
04d4a8ca79 Introduce Collection as a general abstraction in the ast 2021-11-11 14:49:33 -08:00
Folkert
5632e3159d remove im dependency where not needed 2021-11-10 16:00:22 +01:00
Brendan Hansknecht
73e2cbcb1e Make versions numbers consistent and matching the lock files 2021-11-06 13:24:45 -07:00
Brendan Hansknecht
d49ac68bcc Update dep with major version changes 2021-11-05 19:19:37 -07:00
Brendan Hansknecht
bddc08c977 Remove unused dependencies 2021-11-05 16:58:11 -07:00
Anton-4
a3fc724df3 removed unused maplit 2021-11-03 10:50:25 +01:00
Chadtech
8e0fd1b4cd Dont borrow sub_expr 2021-10-16 18:08:18 -04:00
Chadtech
5e2decf89a Binops with parentheses keep their parentheses 2021-10-16 18:01:13 -04:00
Chadtech
56c36c51d7 Commented in many tests which apparently did not work in the past 2021-10-16 13:44:14 -04:00
Chadtech
2ca9dad156 Do not add parens around exprs if they are not needed in formatting 2021-10-16 13:30:32 -04:00
Chelsea Troy
051b511d87 Remove parentheses from unapplied tags 2021-10-11 20:42:07 -05:00
Eric Correia
8272ea876f Get it all to compile! 2021-10-02 13:48:07 -04:00
Folkert
d4896d3ed2 remove inlinable_string dependency 2021-08-03 21:24:19 +02:00
Folkert
e805e63db6 typos 2021-07-30 16:54:22 +02:00
Folkert
899cbeabd7 fix extra ampersands 2021-07-29 17:32:08 +02:00
Anton-4
314503cf7f fixed typos, added typos checking to CI 2021-06-05 20:02:54 +02:00
Richard Feldman
a7518a675a Clean up some clippy warnings 2021-05-23 20:28:23 -04:00
Folkert
700e7d9686 parse expect 2021-04-22 23:00:44 +02:00
Richard Feldman
0a50b0b488 Change license to UPL-1.0
Closes https://github.com/rtfeldman/roc/issues/1199
2021-04-21 19:18:44 -04:00