|
7 | 7 | package viper.silver.frontend |
8 | 8 |
|
9 | 9 | import viper.silver.ast.utility.Consistency |
10 | | -import viper.silver.ast.{SourcePosition, _} |
| 10 | +import viper.silver.ast._ |
11 | 11 | import viper.silver.parser._ |
12 | 12 | import viper.silver.plugin.SilverPluginManager |
13 | 13 | import viper.silver.plugin.SilverPluginManager.PluginException |
14 | 14 | import viper.silver.reporter._ |
15 | 15 | import viper.silver.verifier._ |
16 | | -import fastparse.Parsed |
17 | 16 | import java.nio.file.{Path, Paths} |
18 | 17 | import viper.silver.FastMessaging |
19 | 18 |
|
@@ -266,22 +265,11 @@ trait SilFrontend extends DefaultFrontend { |
266 | 265 | plugins.beforeParse(input, isImported = false) match { |
267 | 266 | case Some(inputPlugin) => |
268 | 267 | val result = fp.parse(inputPlugin, file, Some(plugins)) |
269 | | - result match { |
270 | | - case Parsed.Success(e@ PProgram(_, _, _, _, _, _, _, _, err_list), _) => |
271 | | - if (err_list.isEmpty || err_list.forall(p => p.isInstanceOf[ParseWarning])) { |
272 | | - reporter report WarningsDuringParsing(err_list) |
273 | | - Succ({e.initProperties(); e}) |
274 | | - } |
275 | | - else Fail(err_list) |
276 | | - case fail @ Parsed.Failure(_, index, _) => |
277 | | - val msg = fail.trace().aggregateMsg |
278 | | - val (line, col) = fp.lineCol.getPos(index) |
279 | | - Fail(List(ParseError(msg, SourcePosition(file, line, col)))) |
280 | | - //? val pos = extra.input.prettyIndex(index).split(":").map(_.toInt) |
281 | | - //? Fail(List(ParseError(s"Expected $msg", SourcePosition(file, pos(0), pos(1))))) |
282 | | - case error: ParseError => Fail(List(error)) |
283 | | - } |
284 | | - |
| 268 | + if (result.errors.forall(p => p.isInstanceOf[ParseWarning])) { |
| 269 | + reporter report WarningsDuringParsing(result.errors) |
| 270 | + Succ({result.initProperties(); result}) |
| 271 | + } |
| 272 | + else Fail(result.errors) |
285 | 273 | case None => Fail(plugins.errors) |
286 | 274 | } |
287 | 275 | } |
|
0 commit comments