Pegged: spaces
    Michelle Long 
    HappyDance321 at gmail.com
       
    Thu Oct 25 16:18:18 UTC 2018
    
    
  
Is Pegged suppose to consume white spaces automatically?
I have some text like "abvdfs dfddf"
and I have made some rules to divide the two parts by a space.
The sub-rules are complex but none of them contain a space(' ', 
they do contain spaces to separate the sub-rules).
The parser though is essentially ignore the space.
Sometimes it seems to work on certain rule construction and then 
other times it doesn't.
Basically none of my sub-rules have any space and the main rule is
A ' '+ B
Where A attempts to parse the first half and B the second half.
But A consumes the whole string!
A does not consume any spaces though! (no . usage or ' ' in the 
rule definitions that A uses)
I'd be able to limit the application of the rule to a substring 
that sort of emulates splitting of the string.
(!' ':A) ' '+ B
hypothetically would parse each char for A but terminate the rule 
when it encounters a space before A get to see the space. Is this 
possible with pegged?
It's sort of a look ahead but it has to do it for each character 
rather than (!' ' A) which would only check the first character 
then continue on with A.
    
    
More information about the Digitalmars-d-learn
mailing list