Arma/DayZ config parser
npm install @bis-toolkit/cppparserParser for Arma/DayZ config.cpp and RVMat files.
Part of the BIS Toolkit TypeScript monorepo.
#define, #ifdef/#ifndef, #include (only for node.js)``bash`
npm install @bis-toolkit/cppparser
From the monorepo root for development:
`bash`
npm install
npm run build
Parse an already-loaded string:
`typescript
import { Parser } from '@bis-toolkit/cppparser';
const source = 'class MyClass { value = 42; };';
const ast = new Parser(source, 'inline').parse();
console.log(ast.statements.length);
`
Preprocess and parse a config.cpp from disk:
`typescript
import { Parser, Preprocessor } from '@bis-toolkit/cppparser';
import { join } from 'path';
const configPath = join(process.cwd(), 'config.cpp');
const pre = new Preprocessor();
const text = pre.preprocess(configPath);
const ast = new Parser(text, configPath).parse();
console.log(Statements: ${ast.statements.length});``
GPLv3 © Alpine Labs - see LICENSE.