Commit Graph
204 Commits
Author SHA1 Message Date
Eric Meadows-Jönsson 1303d09f61 Fix precedence of bitwise XOR (^^^) in formatter (#7036)
Closes #7034.
2017-11-15 19:53:20 +01:00
José Valim 5ea7321562 Consider comments inside function calls
Closes #6994
2017-11-07 10:50:11 +01:00
José Valim 794928efe1 Restrict next break fits and eols on operators and function calls
* Whitelist which operators support next_break_fits
  * No longer consider tuples as part of next_break_fits
  * Do not consider eol for = and ::
  * Do not consider eol for calls with one next_break_fits arg
2017-10-27 12:34:09 +02:00
José Valim 3d84aec0f9 Respect the user's choice on calls
Closes #6977
2017-10-26 13:19:21 +02:00
José Valim 7f8136915f Treat => and : as operators in the formatter
This means that the right side will break on its own line
when it doesn't fit and be indented by two spaces.

Closes #6976.
2017-10-26 12:43:02 +02:00
José Valim d3a85bfd21 Remove end column information from tokens
If we want to store this information, we need to store it
alongside the end line, otherwise it is ambiguous.
2017-10-25 11:56:31 +02:00
José Valim b87989e702 Support columns: true in string_to_quoted, closes #3554 2017-10-25 11:02:53 +02:00
Andrea Leopardi 169b8f5a77 Fix a bug where we discarded some meta in some literals in the parser (#6946)
Closes #6945.
2017-10-17 17:31:48 +02:00
José Valim 3d0dbb42d7 Formatter should not fail on empty clauses, closes #6924 2017-10-12 11:30:41 +02:00
José Valim 34651f1034 Format errors_test.exs 2017-10-12 09:35:58 +02:00
José Valim 1bef178c86 Do not add parens for var.field before do/end blocks 2017-10-10 16:13:10 +02:00
José Valim 9e5126256f Do not apply next_break_fits if eol is present 2017-10-09 23:55:49 +02:00
José Valim 52b405bbda Keep the user's choice on non-module remote calls with no args 2017-10-09 22:43:08 +02:00
José Valim f7741f29b5 When when and | also respect new lines 2017-10-09 17:13:39 +02:00
José Valim f1776da4f1 Only keep locals_without_parens if they never had parens to start with 2017-10-09 15:57:57 +02:00
José Valim 8e25bdbb09 Warn on trailing commas in calls 2017-10-09 10:43:10 +02:00
José Valim 9b5af3303d Also preserve user newlines if trailing commas exist 2017-10-09 09:17:35 +02:00
José Valim 22c6311e9d More improvements to the formatter grammar, docs, and locals without bindings 2017-10-08 19:28:36 +02:00
José Valim 82e93512e9 Do not raise on clauses with newlines before and after -> 2017-10-07 10:13:53 +02:00
José Valim 748ae34f0e Add end_lines to do/end blocks and represent empty ones with empty blocks 2017-10-07 09:50:17 +02:00
José Valim 4387576126 Add more metadata to containers 2017-10-07 00:18:22 +02:00
José Valim df6a67dd88 Return empty block for empty parens instead of nil 2017-10-06 19:34:25 +02:00
José Valim eadcc92ff3 Do not match on empty block meta 2017-10-06 15:19:37 +02:00
José Valim ace11872f1 Add endline for functions and blocks 2017-10-06 15:01:23 +02:00
José Valim 2738594886 Add end_line to interpolation 2017-10-05 19:00:37 +02:00
José Valim e8d5c70baa Move & up in the operator table to avoid conflicts with | in cons, closes #6613 2017-09-28 18:32:52 +02:00
José Valim fe7efd6969 Only add eol marker with both begin-end in containers have eol 2017-09-12 14:42:15 +02:00
José Valim 93f79543ae Do not use __block__ and __aliases__ as literal identifiers 2017-09-01 01:45:08 +02:00
José Valim a8bafae468 Store eol info in arrow ops 2017-09-01 00:58:15 +02:00
José Valim 58b498c90f Store if containers and stab are followed by eol 2017-09-01 00:35:14 +02:00
José Valim 2d1e00264e Push blocks to parser 2017-08-31 15:58:03 +02:00
José Valim 97ece16b11 Add more formatter metadata 2017-08-30 17:21:17 +02:00
José Valim 6030be5ae5 Add literal annotation for aliases 2017-08-28 23:59:45 +02:00
José Valim 4fdeba67f6 Add parser rule for call with unary and do-end block 2017-08-28 23:15:45 +02:00
José Valim 89752e724c Also wrap keyword literals in blocks 2017-08-28 22:27:43 +02:00
José Valim a378154652 Make terminator binaries 2017-08-27 12:39:40 +02:00
José Valim dcb76f8882 Do not translate empty files to nil 2017-08-25 14:56:15 +02:00
Andrea Leopardi 82dfe6f56e Add :format metadata to strings and charlist literals (#6505) 2017-08-25 01:33:02 +02:00
José Valim 8914d2c5f0 unquote_splicing has arity of 1 2017-08-24 13:55:35 +02:00
Andrea Leopardi 4cfce073c1 Keep the representation of "float" tokens like we do for "int" tokens (#6501) 2017-08-23 12:57:10 +02:00
Andrea Leopardi 2f9b651011 Merge integer tokens into the "int" token (#6499) 2017-08-23 11:55:12 +02:00
Andrea Leopardi 8cd9b8a75a Change the format of tokens (#6495)
Right now, tokens are "{Token, Location}" or "{Token, Location, Value}".
This commit changes "Location" from "{Line, StartColumn, EndColumn}" to
"{Line, {StartColumn, EndColumn}, Meta}" where "Meta" can be anything.
This will be used for things such as storing the format of integers.
2017-08-22 21:12:30 +02:00
Andrea Leopardi 1dd4c16958 Rename the "hexadecimal" token to "hex" 2017-08-22 00:07:03 +02:00
Alex Jiao 921f17e21d Add heredoc info to heredoc list/binary literals when parsing (#6372) 2017-07-25 00:04:23 +02:00
Alex Jiao c004527139 Augment integer literals with representation info (#6344) 2017-07-18 14:40:59 +02:00
Alex Jiao bb1bcb1634 Wrap lists and two-element tuples literals in blocks (#6323) 2017-07-14 10:23:35 +02:00
Alex Jiao d74bd047df Add terminator info to sigil AST node metadata (#6305) 2017-07-08 01:05:37 +02:00
Alex Jiao d7d47ff640 Add wrap_literals_in_blocks option to parser (#6263) 2017-06-28 10:45:55 +02:00
José Valim 9747e58db7 Fix precedence of unary operators and operator capture 2017-05-14 19:31:50 +02:00
José Valim c6a38017f5 Update elixir_parser.yrl 2017-03-05 20:45:51 +01:00