UNPKG

prism-code-editor

Version:

Lightweight, extensible code editor component for the web using Prism

54 lines (53 loc) 2.04 kB
import { a as languages } from "../../core-8vQkh0Rd.js"; import { i as clikePunctuation } from "../../patterns-C0vJBvXO.js"; //#region src/prism/languages/c.js var char = /'(?:\\[^]|[^\\\n']){0,32}'/g; var comment = /\/\/(?:[^\\\n]|\\\n?)*|\/\*[^]*?(?:\*\/|$)/g; var string = /"(?:\\[^]|[^\\\n"])*"/g; var macroExpression = { pattern: /\S[^]*/ }; macroExpression.inside = languages.c = { "comment": comment, "char": char, "macro": { pattern: /(^[ ]*)#\s*[a-z](?:[^\\\n/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\[^])*/gim, lookbehind: true, alias: "property", inside: { "string": [{ pattern: /^(#\s*include\s*)<[^>]+>/, lookbehind: true }, string], "char": char, "comment": comment, "macro-name": [{ pattern: /(^#\s*define\s+)\w+\b(?!\()/i, lookbehind: true }, { pattern: /(^#\s*define\s+)\w+/i, lookbehind: true, alias: "function" }], "directive": { pattern: /^(#\s*)[a-z]+/, lookbehind: true, alias: "keyword" }, "directive-hash": /^#/g, "punctuation": /##|\\(?=\n)/, "expression": macroExpression } }, "string": string, "class-name": { pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([^]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/, lookbehind: true }, "keyword": /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/, "constant": /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/, "function": /\b[a-z_]\w*(?=\s*\()/i, "number": /(?:\b0x(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i, "operator": /->|([&|:+-])\1|[?:~]|>>=?|<<=?|[%&|^!=<>/*+-]=?/, "punctuation": clikePunctuation }; //#endregion //# sourceMappingURL=c.js.map