scala.meta.internal.parsers.NestedContext.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of parsers_sjs1_2.13 Show documentation
Show all versions of parsers_sjs1_2.13 Show documentation
Scalameta APIs for parsing and their baseline implementation
package scala.meta.internal.parsers
/** Utility for tracking a context, like whether we are inside a pattern or a quote. */
private[parsers] trait NestedContext {
private var nested = 0
def within[T](body: => T): T = {
nested += 1
try {
body
} finally {
nested -= 1
}
}
def isInside() = nested > 0
}
private[parsers] object QuotedSpliceContext extends NestedContext
private[parsers] object QuotedPatternContext extends NestedContext
© 2015 - 2025 Weber Informatics LLC | Privacy Policy