Commit Graph
127 Commits
Author SHA1 Message Date
José Valim 3e52ed0fbb Ensure proper precedence of operators when mixing matched and unmatched 2015-07-07 16:18:29 +02:00
José Valim 7fda0dd5c1 Disallow more ambiguous expressions 2015-07-07 15:23:46 +02:00
José Valim a52c2b5abf Do not allow nested ambig expressions 2015-07-07 11:48:32 +02:00
eksperimental 61675c3ea8 Add space after comma: Format consistently 2015-03-17 22:55:27 +07:00
Or Neeman a870c88cc3 Refine parsing of no parens calls
Reimplements 7f528aa1c0, 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 4ecc9ee1df 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 7f528aa1c0, reversing
changes made to 98746e08ea.

Conflicts:
	lib/elixir/src/elixir_parser.yrl
2015-03-02 11:14:12 +01:00
Alexei Sholik 62e6e026cf Replace "parenthesis" with "parentheses" in comments and doc strings 2015-02-26 20:03:43 +01:00
Alexei Sholik 3f5999af87 Replace "in between" with "between" in comments and doc strings 2015-02-26 20:00:22 +01:00
José Valim 0003f38826 Add line breaks to code comment 2015-02-23 09:24:56 +01:00
Or Neeman ee504eb19e Add comments explaining changes to parser 2015-02-22 17:26:18 -06:00
Or Neeman b432fc74d3 Throw syntax error on [f g :a, :b] 2015-02-22 17:26:18 -06:00
Or Neeman c8132617d6 Add distinction between no_parens_one and no_parens_ambig to parser 2015-02-22 17:26:18 -06:00
José Valim 3726082cb0 Split containers and call args expressions 2015-02-22 19:55:55 +01:00
José Valim 0730829ae1 Unify empty parens and map exprs handling 2015-02-22 19:55:55 +01:00
Or Neeman 76cbf96369 Throw syntax error for :foo.Bar
Closes #2986
2015-02-08 16:56:14 -06:00
Alexander Ivanov c76a186687 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 a9495e7586 Fix line extraction in elixir_parser 2015-01-05 12:16:15 +02:00
Alexander Ivanov a288ddd326 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 843706e36e Add free operators
<<~, ~>>, <~, ~>, <~>, <|>
2014-09-07 12:42:10 +02:00
José Valim 172bfdb128 Revert "Merge pull request #2702 from alexrp/master"
<~ is already a valid expression in Elixir.

This reverts commit 2c741ec6ae, reversing
changes made to 12a457829f.
2014-09-07 12:12:35 +02:00
Alex Rønne Petersen c8bcd89c7c 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 e6e71675ac Make a distinction between eol and ; 2014-08-12 16:27:45 +02:00
José Valim 6ffb248f03 No longer allow empty access as in [][] 2014-07-16 17:54:26 +02:00
José Valim 058b157b36 Remove deprecated features and deprecate soft ones 2014-07-12 16:23:17 +02:00
José Valim 28264c6792 Improvements to the operator table
* |>, <<<, >>> and ^^^ were made left associative

  * <, >, <=, >= were given higher precedence than
    comparison ones (==, !=, etc)

  * xor is deprecated
2014-06-29 16:18:33 +02:00
José Valim b4415f2a14 Change precedence of & to not special case / 2014-06-28 11:16:51 +02:00
José Valim eb32937858 Get rid of Kernel.access/2 in favor of Access.get/2 2014-05-24 12:45:33 +02:00
José Valim 8652ee5838 Do not allow keyword on containers without pos args 2014-05-23 20:59:38 +02:00
José Valim 55e885f5c5 Ensure we don't leak erlang terms on failure, closes #2303 2014-05-21 12:44:12 +02:00
José Valim dc9803de6d Remove inlist and inbits from keywords list 2014-05-19 23:12:45 +02:00
José Valim bf8f5c4bb8 Add String.to_char_list and List.to_string 2014-05-17 13:59:17 +02:00
Eric Meadows-Jönsson d868b4d066 Do not wrap single lists in :__block__ 2014-04-27 22:26:14 +02:00
José Valim 56f15d9f4e Do not add spaces after { and before }
This makes the source code consistent with the result
returned by inspect/2.
2014-04-21 19:06:35 +02:00
José Valim 6624f31472 Merge branch 'jv-char-data'
Conflicts:
	lib/eex/lib/eex/tokenizer.ex
	lib/elixir/lib/file.ex
	lib/elixir/lib/kernel.ex
	lib/elixir/lib/record/extractor.ex
	lib/elixir/lib/string.ex
	lib/ex_unit/lib/ex_unit/doc_test.ex
	lib/mix/lib/mix/archive.ex
	lib/mix/lib/mix/dep/fetcher.ex
	lib/mix/lib/mix/dep/umbrella.ex
2014-04-21 08:38:48 +02:00
José Valim d33463dcd5 Unify precedence of when, :: and | 2014-03-31 12:28:33 +02:00
Eric Meadows-Jönsson 04e774a4ba Support interpolation in keyword list atoms
key = "foo"
    ["#{key}": :value]
2014-03-05 16:43:26 +01:00
José Valim 6a725ab91f Provide List.from_char_data! and String.from_char_data! 2014-02-23 11:04:24 +01:00
José Valim 128d82fde6 Add defstruct and allow unquoting inside maps/structs 2014-02-19 22:35:09 +01:00
José Valim da1541c791 Implement access and slightly reorganize tests 2014-02-05 16:11:53 +01:00
José Valim de71ecf195 Remove outdated default args syntax 2014-02-05 14:58:28 +01:00
José Valim ffdf3d32b2 Ensure multiple kw args with pipe 2014-02-04 22:30:51 +01:00
José Valim 1fa74df6c7 Support map updates 2014-02-04 20:54:15 +01:00
José Valim cb9c17c025 Allow %{ foo => bar } 2014-02-04 18:00:04 +01:00
José Valim 923eeb9602 Unify max_expr to avoid duplication 2014-02-04 17:22:43 +01:00
José Valim c5ff2d1dcf Basic support for maps in the grammar 2014-02-03 20:18:01 +01:00
José Valim c65dcc9b19 Refactor grammar and unify base_expr into max_expr 2014-02-03 17:52:27 +01:00
José Valim 2b12cb4a7e Remove unecessary lexical check in parser 2014-01-30 22:04:39 +01:00
José Valim 05cd7f170f Fix list with keywords expansion
The list `[1, 2, three: :four]` now correctly expands
to `[1, 2, {:three, :four}]`.
2014-01-28 20:59:07 +01:00
José Valim 0d4655d1db Generalize unary operators followed by int have higher precedence 2014-01-28 19:54:09 +01:00
José Valim fe2e4a1010 Move from // to \\ 2014-01-28 10:50:00 +01:00