Skip to content

Commit

Permalink
fix: do not use regex lookbehind (#117)
Browse files Browse the repository at this point in the history
closes #116
  • Loading branch information
rhamzeh authored Feb 17, 2023
1 parent fda9ea6 commit c47b04a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/syntax-highlighters/prism/language-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { OpenFgaDslThemeTokenType } from "../../theme";

export const languageDefinition = {
[OpenFgaDslThemeTokenType.COMMENT]: {
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true,
pattern: /^\s*#.*/,
},
[OpenFgaDslThemeTokenType.KEYWORD]: /\b(type|relations|define|and|or|but not|from|as|model|schema)\b/,
[OpenFgaDslThemeTokenType.TYPE]: {
pattern: /(?<=type\s+)\w+/,
pattern: /(\btype\s+)\w+/i,
lookbehind: true,
},
[OpenFgaDslThemeTokenType.RELATION]: {
pattern: /(?<=define\s+)\w+/,
pattern: /(\bdefine\s+)\w+/i,
lookbehind: true,
},
[OpenFgaDslThemeTokenType.DIRECTLY_ASSIGNABLE]: /\[.*\]/,
};

0 comments on commit c47b04a

Please sign in to comment.