🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.sgml
Article #752

Re: PSGML w\XML support - syntax colouring? (re: attribute parsing)

#752
From: Clayton Weaver
Date: Sat, 30 May 1998 00:00
31 lines
2012 bytes

I think a lexical parse to an attribute tree of att-value pairs consed
to the element would probably far easier to implement here. Accounting for
implied values, like

<element att1_with_implied_val att2="value2">

makes for an extremely complicated regular expression, probably with
miserable performance (wonder if it breaks on multi-byte characters).

Use one regex to find an element, parse to the first non-word-constituent,
non tag-close character, and then a start a new context on the next
word-constituent character, which must be the start of an attribute name.

From there until you get to tag-close, you can do a character-by-character
parse, building an attribute list of name-value pairs, which simplifies
omitting " characters and makes the attribute-attribute_value parsing
routine reusable. 

The sensible thing, it seems to me, is to parse the whole document and
build a nested tree of elements-with-attributes-values and their offsets
into the document. That could be reused for dsssl.

Regards, Clayton Weaver  cgweav@eskimo.com  (Seattle)

-- 

Regards, Clayton Weaver  cgweav@eskimo.com  (Seattle)

"Since this is a technical newsgroup and has mostly done a pretty good job
Technical Details
Message-ID: <Pine.SUN.3.96.980530143235.9880E-100000@eskimo.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <356ada45.451127207@news.ox.ac.uk> <356DF3E2.16EF@m-net.arbornet.org>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fa82c,e14601e24d87f01c
X-Google-Attributes: gidfa82c,public
X-Google-Thread: 102b9a,e14601e24d87f01c
X-Google-Attributes: gid102b9a,public
X-Google-Thread: 103b8b,e14601e24d87f01c
X-Google-Attributes: gid103b8b,public
From: Clayton Weaver <cgweav@eskimo.com>
Subject: Re: PSGML w\XML support - syntax colouring? (re: attribute parsing)
Date: 1998/05/30
Message-ID: <Pine.SUN.3.96.980530143235.9880E-100000@eskimo.com>
X-Deja-AN: 358027738
References: <356ada45.451127207@news.ox.ac.uk> <356DF3E2.16EF@m-net.arbornet.org>
Content-Type: TEXT/PLAIN; charset=US-ASCII
Organization: Eskimo North (206) For-Ever
Mime-Version: 1.0
Newsgroups: comp.text.sgml,comp.emacs,gnu.emacs.help
Originator: cgweav@eskimo.com