Commit Graph
178 Commits
Author SHA1 Message Date
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
José Valim 657e36b1d8 Provide more examples when solving comma conflict 2017-03-05 16:56:24 +01:00
José Valim 300acb518e Deprecate parens as nil and support guards on funs with zero arity
Closes #5799
2017-02-21 13:06:43 +01:00
Eric Entin 21c0e80076 Support "left not in right" syntax (#5620) 2017-01-07 10:23:13 +01:00
José Valim bb715ad5e0 Properly indent parser block code 2016-12-08 12:14:55 +01:00
Aleksei Magusev d22e456047 Improve warning output (#4631) 2016-05-16 00:10:51 +02:00
José Valim b79b041fad Improve ambiguous pipe message 2016-05-15 20:46:37 +02:00
José Valim 7cac73a095 Unify warning calls 2016-05-15 20:34:29 +02:00
eksperimental 0aece49e2d Replace 'char_list' and 'char list' with 'charlist' 2016-05-07 03:20:57 +07:00
eksperimental 4ceb41e71b Formmating: Add white space around vertical bar (#4507) 2016-04-25 00:55:49 +02:00
Andrea Leopardi 8619d26c4d Handle chars literals in the parser for better syntax errors
Before this commit, we handled char literals (like `?a`) in the
tokenizer, turning a literal like `?a` into the token `{:number, _,
97}` (thus indistinguishable from the literal `97` at the parsing
stage). This led to error messages with the integer for the character
instead of the character literal, e.g.:

    iex> :ok ?a
    ** (SyntaxError) iex:11: syntax error before: 97

With this commit, we now turn `?a` into the token `{:char, _,
97}` (which is the same token used by Erlang for Erlang char literals
like `$a`); since it's the same token as in Erlang, the parser will now
output the char literal as an Erlang char (`?a` would be printed as
`$a`). We hijack the error message in elixir_errors.erl to end up with
the correct message:

    iex> :ok ?a
    ** (SyntaxError) iex:11: syntax error before: ?a
2016-04-04 21:29:15 +02:00
José Valim d1d81af7c0 Allow variable struct names when matching 2016-02-21 14:19:57 +01:00
José Valim 901504030f Update elixir_parser.yrl 2016-01-12 10:11:51 +01:00
José Valim 5d5d7dadb4 is -> may be 2015-12-21 16:30:59 +01:00
José Valim 7b5f4a5842 Improve error message for invalid do/do: 2015-11-20 17:30:40 +08:00
Aleksei Magusev ff04de1592 Remove unreachable function "branch" in parser 2015-11-17 12:06:35 +01:00
Aleksei Magusev 58fcce1bfc Remove undesirable output in parser 2015-11-17 11:43:09 +01:00
José Valim a34d81c253 often undesired -> ambiguous 2015-11-16 14:04:40 +01:00
José Valim 3487d00ddb Warn when piping into functions without parens, closes #3642 2015-11-16 13:26:05 +01:00
José Valim 15a613dd08 before -> after 2015-11-14 22:03:56 +01:00
Andrea Leopardi e4db37c1b0 Throw an error for -> with an empty right-hand side 2015-11-13 01:40:53 +01:00
Aleksei Magusev a5a29dc47b Add support for x.{y, z, w} expression 2015-09-25 11:53:54 +02:00
José Valim c2813ac1ea Also perform new line checking with structs 2015-08-16 20:47:53 +02:00
José Valim aa43f3f281 Emit syntax error for invalid fn end, closes #3311 2015-08-16 15:30:20 +02:00
José Valim 1afb655191 Make a distinction between Location, Token and Node in parser 2015-08-15 14:14:11 +02:00
José Valim b3d74127cf Make a distinction between strict containers and strict calls 2015-08-01 08:25:52 +02:00
José Valim cb02ed8eed Provide detailed error message for nested parens calls 2015-07-17 15:27:52 +02:00