Add C highlighting support
Some checks failed
timw4mail/scroll/pipeline/head There was a failure building this commit

This commit is contained in:
Timothy Warren 2024-07-22 15:33:01 -04:00
parent 6101132a15
commit d90d685ef2
2 changed files with 8 additions and 0 deletions

View File

@ -5,6 +5,8 @@ import Option, { None } from '../option.ts';
// ----------------------------------------------------------------------------
export enum FileLang {
C = 'C',
CPP = 'C++',
TypeScript = 'TypeScript',
JavaScript = 'JavaScript',
PHP = 'PHP',
@ -16,6 +18,7 @@ export enum FileLang {
}
export interface HighlightingOptions {
characters: boolean;
numbers: boolean;
octalNumbers: boolean;
hexNumbers: boolean;
@ -51,6 +54,7 @@ export abstract class AbstractFileType implements IFileType {
public readonly keywords2: string[] = [];
public readonly operators: string[] = [];
public readonly hlOptions: HighlightingOptions = {
characters: false,
numbers: false,
octalNumbers: false,
hexNumbers: false,
@ -78,6 +82,7 @@ export abstract class AbstractFileType implements IFileType {
}
export const defaultHighlightOptions: HighlightingOptions = {
characters: false,
numbers: true,
octalNumbers: false,
hexNumbers: false,

View File

@ -1,5 +1,6 @@
import { node_path as path } from '../runtime/mod.ts';
import { AbstractFileType } from './base.ts';
import { CFile } from './c.ts'
import { CSSFile } from './css.ts';
import { JavaScriptFile, TypeScriptFile } from './javascript.ts';
import { ShellFile } from './shell.ts';
@ -10,6 +11,8 @@ import { ShellFile } from './shell.ts';
export class FileType extends AbstractFileType {
static #fileTypeMap = new Map([
['.c', CFile],
['.h', CFile],
['.css', CSSFile],
['.json', JavaScriptFile],
['.js', JavaScriptFile],