Commit Graph
155 Commits
Author SHA1 Message Date
José Valim f16f2f54ab Update elixir_parser.yrl 2017-03-05 20:45:51 +01:00
José Valim cd1f0ca12a Provide more examples when solving comma conflict 2017-03-05 16:56:24 +01:00
José Valim 865b7ef930 Deprecate parens as nil and support guards on funs with zero arity
Closes #5799
2017-02-21 13:06:43 +01:00
Eric Entin 4c6baac3ed Support "left not in right" syntax (#5620) 2017-01-07 10:23:13 +01:00
José Valim 05d75bf689 Properly indent parser block code 2016-12-08 12:14:55 +01:00
Aleksei Magusev 054206b03b Improve warning output (#4631) 2016-05-16 00:10:51 +02:00
José Valim 29bd95cc89 Improve ambiguous pipe message 2016-05-15 20:46:37 +02:00
José Valim e018c773b0 Unify warning calls 2016-05-15 20:34:29 +02:00
eksperimental c3d28f76f2 Replace 'char_list' and 'char list' with 'charlist' 2016-05-07 03:20:57 +07:00
eksperimental 685e87bdf0 Formmating: Add white space around vertical bar (#4507) 2016-04-25 00:55:49 +02:00
Andrea Leopardi a00fe5a017 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 0096354632 Allow variable struct names when matching 2016-02-21 14:19:57 +01:00
José Valim c26ed894bb Update elixir_parser.yrl 2016-01-12 10:11:51 +01:00
José Valim 1589fe8008 is -> may be 2015-12-21 16:30:59 +01:00
José Valim 6dd97036d8 Improve error message for invalid do/do: 2015-11-20 17:30:40 +08:00
Aleksei Magusev 641f325bf8 Remove unreachable function "branch" in parser 2015-11-17 12:06:35 +01:00
Aleksei Magusev f95374f85d Remove undesirable output in parser 2015-11-17 11:43:09 +01:00
José Valim 8e29929db5 often undesired -> ambiguous 2015-11-16 14:04:40 +01:00
José Valim 166294ca83 Warn when piping into functions without parens, closes #3642 2015-11-16 13:26:05 +01:00
José Valim 5fe128bde1 before -> after 2015-11-14 22:03:56 +01:00
Andrea Leopardi d999d82f95 Throw an error for -> with an empty right-hand side 2015-11-13 01:40:53 +01:00
Aleksei Magusev d2238b4cd5 Add support for x.{y, z, w} expression 2015-09-25 11:53:54 +02:00
José Valim 8e778846b2 Also perform new line checking with structs 2015-08-16 20:47:53 +02:00
José Valim e2919d01de Emit syntax error for invalid fn end, closes #3311 2015-08-16 15:30:20 +02:00
José Valim 741452768c Make a distinction between Location, Token and Node in parser 2015-08-15 14:14:11 +02:00
José Valim 41c5fef8c1 Make a distinction between strict containers and strict calls 2015-08-01 08:25:52 +02:00
José Valim afed134b86 Provide detailed error message for nested parens calls 2015-07-17 15:27:52 +02:00
José Valim 25a2a69a35 Remove reference to dynamic operators in table 2015-07-14 09:27:44 +02:00
José Valim 414ad0c20b Ensure proper precedence of operators when mixing matched and unmatched 2015-07-07 16:18:29 +02:00
José Valim 685e22e7a6 Disallow more ambiguous expressions 2015-07-07 15:23:46 +02:00
José Valim 068c31ee9d Do not allow nested ambig expressions 2015-07-07 11:48:32 +02:00
eksperimental f9bcdd5c1c Add space after comma: Format consistently 2015-03-17 22:55:27 +07:00
Or Neeman 6507672623 Refine parsing of no parens calls
Reimplements e859462df2, which was
reverted due to having introduced a bug.  This commit avoids that bug
and includes a regression test for it.  Hat-tip to José Valim for
finding a way to refactor this PR so as to simplify it greatly.

Closes #3074
2015-03-12 19:33:16 -06:00
José Valim 72ba86ab5e Revert "Merge pull request #3109 from oneeman/refine_no_parens_parsing"
This pull request has broken the following expression:

    assert [] = TestRepo.all from p in Post, where: p.title in ^[]

Previously it was parsed as:

    assert [] = TestRepo.all(from p in Post, where: p.title in ^[])

But after this pull request it is parsed as:

    assert [] = TestRepo.all from(p in Post), where: p.title in ^[]

This reverts commit e859462df2, reversing
changes made to c0063bf997.

Conflicts:
	lib/elixir/src/elixir_parser.yrl
2015-03-02 11:14:12 +01:00
Alexei Sholik 5e2c685e86 Replace "parenthesis" with "parentheses" in comments and doc strings 2015-02-26 20:03:43 +01:00
Alexei Sholik 33176d7a15 Replace "in between" with "between" in comments and doc strings 2015-02-26 20:00:22 +01:00
José Valim 94efddfb8e Add line breaks to code comment 2015-02-23 09:24:56 +01:00
Or Neeman 800c72f28b Add comments explaining changes to parser 2015-02-22 17:26:18 -06:00
Or Neeman 8d3e54bc2b Throw syntax error on [f g :a, :b] 2015-02-22 17:26:18 -06:00
Or Neeman 88fe9e510e Add distinction between no_parens_one and no_parens_ambig to parser 2015-02-22 17:26:18 -06:00
José Valim 7cf8b46639 Split containers and call args expressions 2015-02-22 19:55:55 +01:00
José Valim ac21f85a8d Unify empty parens and map exprs handling 2015-02-22 19:55:55 +01:00
Or Neeman 34876e8bf8 Throw syntax error for :foo.Bar
Closes #2986
2015-02-08 16:56:14 -06:00
Alexander Ivanov 1a456768d5 Change location info format in tokenizer
Start column counting in tokenizer from 1, store location info in a tuple `{Line, BeginColumn, EndColumn}` instead of a list
2015-01-05 13:35:23 +02:00
Alexander Ivanov 96a37693f0 Fix line extraction in elixir_parser 2015-01-05 12:16:15 +02:00
Alexander Ivanov d7e00557d0 Add column info in tokenizer, #2987
Add column info for each token in elixir_tokenizer.
Change the format of location info from `Line` to `[Line, BeginColumn,
EndColumn]`. Pass the current column after the current line in
`elixir_tokenizer:tokenize`. Reflect the change in related modules.
2015-01-05 03:34:53 +02:00
José Valim 6b84ee1dab Add free operators
<<~, ~>>, <~, ~>, <~>, <|>
2014-09-07 12:42:10 +02:00
José Valim 75eeaf4a38 Revert "Merge pull request #2702 from alexrp/master"
<~ is already a valid expression in Elixir.

This reverts commit af92deecaa, reversing
changes made to 199b0539b8.
2014-09-07 12:12:35 +02:00
Alex Rønne Petersen b00e24bbfc Introduce new operators intended for use by parser combinator libraries.
The expected definitions (which are by no means required) in
parser combinator speak are:

* `p  ~>> f`   =  `bind(p, f)`
* `p1 ~>  p2`  =  `pair_right(p1, p2)`
* `p1 <~  p2`  =  `pair_left(p1, p2)`
* `p1 <~> p2`  =  `pair_both(p1, p2)`
* `p  |~> f`   =  `map(p, f)`
* `1p <|> p2`  =  `either(p1, p2)`
2014-09-02 01:57:50 +02:00
José Valim c11af58d93 Make a distinction between eol and ; 2014-08-12 16:27:45 +02:00