You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
487 B
30 lines
487 B
1 year ago
|
package ddl
|
||
|
|
||
|
import (
|
||
|
"github.com/antlr4-go/antlr/v4"
|
||
|
"unicode"
|
||
|
)
|
||
|
|
||
|
type CaseChangingStream struct {
|
||
|
antlr.CharStream
|
||
|
upper bool
|
||
|
}
|
||
|
|
||
|
func newCaseChangingStream(in antlr.CharStream, upper bool) *CaseChangingStream {
|
||
|
return &CaseChangingStream{
|
||
|
in,
|
||
|
upper,
|
||
|
}
|
||
|
}
|
||
|
func (is *CaseChangingStream) LA(offset int) int {
|
||
|
in := is.CharStream.LA(offset)
|
||
|
if in < 0 {
|
||
|
return in
|
||
|
}
|
||
|
if is.upper {
|
||
|
return int(unicode.ToUpper(rune(in)))
|
||
|
} else {
|
||
|
return int(unicode.ToLower(rune(in)))
|
||
|
}
|
||
|
}
|