I'm getting a warning while trying to create AST tree from golang code line 6:1 no viable alternative at input 'sMap, lMap map[int32]string\r\n\tif' The code I tried,
package dum
func mergeIntStrMap(map1 map[int32]string, map2 map[int32]string) string {
var sMap, lMap map[int32]string
return lMap
}
Grammar file I downloaded from [github] https://github.com/antlr/grammars-v4/blob/master/golang/ . Is there any issue in the grammar file or any fix for this. Used code to generate AST(python code),
from antlr4 import *
from GoParser import GoParser
from GoLexer import GoLexer
file = FileStream(f,encoding = 'utf-8')
lexer = GoLexer(file)
token = CommonTokenStream(lexer)
parse = GoParser(token)
trees = parse.sourceFile()
here GoParser and GoLexer files are generated from grammar file.
Thanks in Advance
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.