unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Using syntax tables to parse buffer content
Date: Tue, 18 May 2021 17:26:45 -0700	[thread overview]
Message-ID: <87o8d7va9m.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <YKRL6fOyWvzQ6/+9@protected.localdomain> (Jean Louis's message of "Wed, 19 May 2021 02:21:13 +0300")

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	other threads:[~2021-05-19  0:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 21:02 Using syntax tables to parse buffer content Eric Abrahamsen
2021-05-18 22:35 ` Jean Louis
2021-05-18 22:53   ` Eric Abrahamsen
2021-05-18 23:21     ` Jean Louis
2021-05-19  0:26       ` Eric Abrahamsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8d7va9m.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).