Commit graph

16 commits

Author SHA1 Message Date
Anton-4
59ab438c1e
misc improvements 2024-03-26 16:38:09 +01:00
Richard Feldman
40fba2f1af
Fix parsing strings with non-interpolated "$" 2024-01-27 16:28:01 -05:00
Richard Feldman
443b3c8851
Fix single-quote dollar parsing 2024-01-13 15:41:35 -05:00
Richard Feldman
af8e9c7292
Parse deprecated interpolation syntax differently 2024-01-06 21:49:00 -05:00
Richard Feldman
25be487977
Add $(...) string interpolation syntax 2024-01-06 15:04:22 -05:00
Joshua Warner
0b8e68f70d
Fix approximately a bajillion fmt and parsing bugs
(discovered by fuzzing)

There's more to come, but this seems like a good batch for now.
2023-01-13 18:20:44 -08:00
Joshua Warner
94070e8ba6
Improve parsing of scalar literals
* Unify parsing of string literals and scalar literals, to (e.g.) ensure escapes are handled uniformly. Notably, this makes unicode escapes valid in scalar literals.
* Add a variety of custom error messages about specific failure cases of parsing string/scalar literals. For example, if we're expecting a string (e.g. a package name in the header) and the user tried using single quotes, give a clear message about that.
* Fix formatting of unicode escapes (they previously used {}, now correctly use () to match roc strings)
2023-01-07 15:12:52 -08:00
Joshua Warner
2d9aba2242
Refactor parser methods to not return State as part of ParseError
As previously discovered with #4464, it's easy to accidentally mis-use the State value returned on the Err path.

There were mixed assumptions about what that State represents: (1) the State where the error occurred, or (2) the State at the beginning of the thing we were just parsing.

I fixed this up to always mean (2) - at which point we don't actually need to return the State at all - so it's impossible for further discrepency to creep in.

I also took the liberty to refactor a few more methods to be purely combinator-based, rather than calling `parse` directly.
2022-11-18 19:52:23 -05:00
Folkert
134de80150
various updates 2022-11-03 17:18:27 +01:00
Joshua Warner
07be8ec000
Refactor Parser trait to pass min_indent
This removes the need to explicitly pass thru min_indent when using the parser combinators.

My ultimate goal here is to evolve the current parser closer toward a purely combinator-based parser,
at which point we can more easily transition smoothly to a formal(ish) grammar, or expand the meanings of combinators
to include things like:
* Incremental (re)parsing
* Unified parsing and formatting code
* Better error recovery
* Using the main parser directly for syntax highlighting
2022-10-31 13:31:47 -07:00
Joshua Warner
a579edc6f0 Fix error reporting location for unterminated strings and add test for insufficiently indented multiline strings 2022-07-25 19:07:58 -07:00
Joshua Warner
92a9570384 Remove indents from multiline strings 2022-07-25 06:52:08 -07:00
Joshua Warner
31455f5fbd Remove first newline and indent from string 2022-07-20 19:20:48 -07:00
Joshua Warner
a1512dfd79 Introduce State::advance_mut and State::consume_mut to simplify things 2022-07-19 19:20:38 -07:00
Joshua Warner
7a594901dd Refactor: inline simple advance_state macro 2022-07-19 17:01:33 -07:00
Anton-4
eee85fa45d
moved all crates into seperate folder + related path fixes 2022-07-01 17:37:43 +02:00
Renamed from compiler/parse/src/string_literal.rs (Browse further)