forked from jasder/antlr
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:
parent
1203794259
commit
2423359b28
|
@ -21,11 +21,11 @@ type Lexer interface {
|
||||||
|
|
||||||
Emit() Token
|
Emit() Token
|
||||||
|
|
||||||
setChannel(int)
|
SetChannel(int)
|
||||||
pushMode(int)
|
PushMode(int)
|
||||||
popMode() int
|
PopMode() int
|
||||||
setType(int)
|
SetType(int)
|
||||||
setMode(int)
|
SetMode(int)
|
||||||
}
|
}
|
||||||
|
|
||||||
type BaseLexer struct {
|
type BaseLexer struct {
|
||||||
|
@ -150,7 +150,7 @@ func (b *BaseLexer) GetSourceName() string {
|
||||||
return b.GrammarFileName
|
return b.GrammarFileName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BaseLexer) setChannel(v int) {
|
func (b *BaseLexer) SetChannel(v int) {
|
||||||
b.channel = v
|
b.channel = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,11 +250,11 @@ func (b *BaseLexer) More() {
|
||||||
b.thetype = LexerMore
|
b.thetype = LexerMore
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BaseLexer) setMode(m int) {
|
func (b *BaseLexer) SetMode(m int) {
|
||||||
b.mode = m
|
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))
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ func (b *BaseLexer) pushMode(m int) {
|
||||||
b.mode = m
|
b.mode = m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BaseLexer) popMode() int {
|
func (b *BaseLexer) PopMode() int {
|
||||||
if len(b.modeStack) == 0 {
|
if len(b.modeStack) == 0 {
|
||||||
panic("Empty Stack")
|
panic("Empty Stack")
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ func (b *BaseLexer) GetType() int {
|
||||||
return b.thetype
|
return b.thetype
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BaseLexer) setType(t int) {
|
func (b *BaseLexer) SetType(t int) {
|
||||||
b.thetype = t
|
b.thetype = t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ func NewLexerTypeAction(thetype int) *LexerTypeAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LexerTypeAction) execute(lexer Lexer) {
|
func (l *LexerTypeAction) execute(lexer Lexer) {
|
||||||
lexer.setType(l.thetype)
|
lexer.SetType(l.thetype)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LexerTypeAction) hash() int {
|
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
|
// <p>This action is implemented by calling {@link Lexer//pushMode} with the
|
||||||
// value provided by {@link //getMode}.</p>
|
// value provided by {@link //getMode}.</p>
|
||||||
func (l *LexerPushModeAction) execute(lexer Lexer) {
|
func (l *LexerPushModeAction) execute(lexer Lexer) {
|
||||||
lexer.pushMode(l.mode)
|
lexer.PushMode(l.mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LexerPushModeAction) hash() int {
|
func (l *LexerPushModeAction) hash() int {
|
||||||
|
@ -190,7 +190,7 @@ var LexerPopModeActionINSTANCE = NewLexerPopModeAction()
|
||||||
|
|
||||||
// <p>This action is implemented by calling {@link Lexer//popMode}.</p>
|
// <p>This action is implemented by calling {@link Lexer//popMode}.</p>
|
||||||
func (l *LexerPopModeAction) execute(lexer Lexer) {
|
func (l *LexerPopModeAction) execute(lexer Lexer) {
|
||||||
lexer.popMode()
|
lexer.PopMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LexerPopModeAction) String() string {
|
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
|
// <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.setMode(l.mode)
|
lexer.SetMode(l.mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LexerModeAction) hash() int {
|
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
|
// <p>This action is implemented by calling {@link Lexer//setChannel} with the
|
||||||
// value provided by {@link //getChannel}.</p>
|
// value provided by {@link //getChannel}.</p>
|
||||||
func (l *LexerChannelAction) execute(lexer Lexer) {
|
func (l *LexerChannelAction) execute(lexer Lexer) {
|
||||||
lexer.setChannel(l.channel)
|
lexer.SetChannel(l.channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LexerChannelAction) hash() int {
|
func (l *LexerChannelAction) hash() int {
|
||||||
|
|
Loading…
Reference in New Issue