From 4c3e1ce7822a9acd3444b954d0bdbccade603c38 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Thu, 22 Jan 2026 01:59:17 +0100 Subject: Add C++ grammar --- tests/test.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/test.cpp (limited to 'tests') diff --git a/tests/test.cpp b/tests/test.cpp new file mode 100644 index 0000000..5538ba8 --- /dev/null +++ b/tests/test.cpp @@ -0,0 +1,32 @@ +#include +#include + +namespace my_namespace { + void namespaced_function() { + std::cout << "Namespaced function" << std::endl; + } + + class MyClass { + public: + void myMethod() { + std::cout << "Method inside class" << std::endl; + } + }; +} + +struct MyStruct { + int x; + void structMethod() { + std::cout << "Method inside struct" << std::endl; + } +}; + +void global_hello() { + std::cout << "Global hello" << std::endl; +} + +int main() { + global_hello(); + my_namespace::namespaced_function(); + return 0; +} -- cgit v1.2.3