case sensitivity

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

case sensitivity

Erik
Hello

Maybe I missed something obvious, but is there an easy way to parse a language such as SQL or Pascal where keywords are not case sensitive? Obviously, I can make the code lower case before parsing it, but I'd like to have parse errors displaying the original code, for one thing.

Any suggestions?

Thanks

Erik
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: case sensitivity

mathias
Administrator
Hi Erik,

I assume you are using parboiled for Java.
Then the BaseParser [1] comes with a few rule building methods called "IgnoreCase" that do what I think you are looking for: generate rule that match Strings and characters case-insensitively.

Is that what you need?

Cheers,
Mathias

  [1]: http://www.decodified.com/parboiled/api/java/org/parboiled/BaseParser.html


---
[hidden email]
http://www.parboiled.org

On 10.04.2011, at 16:19, Erik [via parboiled users] wrote:

> Hello
>
> Maybe I missed something obvious, but is there an easy way to parse a language such as SQL or Pascal where keywords are not case sensitive? Obviously, I can make the code lower case before parsing it, but I'd like to have parse errors displaying the original code, for one thing.
>
> Any suggestions?
>
> Thanks
>
> Erik
>
>
> If you reply to this email, your message will be added to the discussion below:
> http://users.parboiled.org/case-sensitivity-tp2802520p2802520.html
> To start a new topic under parboiled users, email [hidden email]
> To unsubscribe from parboiled users, click here.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: case sensitivity

Erik
Thanks for your reply. I had seen the IgnoreCase method but didn't see how it could be used, since it does not accept a Rule for parameter. I now realize that Terminal and Keyword, which I had assumed to be the basic building blocks (I'm using JavaParser as my starting point), are just helper functions that I can modify.
Loading...