blynn / nex

Lexer for Go
http://cs.stanford.edu/~blynn/nex/
GNU General Public License v3.0
416 stars 47 forks source link

Allow use of - (dash) inside a character group #10

Closed md2 closed 11 years ago

md2 commented 11 years ago

Currently, if you try to put dash (-) inside a character group (at the beginning or at the end of it) nex will panic: bad range in character class:

/[-a-z]/ {
}
//
package main
import ("fmt";"os")
func main() {
  NN_FUN(NewLexer(os.Stdin))
}

I wish to be able to use dashes like that, because else regexp becomes cumbersome if your identifiers can contain a dash.

blynn commented 11 years ago

I just added support for this feature. Let me know if it seems broken.