ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* lpeg splitter
@ 2011-08-05 14:37 Peter Rolf
  2011-08-05 14:44 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Rolf @ 2011-08-05 14:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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]'?


Regards, Peter
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lpeg splitter
  2011-08-05 14:37 lpeg splitter Peter Rolf
@ 2011-08-05 14:44 ` Hans Hagen
  2011-08-05 17:47   ` Philipp Gesang
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2011-08-05 14:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lpeg splitter
  2011-08-05 14:44 ` Hans Hagen
@ 2011-08-05 17:47   ` Philipp Gesang
  2011-08-05 19:20     ` Peter Rolf
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Gesang @ 2011-08-05 17:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1939 bytes --]

On 2011-08-05 <16:44:59>, Hans Hagen wrote:
> 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))

Hi Peter, there are some examples for „lpeg.splitat“ and
„string.split“ on the wiki:
  <http://wiki.contextgarden.net/String_Manipulation#lpeg.splitat.28delimiter.2C_.5Bsingle.5D.29>

Best regards, Philipp



> 
> 
> -----------------------------------------------------------------
>                                           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
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lpeg splitter
  2011-08-05 17:47   ` Philipp Gesang
@ 2011-08-05 19:20     ` Peter Rolf
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Rolf @ 2011-08-05 19:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 05.08.2011 19:47, schrieb Philipp Gesang:
> On 2011-08-05 <16:44:59>, Hans Hagen wrote:
>> 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))
> 
> Hi Peter, there are some examples for „lpeg.splitat“ and
> „string.split“ on the wiki:
>   <http://wiki.contextgarden.net/String_Manipulation#lpeg.splitat.28delimiter.2C_.5Bsingle.5D.29>
>

Thanks for the link! The more examples, the better. :-)
I have to learn this stuff...

> Best regards, Philipp
> 
> 
> 
>>
>>
>> -----------------------------------------------------------------
>>                                           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
>> ___________________________________________________________________________________
>>
>>
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-05 19:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-05 14:37 lpeg splitter Peter Rolf
2011-08-05 14:44 ` Hans Hagen
2011-08-05 17:47   ` Philipp Gesang
2011-08-05 19:20     ` Peter Rolf

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).