matching keywords

View: New views
3 Messages — Rating Filter:   Alert me  

matching keywords

by bytecolor-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello people,

Still playing with Spirit2. My grammar works well, except for reserved
words.

I've got an example here:
http://codepad.org/SF1xC2ac

It works fine there. I think it's matching reserved words correctly.
More to the point, identifiers that start with a reserved word *dont*
fail.

If I implement this in my larger grammer it fails. So either I'm not
doing this correctly, or I have some ambiguities in my larger grammar.

Does that code look correct?

Thanks
--
S. Edward Dolan


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Spirit-general mailing list
Spirit-general@...
https://lists.sourceforge.net/lists/listinfo/spirit-general

Re: matching keywords

by temp-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Hello people,
>
> Still playing with Spirit2. My grammar works well, except for reserved
> words.
>
> I've got an example here:
> http://codepad.org/SF1xC2ac
>
> It works fine there. I think it's matching reserved words correctly.
> More to the point, identifiers that start with a reserved word *dont*
> fail.
>
> If I implement this in my larger grammer it fails. So either I'm not
> doing this correctly, or I have some ambiguities in my larger grammar.
>
> Does that code look correct?

Spirit 2.x does not have direct support for keywords. I'd try to use the
and predicate. Something like:

lexeme[keyword >> &space]

Paul



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Spirit-general mailing list
Spirit-general@...
https://lists.sourceforge.net/lists/listinfo/spirit-general

Re: matching keywords

by Joel de Guzman-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

temp@... wrote:

>> Hello people,
>>
>> Still playing with Spirit2. My grammar works well, except for reserved
>> words.
>>
>> I've got an example here:
>> http://codepad.org/SF1xC2ac
>>
>> It works fine there. I think it's matching reserved words correctly.
>> More to the point, identifiers that start with a reserved word *dont*
>> fail.
>>
>> If I implement this in my larger grammer it fails. So either I'm not
>> doing this correctly, or I have some ambiguities in my larger grammar.
>>
>> Does that code look correct?
>
> Spirit 2.x does not have direct support for keywords. I'd try to use the
> and predicate. Something like:
>
> lexeme[keyword >> &space]

I prefer:

     keyword >> !(alnum | '_') // make sure we have whole words

Regards,
--
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net
http://www.facebook.com/djowel

Meet me at BoostCon
http://www.boostcon.com/home
http://www.facebook.com/boostcon



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Spirit-general mailing list
Spirit-general@...
https://lists.sourceforge.net/lists/listinfo/spirit-general