Export Lexer methods

- They can be called in target-specific grammar actions, therefore must
  be exported.
- Their Java analogues are public methods.
This commit is contained in:
Eddy Reyes 2017-08-22 23:37:26 -05:00
parent 1203794259
commit 2423359b28
2 changed files with 15 additions and 15 deletions

View File

@ -21,11 +21,11 @@ type Lexer interface {
Emit() Token
setChannel(int)
pushMode(int)
popMode() int
setType(int)
setMode(int)
SetChannel(int)
PushMode(int)
PopMode() int
SetType(int)
SetMode(int)
}
type BaseLexer struct {
@ -150,7 +150,7 @@ func (b *BaseLexer) GetSourceName() string {
return b.GrammarFileName
}
func (b *BaseLexer) setChannel(v int) {
func (b *BaseLexer) SetChannel(v int) {
b.channel = v
}
@ -250,11 +250,11 @@ func (b *BaseLexer) More() {
b.thetype = LexerMore
}
func (b *BaseLexer) setMode(m int) {
func (b *BaseLexer) SetMode(m int) {
b.mode = m
}
func (b *BaseLexer) pushMode(m int) {
func (b *BaseLexer) PushMode(m int) {
if LexerATNSimulatorDebug {
fmt.Println("pushMode " + strconv.Itoa(m))
}
@ -262,7 +262,7 @@ func (b *BaseLexer) pushMode(m int) {
b.mode = m
}
func (b *BaseLexer) popMode() int {
func (b *BaseLexer) PopMode() int {
if len(b.modeStack) == 0 {
panic("Empty Stack")
}
@ -331,7 +331,7 @@ func (b *BaseLexer) GetType() int {
return b.thetype
}
func (b *BaseLexer) setType(t int) {
func (b *BaseLexer) SetType(t int) {
b.thetype = t
}

View File

@ -101,7 +101,7 @@ func NewLexerTypeAction(thetype int) *LexerTypeAction {
}
func (l *LexerTypeAction) execute(lexer Lexer) {
lexer.setType(l.thetype)
lexer.SetType(l.thetype)
}
func (l *LexerTypeAction) hash() int {
@ -145,7 +145,7 @@ func NewLexerPushModeAction(mode int) *LexerPushModeAction {
// <p>This action is implemented by calling {@link Lexer//pushMode} with the
// value provided by {@link //getMode}.</p>
func (l *LexerPushModeAction) execute(lexer Lexer) {
lexer.pushMode(l.mode)
lexer.PushMode(l.mode)
}
func (l *LexerPushModeAction) hash() int {
@ -190,7 +190,7 @@ var LexerPopModeActionINSTANCE = NewLexerPopModeAction()
// <p>This action is implemented by calling {@link Lexer//popMode}.</p>
func (l *LexerPopModeAction) execute(lexer Lexer) {
lexer.popMode()
lexer.PopMode()
}
func (l *LexerPopModeAction) String() string {
@ -242,7 +242,7 @@ func NewLexerModeAction(mode int) *LexerModeAction {
// <p>This action is implemented by calling {@link Lexer//mode} with the
// value provided by {@link //getMode}.</p>
func (l *LexerModeAction) execute(lexer Lexer) {
lexer.setMode(l.mode)
lexer.SetMode(l.mode)
}
func (l *LexerModeAction) hash() int {
@ -341,7 +341,7 @@ func NewLexerChannelAction(channel int) *LexerChannelAction {
// <p>This action is implemented by calling {@link Lexer//setChannel} with the
// value provided by {@link //getChannel}.</p>
func (l *LexerChannelAction) execute(lexer Lexer) {
lexer.setChannel(l.channel)
lexer.SetChannel(l.channel)
}
func (l *LexerChannelAction) hash() int {