ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: lpeg splitter
Date: Fri, 05 Aug 2011 16:44:59 +0200	[thread overview]
Message-ID: <4E3C01EB.20201@wxs.nl> (raw)
In-Reply-To: <4E3C003B.8080204@gmx.net>

On 5-8-2011 4:37, Peter Rolf wrote:
> Hi,
>
> I'm currently trying to adapt my MP specials to the 'new' plugin
> handler. My actual problem is the splitting of the 'ssh_colors' string
> with lpeg. Sadly my knowledge about lpeg is nearly zero and it would
> take me a few days to understand this (my mind is already contaminated
> with 'regular expressions').
>
> How do I split the 'ssh_colors' string
>
>   ["ssh_colors"]="1:1:0 0.949:0.729:0 0.894:0.514:0 0.835:0.341:0
> 0.776:0.216:0 0.706:0.125:0 0.631:0.063:0.588 0.549:0.027:0.953
> 0.443:0.008:0.953 0.318:0:0.588 0:0:0",
>
> to get the single color strings (r:g:b) in say 'col[i]'?

inspect(lpeg.match(lpeg.tsplitat(" "),ssh_colors))


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2011-08-05 14:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05 14:37 Peter Rolf
2011-08-05 14:44 ` Hans Hagen [this message]
2011-08-05 17:47   ` Philipp Gesang
2011-08-05 19:20     ` Peter Rolf

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

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

  git send-email \
    --in-reply-to=4E3C01EB.20201@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /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 NNTP newsgroup(s).