Commit Graph
86 Commits
Author SHA1 Message Date
José Valim 54321de136 Update bidi/line break character checks according to UX#55 2025-08-31 10:56:33 +02:00
José Valim 4b48982da1 Remove incorrect about incorrect usage of \x in strings
Their usage in Elixir v1.0 was always semantically wrong,
which became deprecation warnings in v1.1 to avoid crashes.
Any software relying on this feature both emits warnings
and invalid strings.

Closes #14660.
2025-07-20 18:22:59 +02:00
Jonatan Männchen e1d171e5c7 Add inline License / Copyright to Erlang files (#14255) 2025-02-05 13:50:00 +01:00
José Valim 8eba863f8f Properly track stab inside container_cursor_to_quoted, closes #13826 2024-11-25 14:46:23 +01:00
José Valim 09c602d10e Properly parse quoted identifiers in function calls 2024-06-05 12:03:56 +02:00
José Valim d7ea2fa2e4 Handle cursor completion inside fn/rescue/catch/else/after 2024-05-14 17:04:57 +02:00
José Valim dab3d22993 Deprecate escaping closing delimiter in uppercase sigils
This aligns our uppercase sigils with Erlang/OTP 27.
2024-02-24 20:05:10 +01:00
José Valim 55cd5a4a22 Revert "Do not escape \ in uppercase sigils, closes #8989"
This reverts commit 51d23cbba8
due to a regression.

Closes #13262.
2024-01-17 23:28:21 +01:00
José Valim 7f3d62108b Consider column in snippets, closes #13199 2023-12-21 19:26:06 +01:00
José Valim 51d23cbba8 Do not escape \ in uppercase sigils, closes #8989 2023-11-13 11:53:44 +01:00
Vinícius Müller 0349240827 Add MistmatchedDelimiterError (#12918) 2023-09-12 12:18:51 +02:00
Zach Allaun 2d65a4613b Fix column count when tokenizing escaped interpolations (#12504) 2023-03-30 22:24:23 +02:00
José Valim 03ffc663e7 Add autocompletion of binary modifiers in IEx
Macro.path/2 was added as a helper function for
traversing expressions and returning their context.
2022-07-09 17:06:04 +02:00
José Valim d994415ac8 Return proper syntax error on incomplete escape char in string, closes #11813 2022-05-11 12:05:30 +02:00
José Valim 5bb9633273 Reject bidirectional formatting characters (#11391) 2021-11-15 21:08:37 +01:00
José Valim a1b7ecc259 Support escaping of terminators in uppercase sigils heredocs for consistency, closes #11390 2021-11-15 14:21:12 +01:00
José Valim e480151fe7 Add Code.Fragment.container_cursor_to_quoted/2 (#11315) 2021-10-16 15:12:09 +02:00
José Valim f05ac0a9a4 Improve docs and remove unnecessary field 2021-10-06 21:28:07 +02:00
José Valim 86619b3709 Also handle nfd at the beginning of strings 2021-09-06 23:00:06 +02:00
Willian Frantz e6d194e3a6 Fix nfd cluster columns (#11231) 2021-09-06 22:50:32 +02:00
José Valim 46bd3d57d9 Add operator handling to Code.cursor_context 2021-07-21 18:59:43 +02:00
José Valim 9f37c811b2 Move parser tests to its own file and clean up private API 2021-03-20 11:20:37 +01:00
José Valim 944fae1a91 Allow heredoc inside heredoc interpolation
Closes #10698
2021-03-10 16:03:24 +01:00
José Valim d3eb1b42dd Add :newline to unescape_map 2021-03-10 12:30:29 +01:00
José Valim d62188f8fe Raise correct error message for incomplete interpolation in heredoc, closes #9252 2019-07-30 18:36:41 +02:00
José Valim 52578ff2ac Nest all terminator metadata under :end key 2019-05-09 10:28:18 +02:00
Eksperimental 266caa2f2f Use "code point" instead of "codepoint" (#8774)
That's the term it is used in the Unicode standard.
2019-02-06 11:21:03 +01:00
José Valim fc8de8a440 Warn on unnecessary quotes (#7838) 2018-07-10 10:27:02 +02:00
Adrian Cruz a182da0716 Return error on bad hex escaping (#7809)
As discussed in #7270, it would help if we return error tuples
instead of exceptions. This PR does it for string unescaping.
2018-07-03 12:03:43 +02:00
José Valim 216d6d6edf Add hints on mismatched do/end and others pairs
When you are working on large files and you add new code,
you may forget to add a `do` or an `end`. In those cases,
the error message usually points to the first `do` or the
last `end` in the file, which are usually far away from
the source of the error.

This pull request adds a simple heuristic based on the
indentation of the tokens, to try to provide hints of
where the source may be. Those hints are not deterministic
but they may be able to point users to the source of the
problem.

For example, in this case:

    defmodule MyApp do
      def one do
      # end

      def two do
      end
    end

we know that we now that `def two do` is happening on the
same indentation as `def one do`, which may mean that
`def one do` was not closed properly. We store this as a
hint in case the terminators do not match later.

Similarly, in the case below:

    defmodule MyApp do
      def one
      end

      def two do
      end
    end

The `end` on line 3 will end-up closing the defmodule `do`,
on line 1. Because their indentation do not match, it may
be that there is a missing `do`, where the `end` was supposed
to align.

Some basic testing show those heuristics work on the majority
of the cases, but we will only be sure when we have enough
feedback from the community.
2018-06-10 13:55:49 +02:00
José Valim 703e3000a6 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 566db02f73 Preserve escaped new lines in formatter, closes #6861 2017-10-11 13:18:49 +02:00
José Valim 25e6e268b6 Add end_line to interpolation 2017-10-05 19:00:37 +02:00
José Valim c1bd106613 Rely on side effects for preserving comments
The previous implementation would not lead to parsing
errors in interpolations since code inside interpolation
is parsed immediately.
2017-10-05 13:27:25 +02:00
José Valim 61903399f4 Do not unescape interpolation 2017-08-28 14:17:12 +02:00
Andrea Leopardi db65e4a6ab 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
José Valim d24cad38fb Add Code.Identifier to hold shared identifier logic throughout Elixir 2017-08-22 13:22:26 +02:00
José Valim 7437778b18 Move tokenizer macros to tokenizer 2017-02-15 23:05:02 +01:00
Pedro Medeiros 3016cdb69b Fix some exported from case from erlang source (#5214)
Some erlang code were emiting a warning message when some
variables were defined inside the case statement.
2016-09-14 13:45:32 +02:00
José Valim c14a05f73d Update TODOs and CHANGELOG
* Functionality won't be removed before v2.0
  * Features soft-deprecated in Elixir v1.2 will warn on v1.4
  * Features soft-deprecated in Elixir v1.3 will warn on v1.5
2016-06-02 21:21:24 +02:00
eksperimental bc8c2a55e9 Standardize unicode and friends (#4569)
* Unicode is a proper noun, so it should be capitalized

* Replace 'char data' with 'chardata'

* Correct use of a/an articles
2016-05-05 09:21:05 +02:00
eksperimental 685e87bdf0 Formmating: Add white space around vertical bar (#4507) 2016-04-25 00:55:49 +02:00
eksperimental ba111fb9b3 Formatting: add white space after comma (#4491)
Standardizes the use of comma leaving a white space after it whenever applicable.

Note: It does not enforce this in quantifiers in regular expressions such as in: `x{1,3}`
2016-04-19 01:23:50 +02:00
José Valim 0db65a9615 Spell out our deprecation policy 2016-04-03 13:52:15 +02:00
José Valim 7ec6c529c9 Update TODOs 2016-04-03 13:00:48 +02:00
Daniel Perez cf359c0e69 Do not escape new line when interpolation is disabled. Fix #4209. 2016-02-29 01:36:16 +09:00
José Valim 5d4ce1aaeb Control escaping of unicode sequences with ?u 2016-01-15 14:05:40 +01:00
José Valim fe14caeacc Deprecate soft-deprecated functionality 2016-01-02 11:04:21 +01:00
José Valim 664ff1a89a Support \u in strings and char lists for unicode mapping 2015-08-16 18:32:29 +02:00
eksperimental f9bcdd5c1c Add space after comma: Format consistently 2015-03-17 22:55:27 +07:00