diff options
-rw-r--r-- | src/elisp/urweb-mode.el | 6 | ||||
-rw-r--r-- | src/elisp/urweb-move.el | 2 | ||||
-rw-r--r-- | tests/crud1.ur | 64 |
3 files changed, 40 insertions, 32 deletions
diff --git a/src/elisp/urweb-mode.el b/src/elisp/urweb-mode.el index 626fdc63..d32b2a55 100644 --- a/src/elisp/urweb-mode.el +++ b/src/elisp/urweb-mode.el @@ -164,11 +164,11 @@ See doc for the variable `urweb-mode-info'." `(;;(urweb-font-comments-and-strings) (,(concat "\\<\\(fun\\|and\\)\\s-+\\(\\sw+\\)\\s-+[^ \t\n=]") (1 font-lock-keyword-face) - (5 font-lock-function-name-face)) - (,(concat "\\<\\(\\(data\\)?type\\|con\\)\\s-+\\(\\sw+\\)") + (2 font-lock-function-name-face)) + (,(concat "\\<\\(\\(data\\)?type\\|con\\|class\\)\\s-+\\(\\sw+\\)") (1 font-lock-keyword-face) (3 font-lock-type-def-face)) - ("\\<\\(val\\)\\s-+\\(\\sw+\\>\\s-*\\)?\\(\\sw+\\)\\s-*[=:]" + ("\\<\\(val\\|table\\|sequence\\)\\s-+\\(\\sw+\\>\\s-*\\)?\\(\\sw+\\)\\s-*[=:]" (1 font-lock-keyword-face) (3 font-lock-variable-name-face)) ("\\<\\(structure\\|functor\\)\\s-+\\(\\sw+\\)" diff --git a/src/elisp/urweb-move.el b/src/elisp/urweb-move.el index 428a6803..3c7d5b21 100644 --- a/src/elisp/urweb-move.el +++ b/src/elisp/urweb-move.el @@ -78,7 +78,7 @@ (("/" "*" "%") . 7) (("++" "--") 8) (("NOT") 9) - (("~" "$") 10))) + (("~") 10))) "Alist of Ur/Web infix operators and their precedence.") (defconst urweb-syntax-prec diff --git a/tests/crud1.ur b/tests/crud1.ur index 6a7e38de..2ed2b9e7 100644 --- a/tests/crud1.ur +++ b/tests/crud1.ur @@ -1,36 +1,44 @@ table t1 : {Id : int, A : int, B : string, C : float, D : bool} +val a = {Nam = "A", + Show = txt _, + Widget = fn nm :: Name => <lform><textbox{nm}/></lform>, + WidgetPopulated = fn (nm :: Name) n => + <lform><textbox{nm} value={show _ n}/></lform>, + Parse = readError _, + Inject = _} + +val b = {Nam = "B", + Show = txt _, + Widget = fn nm :: Name => <lform><textbox{nm}/></lform>, + WidgetPopulated = fn (nm :: Name) s => + <lform><textbox{nm} value={s}/></lform>, + Parse = readError _, + Inject = _} + +val c = {Nam = "C", + Show = txt _, + Widget = fn nm :: Name => <lform><textbox{nm}/></lform>, + WidgetPopulated = fn (nm :: Name) n => + <lform><textbox{nm} value={show _ n}/></lform>, + Parse = readError _, + Inject = _} + +val d = {Nam = "D", + Show = txt _, + Widget = fn nm :: Name => <lform><checkbox{nm}/></lform>, + WidgetPopulated = fn (nm :: Name) b => + <lform><checkbox{nm} checked={b}/></lform>, + Parse = fn x => x, + Inject = _} + open Crud.Make(struct val tab = t1 val title = "Crud1" - val cols = { - A = {Nam = "A", - Show = txt _, - Widget = fn nm :: Name => <lform><textbox{nm}/></lform>, - WidgetPopulated = fn (nm :: Name) n => <lform><textbox{nm} value={show _ n}/></lform>, - Parse = readError _, - Inject = _}, - B = {Nam = "B", - Show = txt _, - Widget = fn nm :: Name => <lform><textbox{nm}/></lform>, - WidgetPopulated = fn (nm :: Name) s => <lform><textbox{nm} value={s}/></lform>, - Parse = readError _, - Inject = _ - }, - C = {Nam = "C", - Show = txt _, - Widget = fn nm :: Name => <lform><textbox{nm}/></lform>, - WidgetPopulated = fn (nm :: Name) n => <lform><textbox{nm} value={show _ n}/></lform>, - Parse = readError _, - Inject = _ - }, - D = {Nam = "D", - Show = txt _, - Widget = fn nm :: Name => <lform><checkbox{nm}/></lform>, - WidgetPopulated = fn (nm :: Name) b => <lform><checkbox{nm} checked={b}/></lform>, - Parse = fn x => x, - Inject = _} - } + val cols = {A = a, + B = b, + C = c, + D = d} end) |