Skip to content

Allow significant indentation syntax #7083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/src/dotty/tools/dotc/config/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ object Config {
*/
final val simplifyApplications = true

/** Always assume -indent */
final val allowIndent = true

/** If set, prints a trace of all symbol completions */
final val showCompletions = false

Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/config/Printers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ object Printers {
val hk: Printer = noPrinter
val implicits: Printer = noPrinter
val implicitsDetailed: Printer = noPrinter
val lexical: Printer = noPrinter
val inlining: Printer = noPrinter
val interactiv: Printer = noPrinter
val overload: Printer = noPrinter
Expand Down
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class ScalaSettings extends Settings.SettingGroup {

val newSyntax: Setting[Boolean] = BooleanSetting("-new-syntax", "Require `then` and `do` in control expressions")
val oldSyntax: Setting[Boolean] = BooleanSetting("-old-syntax", "Require `(...)` around conditions")
val indent: Setting[Boolean] = BooleanSetting("-indent", "allow significant indentation")
val noindent: Setting[Boolean] = BooleanSetting("-noindent", "require classical {...} syntax, indentation is not significant")

/** Decompiler settings */
val printTasty: Setting[Boolean] = BooleanSetting("-print-tasty", "Prints the raw tasty.") withAbbreviation "--print-tasty"
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/core/StdNames.scala
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ object StdNames {
val elem: N = "elem"
val elems: N = "elems"
val emptyValDef: N = "emptyValDef"
val end: N = "end"
val ensureAccessible : N = "ensureAccessible"
val eq: N = "eq"
val eqInstance: N = "eqInstance"
Expand Down
11 changes: 2 additions & 9 deletions compiler/src/dotty/tools/dotc/parsing/CharArrayReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ abstract class CharArrayReader { self =>
/** The start offset of the current line */
var lineStartOffset: Int = startFrom

/** The start offset of the line before the current one */
var lastLineStartOffset: Int = startFrom

private[this] var lastUnicodeOffset = -1

/** Is last character a unicode escape \\uxxxx? */
Expand Down Expand Up @@ -112,12 +109,8 @@ abstract class CharArrayReader { self =>
}

/** Handle line ends */
private def potentialLineEnd(): Unit = {
if (ch == LF || ch == FF) {
lastLineStartOffset = lineStartOffset
lineStartOffset = charOffset
}
}
private def potentialLineEnd(): Unit =
if (ch == LF || ch == FF) lineStartOffset = charOffset

def isAtEnd: Boolean = charOffset >= buf.length

Expand Down
Loading