Rename Lexer.mode to setMode

Also minor formatting.
This commit is contained in:
Will Faught 2016-05-26 23:27:21 -07:00
parent 128ec07dd3
commit 10eb1a1970
2 changed files with 7 additions and 3 deletions

View File

@ -19,7 +19,7 @@ type Lexer interface {
pushMode(int) pushMode(int)
popMode() int popMode() int
setType(int) setType(int)
mode(int) setMode(int)
} }
type BaseLexer struct { type BaseLexer struct {
@ -37,7 +37,7 @@ type BaseLexer struct {
token Token token Token
hitEOF bool hitEOF bool
channel int channel int
thetype int thetype int
modeStack IntStack modeStack IntStack
mode int mode int
text string text string
@ -249,6 +249,10 @@ func (b *BaseLexer) More() {
b.thetype = LexerMore b.thetype = LexerMore
} }
func (b *BaseLexer) setMode(m int) {
b.mode = m
}
func (b *BaseLexer) pushMode(m int) { func (b *BaseLexer) pushMode(m int) {
if LexerATNSimulatorDebug { if LexerATNSimulatorDebug {
fmt.Println("pushMode " + strconv.Itoa(m)) fmt.Println("pushMode " + strconv.Itoa(m))

View File

@ -232,7 +232,7 @@ func NewLexerModeAction(mode int) *LexerModeAction {
// <p>This action is implemented by calling {@link Lexer//mode} with the // <p>This action is implemented by calling {@link Lexer//mode} with the
// value provided by {@link //getMode}.</p> // value provided by {@link //getMode}.</p>
func (l *LexerModeAction) execute(lexer Lexer) { func (l *LexerModeAction) execute(lexer Lexer) {
lexer.mode(l.mode) lexer.setMode(l.mode)
} }
func (l *LexerModeAction) Hash() string { func (l *LexerModeAction) Hash() string {