Merge pull request #1848 from davesisson/master
Fix tests for PR #1844.
This commit is contained in:
commit
f2ee752a58
|
@ -88,7 +88,7 @@ func (this *TreeShapeListener) EnterEveryRule(ctx antlr.ParserRuleContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
input := antlr.NewFileStream(os.Args[1])
|
input, _ := antlr.NewFileStream(os.Args[1])
|
||||||
lexer := parser.NewJSONLexer(input)
|
lexer := parser.NewJSONLexer(input)
|
||||||
stream := antlr.NewCommonTokenStream(lexer,0)
|
stream := antlr.NewCommonTokenStream(lexer,0)
|
||||||
p := parser.NewJSONParser(stream)
|
p := parser.NewJSONParser(stream)
|
||||||
|
|
|
@ -674,6 +674,7 @@ public class BaseGoTest implements RuntimeTestSupport {
|
||||||
"import (\n"
|
"import (\n"
|
||||||
+" \"github.com/antlr/antlr4/runtime/Go/antlr\"\n"
|
+" \"github.com/antlr/antlr4/runtime/Go/antlr\"\n"
|
||||||
+" \"./parser\"\n"
|
+" \"./parser\"\n"
|
||||||
|
+" \"fmt\"\n"
|
||||||
+" \"os\"\n"
|
+" \"os\"\n"
|
||||||
+")\n"
|
+")\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
|
@ -696,7 +697,11 @@ public class BaseGoTest implements RuntimeTestSupport {
|
||||||
+ "}\n"
|
+ "}\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "func main() {\n"
|
+ "func main() {\n"
|
||||||
+ " input := antlr.NewFileStream(os.Args[1])\n"
|
+ " input, err := antlr.NewFileStream(os.Args[1])\n"
|
||||||
|
+ " if err != nil {\n"
|
||||||
|
+ " fmt.Printf(\"Failed to find file: %v\", err)\n"
|
||||||
|
+ " return\n"
|
||||||
|
+ " }\n"
|
||||||
+ " lexer := parser.New<lexerName>(input)\n"
|
+ " lexer := parser.New<lexerName>(input)\n"
|
||||||
+ " stream := antlr.NewCommonTokenStream(lexer,0)\n"
|
+ " stream := antlr.NewCommonTokenStream(lexer,0)\n"
|
||||||
+ "<createParser>"
|
+ "<createParser>"
|
||||||
|
@ -734,7 +739,11 @@ public class BaseGoTest implements RuntimeTestSupport {
|
||||||
+ ")\n"
|
+ ")\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "func main() {\n"
|
+ "func main() {\n"
|
||||||
+ " input := antlr.NewFileStream(os.Args[1])\n"
|
+ " input, err := antlr.NewFileStream(os.Args[1])\n"
|
||||||
|
+ " if err != nil {\n"
|
||||||
|
+ " fmt.Printf(\"Failed to find file: %v\", err)\n"
|
||||||
|
+ " return\n"
|
||||||
|
+ " }\n"
|
||||||
+ " lexer := parser.New<lexerName>(input)\n"
|
+ " lexer := parser.New<lexerName>(input)\n"
|
||||||
+ " stream := antlr.NewCommonTokenStream(lexer,0)\n"
|
+ " stream := antlr.NewCommonTokenStream(lexer,0)\n"
|
||||||
+ " stream.Fill()\n"
|
+ " stream.Fill()\n"
|
||||||
|
|
|
@ -28,9 +28,9 @@ func NewFileStream(fileName string) (*FileStream, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
err = io.Copy(buf, f)
|
_, err = io.Copy(buf, f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, er
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
fs := new(FileStream)
|
fs := new(FileStream)
|
||||||
|
|
Loading…
Reference in New Issue