question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0.13.2 missing parsing errors

See original GitHub issue

0.13.1 error on a file like this with a missing fi:

PATH_INPUT=src/in.js
PATH_OUTPUT=src/out.js

if [[ $PATH_INPUT -nt $PATH_OUTPUT ]]; then
  babel --compact false ${PATH_INPUT} > ${PATH_OUTPUT}
f

I guess this is a regression from 0.13.1? Didn’t investigate if this is due to https://github.com/tree-sitter/tree-sitter-bash/commit/6ff7fe3c7e584b7eaf6b9fb3fe952499d1dd3008

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
maxbrunsfeldcommented, Aug 6, 2018

Parsing this file with 0.13.2, I get this output:

$ tree-sitter parse test.sh 

(program [0, 0] - [6, 0]
  (variable_assignment [0, 0] - [0, 20]
    (variable_name [0, 0] - [0, 10])
    (word [0, 11] - [0, 20]))
  (variable_assignment [1, 0] - [1, 22]
    (variable_name [1, 0] - [1, 11])
    (word [1, 12] - [1, 22]))
  (if_statement [3, 0] - [6, 0]
    (test_command [3, 3] - [3, 37]
      (binary_expression [3, 6] - [3, 34]
        (simple_expansion [3, 6] - [3, 17]
          (variable_name [3, 7] - [3, 17]))
        (test_operator [3, 18] - [3, 21])
        (simple_expansion [3, 22] - [3, 34]
          (variable_name [3, 23] - [3, 34]))))
    (command [4, 2] - [4, 54]
      (command_name [4, 2] - [4, 7]
        (word [4, 2] - [4, 7]))
      (word [4, 8] - [4, 17])
      (word [4, 18] - [4, 23])
      (expansion [4, 24] - [4, 37]
        (variable_name [4, 26] - [4, 36]))
      (file_redirect [4, 38] - [4, 54]
        (expansion [4, 40] - [4, 54]
          (variable_name [4, 42] - [4, 53]))))
    (command [5, 0] - [5, 1]
      (command_name [5, 0] - [5, 1]
        (word [5, 0] - [5, 1])))))
test.sh	7 ms	MISSING fi [6, 0] - [6, 0]

The last child of the if_statement is a fi token that is “missing” (i.e. tree-sitter realized that it was missing and inserted it for error recovery). I just realized that the SyntaxNode.isMissing() method was not declared in the typescript declarations file. That is now fixed.

In bash-language-server, I’m guessing you’re probably not checking if nodes are missing. These nodes will have zero size (e.g. startPosition equals endPosition).

1reaction
maxbrunsfeldcommented, Aug 6, 2018

Another thing that might be useful is that you can check whether a parent node contains any errors of any kind using the SyntaxNode.hasError() method. This will return true of the node contains any ERROR nodes or any missing nodes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven trouble when trying to generate from WSDL file
Im trying to generate sources from a wsdl file, but I keep running into an error on my pom.xml that I believe might...
Read more >
parse-error / F0010 - Pylint 2.16.0-dev documentation
This is a message linked to an internal problem in pylint. There's nothing to change in your code. Created by the main checker....
Read more >
Help! Now getting 'Parsing Error "" is not a function' on all ...
I've tried multiple clean installs of Obsidian and Templator, and no matter what, I get the same error. I think it all started...
Read more >
Unparsable structured data report - Search Console Help
Error types ; Parsing error: Missing ',' or ']' in array declaration, Error parsing an array value: missing a comma or closing bracket...
Read more >
Version history — Pybtex User's Guide (0.24.0)
BibTeX parser now produces human-readable error messages on unread macros. Added error messages on missing data in .aux files.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found