|
|
@ -104,6 +104,7 @@ func (v *ApiVisitor) newExprWithTerminalNode(node antlr.TerminalNode) *defaultEx
|
|
|
|
if node == nil {
|
|
|
|
if node == nil {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
token := node.GetSymbol()
|
|
|
|
token := node.GetSymbol()
|
|
|
|
return v.newExprWithToken(token)
|
|
|
|
return v.newExprWithToken(token)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -132,6 +133,7 @@ func (v *ApiVisitor) newExprWithText(text string, line, column, start, stop int)
|
|
|
|
instance.column = column
|
|
|
|
instance.column = column
|
|
|
|
instance.start = start
|
|
|
|
instance.start = start
|
|
|
|
instance.stop = stop
|
|
|
|
instance.stop = stop
|
|
|
|
|
|
|
|
|
|
|
|
return instance
|
|
|
|
return instance
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -248,8 +250,7 @@ func EqualDoc(spec1, spec2 Spec) bool {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (v *ApiVisitor) getDoc(t TokenStream) []Expr {
|
|
|
|
func (v *ApiVisitor) getDoc(t TokenStream) []Expr {
|
|
|
|
list := v.getHiddenTokensToLeft(t, api.COMEMNTS, false)
|
|
|
|
return v.getHiddenTokensToLeft(t, api.COMEMNTS, false)
|
|
|
|
return list
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (v *ApiVisitor) getComment(t TokenStream) Expr {
|
|
|
|
func (v *ApiVisitor) getComment(t TokenStream) Expr {
|
|
|
@ -273,11 +274,9 @@ func (v *ApiVisitor) getComment(t TokenStream) Expr {
|
|
|
|
func (v *ApiVisitor) getHiddenTokensToLeft(t TokenStream, channel int, containsCommentOfDefaultChannel bool) []Expr {
|
|
|
|
func (v *ApiVisitor) getHiddenTokensToLeft(t TokenStream, channel int, containsCommentOfDefaultChannel bool) []Expr {
|
|
|
|
ct := t.GetParser().GetTokenStream().(*antlr.CommonTokenStream)
|
|
|
|
ct := t.GetParser().GetTokenStream().(*antlr.CommonTokenStream)
|
|
|
|
tokens := ct.GetHiddenTokensToLeft(t.GetStart().GetTokenIndex(), channel)
|
|
|
|
tokens := ct.GetHiddenTokensToLeft(t.GetStart().GetTokenIndex(), channel)
|
|
|
|
tmp := make([]antlr.Token, len(tokens))
|
|
|
|
|
|
|
|
copy(tmp, tokens)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var list []Expr
|
|
|
|
var list []Expr
|
|
|
|
for _, each := range tmp {
|
|
|
|
for _, each := range tokens {
|
|
|
|
if !containsCommentOfDefaultChannel {
|
|
|
|
if !containsCommentOfDefaultChannel {
|
|
|
|
index := each.GetTokenIndex() - 1
|
|
|
|
index := each.GetTokenIndex() - 1
|
|
|
|
|
|
|
|
|
|
|
|