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
José Valim
aa4a38bccc
No longer allow empty access as in [][]
2014-07-16 17:54:26 +02:00
José Valim
ecdcfaeda1
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
José Valim
ec94c93b24
Remove ** from operators list for now
2014-01-20 12:24:22 +01:00
José Valim
f671e1204c
Change precedence of <- to be the same as other generators
2014-01-16 20:08:55 +01:00
José Valim
53b68887b6
Invert the precedence of | and when
...
Although this adds some drawbacks when it comes to typespecs,
it prepares us for when we have named patterns.
2014-01-11 16:52:46 +01:00
José Valim
96a1628033
Unify precedence of ++, --, **, .., <> ops
2014-01-09 01:06:34 +01:00
José Valim
ade26dedd8
Work on Elixir expressions rather than forms
2013-12-28 11:47:44 +01:00
José Valim
51aef55c83
Change how -> is represented in the AST
...
The previous representation was very hard to compose
and very often required the AST nodes to be created
manually.
The current approach is easier to compose because
the node is represented as any other operator as long
as it is wrapped in parentheses.
For example, imagine we have pairs of patterns and
the code to be executed for that pattern, and we want
to inject them into a case. It can now be writen as:
pairs = Enum.map pairs, fn { pattern, expr } ->
quote do: (unquote(pattern) -> unquote(expr))
end
quote do
case unquote(condition), do: unquote(pairs)
end
Compare to the previous implementation:
pairs = Enum.map pairs, fn { pattern, expr } ->
{ [pattern], [], expr }
end
pairs = { :->, [], pairs }
quote do
case unquote(condition), do: unquote(pairs)
end
2013-12-23 16:10:33 +01:00
Eric Meadows-Jonsson
a711bef57f
Dont require [] for keyword list operand in when/2
2013-12-13 13:12:25 +01:00
José Valim
f62c26b9b6
Ensure record aliases in the same quote can be accessed, closes #1915
...
This commit also simplifies macro expansion for both imports and aliases
to always give higher preference to the macro environment rather than
the caller one, if such is available. The deal is to simplify both the
code and understanding of how macros work.
2013-12-07 20:01:11 +01:00
Eric Meadows-Jonsson
f125d19854
Move typespec guards to end of spec
...
Moves precedence of `when` to be lower than `::`.
2013-11-11 10:08:24 +01:00
José Valim
0171e201fb
Move parsing from elixir_interpolations to elixir_parser
2013-10-26 13:46:01 +02:00
José Valim
0b3c91bf6d
Do not wrap fn -> end in do keyword
...
The previous AST came from the fact `fn -> end` was a shortcut
for `function do ... end`. But now since the original no longer
exists, it seems saner to update `fn -> end` AST.
2013-10-24 22:38:25 +02:00
José Valim
997a0857c3
Avoid flattening in access[...], closes #1763
2013-10-18 14:54:49 +02:00