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

bug: Problem parsing reader conditionals inside loop #36

Open
2 tasks done
richardjdare opened this issue Oct 11, 2024 · 0 comments
Open
2 tasks done

bug: Problem parsing reader conditionals inside loop #36

richardjdare opened this issue Oct 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@richardjdare
Copy link

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

tree-sitter 0.21.0-pre-release-1 (76baf8152adada3a630bba9691fadb413a8e3783)

Describe the bug

First, I just want to thank you for this great Tree-Sitter parser, it's become one of the cornerstones of my current project. But I'm having a problem parsing this piece of Common Lisp code (from a Lispworks example).

(defun update-othello-board (self &optional squares)
  (with-slots (grid game) self
    (loop for piece
          #+:Lucid in
          #+:Lucid (coerce (or squares (slot-value game 'squares)) 'list)
          #-:Lucid across
          #-:Lucid (or squares (slot-value game 'squares))
          for pinboard-object in (capi:layout-description grid)
          unless (eq (othello-square-piece pinboard-object) piece)
          do
          (setf (othello-square-piece pinboard-object) piece))))

Steps To Reproduce/Bad Parse Tree

(source [0, 0] - [11, 0]
  (ERROR [0, 0] - [11, 0]
    (defun_header [0, 1] - [0, 52]
      keyword: (defun_keyword [0, 1] - [0, 6])
      function_name: (sym_lit [0, 7] - [0, 27])
      lambda_list: (list_lit [0, 28] - [0, 52]
        value: (sym_lit [0, 29] - [0, 33])
        value: (sym_lit [0, 34] - [0, 43])
        value: (sym_lit [0, 44] - [0, 51])))
    value: (sym_lit [1, 3] - [1, 13])
    value: (list_lit [1, 14] - [1, 25]
      value: (sym_lit [1, 15] - [1, 19])
      value: (sym_lit [1, 20] - [1, 24]))
    value: (sym_lit [1, 26] - [1, 30])
    (sym_lit [2, 14] - [2, 19])
    (include_reader_macro [3, 10] - [3, 21]
      condition: (kwd_lit [3, 12] - [3, 18]
        (kwd_symbol [3, 13] - [3, 18]))
      target: (sym_lit [3, 19] - [3, 21]))))

Expected Behavior/Parse Tree

I expected to find a parse tree with no errors and 4 reader conditionals inside the loop.

Repro

No response

@richardjdare richardjdare added the bug Something isn't working label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant