Actually add file for new filetype
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good

This commit is contained in:
Timothy Warren 2024-07-22 15:44:11 -04:00
parent d90d685ef2
commit 58490f1c51

154
src/common/filetype/c.ts Normal file
View File

@ -0,0 +1,154 @@
import Option, { Some } from '../option.ts';
import {
AbstractFileType,
defaultHighlightOptions,
FileLang,
HighlightingOptions,
} from './base.ts';
export class CFile extends AbstractFileType {
public readonly name: FileLang = FileLang.C;
public readonly singleLineComment = Some('//');
public readonly multiLineCommentStart: Option<string> = Some('/*');
public readonly multiLineCommentEnd: Option<string> = Some('*/');
public readonly keywords1 = [
'continue',
'register',
'restrict',
'volatile',
'default',
'typedef',
'typedef',
'switch',
'return',
'static',
'struct',
'extern',
'inline',
'return',
'sizeof',
'switch',
'break',
'const',
'while',
'break',
'union',
'class',
'union',
'auto',
'case',
'else',
'enum',
'case',
'for',
'do',
'if',
];
public readonly keywords2 = [
'#include',
'unsigned',
'uint32_t',
'uint64_t',
'uint16_t',
'#define',
'#ifndef',
'wchar_t',
'int32_t',
'int64_t',
'int16_t',
'uint8_t',
'double',
'signed',
'#endif',
'#ifdef',
'#error',
'#undef',
'int8_t',
'time_t',
'size_t',
'float',
'#elif',
'long',
'char',
'void',
'int',
'#if',
];
public readonly operators = [
'>>>=',
'**=',
'<<=',
'>>=',
'&&=',
'||=',
'??=',
'===',
'!==',
'>>>',
'<=>',
'<<=',
'>>=',
'+=',
'-=',
'*=',
'/=',
'%=',
'&=',
'^=',
'|=',
'==',
'!=',
'>=',
'<=',
'++',
'--',
'**',
'<<',
'>>',
'&&',
'||',
'??',
'?.',
'++',
'--',
'==',
'!=',
'>=',
'<=',
'&&',
'||',
'<<',
'>>',
'+=',
'-=',
'*=',
'/=',
'%=',
'&=',
'|=',
'^=',
'->',
'::',
'?',
':',
'=',
'>',
'<',
'%',
'-',
'+',
'&',
'|',
'^',
'~',
'!',
'.',
',',
';',
];
public readonly hlOptions: HighlightingOptions = {
...defaultHighlightOptions,
characters: true,
hexNumbers: true,
};
}