Skip to content

Instantly share code, notes, and snippets.

View umanwizard's full-sized avatar

umanwizard

View GitHub Profile
// Compile with `clang++ -lclang main.cpp`
// Important:
// 1. The compile_commands.json in the node build dir should be generated with `bear`, NOT
// with the (broken) ./configure -C option.
// 2. the libclang must be from the same build as the clang that was used to build node
// 3. You will have to tweak the /gnu/store/bzzn05rblq1hnds5zq1g4nsphry1cs60-profile/bin/clang++
// path to wherever clang lives on your system.
#include <clang-c/CXCompilationDatabase.h>
#include <clang-c/CXString.h>
@umanwizard
umanwizard / optional_capgroup.rs
Last active January 22, 2020 21:42
Visitor to output the list of groups that may not exist in the output
use regex::Regex;
use regex_syntax::hir::visit;
use regex_syntax::hir::Group;
use regex_syntax::hir::GroupKind;
use regex_syntax::hir::Hir;
use regex_syntax::hir::HirKind;
use regex_syntax::hir::RepetitionKind;
use regex_syntax::hir::RepetitionRange;
use regex_syntax::hir::Visitor;