connorlay / tree-sitter-eex

EEx grammar for Tree-sitter
9 stars 3 forks source link

Errors with expressions #9

Open rockerBOO opened 2 years ago

rockerBOO commented 2 years ago

I've been working on a html parser to work well with .html.eex files and found these errors when using this grammar.

2022-08-03_18-49

I looked at it some but I didn't make much progress as I do not understand some parts of the grammar.

So here's my test case and the resulting errors when testing.

<%= Enum.map(errors, fn error -> error end) |> Enum.join("") %>
<%= Enum.each(errors, fn error -> if error do %>error<%= end) %>
<%= Enum.each(errors, fn error -> if Map.has_key?(error,
  :email) do %><%= error.email %><%= end) %>
<%= Enum.map(errors, fn error -> if Map.has_key?(error,
  :email) do "hello" end) |> Enum.join("") %>
    (fragment
      (directive
        (partial_expression)
        (ERROR
          (UNEXPECTED 'r')
          (UNEXPECTED '|')))
      (directive
        (partial_expression)
        (ERROR
          (UNEXPECTED 'i')))
      (text)
      (directive
        (partial_expression))
      (directive
        (partial_expression)
        (ERROR
          (UNEXPECTED 'i')))
      (directive
        (expression))
      (directive
        (partial_expression))
      (directive
        (ERROR
          (partial_expression)
          (UNEXPECTED 'i')
          (UNEXPECTED '"'))
        (partial_expression))
      (text))

Willing to try and fix this. But I'm lacking on context for how it's expected to work or why it may be erroring.