unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: how to use parsing expressing grammar
Date: Wed, 17 Dec 2008 20:43:28 -0700	[thread overview]
Message-ID: <gicgsv$dfh$1@ger.gmane.org> (raw)
In-Reply-To: <72bde6b1-ee08-4053-8d42-2a16ccd59900@v5g2000prm.googlegroups.com>

Xah Lee wrote:
> There are 2 parsing expression grammars in elisp.
> 
>     * http://www.emacswiki.org/cgi-bin/wiki/ParserCompiler, (2008) by
> Mike Mattie.
>     * http://www.emacswiki.org/emacs/ParsingExpressionGrammars (2008)
> by Helmut Eller.
> 
> The second one seems simpler, and i'm trying to learn it as a regex
> replacement, but don't know how to use it.
> 
> Could anyone give concrete example in the following scenario?
> 
> For example, on my website i have things like:
> 
>  <hr>
>  <p>Related essays:</p>
>  <ul>
>  <li><a href="someFilePath1">SomeTitleString2</a> someSring1</li>
>  <li><a href="someFilePath2">SomeTitleString2</a> someSring2</li>
>  ...
>  </ul>
> 
> Suppose i want to change them to:
> 
>  <hr>
>  <p>See also:</p>
>  <p>
>  <a href="someFilePath1">SomeTitleString1</a> someSring1<br>
>  <a href="someFilePath2">SomeTitleString2</a> someSring2<br>
>  ...
>  </p>
> 
> How do i do it?

Choose the right tool for the job:

sed -e 's|^<p>Related essays:</p>$|<p>See also:</p>|' -e 
'/^<ul>$/,/^<\/ul>/{s|^<\(/*\)ul>$|<\1p>|;s|^<li>||;s|</li>$|<br>|;}'

And since this is help-gnu-emacs@gnu.org:

C-x h
C-u M-| sed -e ...

-- 
Kevin Rodgers
Denver, Colorado, USA





  reply	other threads:[~2008-12-18  3:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-17 11:53 how to use parsing expressing grammar Xah Lee
2008-12-18  3:43 ` Kevin Rodgers [this message]
     [not found] ` <mailman.3007.1229571828.26697.help-gnu-emacs@gnu.org>
2008-12-18  9:24   ` Xah Lee
     [not found] <6b8a1070-1a89-48b0-9287-343b673b5758@a29g2000pra.googlegroups.com>
     [not found] ` <m27i5yygi5.fsf@gmail.com>
     [not found]   ` <m2k59ywtj2.fsf@gmail.com>
     [not found]     ` <b3203a8b-324f-440f-98a9-653c8d582c7c@y1g2000pra.googlegroups.com>
2008-12-20  8:42       ` Xah Lee
2008-12-20  9:34         ` Helmut Eller
2008-12-20 21:41           ` Xah Lee
2008-12-21  9:49             ` Helmut Eller
2009-03-03 17:34               ` Leo
2009-03-03 17:59                 ` Mike Mattie
     [not found]                 ` <mailman.2299.1236115586.31690.help-gnu-emacs@gnu.org>
2009-03-03 22:05                   ` Xah Lee
2009-03-03 23:52                     ` W Dan Meyer
2009-03-04  0:35                       ` Miles Bader
2009-03-05  6:55                         ` Mike Mattie
2009-03-05  6:18                       ` Mike Mattie
2009-03-05 16:38                     ` Mike Mattie
2009-03-06  8:53                     ` Helmut Eller
2008-12-20 22:27           ` Xah Lee
2008-12-21 11:24             ` Helmut Eller
2008-12-23 23:21         ` ashishnkadakia

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='gicgsv$dfh$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --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).