tree-sitter-bash icon indicating copy to clipboard operation
tree-sitter-bash copied to clipboard

Option arguments should be treated differently

Open ObserverOfTime opened this issue 3 years ago • 0 comments

Option arguments (-foo --bar) should not be mapped to argument: (word) like other arguments.

For example, this script produces the following syntax tree:

cmake . --fresh -B build -DCMAKE_BUILD_TYPE=Release
(program
  (command
    name: (command_name
      (word))
    argument: (word)
    argument: (word)
    argument: (word)
    argument: (word)
    argument: (word)))

I think it'd be better if options were differentiated with something like this:

(program
  (command
    name: (command_name
      (word))
    argument: (word)
    (option)
    (option)
    (option  
      operator: '='
      value: (word))))

ObserverOfTime avatar Sep 09 '22 08:09 ObserverOfTime