Plan 9 from Bell Labs’s /usr/web/sources/contrib/maht/limbo/xmlhell/xml.m

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Xml: module {
	PATH: con "/usr/maht/xmhell/xml.dis";

	Data : adt {
		txt : string;
		ptr : int;

		seek:		fn(b: self ref Data, n, where: int): int;
		offset:	fn(b: self ref Data): int;

		getc:		fn(b: self ref Data): int;
		gets:		fn(b: self ref Data, sep: int): string;
		ungetc:	fn(b: self ref Data): int;
	};

	Item: adt {
		fileoffset:	int;
		pick {
		Tag =>
			name:	string;
			attrs:		Attributes;
		Text =>
			ch:		string;
			ws1, ws2: int;
		Process =>
			target:	string;
			data:		string;
		Doctype =>
			name:	string;
			public:	int;
			params:	list of string;
		Stylesheet =>
			attrs:		Attributes;
		Error =>
			loc:		Locator;
			msg:		string;
		}
		to_string : fn(i : self ref Item) : string;
	};

	Locator: adt {
		line:				int;
		systemid:			string;
		publicid:			string;
	};

	Attribute: adt {
		name:			string;
		value:			string;
	};

	Attributes: adt {
		attrs:			list of Attribute;

		all:			fn(a: self Attributes): list of Attribute;
		get:			fn(a: self Attributes, name: string): string;
	};

	Mark: adt {
		estack:	list of string;
		line:		int;
		offset:	int;
		readdepth:	int;

		str:		fn(m: self ref Mark): string;	
	};

	Parser: adt {
		in:		ref Data;
		eof:		int;
		lastnl:	int;
		estack:	list of string;
		loc:		Locator;
		warning:	chan of (Locator, string);
		errormsg:	string;
		actdepth:	int;
		readdepth:	int;
		fileoffset:	int;
		preelem:	string;
		ispre:	int;

		next:		fn(p: self ref Parser): ref Item;
		up:		fn(p: self ref Parser);
		down:	fn(p: self ref Parser);
		mark:	fn(p: self ref Parser): ref Mark;
		atmark:	fn(p: self ref Parser, m: ref Mark): int;
		goto:	fn(p: self ref Parser, m: ref Mark);
		str2mark:	fn(p: self ref Parser, s: string): ref Mark;
	};
	init:	fn(): string;
	init_io: fn(ml: string, warning: chan of (Locator, string), preelem: string): ref Parser;
};

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.