import { cssGrammar } from './css';
import { markupGrammar } from './markup';
import { javascriptGrammar } from './javascript';
import { typescriptGrammar } from './typescript';
import { jsxGrammar } from './jsx';
import { tsxGrammar } from './tsx';
/**
 * A registry that maps language identifiers to their grammar definitions.
 * Supports common aliases (e.g., 'html' -> markup, 'js' -> javascript).
 *
 * The registry provides grammars for:
 * - CSS
 * - HTML / Markup
 * - JavaScript (JS)
 * - TypeScript (TS)
 * - JSX
 * - TSX
 * - C / C-like (falls back to JavaScript grammar for basic C-family highlighting)
 */
const languageRegistry = {
  css: cssGrammar,
  html: markupGrammar,
  markup: markupGrammar,
  javascript: javascriptGrammar,
  js: javascriptGrammar,
  typescript: typescriptGrammar,
  ts: typescriptGrammar,
  jsx: jsxGrammar,
  tsx: tsxGrammar,
  c: javascriptGrammar,
  clike: javascriptGrammar,
};
/**
 * Retrieve the grammar for a given language identifier.
 *
 * @param {string} language - The language identifier (e.g., 'js', 'css', 'html', 'ts', 'jsx', 'tsx').
 * @returns {Grammar | undefined} The grammar definition, or undefined if the language is not registered.
 */
export function getLanguageGrammar(language) {
  return languageRegistry[language];
}
