Add Diff language mode

This commit is contained in:
Jonatan Heyman 2024-02-09 15:15:39 +01:00
parent 30d6e4d3fb
commit 9e3fc5e8e6
3 changed files with 9 additions and 2 deletions

View File

@ -11,7 +11,7 @@ NoteDelimiter {
@tokens { @tokens {
noteDelimiterMark { "∞∞∞" } noteDelimiterMark { "∞∞∞" }
NoteLanguage { "text" | "math" | "javascript" | "typescript" | "jsx" | "tsx" | "json" | "python" | "html" | "sql" | "markdown" | "java" | "php" | "css" | "xml" | "cpp" | "rust" | "csharp" | "ruby" | "shell" | "yaml" | "golang" | "clojure" | "erlang" | "lezer" | "toml" | "swift" | "kotlin" | "groovy" } NoteLanguage { "text" | "math" | "javascript" | "typescript" | "jsx" | "tsx" | "json" | "python" | "html" | "sql" | "markdown" | "java" | "php" | "css" | "xml" | "cpp" | "rust" | "csharp" | "ruby" | "shell" | "yaml" | "golang" | "clojure" | "erlang" | "lezer" | "toml" | "swift" | "kotlin" | "groovy" | "diff" }
Auto { "-a" } Auto { "-a" }
noteDelimiterEnter { "\n" } noteDelimiterEnter { "\n" }
//NoteContent { String } //NoteContent { String }

View File

@ -10,7 +10,7 @@ export const parser = LRParser.deserialize({
maxTerm: 10, maxTerm: 10,
skippedNodes: [0], skippedNodes: [0],
repeatNodeCount: 1, repeatNodeCount: 1,
tokenData: ",p~RaYZ!W}!O!]#V#W!h#X#Y$U#Z#[$t#[#]%g#^#_%y#_#`'g#`#a(P#a#b(i#d#e)h#f#g*T#g#h*d#h#i+Y#l#m%m#m#n,X%&x%&y,_~!]OX~~!`P#T#U!c~!hOU~~!kR#`#a!t#d#e#i#g#h#o~!wP#c#d!z~!}P#^#_#Q~#TP#i#j#W~#ZP#f#g#^~#aP#X#Y#d~#iOT~~#lP#d#e#d~#rQ#[#]#x#g#h#d~#{P#T#U$O~$RP#f#g#i~$XP#f#g$[~$_P#`#a$b~$eP#T#U$h~$kP#b#c$n~$qP#Z#[#d~$wQ#c#d$[#f#g$}~%QP#c#d%T~%WP#c#d%Z~%^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#a#b&Y~&]P#`#a#g~&cQ#T#U&i#g#h'm~&lP#j#k&o~&rP#T#U&u~&zPT~#g#h&}~'QP#V#W'T~'WP#f#g'Z~'^P#]#^'a~'dP#d#e'g~'jP#h#i#g~'pQ#c#d'v#l#m#g~'yP#b#c#g~(PP#c#d(S~(VP#h#i(Y~(]P#`#a(`~(cP#]#^'v~(iP#X#Y(l~(oP#n#o(r~(uP#X#Y(x~({P#f#g#g~)RP#T#U)U~)XQ#f#g)_#h#i)w~)bP#_#`)e~)hP#W#X)k~)nP#c#d)q~)tP#k#l'v~)zP#[#]#g~*QQ#[#]#l#m#n*W~*ZP#h#i*^~*aP#[#]*d~*gP#c#d'v~*mP#i#j*p~*sQ#U#V%v#g#h'g~*|R#[#]+V#e#f&Y#k#l+c~+YP#X#Y+]~+`P#`#a&Y~+fP#]#^+i~+lP#Y#Z'g~+rS#X#Y,O#c#d&S#g#h,U#m#n,[~,RP#l#m'g~,XP#l#m#g~,_P#d#e,b~,eP#X#Y,h~,kP#g#h&}~,qP#T#U&S~,wP%&x%&y,z~,}P%&x%&y-Q~-VOY~",
tokenizers: [0, noteContent], tokenizers: [0, noteContent],
topRules: {"Document":[0,2]}, topRules: {"Document":[0,2]},
tokenPrec: 0 tokenPrec: 0

View File

@ -24,6 +24,7 @@ import { toml } from "@codemirror/legacy-modes/mode/toml"
import { swift } from "@codemirror/legacy-modes/mode/swift" import { swift } from "@codemirror/legacy-modes/mode/swift"
import { kotlin } from "@codemirror/legacy-modes/mode/clike" import { kotlin } from "@codemirror/legacy-modes/mode/clike"
import { groovy } from "@codemirror/legacy-modes/mode/groovy" import { groovy } from "@codemirror/legacy-modes/mode/groovy"
import { diff } from "@codemirror/legacy-modes/mode/diff";
import typescriptPlugin from "prettier/plugins/typescript.mjs" import typescriptPlugin from "prettier/plugins/typescript.mjs"
import babelPrettierPlugin from "prettier/plugins/babel.mjs" import babelPrettierPlugin from "prettier/plugins/babel.mjs"
@ -239,6 +240,12 @@ export const LANGUAGES = [
parser: StreamLanguage.define(groovy).parser, parser: StreamLanguage.define(groovy).parser,
guesslang: "groovy", guesslang: "groovy",
}), }),
new Language({
token: "diff",
name: "Diff",
parser: StreamLanguage.define(diff).parser,
guesslang: null,
}),
] ]