Skip to content

macro internal error when input ends with an escaped sequence #35

@vtjnash

Description

@vtjnash
julia> styled"\\\n"
ERROR: LoadError: MethodError: no method matching lastindex(::Nothing)
The function `lastindex` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  lastindex(::Any, !Matched::Any)
   @ Base abstractarray.jl:427
  lastindex(!Matched::Base64.Buffer)
   @ Base64 ~/julia/usr/share/julia/stdlib/v1.11/Base64/src/buffer.jl:19
  lastindex(!Matched::LazyString)
   @ Base strings/lazy.jl:93
  ...

Stacktrace:
 [1] last(a::Nothing)
   @ Base ./abstractarray.jl:527
 [2] (::StyledStrings.var"#escaped!#44")(state::@NamedTuple{…}, i::Int64, char::Char)
   @ StyledStrings ~/julia/usr/share/julia/stdlib/v1.11/StyledStrings/src/stylemacro.jl:218
 [3] (::StyledStrings.var"#run_state_machine!#66"{…})(state::@NamedTuple{…})
   @ StyledStrings ~/julia/usr/share/julia/stdlib/v1.11/StyledStrings/src/stylemacro.jl:641
 [4] var"@styled_str"(__source__::LineNumberNode, __module__::Module, raw_content::String)
   @ StyledStrings ~/julia/usr/share/julia/stdlib/v1.11/StyledStrings/src/stylemacro.jl:669
in expression starting at REPL[8]:1
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions