UNPKG

@typecad/kicad-symbols

Version:

Intelligent fuzzy search for KiCad symbols with CLI interface

96 lines 2.51 kB
/** * S-Expression parser for KiCad symbol files (.kicad_sym) * Parses the nested s-expression format used by KiCad symbol libraries */ /** * Represents a parsed s-expression token */ export interface SExpression { type: 'atom' | 'list'; value?: string; children?: SExpression[]; } /** * Represents a parsed KiCad symbol property */ export interface SymbolProperty { name: string; value: string; effects?: { font?: { size?: number; }; hide?: boolean; }; } /** * Represents a complete KiCad symbol definition */ export interface SymbolDefinition { name: string; properties: SymbolProperty[]; description?: string; keywords?: string; library?: string; } /** * S-Expression parser for KiCad symbol files */ export declare class SExpressionParser { private position; private content; /** * Parse a KiCad symbol file content into symbol definitions * @param content - The file content as a string * @returns Array of symbol definitions found in the file */ parseSymbolFile(content: string): SymbolDefinition[]; /** * Parse a single s-expression from the current position * @returns Parsed s-expression or null if end of input */ private parseExpression; /** * Parse a list s-expression (starts with '(') * @returns Parsed list expression */ private parseList; /** * Parse an atom s-expression (string or quoted string) * @returns Parsed atom expression */ private parseAtom; /** * Parse a quoted string atom * @returns Parsed quoted string */ private parseQuotedString; /** * Parse an unquoted atom * @returns Parsed unquoted atom */ private parseUnquotedAtom; /** * Parse a symbol definition from an s-expression * @param symbolExpr - The symbol s-expression * @returns Parsed symbol definition or null if invalid */ private parseSymbolDefinition; /** * Parse a property from an s-expression * @param propertyExpr - The property s-expression * @returns Parsed property or null if invalid */ private parseProperty; /** * Skip whitespace characters and comments */ private skipWhitespace; /** * Check if character is whitespace * @param char - Character to check * @returns True if whitespace */ private isWhitespace; } //# sourceMappingURL=SExpressionParser.d.ts.map