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: fails to parse JSX string property that contains URL #320

Open
1 of 2 tasks
scarf005 opened this issue Dec 5, 2024 · 0 comments
Open
1 of 2 tasks

bug: fails to parse JSX string property that contains URL #320

scarf005 opened this issue Dec 5, 2024 · 0 comments
Labels

Comments

@scarf005
Copy link

scarf005 commented Dec 5, 2024

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 of tree-sitter-typescript

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

No response

Describe the bug

this parses correctly:

"https://fonts.googleapis.com/css2?family=Herr+Von+Muellerhoff&family=La+Belle+Aurore&family=Nothing+You+Could+Do&display=block"

this results in error:

import React from "react"

const MyDocument = () => <a href="https://fonts.googleapis.com/css2?family=Herr+Von+Muellerhoff&family=La+Belle+Aurore&family=Nothing+You+Could+Do&display=block" />

Steps To Reproduce/Bad Parse Tree

import React from "react"

const MyDocument = () => <a href="https://fonts.googleapis.com/css2?family=Herr+Von+Muellerhoff&family=La+Belle+Aurore&family=Nothing+You+Could+Do&display=block" />

image

[program](https://tree-sitter.github.io/tree-sitter/playground#) [0, 0] - [3, 0]
  [import_statement](https://tree-sitter.github.io/tree-sitter/playground#) [0, 0] - [0, 25]
    [import_clause](https://tree-sitter.github.io/tree-sitter/playground#) [0, 7] - [0, 12]
      [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [0, 7] - [0, 12]
    source: [string](https://tree-sitter.github.io/tree-sitter/playground#) [0, 18] - [0, 25]
      [string_fragment](https://tree-sitter.github.io/tree-sitter/playground#) [0, 19] - [0, 24]
  [lexical_declaration](https://tree-sitter.github.io/tree-sitter/playground#) [2, 0] - [2, 164]
    [variable_declarator](https://tree-sitter.github.io/tree-sitter/playground#) [2, 6] - [2, 164]
      name: [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 6] - [2, 16]
      value: [arrow_function](https://tree-sitter.github.io/tree-sitter/playground#) [2, 19] - [2, 164]
        parameters: [formal_parameters](https://tree-sitter.github.io/tree-sitter/playground#) [2, 19] - [2, 21]
        body: [jsx_self_closing_element](https://tree-sitter.github.io/tree-sitter/playground#) [2, 25] - [2, 164]
          name: [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 26] - [2, 27]
          attribute: [jsx_attribute](https://tree-sitter.github.io/tree-sitter/playground#) [2, 28] - [2, 161]
            [property_identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 28] - [2, 32]
            [string](https://tree-sitter.github.io/tree-sitter/playground#) [2, 33] - [2, 161]
              [string_fragment](https://tree-sitter.github.io/tree-sitter/playground#) [2, 34] - [2, 95]
              [ERROR](https://tree-sitter.github.io/tree-sitter/playground#) [2, 95] - [2, 160]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 96] - [2, 102]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 103] - [2, 105]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 106] - [2, 111]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 112] - [2, 118]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 119] - [2, 125]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 126] - [2, 133]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 134] - [2, 137]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 138] - [2, 143]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 144] - [2, 146]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 147] - [2, 154]
                [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 155] - [2, 160]

Expected Behavior/Parse Tree

syntax is parsed correctly.

Repro

https://www.typescriptlang.org/play/?ssl=1&ssc=26&pln=1&pc=1#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgIilQ3wChS0IA7AZ3gFkBPAEQjQFcQkr4BeOABQBKOLwB8cADwo4ACyKZe+WTBhgaALgD0WzNRg0AdAHMIEYwBtUYYEcogtaGjQBMAfkwoQwC414AJJCgoAGoANWoQ+nYkCysoWQhMTAAyT29fXgAZFBCAIVirEIBBdhwiNK8fPwA5CBhZYCpjEIBNCHYQgGEOiwATENYUvtswCxQ-ACMLNgBrfDgtMSA
@scarf005 scarf005 added the bug label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant