Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 187080b

Browse files
committed
git rid of c-bindings artifacts
1 parent 043be54 commit 187080b

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ All node classes fully match node structs of the original Rust implementation. Y
5757
+ Clone the repo
5858
+ Set environment variables:
5959
+ `TARGET` (e.g. `export TARGET=x86_64-apple-darwin`, no default value)
60-
+ `CC` (e.g. `gcc`)
60+
+ `CXX` (e.g. `g++`)
6161
+ `BUILD_ENV` (`debug` or `release`, `debug` is the default value)
6262
+ run `make tests/run` to run tests
6363
+ run `make libruby_parser_cpp.a` (or `make libruby_parser_cpp.lib` for MSVC) to get a static library
@@ -66,8 +66,8 @@ All node classes fully match node structs of the original Rust implementation. Y
6666
# Structure
6767
6868
+ Each directory has its own `build.mk` file that is included my the main `Makefile`
69-
+ Rust parser with basic C bindings is located under `ruby-parser-c`.
70-
+ Actual C bindings are located in `*.{h, c}` files in the root directory
69+
+ Rust parser with basic C++ bindings is located under `ruby-parser-cpp`.
70+
+ Actual C++ bindings are located in `*.{hpp, cpp}` files in the root directory
7171
+ `scripts` directory contains per-triplet additional configurations for `make`
7272
+ `codegen` directory is a Rust micro-library that does code generation
73-
+ `benchmark` directory contains a set of scripts to compare performance of Rust vs C vs Ripper
73+
+ `benchmark` directory contains a set of scripts to compare performance of Rust vs C++ vs Ripper

codegen/build.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ nodes.hpp: $(CODEGEN_DEPS)
2121
$(DO_CODEGEN)
2222
CLEAN += nodes.hpp
2323

24-
ruby-parser-c/src/node.rs: $(CODEGEN_DEPS)
24+
ruby-parser-cpp/src/node.rs: $(CODEGEN_DEPS)
2525
$(DO_CODEGEN)
26-
CLEAN += ruby-parser-c/src/node.rs
26+
CLEAN += ruby-parser-cpp/src/node.rs
2727

28-
ruby-parser-c/src/message.rs: $(CODEGEN_DEPS)
28+
ruby-parser-cpp/src/message.rs: $(CODEGEN_DEPS)
2929
$(DO_CODEGEN)
30-
CLEAN += ruby-parser-c/src/message.rs
30+
CLEAN += ruby-parser-cpp/src/message.rs
3131

3232
# token_id.hpp codegen
3333
DO_CODEGEN_TOKEN_IDS = cargo run --example build_token_ids --manifest-path codegen/Cargo.toml

codegen/codegen/messages.hpp.liquid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace lib_ruby_parser
1414
{
1515
public:
1616
{%- if message.fields.size == 0 %}
17-
// dummy byte (zero-sized structs are no allowed in C)
17+
// dummy byte (zero-sized classes are not allowed in C++)
1818
uint8_t dummy;
1919
{%- endif %}
2020

ruby-parser-cpp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ crate-type = ["staticlib"]
1111
[features]
1212
default = []
1313

14-
# Include test APIs to run C tests
14+
# Include test APIs to run C++ tests
1515
tests = []
1616

1717
[dependencies]

ruby-parser-cpp/build.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ RUST_SRCS = $(wildcard ruby-parser-cpp/src/*.rs)
22
RUST_SRCS += ruby-parser-cpp/src/node.rs
33
RUST_SRCS += ruby-parser-cpp/src/message.rs
44

5-
ruby-parser-cpp/lib_ruby_parser_cpp.$(A): $(RUST_SRCS)
5+
ruby-parser-cpp/lib_ruby_parser_cpp.$(A): $(RUST_SRCS) ruby-parser-cpp/src/message.rs ruby-parser-cpp/src/node.rs
66
RUSTFLAGS="$(RUSTFLAGS)" cargo build $(CARGOFLAGS) --manifest-path ruby-parser-cpp/Cargo.toml
77
ls -l ruby-parser-cpp/target/$(TARGET)
88
ls -l ruby-parser-cpp/target/$(TARGET)/$(RUST_ENV)

tests/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C"
2727
int main()
2828
{
2929
lib_ruby_parser__test__print_build_info();
30-
std::cerr << "C build info:\n";
30+
std::cerr << "C++ build info:\n";
3131
std::cerr << "sizeof(size_t): " << sizeof(size_t) << "\n";
3232
std::cerr << "sizeof(void*): " << sizeof(void *) << "\n";
3333
std::cerr << "\n";

0 commit comments

Comments
 (0)