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

feat(ocaml): Add OCaml queries #723

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

beajeanm
Copy link

@beajeanm beajeanm commented Dec 8, 2024

I'm a treesitter queries newbie, so I'd appreciate the feedback on these queries.

This is an example of syntactically correct ocaml I used to test them:

let example_function param1 param2 = param1 + param2

class example_object =
  object (self)
    method do_stuff x = raise Not_found
  end

(* This is a comment. *)

let some_loops () =
  for variable = start_value to end_value do
    expression
  done;
  while boolean - condition do
    expression
  done

let conditionals () =
  let if_condition = if a then b else c in
  let match_cases = match a with b -> 1 | c -> 2 in
  let function_expression = function b -> 1 | c -> 2 in
  ()

let test_call =
  (* A function call, followed by 3 arguments. *)
  String.fold (fun a b -> a) 0 xs

let some_blocks =
  let begin_block = begin
    let inner_block = a in
    b
    end
  in
  let paren_block =
    (
      let inner_block = a in
      b
    )
  in c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant