Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot parse half brackets in doctests #342

Closed
singularitti opened this issue Aug 8, 2023 · 1 comment
Closed

Cannot parse half brackets in doctests #342

singularitti opened this issue Aug 8, 2023 · 1 comment

Comments

@singularitti
Copy link

For example, I have code like this:

"""
    Lattice(data::AbstractMatrix)

Construct a `Lattice` from a matrix.

!!! note
    The basis vectors of the matrix are stored as columns.

# Examples
```jldoctest
julia> Lattice([
    1.2 4.5 7.8
    2.3 5.6 8.9
    3.4 6.7 9.1
])
3×3 Lattice{Float64}
 1.2  4.5  7.8
 2.3  5.6  8.9
 3.4  6.7  9.1
```
"""

and getting errors like this:

│ Subexpression:
│ 
│ Lattice([
│ 
│ Evaluated output:
│ 
│ ERROR: syntax: incomplete: premature end of input
│ Stacktrace:
│  [1] top-level scope
│    @ none:1
│ 
│ Expected output:
│ 
│     1.2 4.5 7.8
│     2.3 5.6 8.9
│     3.4 6.7 9.1
│ ])
│ 3×3 Lattice{Float64}
│  1.2  4.5  7.8
│  2.3  5.6  8.9
│  3.4  6.7  9.1
│ 
│   diff =
│    Warning: Diff output requires color.
│        1.2 4.5 7.8
│        2.3 5.6 8.9
│        3.4 6.7 9.1
│    ])
│    3×3 Lattice{Float64}
│     1.2  4.5  7.8
│     2.3  5.6  8.9
│     3.4  6.7  9.1ERROR: syntax: incomplete: premature end of input
│    Stacktrace:
│     [1] top-level scope
│       @ none:1

Similar to #328

@c42f
Copy link
Member

c42f commented Sep 6, 2023

I don't think this is related to JuliaSyntax as this same error happens on Julia 1.8.

I think the problem is just that the indentation in the doctest is broken and you need something like the following?

julia> Lattice([
           1.2 4.5 7.8
           2.3 5.6 8.9
           3.4 6.7 9.1
       ])

@c42f c42f closed this as completed Sep 6, 2023
singularitti added a commit to MineralsCloud/CrystallographyCore.jl that referenced this issue Sep 16, 2023
singularitti added a commit to singularitti/Spglib.jl that referenced this issue Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants