FallenAngel97 / tree-sitter-rego

https://decodeapps.pp.ua/blog/post/rego-treesitter
MIT License
11 stars 6 forks source link

Parsing error - union #8

Open krzykli opened 1 year ago

krzykli commented 1 year ago

Repro case

package test.block

a := {1, 2, 3}
b := {4, 5, 6}
c := a | b

(MISSING "null") in the last rule

(source_file
  (module
    (package)
    (ref
      (var)
      (ref_arg
        (ref_arg_dot
          (var))))
    (policy
      (rule
        (rule_head
          (var))
        (rule_body
          (assignment)
          (term
            (ref
              (set
                (non_empty_set
                  (open_curly)
                  (term
                    (scalar
                      (number)))
                  (term
                    (scalar
                      (number)))
                  (term
                    (scalar
                      (number)))
                  (close_curly)))))))
      (rule
        (rule_head
          (var))
        (rule_body
          (assignment)
          (term
            (ref
              (set
                (non_empty_set
                  (open_curly)
                  (term
                    (scalar
                      (number)))
                  (term
                    (scalar
                      (number)))
                  (term
                    (scalar
                      (number)))
                  (close_curly)))))))
      (rule
        (rule_head
          (var))
        (rule_body
          (assignment)
          (term
            (ref
              (var))))
        (rule_body
          (literal
            (expr
              (expr_infix
                (expr
                  (term
                    (scalar
                      (MISSING "null"))))
                (infix_operator
                  (bin_operator))
                (expr
                  (term
                    (ref
                      (var))))))))))))
RmStorm commented 1 year ago

I'm not sure if the c := a | b notation is a synonym for the object.union(a, b) operation but that one is also not properly recognized. :sweat_smile: