46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
import * as fs from 'fs';
|
|
import { CsoundManualParser } from './parser';
|
|
|
|
const parser = new CsoundManualParser();
|
|
const content = fs.readFileSync('downloaded-opcodes/moogladder.md', 'utf-8');
|
|
|
|
console.log('=== Testing moogladder.md ===\n');
|
|
|
|
// Test extractSection
|
|
const syntaxSection = parser.extractSection(content, 'Syntax');
|
|
console.log('Syntax section length:', syntaxSection.length);
|
|
console.log('First 200 chars:', syntaxSection.substring(0, 200));
|
|
console.log('\n---\n');
|
|
|
|
// Look for ### Initialization
|
|
const initMatch = syntaxSection.match(/###\s+Initialization\s*\n([\s\S]*?)(?=\n###|\n##|$)/i);
|
|
console.log('Initialization match:', initMatch ? 'FOUND' : 'NOT FOUND');
|
|
if (initMatch) {
|
|
console.log('Init section content (first 300 chars):');
|
|
console.log(initMatch[1].substring(0, 300));
|
|
console.log('\n---\n');
|
|
|
|
// Test the parameter regex
|
|
const paramRegex = /_([a-zA-Z0-9_,\s/]+)_\s*[-–—]+\s*([^\n]+(?:\n(?!_)[^\n]+)*)/g;
|
|
const params = Array.from(initMatch[1].matchAll(paramRegex));
|
|
console.log(`Found ${params.length} parameters`);
|
|
params.forEach((p, i) => {
|
|
console.log(` Param ${i + 1}: name="${p[1]}", desc="${p[2].substring(0, 60)}..."`);
|
|
});
|
|
}
|
|
|
|
// Test extractParameters directly
|
|
const initParams = parser.extractParameters(content, 'Initialization');
|
|
const perfParams = parser.extractParameters(content, 'Performance');
|
|
|
|
console.log('\n=== extractParameters results ===');
|
|
console.log(`Initialization params: ${initParams.length}`);
|
|
initParams.forEach(p => {
|
|
console.log(` - ${p.name}: ${p.description.substring(0, 60)}...`);
|
|
});
|
|
|
|
console.log(`\nPerformance params: ${perfParams.length}`);
|
|
perfParams.forEach(p => {
|
|
console.log(` - ${p.name}: ${p.description.substring(0, 60)}...`);
|
|
});
|