Skip to content

built-ins.stx

pdmosses/webdsl-statix/webdslstatix/trans/static-semantics/ui/built-ins.stx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module 

imports
  static-semantics/types/built-ins

  static-semantics/ui/template-calls

  static-semantics/webdsl
  static-semantics/webdsl-ui

rules

   : scope
  declareUIBuiltIns() :-
    declareTemplate(s, "title", []),
    declareTemplate(s, "text", [object(s)]),
    declareTemplate(s, "image", [url(s)]),
    declareTemplate(s, "header", []),
    declareTemplate(s, "section", []),
//    declTemplate(s, "url", [url(s)], []), // TO-DO: investigate if url is template or pageplaceholde
    declareTemplate(s, "form", []),
    declareTemplate(s, "dynamicform", []),
    declareTemplate(s, "captcha", []),
    declareTemplate(s, "input", [object(s)]),
    declareTemplate(s, "output", [object(s)]),

//    declareTemplate(s, "navigate", []),
//    declareTemplate(s, "navigate", [url(s)]),
//    declareTemplate(s, "navigate", [PAGE(_)]), // disable PAGE(_) declarations for now since they are producing nabl2.Var in libraries
//    declareTemplate(s, "navigate", [string(s), url(s)]),
//    declareTemplate(s, "navigate", [string(s), PAGE(_)]), // disable PAGE(_) declarations for now since they are producing nabl2.Var in libraries
//    declareTemplate(s, "navigatebutton", [PAGE(_), string(s)]), // disable PAGE(_) declarations for now since they are producing nabl2.Var in libraries
    declareTemplate(s, "navigatebutton", [url(s), string(s)]),

    declareTemplate(s, "includeCSS", [string(s)]),
    declareTemplate(s, "includeCSS", [string(s), string(s)]),
    declareTemplate(s, "includeJS", [string(s)]),
    declareTemplate(s, "includeJSLast", [string(s)]),
    declareTemplate(s, "includeHead", [string(s)]),

    declareTemplate(s, "templateContext", [string(s)]),

    declarePage(s, "url", [string(s)]).

rules // navigate function call

  typeOfExp(s, ThisCall2Exp(ThisCall("navigate", [ThisCall2Exp(ThisCall(p, args))]))) = string(s) :-
    pageCallOk_internal(s, p, args).

  typeOfExp(s, ThisCall2Exp(ThisCall("navigate", [_]))) = UNTYPED() :-
    false | error $[Navigate function should have a page call or url(...) argument].