svghmi/parse_labels.ysl2
changeset 3593 122b1094b8e6
parent 3592 b2bdb8b433e0
child 3594 30f7eade322f
equal deleted inserted replaced
3592:b2bdb8b433e0 3593:122b1094b8e6
     1 // parse_labels.ysl2
     1 // parse_labels.ysl2
     2 
     2 
     3 
     3 
     4 //  Parses:
     4 //  Parses:
     5 //  "HMI:WidgetType|freq:param1:param2@path1,path1min,path1max@path2"
     5 //  "HMI:WidgetType|freq:param1:param2@path1,path1min,path1max@path2#"
     6 //
     6 //
     7 //  Into:
     7 //  Into:
     8 //  widget type="WidgetType" id="blah456" {
     8 //  widget type="WidgetType" id="blah456" {
     9 //      arg value="param1";
     9 //      arg value="param1";
    10 //      arg value="param2";
    10 //      arg value="param2";
    73         foreach "str:split(substring-after($args, ':'), ':')" {
    73         foreach "str:split(substring-after($args, ':'), ':')" {
    74             arg {
    74             arg {
    75                 attrib "value" > «.»
    75                 attrib "value" > «.»
    76             }
    76             }
    77         }
    77         }
    78         const "paths", "substring-after($declaration,'@')";
    78         const "tail", "substring-after($declaration,'@')";
       
    79         const "taillen","string-length($tail)";
       
    80         const "has_enable", "substring($tail,$taillen,1)='#'";
       
    81         const "paths" choose{
       
    82             when "$has_enable" {
       
    83                value "substring($tail,1,$taillen - 1)";
       
    84             }
       
    85             otherwise value "$tail";
       
    86         }
       
    87         if "$has_enable" {
       
    88             attrib "has_enable" > yes
       
    89         }
    79         foreach "str:split($paths, '@')" {
    90         foreach "str:split($paths, '@')" {
    80             if "string-length(.) > 0" path {
    91             if "string-length(.) > 0" path {
    81                 // 1 : global match
    92                 // 1 : global match
    82                 // 2 : /path
    93                 // 2 : /path
    83                 // 3 : [accepts]
    94                 // 3 : [accepts]