Proof-of-concept value validation.
This commit is contained in:
parent
f586d89fca
commit
09a583c565
1 changed files with 20 additions and 1 deletions
|
@ -269,9 +269,28 @@
|
||||||
(cons lines
|
(cons lines
|
||||||
(dict-ref m esym '())))))
|
(dict-ref m esym '())))))
|
||||||
|
|
||||||
|
;; Check actual key error
|
||||||
|
(define (check-member-key-error key v)
|
||||||
|
(case key
|
||||||
|
((nick)
|
||||||
|
(if (irregex-search (irregex " " 'u) v)
|
||||||
|
"Space in nick!"
|
||||||
|
#f))
|
||||||
|
(else
|
||||||
|
#f)))
|
||||||
|
|
||||||
|
;; Adds error to the highlights
|
||||||
|
(define (add-member-error mr ln msg)
|
||||||
|
(dict-set mr member-file-error-symbol
|
||||||
|
(cons (list ln msg)
|
||||||
|
(dict-ref mr member-file-error-symbol '()))))
|
||||||
|
|
||||||
;; Performs actual validation, optionally adding error to the list
|
;; Performs actual validation, optionally adding error to the list
|
||||||
(define (validate-member-key m key v line-number)
|
(define (validate-member-key m key v line-number)
|
||||||
m)
|
(let ((res (check-member-key-error key v)))
|
||||||
|
(if res
|
||||||
|
(add-member-error m line-number res)
|
||||||
|
m)))
|
||||||
|
|
||||||
;; Gets cons of nick and line number and if validation fails, adds
|
;; Gets cons of nick and line number and if validation fails, adds
|
||||||
;; error to the error key.
|
;; error to the error key.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue