Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Complex Splitting - /\G.../gc

by ikegami (Pope)
on Feb 07, 2007 at 08:00 UTC ( #598701=note: print w/replies, xml ) Need Help??


in reply to Re: Complex Splitting - Parse::RecDescent
in thread Complex Splitting

That silently ignores whitespace (read up on <skip>).

Also, P::RD is rather slow. I'd even say inexcusably slow if you're just using it as a tokenizer. May I suggest a much faster tokenizer?

use strict; use warnings; sub process_token { my ($token) = @_; print("Token: $token\n"); } { my $str = "ABC[GHI]XY[Z]1A"; for ($str) { /\G \[ ([A-Z]*) \] /xgcs && do { process_token("$1"); redo }; /\G ([A-Z]) /xgcs && do { process_token("$1"); redo }; /\G (.) /xgcs && do { printf("Unexpected '%s' at pos %d\n", $1, pos()-length($1)); redo }; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://598701]
help
Chatterbox?
[stevieb]: yeah, so the wiringPi library appears to be missing/injecting incorrect defined variables into I2C calls, and it's all over the map. I'm going to have to revisit and use something else, write something else, or scrutinize the code and fix

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2017-06-23 00:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (532 votes). Check out past polls.