cznic / golex

github.com/cznic/golex has moved to modernc.org/golex
https://godoc.org/modernc.org/golex
BSD 3-Clause "New" or "Revised" License
182 stars 18 forks source link

Is golex going to support case-insensitive as flex #9

Closed buptmiao closed 7 years ago

buptmiao commented 7 years ago

I think this feature is very usefull.

cznic commented 7 years ago

It is useful. For example here.

buptmiao commented 7 years ago

Thanks. I saw this work around, but it is too boring if there are too many reserved words.

cznic commented 7 years ago

Quoting an answer from stackoverflow

You could set case-insensitivity in the .l file:

%option caseless

You could call flex -i.

Or you could state individual rules to be case-insensitive:

(?i:word)

Which of these options would be helpful in your use case?

buptmiao commented 7 years ago

I use the option below in flex.

%option case-insensitive
cznic commented 7 years ago

@buptmiao Please try checking out cznic/lex branch case-insensitive, then rebuild cznic/golex and test with some .l source. I did not actually tested if it works whatsoever, so please provide feedback. Thank you.

buptmiao commented 7 years ago

You are so great! It works now.

cznic commented 7 years ago

Thanks for testing it!