SS.k 792 B

123456789101112131415161718192021222324252627282930313233343536
  1. \d u
  2. \l utils.k
  3. \d pat
  4. \l excelpm.k
  5. \l ngnk-libs/csv/csv.k
  6. \d .
  7. /helpers
  8. / e exclusive
  9. slice: {[l;s;e] s_(e)#l};
  10. listize: {1_(,/(";",)'{"(",x,")"}'x)};
  11. split: {[l;di] idx: (-1,&(di~'l)),(#l); {slice[x;y[0]+1;y[1]+1]}[l]'(idx@(2':!#idx))};
  12. s2n: {[s] `i$s;}; // string to number
  13. parseidx: {core: slice[x;1;#x]; split[core;";"]};
  14. /:parseidx["[1;2]"];
  15. /:split["1;2;3";";"];
  16. tstkey: "States/Events"; / key indicating start of transition section
  17. cstkey: "Events"; / key indicating start of events condition section
  18. astkey: "Actions"; / key indicating start of actions section
  19. sectionkeys: (tstkey;cstkey;astkey);
  20. lines: {x,"\n",y}/(0: "SS.csv");
  21. table: csv.csv[lines];
  22. / excel patterns
  23. pats: *''|''(pat.run''table);
  24. :pats {
  25. u.ppr (x;y);
  26. u.ppr $[x[0]>4;slice[y;x[1];x[2]];'$'];
  27. }''table;