Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
mathis committed Aug 17, 2023
1 parent 6fcc8a2 commit 110b6bf
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 31 deletions.
34 changes: 7 additions & 27 deletions client/src/ui/lib/editAutomapper.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@
import { onMount } from "svelte"
import { automappers, server } from "../global"
import { TrashCan as TrashIcon, Add as AddIcon } from "carbon-icons-svelte"
import { showError, showInfo, showWarning } from "./dialog"
import { Button } from 'carbon-components-svelte'
import { clearDialog, showError, showInfo, showWarning } from "./dialog"
import { Button, TextInput } from 'carbon-components-svelte'
import { createEventDispatcher } from 'svelte'
import { basicSetup } from "codemirror"
import { EditorState } from "@codemirror/state"
import { EditorView } from "@codemirror/view"
import { DDNetRules } from './lang-ddnet_rules/index'
import {
lint as lintAutomapper,
LintLevel,
lintToString,
} from '../../twmap/automap'
import { DDNetRulesLinter } from "./lang-ddnet_rules/lint";
import { DDNetRulesLinter } from "./lang-ddnet_rules/lint"
const dispatch = createEventDispatcher()
Expand Down Expand Up @@ -70,19 +64,8 @@ import { DDNetRulesLinter } from "./lang-ddnet_rules/lint";
const str = view.state.doc.toString()
const lints = lintAutomapper(str)
const errs = lints.filter(l => l.level === LintLevel.Error)
for (const lint of lints) {
await showError(lintToString(lint))
}
if (errs.length > 0) {
const resp = await showWarning(`The automapper contains ${errs.length} error(s). Proceed?`, 'yesno')
if (!resp) return
}
try {
showInfo("Uploading...")
const resp = await $server.query('uploadautomapper', {
image: selected,
content: str
Expand All @@ -96,10 +79,7 @@ import { DDNetRulesLinter } from "./lang-ddnet_rules/lint";
return
}
showInfo(
`Uploaded ${$automappers[selected].length} rules for '${selected}'.`,
'closable'
)
clearDialog()
changed = false
}
Expand Down Expand Up @@ -161,8 +141,8 @@ import { DDNetRulesLinter } from "./lang-ddnet_rules/lint";
<div class="right">
<div class="editor hljs" bind:this={editor}></div>
<div class="controls">
<button class="default large" on:click={onClose}>Close</button>
<button class="primary large" on:click={onSave} disabled={selected === null}>Save</button>
<Button size="small" kind="secondary" on:click={onClose}>Close</Button>
<Button size="small" on:click={onSave} disabled={selected === null}>Save</Button>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion client/src/ui/lib/lang-ddnet_rules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const parser = LRParser.deserialize({
maxTerm: 45,
skippedNodes: [0,1],
repeatNodeCount: 5,
tokenData: "/`~RaYZ!Wpq!]st!b{|!y}!O!y!O!P#S!Q![#x!g!h$Y!h!i$w!k!l%`!p!q&i!q!r+b!r!s+m!t!u,O!z!{-e!{!|.S!}#O.q~!]OU~~!bO{~~!gSP~OY!bZ;'S!b;'S;=`!s<%lO!b~!vP;=`<%l!bQ!|Q!O!P#S!Q![#jQ#VP!Q![#YQ#_QpQuv#e!Q![#YQ#jOpQQ#oRpQuv#e!O!P#Y!Q![#jR$PRpQ^Puv#e!O!P#Y!Q![#x~$]P!o!p$`~$cP!r!s$f~$iP!v!w$l~$oP!{!|$r~$wOg~~$zP!w!x$}~%QP!n!o%T~%WP!n!o%Z~%`Oh~~%cQ!p!q%i#b#c&Q~%lP!f!g%o~%rP!g!h%u~%xP!z!{%{~&QOj~~&TP#W#X&W~&ZP#X#Y&^~&aP#l#m&d~&iO]~~&lR!q!r&u#X#Y(O#c#d(m~&xQ!p!q'O!v!w'Z~'RP!g!h'U~'ZO|~~'^P!k!l'a~'dP!p!q'g~'jP!f!g'm~'pP!g!h's~'vP!z!{'y~(OOk~~(RP#k#l(U~(XP!t!u([~(_P#i#j(b~(eP#b#c(h~(mO}~~(pQ!f!g(v!n!o*Z~(yP#X#Y(|~)PP#Y#Z)S~)VP#T#U)Y~)]P#i#j)`~)cP#`#a)f~)iP#h#i)l~)oP!t!u)r~)uP#i#j)x~){P#`#a*O~*RP#X#Y*U~*ZOr~~*^P#T#U*a~*dP#m#n*g~*jP#X#Y*m~*pP#f#g*s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)j~)mP#`#a)p~)sP#X#Y)v~){Or~~*OP#T#U*R~*UP#m#n*X~*[P#X#Y*_~*bP#f#g*e~*hP!e!f*k~*nP#c#d*q~*tP#d#e*w~*zP#m#n*}~+SOY~~+VP!t!u+Y~+_Om~~+bP#c#d+e~+hP#g#h+k~+pOe~~+sQ!q!r+y#T#U,h~+|P!v!w,P~,SP!c!d,V~,YP!v!w,]~,`P!g!h,c~,hOc~~,kP#b#c,n~,qP#W#X,t~,wP#c#d,z~,}P#a#b-Q~-VOo~~-YP!h!i-]~-`P!n!o-c~-fP!k!l-i~-lP!r!s-o~-tOa~~-wP!h!i-z~-}P!n!o.Q~.TP!k!l.W~.ZP!r!s.^~.cOb~~.fTO#P.c#P#Q.u#Q;'S.c;'S;=`.z<%lO.c~.zOT~~.}P;=`<%l.c",
tokenizers: [0, 1],
topRules: {"file":[0,2]},
tokenPrec: 238
Expand Down
2 changes: 0 additions & 2 deletions codemirror-lang-ddnet_rules/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/node_modules
package-lock.json
/dist
/src/*.js
/src/*.d.ts
2 changes: 1 addition & 1 deletion codemirror-lang-ddnet_rules/src/syntax.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ NoLayerCopy { "NoLayerCopy" EndLine }
Comment { "#" ![\n]* }
space { " " }
EndLine { "\n" }
Int { @digit+ }
Int { $[+-]? @digit+ }
Float { $[+-]? (@digit+ ("." @digit*)? | "." @digit+) "%"? }
HeaderTok { "[" ![\]]* "]" }

Expand Down
3 changes: 3 additions & 0 deletions codemirror-lang-ddnet_rules/src/syntax.grammar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {LRParser} from "@lezer/lr"

export declare const parser: LRParser

0 comments on commit 110b6bf

Please sign in to comment.