From 595567b5adaf4b66e1dc5deb8662391f8ad71424 Mon Sep 17 00:00:00 2001 From: Jamie Willis Date: Sat, 28 Dec 2024 16:44:57 +0000 Subject: [PATCH] refactor(debug)!: the debugger and debug packages are merged --- .../{debugger => debug}/util/XCollector.scala | 2 +- .../internal/XException.scala | 2 +- .../internal/XWeakMap.scala | 4 ++-- .../internal/XException.scala | 2 +- .../internal/XWeakMap.scala | 4 ++-- .../{debugger => debug}/util/XCollector.scala | 2 +- .../{debugger => debug}/util/XCollector.scala | 2 +- .../{debugger => debug}/util/XMap.scala | 0 .../{debugger => debug}/util/XMutMap.scala | 0 .../{debugger => debug}/util/XMap.scala | 2 +- .../{debugger => debug}/util/XMutMap.scala | 2 +- .../src/main/scala-2/parsley/debuggable.scala | 2 +- .../src/main/scala-3/parsley/debuggable.scala | 2 +- .../{debugger => debug}/DebugTree.scala | 6 +++--- .../{debugger => debug}/DebugView.scala | 10 +++++----- .../{debugger => debug}/ParseAttempt.scala | 2 +- .../{debugger => debug}/PrintView.scala | 6 +++--- .../{debugger => debug}/combinator.scala | 20 +++++++++---------- .../internal/DebugContext.scala | 4 ++-- .../internal/DivergenceContext.scala | 2 +- .../internal/Renamer.scala | 4 ++-- .../internal/TransientDebugTree.scala | 6 +++--- .../{debugger => debug}/util/Collector.scala | 6 +++--- .../util/XDummyCollector.scala | 2 +- .../{debugger => debug}/Debugged.scala | 4 ++-- .../frontend/{debugger => debug}/Named.scala | 2 +- .../{debugger => debug}/TaggedWith.scala | 6 +++--- .../instructions/debug/DebugInstrs.scala | 4 ++-- .../test/scala/parsley/AnnotationTest.scala | 2 +- .../DebuggerUsageSpec.scala | 14 ++++++------- .../{debugger => debug}/ReuseSpec.scala | 6 +++--- .../internal/deepembedding/RenameSpec.scala | 10 +++++----- .../frontend/TotalAttachmentSpec.scala | 4 ++-- 33 files changed, 73 insertions(+), 73 deletions(-) rename parsley-debug/js-native/src/main/scala/parsley/{debugger => debug}/util/XCollector.scala (92%) rename parsley-debug/js/src/main/scala/parsley/{debugger => debug}/internal/XException.scala (94%) rename parsley-debug/js/src/main/scala/parsley/{debugger => debug}/internal/XWeakMap.scala (96%) rename parsley-debug/jvm-native/src/main/scala/parsley/{debugger => debug}/internal/XException.scala (93%) rename parsley-debug/jvm-native/src/main/scala/parsley/{debugger => debug}/internal/XWeakMap.scala (94%) rename parsley-debug/jvm/src/main/scala-2/parsley/{debugger => debug}/util/XCollector.scala (98%) rename parsley-debug/jvm/src/main/scala-3/parsley/{debugger => debug}/util/XCollector.scala (89%) rename parsley-debug/shared/src/main/scala-2.12/parsley/{debugger => debug}/util/XMap.scala (100%) rename parsley-debug/shared/src/main/scala-2.12/parsley/{debugger => debug}/util/XMutMap.scala (100%) rename parsley-debug/shared/src/main/scala-2.13+/parsley/{debugger => debug}/util/XMap.scala (93%) rename parsley-debug/shared/src/main/scala-2.13+/parsley/{debugger => debug}/util/XMutMap.scala (92%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/DebugTree.scala (95%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/DebugView.scala (86%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/ParseAttempt.scala (99%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/PrintView.scala (93%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/combinator.scala (95%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/internal/DebugContext.scala (98%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/internal/DivergenceContext.scala (99%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/internal/Renamer.scala (95%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/internal/TransientDebugTree.scala (96%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/util/Collector.scala (97%) rename parsley-debug/shared/src/main/scala/parsley/{debugger => debug}/util/XDummyCollector.scala (92%) rename parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/backend/{debugger => debug}/Debugged.scala (96%) rename parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/{debugger => debug}/Named.scala (95%) rename parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/{debugger => debug}/TaggedWith.scala (98%) rename parsley-debug/shared/src/test/scala/parsley/{debugger => debug}/DebuggerUsageSpec.scala (91%) rename parsley-debug/shared/src/test/scala/parsley/{debugger => debug}/ReuseSpec.scala (88%) diff --git a/parsley-debug/js-native/src/main/scala/parsley/debugger/util/XCollector.scala b/parsley-debug/js-native/src/main/scala/parsley/debug/util/XCollector.scala similarity index 92% rename from parsley-debug/js-native/src/main/scala/parsley/debugger/util/XCollector.scala rename to parsley-debug/js-native/src/main/scala/parsley/debug/util/XCollector.scala index 77b709c45..927829f9c 100644 --- a/parsley-debug/js-native/src/main/scala/parsley/debugger/util/XCollector.scala +++ b/parsley-debug/js-native/src/main/scala/parsley/debug/util/XCollector.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.util +package parsley.debug.util // Sadly, no reflective capabilities exist in Scala.JS or Scala Native, so these // methods don't do anything yet. diff --git a/parsley-debug/js/src/main/scala/parsley/debugger/internal/XException.scala b/parsley-debug/js/src/main/scala/parsley/debug/internal/XException.scala similarity index 94% rename from parsley-debug/js/src/main/scala/parsley/debugger/internal/XException.scala rename to parsley-debug/js/src/main/scala/parsley/debug/internal/XException.scala index 39081eab8..a00bc6831 100644 --- a/parsley-debug/js/src/main/scala/parsley/debugger/internal/XException.scala +++ b/parsley-debug/js/src/main/scala/parsley/debug/internal/XException.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.internal +package parsley.debug.internal import scala.scalajs.js diff --git a/parsley-debug/js/src/main/scala/parsley/debugger/internal/XWeakMap.scala b/parsley-debug/js/src/main/scala/parsley/debug/internal/XWeakMap.scala similarity index 96% rename from parsley-debug/js/src/main/scala/parsley/debugger/internal/XWeakMap.scala rename to parsley-debug/js/src/main/scala/parsley/debug/internal/XWeakMap.scala index 29c76af74..b69054293 100644 --- a/parsley-debug/js/src/main/scala/parsley/debugger/internal/XWeakMap.scala +++ b/parsley-debug/js/src/main/scala/parsley/debug/internal/XWeakMap.scala @@ -3,13 +3,13 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.internal +package parsley.debug.internal import scala.scalajs.js import scala.scalajs.js.annotation.JSGlobal import org.typelevel.scalaccompat.annotation.unused -import parsley.debugger.util.XMutMap +import parsley.debug.util.XMutMap private [parsley] final class XWeakMap[K <: Object, V] extends XMutMap[K, V] { // import XWeakMap.WeakMap // scalastyle:ignore import.grouping diff --git a/parsley-debug/jvm-native/src/main/scala/parsley/debugger/internal/XException.scala b/parsley-debug/jvm-native/src/main/scala/parsley/debug/internal/XException.scala similarity index 93% rename from parsley-debug/jvm-native/src/main/scala/parsley/debugger/internal/XException.scala rename to parsley-debug/jvm-native/src/main/scala/parsley/debug/internal/XException.scala index 76f883e81..57ab5f148 100644 --- a/parsley-debug/jvm-native/src/main/scala/parsley/debugger/internal/XException.scala +++ b/parsley-debug/jvm-native/src/main/scala/parsley/debug/internal/XException.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.internal +package parsley.debug.internal // Cross platform wrapper around UnsupportedOperationException. private [parsley] class XUnsupportedOperationException(msg: String) { diff --git a/parsley-debug/jvm-native/src/main/scala/parsley/debugger/internal/XWeakMap.scala b/parsley-debug/jvm-native/src/main/scala/parsley/debug/internal/XWeakMap.scala similarity index 94% rename from parsley-debug/jvm-native/src/main/scala/parsley/debugger/internal/XWeakMap.scala rename to parsley-debug/jvm-native/src/main/scala/parsley/debug/internal/XWeakMap.scala index 3bf05ed59..d4c702749 100644 --- a/parsley-debug/jvm-native/src/main/scala/parsley/debugger/internal/XWeakMap.scala +++ b/parsley-debug/jvm-native/src/main/scala/parsley/debug/internal/XWeakMap.scala @@ -3,11 +3,11 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.internal +package parsley.debug.internal import scala.collection.mutable -import parsley.debugger.util.XMutMap +import parsley.debug.util.XMutMap // Abstracts away the logic of XWeakMap so that only minimal interfaces are needed between Scala // versions. This reduces code duplication, and makes further changes much easier to implement. diff --git a/parsley-debug/jvm/src/main/scala-2/parsley/debugger/util/XCollector.scala b/parsley-debug/jvm/src/main/scala-2/parsley/debug/util/XCollector.scala similarity index 98% rename from parsley-debug/jvm/src/main/scala-2/parsley/debugger/util/XCollector.scala rename to parsley-debug/jvm/src/main/scala-2/parsley/debug/util/XCollector.scala index 054b3271d..3ea2c5194 100644 --- a/parsley-debug/jvm/src/main/scala-2/parsley/debugger/util/XCollector.scala +++ b/parsley-debug/jvm/src/main/scala-2/parsley/debug/util/XCollector.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.util +package parsley.debug.util import scala.annotation.nowarn import scala.collection.mutable diff --git a/parsley-debug/jvm/src/main/scala-3/parsley/debugger/util/XCollector.scala b/parsley-debug/jvm/src/main/scala-3/parsley/debug/util/XCollector.scala similarity index 89% rename from parsley-debug/jvm/src/main/scala-3/parsley/debugger/util/XCollector.scala rename to parsley-debug/jvm/src/main/scala-3/parsley/debug/util/XCollector.scala index 4d3c0a5ba..0b3a4852f 100644 --- a/parsley-debug/jvm/src/main/scala-3/parsley/debugger/util/XCollector.scala +++ b/parsley-debug/jvm/src/main/scala-3/parsley/debug/util/XCollector.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.util +package parsley.debug.util // TODO: Find a substitute for Java reflection for Scala 3. private [parsley] object XCollector extends XDummyCollector diff --git a/parsley-debug/shared/src/main/scala-2.12/parsley/debugger/util/XMap.scala b/parsley-debug/shared/src/main/scala-2.12/parsley/debug/util/XMap.scala similarity index 100% rename from parsley-debug/shared/src/main/scala-2.12/parsley/debugger/util/XMap.scala rename to parsley-debug/shared/src/main/scala-2.12/parsley/debug/util/XMap.scala diff --git a/parsley-debug/shared/src/main/scala-2.12/parsley/debugger/util/XMutMap.scala b/parsley-debug/shared/src/main/scala-2.12/parsley/debug/util/XMutMap.scala similarity index 100% rename from parsley-debug/shared/src/main/scala-2.12/parsley/debugger/util/XMutMap.scala rename to parsley-debug/shared/src/main/scala-2.12/parsley/debug/util/XMutMap.scala diff --git a/parsley-debug/shared/src/main/scala-2.13+/parsley/debugger/util/XMap.scala b/parsley-debug/shared/src/main/scala-2.13+/parsley/debug/util/XMap.scala similarity index 93% rename from parsley-debug/shared/src/main/scala-2.13+/parsley/debugger/util/XMap.scala rename to parsley-debug/shared/src/main/scala-2.13+/parsley/debug/util/XMap.scala index 193bbc9e0..0242b07e6 100644 --- a/parsley-debug/shared/src/main/scala-2.13+/parsley/debugger/util/XMap.scala +++ b/parsley-debug/shared/src/main/scala-2.13+/parsley/debug/util/XMap.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.util +package parsley.debug.util // This is used to give Scala 2.12 access to "removed" and "updated". // In Scala 2.13 and up, this doesn't need any extra methods. diff --git a/parsley-debug/shared/src/main/scala-2.13+/parsley/debugger/util/XMutMap.scala b/parsley-debug/shared/src/main/scala-2.13+/parsley/debug/util/XMutMap.scala similarity index 92% rename from parsley-debug/shared/src/main/scala-2.13+/parsley/debugger/util/XMutMap.scala rename to parsley-debug/shared/src/main/scala-2.13+/parsley/debug/util/XMutMap.scala index 4ed98cb1d..c181755af 100644 --- a/parsley-debug/shared/src/main/scala-2.13+/parsley/debugger/util/XMutMap.scala +++ b/parsley-debug/shared/src/main/scala-2.13+/parsley/debug/util/XMutMap.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.util +package parsley.debug.util import scala.collection.mutable diff --git a/parsley-debug/shared/src/main/scala-2/parsley/debuggable.scala b/parsley-debug/shared/src/main/scala-2/parsley/debuggable.scala index a283d1d9f..0b51b7c86 100644 --- a/parsley-debug/shared/src/main/scala-2/parsley/debuggable.scala +++ b/parsley-debug/shared/src/main/scala-2/parsley/debuggable.scala @@ -113,7 +113,7 @@ private object debuggable { // the idea is we inject a call to Collector.registerNames with a constructed // map from these identifiers to their compile-time names val listOfParsers = q"List(..${parsers.map(tr => q"${Ident(tr)} -> ${tr.toString}")})" - val registration = q"parsley.debugger.util.Collector.registerNames($listOfParsers.toMap)" + val registration = q"parsley.debug.util.Collector.registerNames($listOfParsers.toMap)" // add the registration as the last statement in the object // TODO: in future, we want to modify all `def`s with a top level `opaque` combinator // that will require a bit more modification of the overall `body`, unfortunately diff --git a/parsley-debug/shared/src/main/scala-3/parsley/debuggable.scala b/parsley-debug/shared/src/main/scala-3/parsley/debuggable.scala index 6447f3f1a..69e863e3c 100644 --- a/parsley-debug/shared/src/main/scala-3/parsley/debuggable.scala +++ b/parsley-debug/shared/src/main/scala-3/parsley/debuggable.scala @@ -31,7 +31,7 @@ import scala.quoted.* val listOfParsers = Expr.ofList { parsers.map(tr => Expr.ofTuple((Ident(tr).asExprOf[parsley.Parsley[?]], Expr(tr.name)))).toList } - val registration = '{parsley.debugger.util.Collector.registerNames($listOfParsers.toMap)}.asTerm + val registration = '{parsley.debug.util.Collector.registerNames($listOfParsers.toMap)}.asTerm // add the registration as the last statement in the object // TODO: in future, we want to modify all `def`s with a top level `opaque` combinator diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/DebugTree.scala b/parsley-debug/shared/src/main/scala/parsley/debug/DebugTree.scala similarity index 95% rename from parsley-debug/shared/src/main/scala/parsley/debugger/DebugTree.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/DebugTree.scala index d88d84461..38b716126 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/DebugTree.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/DebugTree.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger +package parsley.debug /** The tree representing a parser's parse tree (its parser execution path). * @@ -20,7 +20,7 @@ package parsley.debugger * * @since 4.5.0 */ -private [debugger] abstract class DebugTree extends Iterable[DebugTree] { +private [debug] abstract class DebugTree extends Iterable[DebugTree] { /** The name of the parser that made this node. */ def parserName: String @@ -66,7 +66,7 @@ private [debugger] abstract class DebugTree extends Iterable[DebugTree] { } } -private [debugger] object DebugTree { +private [debug] object DebugTree { def unapply(dt: DebugTree): Some[(String, String, Option[Long], String, Option[ParseAttempt], Map[String, DebugTree])] = { Some((dt.parserName, dt.internalName, dt.childNumber, dt.fullInput, dt.parseResults, dt.nodeChildren)) } diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/DebugView.scala b/parsley-debug/shared/src/main/scala/parsley/debug/DebugView.scala similarity index 86% rename from parsley-debug/shared/src/main/scala/parsley/debugger/DebugView.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/DebugView.scala index 4f93f6463..f228ba9c4 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/DebugView.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/DebugView.scala @@ -3,9 +3,9 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger +package parsley.debug -import parsley.debugger.internal.XIllegalStateException +import parsley.debug.internal.XIllegalStateException /** A common interface for a rendering view for a debugger to present the debug tree. Inherit from * one of the two provided subtraits to use. @@ -27,7 +27,7 @@ sealed trait DebugView { * @param input The full input of the parse. * @param tree Debug tree to render. */ - private [debugger] def render(input: =>String, tree: =>DebugTree): Unit + private [debug] def render(input: =>String, tree: =>DebugTree): Unit } object DebugView { /** Signifies that the debug view inheriting from this can be used multiple times. @@ -44,7 +44,7 @@ object DebugView { */ trait SingleUse extends DebugView { private var hasBeenRun = false - final override private[debugger] def render(input: =>String, tree: =>DebugTree): Unit = { + final override private [debug] def render(input: =>String, tree: =>DebugTree): Unit = { if (hasBeenRun) { // XXX: There isn't really another way to enforce not running a stateful frontend more than once that isn't just "do nothing". // Especially since doing nothing turns that action into a silent error, which is generally less preferable to "loud" @@ -56,6 +56,6 @@ object DebugView { } } /** The implementation of the render method above */ - private[debugger] def renderImpl(input: =>String, tree: =>DebugTree): Unit + private [debug] def renderImpl(input: =>String, tree: =>DebugTree): Unit } } diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/ParseAttempt.scala b/parsley-debug/shared/src/main/scala/parsley/debug/ParseAttempt.scala similarity index 99% rename from parsley-debug/shared/src/main/scala/parsley/debugger/ParseAttempt.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/ParseAttempt.scala index ba68525ab..87d556d04 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/ParseAttempt.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/ParseAttempt.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger +package parsley.debug import ParseAttempt._ // scalastyle:ignore underscore.import diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/PrintView.scala b/parsley-debug/shared/src/main/scala/parsley/debug/PrintView.scala similarity index 93% rename from parsley-debug/shared/src/main/scala/parsley/debugger/PrintView.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/PrintView.scala index 4882a6195..5c6436490 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/PrintView.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/PrintView.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger +package parsley.debug import java.io.{OutputStream, PrintStream} @@ -32,9 +32,9 @@ object PrintView extends DebugView.Reusable with PrintView { } } -private [debugger] sealed trait PrintView extends DebugView.Reusable { +private [debug] sealed trait PrintView extends DebugView.Reusable { protected val out: PrintStream - override private [debugger] def render(input: =>String, tree: =>DebugTree): Unit = { + override private [debug] def render(input: =>String, tree: =>DebugTree): Unit = { out.println(s"${tree.parserName}'s parse tree for input:\n\n$input\n\n") pretty(tree) } diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/combinator.scala b/parsley-debug/shared/src/main/scala/parsley/debug/combinator.scala similarity index 95% rename from parsley-debug/shared/src/main/scala/parsley/debugger/combinator.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/combinator.scala index 3fa031ce8..5f0cfe7ed 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/combinator.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/combinator.scala @@ -3,15 +3,15 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger +package parsley.debug import parsley.Parsley import parsley.Parsley.{atomic, empty, fresh} -import parsley.debugger.internal.{DebugContext, DivergenceContext} +import parsley.debug.internal.{DebugContext, DivergenceContext} import parsley.internal.deepembedding.frontend.LazyParsley -import parsley.internal.deepembedding.frontend.debugger.{TaggedWith, Named} -import parsley.internal.deepembedding.backend.debugger.{CheckDivergence, Debugging} +import parsley.internal.deepembedding.frontend.debug.{TaggedWith, Named} +import parsley.internal.deepembedding.backend.debug.{CheckDivergence, Debugging} /** This object contains the combinators for attaching debuggers to parsers. * @@ -143,12 +143,12 @@ object combinator { // TODO: fix docs by incorporating some of the base stuff above /** Attach a debugger to be rendered via a given view. This view will render whenever the parser produces debug content. * - * You would normally obtain a [[parsley.debugger.DebugView]] from its + * You would normally obtain a [[parsley.debug.DebugView]] from its * respective package as either a static object or an instance object depending on whether the * renderer stores state. In the latter case, it is better to regenerate the frontend with * every new debugged parser. The view can be reusable (i.e. inherits from - * [[parsley.debugger.DebugView.Reusable]]) or single-use (i.e. inherits from - * [[parsley.debugger.DebugView.SingleUse]]). + * [[parsley.debug.DebugView.Reusable]]) or single-use (i.e. inherits from + * [[parsley.debug.DebugView.SingleUse]]). * * The instrumented parser will automatically call the view to render the debug tree, so it * may be recommended that you only use this with smaller parsers as large parsers may cause @@ -188,7 +188,7 @@ object combinator { * @note Do not run a parser through this combinator multiple times. * @see * The other overload of this method - * ([[parsley.debugger.combinator$.attach[A](parser:parsley\.Parsley[A],view:parsley\.debugger\.DebugView,toStringRules* attachDebugger]]) + * ([[parsley.debug.combinator$.attach[A](parser:parsley\.Parsley[A],view:parsley\.debug\.DebugView,toStringRules* attachDebugger]]) * has more information on its usage. * @param parser The parser to debug. * @param view The debug view instance to render with. @@ -219,7 +219,7 @@ object combinator { * @note Do not run a parser through this combinator multiple times. * @see * The other overload of this method - * ([[parsley.debugger.combinator$.attachReusable[A](parser:parsley\.Parsley[A],view:=>parsley\.debugger\.DebugView\.Reusable,toStringRules* attachDebugger]]) + * ([[parsley.debug.combinator$.attachReusable[A](parser:parsley\.Parsley[A],view:=>parsley\.debug\.DebugView\.Reusable,toStringRules* attachDebugger]]) * has more information on its usage. * @return Generator closure for view-debugged versions of the input parser. */ @@ -252,7 +252,7 @@ object combinator { //def attach[A](parser: Parsley[A])(implicit frontend: DebugFrontend): Parsley[A] = attach[A](parser, defaultRules) /** Attach a name to a parser, for display within the debugger output. - * Names assigned here have a higher precedence than names collected with [[parsley.debugger.util.Collector]]. + * Names assigned here have a higher precedence than names collected with [[parsley.debug.util.Collector]]. * * Renaming the same parser multiple times simply overwrites its name to the most latest rename. */ diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/internal/DebugContext.scala b/parsley-debug/shared/src/main/scala/parsley/debug/internal/DebugContext.scala similarity index 98% rename from parsley-debug/shared/src/main/scala/parsley/debugger/internal/DebugContext.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/internal/DebugContext.scala index fea2b260a..18f1d5aa6 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/internal/DebugContext.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/internal/DebugContext.scala @@ -3,13 +3,13 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.internal +package parsley.debug.internal import scala.collection.mutable import org.typelevel.scalaccompat.annotation.unused import parsley.XAssert -import parsley.debugger.ParseAttempt +import parsley.debug.ParseAttempt import parsley.internal.deepembedding.frontend.LazyParsley // Class used to hold details about a parser being debugged. diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/internal/DivergenceContext.scala b/parsley-debug/shared/src/main/scala/parsley/debug/internal/DivergenceContext.scala similarity index 99% rename from parsley-debug/shared/src/main/scala/parsley/debugger/internal/DivergenceContext.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/internal/DivergenceContext.scala index c2311d14b..5804154d6 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/internal/DivergenceContext.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/internal/DivergenceContext.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.internal +package parsley.debug.internal import scala.annotation.nowarn import scala.collection.mutable diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/internal/Renamer.scala b/parsley-debug/shared/src/main/scala/parsley/debug/internal/Renamer.scala similarity index 95% rename from parsley-debug/shared/src/main/scala/parsley/debugger/internal/Renamer.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/internal/Renamer.scala index 7c64a9d09..52ba98b82 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/internal/Renamer.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/internal/Renamer.scala @@ -3,10 +3,10 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.internal +package parsley.debug.internal import parsley.internal.deepembedding.frontend.LazyParsley -import parsley.internal.deepembedding.frontend.debugger.TaggedWith +import parsley.internal.deepembedding.frontend.debug.TaggedWith // An object with a single public apply method that allows the renaming of a // debugged parser's name in order to increase the clarity of the debugger's diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/internal/TransientDebugTree.scala b/parsley-debug/shared/src/main/scala/parsley/debug/internal/TransientDebugTree.scala similarity index 96% rename from parsley-debug/shared/src/main/scala/parsley/debugger/internal/TransientDebugTree.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/internal/TransientDebugTree.scala index fccce271d..4846544c1 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/internal/TransientDebugTree.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/internal/TransientDebugTree.scala @@ -3,13 +3,13 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.internal +package parsley.debug.internal import scala.collection.immutable.ListMap import scala.collection.mutable -import parsley.debugger.{DebugTree, ParseAttempt} -import parsley.debugger.util.XMap +import parsley.debug.{DebugTree, ParseAttempt} +import parsley.debug.util.XMap /** A mutable implementation of [[DebugTree]], used when constructing the tree as a parser is * running. diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/util/Collector.scala b/parsley-debug/shared/src/main/scala/parsley/debug/util/Collector.scala similarity index 97% rename from parsley-debug/shared/src/main/scala/parsley/debugger/util/Collector.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/util/Collector.scala index b685b926f..86b4f0498 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/util/Collector.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/util/Collector.scala @@ -3,12 +3,12 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.util +package parsley.debug.util //import scala.annotation.nowarn import parsley.Parsley -import parsley.debugger.internal.Renamer +import parsley.debug.internal.Renamer import parsley.token.Lexer import parsley.internal.deepembedding.frontend.LazyParsley @@ -66,7 +66,7 @@ object Collector { * automatically finding parsers in objects and getting their field names as written in your * parser code? * - * @note Manually named parsers using [[parsley.debugger.combinator.named]] + * @note Manually named parsers using [[parsley.debug.combinator.named]] * will still work regardless if the platform is supported or not. */ @inline def isSupported: Boolean = XCollector.supported diff --git a/parsley-debug/shared/src/main/scala/parsley/debugger/util/XDummyCollector.scala b/parsley-debug/shared/src/main/scala/parsley/debug/util/XDummyCollector.scala similarity index 92% rename from parsley-debug/shared/src/main/scala/parsley/debugger/util/XDummyCollector.scala rename to parsley-debug/shared/src/main/scala/parsley/debug/util/XDummyCollector.scala index 895796d0c..b044fcc16 100644 --- a/parsley-debug/shared/src/main/scala/parsley/debugger/util/XDummyCollector.scala +++ b/parsley-debug/shared/src/main/scala/parsley/debug/util/XDummyCollector.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger.util +package parsley.debug.util import parsley.token.Lexer diff --git a/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/backend/debugger/Debugged.scala b/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/backend/debug/Debugged.scala similarity index 96% rename from parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/backend/debugger/Debugged.scala rename to parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/backend/debug/Debugged.scala index 6c20a5691..436cc74fc 100644 --- a/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/backend/debugger/Debugged.scala +++ b/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/backend/debug/Debugged.scala @@ -3,9 +3,9 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.internal.deepembedding.backend.debugger +package parsley.internal.deepembedding.backend.debug -import parsley.debugger.internal.{DebugContext, DivergenceContext} +import parsley.debug.internal.{DebugContext, DivergenceContext} import parsley.internal.deepembedding.ContOps import parsley.internal.deepembedding.ContOps.{suspend, ContAdapter} diff --git a/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debugger/Named.scala b/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debug/Named.scala similarity index 95% rename from parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debugger/Named.scala rename to parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debug/Named.scala index c95863213..ded576f2d 100644 --- a/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debugger/Named.scala +++ b/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debug/Named.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.internal.deepembedding.frontend.debugger +package parsley.internal.deepembedding.frontend.debug import parsley.XAssert diff --git a/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debugger/TaggedWith.scala b/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debug/TaggedWith.scala similarity index 98% rename from parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debugger/TaggedWith.scala rename to parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debug/TaggedWith.scala index f6fdf0906..74c08e48e 100644 --- a/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debugger/TaggedWith.scala +++ b/parsley-debug/shared/src/main/scala/parsley/internal/deepembedding/frontend/debug/TaggedWith.scala @@ -3,20 +3,20 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.internal.deepembedding.frontend.debugger +package parsley.internal.deepembedding.frontend.debug import scala.collection.mutable import org.typelevel.scalaccompat.annotation.unused import parsley.XAssert -import parsley.debugger.internal.XWeakMap +import parsley.debug.internal.XWeakMap import parsley.state.Ref import parsley.internal.deepembedding.{singletons, Cont, ContOps, Id} import parsley.internal.deepembedding.ContOps.{perform, result, suspend, zipWith, zipWith3, ContAdapter} import parsley.internal.deepembedding.backend.StrictParsley -import parsley.internal.deepembedding.backend.debugger.DebugStrategy +import parsley.internal.deepembedding.backend.debug.DebugStrategy import parsley.internal.deepembedding.frontend._ // scalastyle:ignore underscore.import // Wrapper class signifying debugged classes diff --git a/parsley-debug/shared/src/main/scala/parsley/internal/machine/instructions/debug/DebugInstrs.scala b/parsley-debug/shared/src/main/scala/parsley/internal/machine/instructions/debug/DebugInstrs.scala index 4123d305f..7e387babb 100644 --- a/parsley-debug/shared/src/main/scala/parsley/internal/machine/instructions/debug/DebugInstrs.scala +++ b/parsley-debug/shared/src/main/scala/parsley/internal/machine/instructions/debug/DebugInstrs.scala @@ -5,8 +5,8 @@ */ package parsley.internal.machine.instructions.debug -import parsley.debugger.ParseAttempt -import parsley.debugger.internal.{DebugContext, DivergenceContext} +import parsley.debug.ParseAttempt +import parsley.debug.internal.{DebugContext, DivergenceContext} import parsley.internal.deepembedding.frontend.LazyParsley import parsley.internal.machine.Context diff --git a/parsley-debug/shared/src/test/scala/parsley/AnnotationTest.scala b/parsley-debug/shared/src/test/scala/parsley/AnnotationTest.scala index fa1a8fdb6..b05c36054 100644 --- a/parsley-debug/shared/src/test/scala/parsley/AnnotationTest.scala +++ b/parsley-debug/shared/src/test/scala/parsley/AnnotationTest.scala @@ -6,7 +6,7 @@ package parsley import scala.annotation.experimental -import parsley.debugger.internal.Renamer +import parsley.debug.internal.Renamer @experimental class AnnotationTest extends ParsleyTest { diff --git a/parsley-debug/shared/src/test/scala/parsley/debugger/DebuggerUsageSpec.scala b/parsley-debug/shared/src/test/scala/parsley/debug/DebuggerUsageSpec.scala similarity index 91% rename from parsley-debug/shared/src/test/scala/parsley/debugger/DebuggerUsageSpec.scala rename to parsley-debug/shared/src/test/scala/parsley/debug/DebuggerUsageSpec.scala index 7ff365ada..7c0af1af4 100644 --- a/parsley-debug/shared/src/test/scala/parsley/debugger/DebuggerUsageSpec.scala +++ b/parsley-debug/shared/src/test/scala/parsley/debug/DebuggerUsageSpec.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger +package parsley.debug import scala.annotation.experimental @@ -12,18 +12,18 @@ import org.typelevel.scalaccompat.annotation.unused import parsley.Parsley, Parsley._ import parsley.ParsleyTest import parsley.character._ -import parsley.debugger.combinator.{attachDebugger, named, detectDivergence} -import parsley.debugger.internal.DebugContext +import parsley.debug.combinator.{attachDebugger, named, detectDivergence} +import parsley.debug.internal.DebugContext import parsley.expr._ -import parsley.internal.deepembedding.frontend.debugger.TaggedWith -import parsley.internal.deepembedding.backend.debugger.Debugging +import parsley.internal.deepembedding.frontend.debug.TaggedWith +import parsley.internal.deepembedding.backend.debug.Debugging // scalastyle:on underscore.import @experimental class DebuggerUsageSpec extends ParsleyTest { import DebuggerUsageSpec.Arithmetic "the Debugged internal frontend class" should "not allow nesting of Debugged nodes" in { - val factory = new Debugging(new DebugContext(parsley.debugger.combinator.DefaultStringRules)) + val factory = new Debugging(new DebugContext(parsley.debug.combinator.DefaultStringRules)) try { val _ = new TaggedWith(factory)(new TaggedWith(factory)(fresh(()).internal, null, None), null, None) fail("Debugged nodes have been nested") @@ -33,7 +33,7 @@ class DebuggerUsageSpec extends ParsleyTest { } it should "preserve the prettified names of the parsers" in { - val factory = new Debugging(new DebugContext(parsley.debugger.combinator.DefaultStringRules)) + val factory = new Debugging(new DebugContext(parsley.debug.combinator.DefaultStringRules)) new TaggedWith(factory)(named(fresh(()), "foo").internal, null, None).debugName shouldBe "foo" new TaggedWith(factory)(fresh(()).internal, null, None).debugName shouldBe "fresh" new TaggedWith(factory)(fresh(()).internal, null, Some("bar")).debugName shouldBe "bar" diff --git a/parsley-debug/shared/src/test/scala/parsley/debugger/ReuseSpec.scala b/parsley-debug/shared/src/test/scala/parsley/debug/ReuseSpec.scala similarity index 88% rename from parsley-debug/shared/src/test/scala/parsley/debugger/ReuseSpec.scala rename to parsley-debug/shared/src/test/scala/parsley/debug/ReuseSpec.scala index 35b2f058a..7e969dbdd 100644 --- a/parsley-debug/shared/src/test/scala/parsley/debugger/ReuseSpec.scala +++ b/parsley-debug/shared/src/test/scala/parsley/debug/ReuseSpec.scala @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package parsley.debugger +package parsley.debug import org.typelevel.scalaccompat.annotation.unused import parsley.ParsleyTest @@ -15,11 +15,11 @@ class ReuseSpec extends ParsleyTest { it should "throw when run multiple times, only if the view is marked as single-use" in { // Dummy values. val reusable: DebugView.Reusable = new DebugView.Reusable { - override private [debugger] def render(input: => String, tree: => DebugTree): Unit = () + override private [debug] def render(input: => String, tree: => DebugTree): Unit = () } val singleUse: DebugView.SingleUse = new DebugView.SingleUse { - override private [debugger] def renderImpl(input: => String, tree: => DebugTree): Unit = () + override private [debug] def renderImpl(input: => String, tree: => DebugTree): Unit = () } val tree: DebugTree = new DebugTree { diff --git a/parsley-debug/shared/src/test/scala/parsley/internal/deepembedding/RenameSpec.scala b/parsley-debug/shared/src/test/scala/parsley/internal/deepembedding/RenameSpec.scala index 862f8e161..cb9ea963b 100644 --- a/parsley-debug/shared/src/test/scala/parsley/internal/deepembedding/RenameSpec.scala +++ b/parsley-debug/shared/src/test/scala/parsley/internal/deepembedding/RenameSpec.scala @@ -9,14 +9,14 @@ import scala.annotation.experimental import org.scalatest.Assertions.fail import parsley.ParsleyTest -import parsley.debugger.internal.{DebugContext, Renamer} -import parsley.debugger.util.Collector +import parsley.debug.internal.{DebugContext, Renamer} +import parsley.debug.util.Collector import parsley.internal.deepembedding.backend.StrictParsley import parsley.internal.deepembedding.frontend.{LazyParsley, LazyParsleyIVisitor, LetFinderState, LetMap} -import parsley.internal.deepembedding.frontend.debugger.TaggedWith +import parsley.internal.deepembedding.frontend.debug.TaggedWith import parsley.token.Lexer import parsley.token.descriptions.LexicalDesc -import parsley.internal.deepembedding.backend.debugger.Debugging +import parsley.internal.deepembedding.backend.debug.Debugging @experimental class RenameSpec extends ParsleyTest { @@ -39,7 +39,7 @@ class RenameSpec extends ParsleyTest { it should "pass through Debugged parsers and get the inner parser's name" in { val symbolic = new <**> - val debugged = new TaggedWith[Any](new Debugging(new DebugContext(parsley.debugger.combinator.DefaultStringRules)))(symbolic, symbolic, None) + val debugged = new TaggedWith[Any](new Debugging(new DebugContext(parsley.debug.combinator.DefaultStringRules)))(symbolic, symbolic, None) Renamer.nameOf(None, debugged) shouldBe "<**>" } diff --git a/parsley-debug/shared/src/test/scala/parsley/internal/deepembedding/frontend/TotalAttachmentSpec.scala b/parsley-debug/shared/src/test/scala/parsley/internal/deepembedding/frontend/TotalAttachmentSpec.scala index 10237a57a..06672927b 100644 --- a/parsley-debug/shared/src/test/scala/parsley/internal/deepembedding/frontend/TotalAttachmentSpec.scala +++ b/parsley-debug/shared/src/test/scala/parsley/internal/deepembedding/frontend/TotalAttachmentSpec.scala @@ -11,9 +11,9 @@ import org.typelevel.scalaccompat.annotation.unused import parsley.Parsley import parsley.ParsleyTest import parsley.combinator.ifS -import parsley.debugger.combinator.attachDebugger +import parsley.debug.combinator.attachDebugger import parsley.expr.chain -import parsley.internal.deepembedding.frontend.debugger.TaggedWith +import parsley.internal.deepembedding.frontend.debug.TaggedWith import parsley.internal.deepembedding.singletons class TotalAttachmentSpec extends ParsleyTest {