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.
29 lines
487 B
29 lines
487 B
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))) |
|
} |
|
}
|
|
|