Skip to content

Commit

Permalink
Call escape_raw_string to make parsing more predictable
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored Feb 5, 2024
1 parent 57619c2 commit 9ca429e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/stylemacro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ macro styled_str(raw_content::String)
interpolated::Ref{Bool} # whether any string interpolation occurs
errors::Vector # any errors raised during parsing
end =#

# Instead we'll just use a `NamedTuple`

# first undo the transforms of the parser (assuming the input was entered with single styled"" markers so this transform is unambiguously reversible and not as `@styled_str "."` or `styled"""."""`),
# since the `unescape_string` transforms will be a superset of those transforms
raw_content = Base.escape_raw_string(raw_content)

state = let content = unescape_string(raw_content, ('{', '}', '$', '\n', '\r'))
(; content, bytes = Vector{UInt8}(content),
s = Iterators.Stateful(pairs(content)),
Expand Down

0 comments on commit 9ca429e

Please sign in to comment.