codigo0/node_modules/highlight.js/es/languages/leaf.js
planetazuzu 5d7a6500fe refactor: Fase 1 - Clean Architecture, refactorización modular y eliminación de duplicidades
-  Ticket 1.1: Estructura Clean Architecture en backend
-  Ticket 1.2: Schemas Zod compartidos
-  Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares)
-  Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares)
-  Ticket 1.5: Eliminación de duplicidades (~50 líneas)

Cambios principales:
- Creada estructura Clean Architecture en backend/src/
- Schemas Zod compartidos en backend/src/shared/schemas/
- Refactorización modular de drugs y procedures
- Utilidades genéricas en src/utils/ (filter, validation)
- Eliminados scripts obsoletos y documentación antigua
- Corregidos errores: QueryClient, import test-error-handling
- Build verificado y funcionando correctamente
2026-01-25 21:09:47 +01:00

98 lines
1.8 KiB
JavaScript

/*
Language: Leaf
Description: A Swift-based templating language created for the Vapor project.
Website: https://docs.vapor.codes/leaf/overview
Category: template
*/
function leaf(hljs) {
const IDENT = /([A-Za-z_][A-Za-z_0-9]*)?/;
const LITERALS = [
'true',
'false',
'in'
];
const PARAMS = {
scope: 'params',
begin: /\(/,
end: /\)(?=\:?)/,
endsParent: true,
relevance: 7,
contains: [
{
scope: 'string',
begin: '"',
end: '"'
},
{
scope: 'keyword',
match: LITERALS.join("|"),
},
{
scope: 'variable',
match: /[A-Za-z_][A-Za-z_0-9]*/
},
{
scope: 'operator',
match: /\+|\-|\*|\/|\%|\=\=|\=|\!|\>|\<|\&\&|\|\|/
}
]
};
const INSIDE_DISPATCH = {
match: [
IDENT,
/(?=\()/,
],
scope: {
1: "keyword"
},
contains: [ PARAMS ]
};
PARAMS.contains.unshift(INSIDE_DISPATCH);
return {
name: 'Leaf',
contains: [
// #ident():
{
match: [
/#+/,
IDENT,
/(?=\()/,
],
scope: {
1: "punctuation",
2: "keyword"
},
// will start up after the ending `)` match from line ~44
// just to grab the trailing `:` if we can match it
starts: {
contains: [
{
match: /\:/,
scope: "punctuation"
}
]
},
contains: [
PARAMS
],
},
// #ident or #ident:
{
match: [
/#+/,
IDENT,
/:?/,
],
scope: {
1: "punctuation",
2: "keyword",
3: "punctuation"
}
},
]
};
}
export { leaf as default };