xml.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Xml: module {
  2. PATH: con "/dis/lib/xml.dis";
  3. Item: adt {
  4. fileoffset: int;
  5. pick {
  6. Tag =>
  7. name: string;
  8. attrs: Attributes;
  9. Text =>
  10. ch: string;
  11. ws1, ws2: int;
  12. Process =>
  13. target: string;
  14. data: string;
  15. Doctype =>
  16. name: string;
  17. public: int;
  18. params: list of string;
  19. Stylesheet =>
  20. attrs: Attributes;
  21. Error =>
  22. loc: Locator;
  23. msg: string;
  24. }
  25. };
  26. Locator: adt {
  27. line: int;
  28. systemid: string;
  29. publicid: string;
  30. };
  31. Attribute: adt {
  32. name: string;
  33. value: string;
  34. };
  35. Attributes: adt {
  36. attrs: list of Attribute;
  37. all: fn(a: self Attributes): list of Attribute;
  38. get: fn(a: self Attributes, name: string): string;
  39. };
  40. Mark: adt {
  41. estack: list of string;
  42. line: int;
  43. offset: int;
  44. readdepth: int;
  45. str: fn(m: self ref Mark): string;
  46. };
  47. Parser: adt {
  48. in: ref Bufio->Iobuf;
  49. eof: int;
  50. lastnl: int;
  51. estack: list of string;
  52. loc: Locator;
  53. warning: chan of (Locator, string);
  54. errormsg: string;
  55. actdepth: int;
  56. readdepth: int;
  57. fileoffset: int;
  58. preelem: string;
  59. ispre: int;
  60. next: fn(p: self ref Parser): ref Item;
  61. up: fn(p: self ref Parser);
  62. down: fn(p: self ref Parser);
  63. mark: fn(p: self ref Parser): ref Mark;
  64. atmark: fn(p: self ref Parser, m: ref Mark): int;
  65. goto: fn(p: self ref Parser, m: ref Mark);
  66. str2mark: fn(p: self ref Parser, s: string): ref Mark;
  67. };
  68. init: fn(): string;
  69. open: fn(f: string, warning: chan of (Locator, string), preelem: string): (ref Parser, string);
  70. fopen: fn(f: ref Bufio->Iobuf, srcname: string, warning: chan of (Locator, string), preelem: string): (ref Parser, string);
  71. };