queries
c.h c.scm cpp.h cpp.scm cuda.h cuda.scm glsl.h glsl.scm go.h go.scm javascript.h javascript.scm kotlin.h kotlin.scm lua.h lua.scm odin.h odin.scm php.h php.scm python.h python.scm rust.h rust.scm tcl.h tcl.scm zig.h zig.scmtests
test.c test.cpp test.cu test.cuh test.glsl test.go test.js test.kt test.lua test.odin test.php test.py test.rs test.tcl test.zigvendor
tree-sitter
lib
src
alloc.c alloc.h array.h atomic.h clock.h error_costs.h get_changed_ranges.c get_changed_ranges.h host.h language.c language.h length.h lexer.c lexer.h lib.c node.c parser.c point.h query.c reduce_action.h reusable_node.h stack.c stack.h subtree.c subtree.h tree.c tree.h tree_cursor.c tree_cursor.h unicode.h
tests/test.cpp
raw
1#include <iostream>
2#include <string>
3
4namespace my_namespace {
5 void namespaced_function() {
6 std::cout << "Namespaced function" << std::endl;
7 }
8
9 class MyClass {
10 public:
11 void myMethod() {
12 std::cout << "Method inside class" << std::endl;
13 }
14 };
15}
16
17struct MyStruct {
18 int x;
19 void structMethod() {
20 std::cout << "Method inside struct" << std::endl;
21 }
22};
23
24void global_hello() {
25 std::cout << "Global hello" << std::endl;
26}
27
28int main() {
29 global_hello();
30 my_namespace::namespaced_function();
31 return 0;
32}