|
Scala example source code file (Parsers.scala)
The Parsers.scala Scala example source codepackage scala.reflect.macros package contexts import scala.tools.nsc.reporters.StoreReporter trait Parsers { self: Context => import global._ def parse(code: String) = { val sreporter = new StoreReporter() val unit = new CompilationUnit(newSourceFile(code, "<macro>")) { override def reporter = sreporter } val parser = newUnitParser(unit) val tree = gen.mkTreeOrBlock(parser.parseStatsOrPackages()) sreporter.infos.foreach { case sreporter.Info(pos, msg, sreporter.ERROR) => throw ParseException(pos, msg) } tree } } Other Scala source code examplesHere is a short list of links related to this Scala Parsers.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.