From 6ccc1d11c8b99d86537a1a7aa54fe3f6d37696ce Mon Sep 17 00:00:00 2001 From: Caleb White Date: Thu, 8 Feb 2024 21:46:16 -0600 Subject: [PATCH] chore: document preferred language for scanner --- docs/section-3-creating-parsers.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/section-3-creating-parsers.md b/docs/section-3-creating-parsers.md index 7ff0ae96..dd6ef102 100644 --- a/docs/section-3-creating-parsers.md +++ b/docs/section-3-creating-parsers.md @@ -626,6 +626,9 @@ grammar({ Then, add another C or C++ source file to your project. Currently, its path must be `src/scanner.c` or `src/scanner.cc` for the CLI to recognize it. Be sure to add this file to the `sources` section of your `binding.gyp` file so that it will be included when your project is compiled by Node.js and uncomment the appropriate block in your `bindings/rust/build.rs` file so that it will be included in your Rust crate. +> **Note** +> While it is possible to write an external scanner in C++, it can be difficult to get working cross-platform and introduces extra requirements; therefore it is *greatly* preferred to use C. + In this new source file, define an [`enum`][enum] type containing the names of all of your external tokens. The ordering of this enum must match the order in your grammar's `externals` array; the actual names do not matter. ```c