April 01, 2008
BCS wrote:
> I'm planing on adding "!" as a "not" suffix in dparse (if "Blah" can be parsed, fail, else continue from the same place) and I'm wondering if anyone would find the reverse useful (try to parse a "Foo", if it works, drop it, back up to where we started and continue, else fail). Also is there any suggestions as to what suffix to use?

PERL regular expressions have lookahead (and negative lookahead):

(?=pattern)
	Matches pattern, but doesn't include pattern in the result
(?!pattern)
	Will only succeed if pattern does *not* match.
April 01, 2008
BCS wrote:
> Frits van Bommel wrote:
>> BCS wrote:
>>
>>> I was kidna hoping for a single char as it make the parsing of the BNF simpler.
>>
>>
>> Well, this would make (the implmentation of) the parsing simpler; just implement '!' and you get the other one for free! :P
>>
> 
> Given that I have no nested constructs, I !! doesn't "just work", it just fails to parse :(

Perhaps you should fix that then :P.
April 01, 2008
Frits van Bommel wrote:
> BCS wrote:
> 
>> Frits van Bommel wrote:
>>
>>> BCS wrote:
>>>
>>>> I was kidna hoping for a single char as it make the parsing of the BNF simpler.
>>>
>>>
>>>
>>> Well, this would make (the implmentation of) the parsing simpler; just implement '!' and you get the other one for free! :P
>>>
>>
>> Given that I have no nested constructs, I !! doesn't "just work", it just fails to parse :(
> 
> 
> Perhaps you should fix that then :P.

It can't be. The structure of the system can't work that way and would have to be rebuilt to make it work.
April 01, 2008
Russell Lewis wrote:
> BCS wrote:
> 
>> I'm planing on adding "!" as a "not" suffix in dparse (if "Blah" can be parsed, fail, else continue from the same place) and I'm wondering if anyone would find the reverse useful (try to parse a "Foo", if it works, drop it, back up to where we started and continue, else fail). Also is there any suggestions as to what suffix to use?
> 
> 
> PERL regular expressions have lookahead (and negative lookahead):
> 
> (?=pattern)
>     Matches pattern, but doesn't include pattern in the result
> (?!pattern)
>     Will only succeed if pattern does *not* match.

I /knew/ I saw that someplace! However the "=" doesn't work as a suffix. Oh well. Thanks.
1 2
Next ›   Last »