Cleaning the codebase a tiny bit
This commit is contained in:
@ -1,45 +0,0 @@
|
||||
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)}...`);
|
||||
});
|
||||
@ -1,30 +0,0 @@
|
||||
import * as fs from 'fs';
|
||||
|
||||
const content = fs.readFileSync('downloaded-opcodes/moogladder.md', 'utf-8');
|
||||
|
||||
console.log('Full content length:', content.length);
|
||||
console.log('\n=== Testing extractSection regex ===\n');
|
||||
|
||||
const regex = /##\s+Syntax\s*\n([\s\S]*?)(?=\n##|$)/i;
|
||||
const match = content.match(regex);
|
||||
|
||||
if (match) {
|
||||
console.log('Match found!');
|
||||
console.log('Captured content length:', match[1].length);
|
||||
console.log('\nFull captured content:');
|
||||
console.log('---START---');
|
||||
console.log(match[1]);
|
||||
console.log('---END---');
|
||||
} else {
|
||||
console.log('No match found');
|
||||
}
|
||||
|
||||
// Also check what comes after
|
||||
const syntaxIndex = content.indexOf('## Syntax');
|
||||
const examplesIndex = content.indexOf('## Examples');
|
||||
console.log('\n=== Indices ===');
|
||||
console.log('## Syntax at:', syntaxIndex);
|
||||
console.log('## Examples at:', examplesIndex);
|
||||
console.log('Distance:', examplesIndex - syntaxIndex);
|
||||
console.log('\nContent between (first 500 chars):');
|
||||
console.log(content.substring(syntaxIndex, syntaxIndex + 500));
|
||||
@ -1,71 +0,0 @@
|
||||
import {
|
||||
allCsoundReferences,
|
||||
getCsoundReference,
|
||||
getCsoundReferencesByCategory
|
||||
} from '../../src/lib/csound-reference/csoundReference';
|
||||
|
||||
console.log('='.repeat(60));
|
||||
console.log('Csound Reference Output Test');
|
||||
console.log('='.repeat(60));
|
||||
|
||||
console.log(`\nTotal opcodes: ${allCsoundReferences.length}`);
|
||||
|
||||
console.log('\n--- Testing getCsoundReference() ---');
|
||||
const oscil = getCsoundReference('oscil');
|
||||
if (oscil) {
|
||||
console.log(`\nFound oscil:`);
|
||||
console.log(` Name: ${oscil.name}`);
|
||||
console.log(` Category: ${oscil.category}`);
|
||||
console.log(` Description: ${oscil.description.substring(0, 80)}...`);
|
||||
console.log(` Syntax: ${oscil.syntax?.substring(0, 80)}...`);
|
||||
console.log(` Rates: ${oscil.rates?.join(', ')}`);
|
||||
console.log(` Parameters: ${oscil.parameters?.length || 0}`);
|
||||
}
|
||||
|
||||
const moogladder = getCsoundReference('moogladder');
|
||||
if (moogladder) {
|
||||
console.log(`\nFound moogladder:`);
|
||||
console.log(` Name: ${moogladder.name}`);
|
||||
console.log(` Category: ${moogladder.category}`);
|
||||
console.log(` Description: ${moogladder.description}`);
|
||||
console.log(` Syntax: ${moogladder.syntax?.substring(0, 100)}...`);
|
||||
console.log(` Rates: ${moogladder.rates?.join(', ')}`);
|
||||
console.log(` Parameters: ${moogladder.parameters?.length || 0}`);
|
||||
if (moogladder.parameters) {
|
||||
console.log(` Parameters detail:`);
|
||||
moogladder.parameters.forEach(p => {
|
||||
console.log(` - ${p.name} (${p.type}): ${p.description.substring(0, 60)}...`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
console.log('\n--- Testing getCsoundReferencesByCategory() ---');
|
||||
const oscillators = getCsoundReferencesByCategory('Signal Generators:Basic Oscillators');
|
||||
console.log(`\nBasic Oscillators (${oscillators.length} opcodes):`);
|
||||
oscillators.slice(0, 5).forEach(op => {
|
||||
console.log(` - ${op.name}: ${op.description.substring(0, 60)}...`);
|
||||
});
|
||||
|
||||
console.log('\n--- Sample categories ---');
|
||||
const categories = new Set(allCsoundReferences.map(ref => ref.category));
|
||||
const categoryArray = Array.from(categories).sort();
|
||||
console.log(`\nTotal categories: ${categories.size}`);
|
||||
console.log('First 10 categories:');
|
||||
categoryArray.slice(0, 10).forEach(cat => {
|
||||
const count = allCsoundReferences.filter(r => r.category === cat).length;
|
||||
console.log(` - ${cat} (${count} opcodes)`);
|
||||
});
|
||||
|
||||
console.log('\n--- Checking for opcodes with parameters ---');
|
||||
const opcodesWithParams = allCsoundReferences.filter(ref => ref.parameters && ref.parameters.length > 0);
|
||||
console.log(`\nOpcodes with parameters: ${opcodesWithParams.length} out of ${allCsoundReferences.length}`);
|
||||
if (opcodesWithParams.length > 0) {
|
||||
console.log('\nFirst 5 opcodes with parameters:');
|
||||
opcodesWithParams.slice(0, 5).forEach(op => {
|
||||
console.log(` - ${op.name}: ${op.parameters?.length} parameters`);
|
||||
});
|
||||
}
|
||||
|
||||
console.log('\n' + '='.repeat(60));
|
||||
console.log('Test Complete!');
|
||||
console.log('='.repeat(60));
|
||||
Reference in New Issue
Block a user