@@ -89,11 +89,12 @@ trait SilFrontend extends DefaultFrontend {
8989 /** For testing of plugin import feature */
9090 def defaultPluginCount : Int = defaultPlugins.size
9191
92+ protected val fp = new FastParser ()
9293
9394 protected var _plugins : SilverPluginManager = SilverPluginManager (defaultPlugins match {
9495 case Seq () => None
9596 case s => Some (s.mkString(" :" ))
96- })(reporter, logger, _config)
97+ })(reporter, logger, _config, fp )
9798
9899 def plugins : SilverPluginManager = _plugins
99100
@@ -187,7 +188,7 @@ trait SilFrontend extends DefaultFrontend {
187188 val list = _config.plugin.toOption ++ defaultPlugins
188189 if (list.isEmpty) { None } else { Some (list.mkString(" :" )) }
189190 }
190- _plugins = SilverPluginManager (plugins)(reporter, logger, _config)
191+ _plugins = SilverPluginManager (plugins)(reporter, logger, _config, fp )
191192 }
192193 }
193194
@@ -233,7 +234,7 @@ trait SilFrontend extends DefaultFrontend {
233234 val file = _inputFile.get
234235 _plugins.beforeParse(input, isImported = false ) match {
235236 case Some (inputPlugin) =>
236- val result = FastParser .parse(inputPlugin, file, Some (_plugins))
237+ val result = fp .parse(inputPlugin, file, Some (_plugins))
237238 result match {
238239 case Parsed .Success (e@ PProgram (_, _, _, _, _, _, _, _, err_list), _) =>
239240 if (err_list.isEmpty || err_list.forall(p => p.isInstanceOf [ParseWarning ])) {
@@ -243,7 +244,7 @@ trait SilFrontend extends DefaultFrontend {
243244 else Fail (err_list)
244245 case fail @ Parsed .Failure (_, index, extra) =>
245246 val msg = fail.trace().longAggregateMsg
246- val (line, col) = LineCol (index)
247+ val (line, col) = fp.lineCol.getPos (index)
247248 Fail (List (ParseError (s " Expected $msg" , SourcePosition (file, line, col))))
248249 // ? val pos = extra.input.prettyIndex(index).split(":").map(_.toInt)
249250 // ? Fail(List(ParseError(s"Expected $msg", SourcePosition(file, pos(0), pos(1)))))
0 commit comments