help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using syntax tables to parse buffer content


From: Eric Abrahamsen
Subject: Re: Using syntax tables to parse buffer content
Date: Tue, 18 May 2021 17:26:45 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jean Louis <bugs@gnu.support> writes:

> * Eric Abrahamsen <eric@ericabrahamsen.net> [2021-05-19 01:54]:
>> Jean Louis <bugs@gnu.support> writes:
>> 
>> > * Eric Abrahamsen <eric@ericabrahamsen.net> [2021-05-19 00:04]:
>> >> My main problem now is escaping: I don't know how to treat escaped
>> >> special characters as non-special. The simplest example is in vCard
>> >> parsing. A property line might look like this:
>> >> 
>> >> URL;TYPE=homepage:https\://mygreatpage.com/
>> >
>> > That is when important "standards" like vCard are written by people
>> > that lack global knowledge of data structures. Would they write it in
>> > LISP data or at least XML, we could all easily parse it, including by
>> > using other programming languages. But no...
>> 
>> There have been further efforts based on XML and JSON, but nothing has
>> quite gained the currency of vCard, so here we are...
>
> Is it vCard that you wish to parse?
>
> I have made some vCard exporting functions. But I would need
> importing. Some packages already exist.

I've actually already written the package!

https://elpa.gnu.org/packages/vcard.html

There were some existing things, but all seemingly part of other
packages. I needed something for EBDB, and wanted to write a library
that was pure vcard->lisp, so it would be useful to other people, as
well. The library parses to elisp structures that can be consumed by
whomever. I'm doing it with (very ugly) regular expressions now, and
want to move to syntax parsing, which I suspect will be much faster.

I'd also just like to learn this technique, as I suspect it would also
be very useful in several places in Gnus.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]