summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
Commit message (Collapse)AuthorAgeFilesLines
* Fix Greek Mythology references in compiler packageJanek Bogucki2017-04-101-1/+1
| | | | | | | Improve documentation some packages and correct some typos in these directories, - compiler - library
* Revert "SI-10133 Require escaped single quote char lit"Adriaan Moors2017-02-211-18/+6
|
* Merge pull request #5629 from som-snytt/issue/10120-quote-errAdriaan Moors2017-02-201-6/+18
|\ | | | | SI-10133 Require escaped single quote char lit
| * SI-10120 Extra advice on unclosed char literalSom Snytt2017-01-081-6/+13
| | | | | | | | | | | | | | | | | | | | Folks from other languages might mistakenly enclose a string in single quotes. Since this presents as a symbol literal followed by the unpaired single quote, we can add a syntax reminder. Also polish the wording for bad string interpolation.
| * SI-10133 Require escaped single quote char litSom Snytt2017-01-081-0/+5
| | | | | | | | | | | | The spec specifically requires `'\''` and not `'''`. The error consumes all consecutive single quotes.
* | SI-10148 Accept verbose zeroSom Snytt2017-02-181-4/+4
| | | | | | | | The test for non-zero must recognize `-0e+00f` and variants.
* | Merge pull request #5648 from som-snytt/issue/10148Seth Tisue2017-02-161-6/+28
|\ \ | | | | | | SI-10148 Follow Java for float literals
| * | SI-10148 Follow Java for float literalsSom Snytt2017-01-181-6/+28
| |/ | | | | | | | | Use `Float.parseFloat` instead of converting from Double. Error when a value rounds to zero.
* | SIP-27 Tweak and test wildstar in REPLDale Wijnand2017-01-081-2/+5
| | | | | | | | From https://github.com/scala/scala/pull/5245#issuecomment-266658070
* | SI-4986 SIP-27 Trailing Comma (multi-line only) supportDale Wijnand2016-12-111-0/+8
|/
* Merge pull request #5440 from som-snytt/issue/9944Lukas Rytz2016-11-161-2/+11
|\ | | | | SI-9944 Scan after interp expr keeps CR
| * SI-9944 Scan after interp expr keeps CRSom Snytt2016-10-011-2/+11
| | | | | | | | | | | | In an interpolated expression `s"""${ e }"""`, the scanner advances input past the RBRACE. If a multiline string as shown, get the next raw char, because CR is significant.
* | Factor out some more into ScaladocScannerAdriaan Moors2016-10-191-1/+1
| |
* | DocScanner has doc-comment scanning hooks.Adriaan Moors2016-10-191-15/+30
|/ | | | | | | Align the Scala and Java doc comment scanning methods a bit. The Scala one especially had gotten a bit messy, with regular block comments being kind of accumulated, but never actually registered as DocComments.
* Add since arg to deprecationWarning and use itSimon Ochsenreither2016-05-291-9/+9
|
* Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-181-1/+1
| | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
* Merge pull request #4590 from som-snytt/issue/6810Lukas Rytz2015-08-241-3/+5
|\ | | | | SI-6810 Disallow EOL in char literal
| * SI-6810 Disallow EOL in char literalSom Snytt2015-06-291-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's clear that char literals are one-lined like normal string literals. By the same token, pun intended, char literals accept unicode escapes the same as string literals, including `\u000A`. This commit adds the usual exclusions (CR, NL, SU). The spec is outdated in outlawing chars that are not "printable", in particular, the ASCII control codes. The original intention may have been that the ordinary string escapes are required, such as "\b\n". Note that some common escapes are absent, such as "\a".
* | ScalaDoc fixes for compilerJanek Bogucki2015-07-291-1/+1
|/
* SI-9015 Reject 0x and minor parser cleanupSom Snytt2014-12-051-119/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only print error results. Show deprecated forms. Test for rejected literals and clean up parser There was no negative test for what constitutes a legal literal. The ultimate goal is for the test to report all errors in one compilation. This commit follows up the removal of "1." syntax to simplify number parsing. It removes previous paulp code to contain the erstwhile complexity. Leading zero is not immediately put to the buffer. Instead, the empty buffer is handled on evaluation. In particular, an empty buffer due to `0x` is a syntax error. The message for obsolete octal syntax is nuanced and deferred until evaluation by the parser, which is slightly simpler to reason about. Improve comment on usage of base The slice-and-dicey usage of base deserves a better comment. The difference is that `intVal` sees an empty char buffer for input `"0"`.
* Merge pull request #3886 from adriaanm/report-filterGrzegorz Kossakowski2014-08-261-1/+1
|\ | | | | part 2 of the big error reporting refactoring
| * Move more parsing hooks out of reporting.Adriaan Moors2014-07-171-1/+1
| | | | | | | | | | | | Create a trait Parsing, which, like Reporting, factors our functionality from Global (aka. "the cake"), that is related to global aspects of configuring parsing.
* | SI-6476 Unitize ALL the procedures!Som Snytt2014-07-191-18/+17
| |
* | SI-6476 Unitize procedures, readabilitySom Snytt2014-07-191-8/+8
|/ | | | | | | | Strictly trivial updates for readability. I used to prefer procedure syntax, but since it was scheduled for removal, I can't scan a def without an equals sign.
* Rip out reporting indirection from CompilationUnitAdriaan Moors2014-07-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inline the forwarders from CompilationUnit, which should not affect behavior. Since all forwarders lead to global.reporter, don't first navigate to a compilation unit, only to then forward back to global.reporter. The cleanup in the previous commits revealed a ton of confusion regarding how to report an error. This was a mechanical search/replace, which has low potential for messing things up, since the list of available methods are disjoint between `reporter` and `currentRun.reporting`. The changes involving `typer.context` were done previously. Essentially, there are three ways to report: - via typer.context, so that reporting can be silenced (buffered) - via global.currentRun.reporting, which summarizes (e.g., deprecation) - via global.reporter, which is (mostly) stateless and straightforward. Ideally, these should all just go through `global.currentRun.reporting`, with the typing context changing that reporter to buffer where necessary. After the refactor, these are the ways in which we report (outside of typer): - reporter.comment - reporter.echo - reporter.error - reporter.warning - currentRun.reporting.deprecationWarning - currentRun.reporting.incompleteHandled - currentRun.reporting.incompleteInputError - currentRun.reporting.inlinerWarning - currentRun.reporting.uncheckedWarning Before: - c.cunit.error - c.enclosingUnit.deprecationWarning - context.unit.error - context.unit.warning - csymCompUnit.warning - cunit.error - cunit.warning - currentClass.cunit.warning - currentIClazz.cunit.inlinerWarning - currentRun.currentUnit.error - currentRun.reporting - currentUnit.deprecationWarning - currentUnit.error - currentUnit.warning - getContext.unit.warning - getCurrentCUnit.error - global.currentUnit.uncheckedWarning - global.currentUnit.warning - global.reporter - icls.cunit.warning - item.cunit.warning - reporter.comment - reporter.echo - reporter.error - reporter.warning - reporting.deprecationWarning - reporting.incompleteHandled - reporting.incompleteInputError - reporting.inlinerWarning - reporting.uncheckedWarning - typer.context.unit.warning - unit.deprecationWarning - unit.echo - unit.error - unit.incompleteHandled - unit.incompleteInputError - unit.uncheckedWarning - unit.warning - v1.cunit.warning All these methods ended up calling a method on `global.reporter` or on `global.currentRun.reporting` (their interfaces are disjoint). Also clean up `TypeDiagnostics`: inline nearly-single-use private methods.
* SI-7919 Newline after empty string interpSom Snytt2014-01-241-2/+5
| | | | | Consume the newline non-raw for safe handling after single-line interpolation.
* Merge commit '97b9b2c06a' from 2.10.x into masterAdriaan Moors2014-01-171-4/+1
|\ | | | | | | | | | | | | | | | | Check files updated: test/files/presentation/t8085*.check Conflicts: build.xml src/compiler/scala/tools/nsc/ast/parser/Parsers.scala src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
| * Revert "SI-6426, importable _."Adriaan Moors2013-12-101-4/+1
| | | | | | | | | | | | | | This reverts commit d2316df920ffa4804fe51e8f8780240c46efa982. We can't make `_` an illegal identifier -- it's legal in Java, so we must be able to name these Java underscores.
* | SI-8015 Count lines by EOLsSom Snytt2014-01-081-3/+3
| | | | | | | | | | | | | | | | Source lines were counted by "line break chars", including FF. Clients of `pos.line` seem to all expect the ordinary line num, so that is what they get. Unicode processing now precedes line ending processing.
* | Merge pull request #3239 from soc/SI-8052Jason Zaugg2014-01-031-2/+6
|\ \ | | | | | | SI-8052 Disallow `macro` as an identifier
| * | SI-8052 Disallow `macro` as an identifierSimon Ochsenreither2013-12-091-2/+6
| | | | | | | | | | | | | | | | | | | | | Note that the change could look a lot cleaner, at the cost of returning more generic error messages. I decided that at least for 2.11 I'll keep scalac remembering that macro was a standard identifier name once, so that we can point out more precisely what's wrong with users' code.
* | | SI-7618 Remove octal number literalsSimon Ochsenreither2013-12-091-10/+9
|/ / | | | | | | | | | | This also fixes a spurious detection of octal literals in floating point literals: Literals like 01.23 are neither deprecated nor planned for removal.
* | use more descriptive types instead of ints in the parser and scannerDen Shabalin2013-10-181-24/+26
| |
* | Revert "Merge pull request #2957 from paulp/pr/parser-improvements"François Garillot2013-09-241-9/+0
| | | | | | | | | | This reverts commit 884e1ce762d98b29594146d37b85384581d9ba96, reversing changes made to f6fcc4431f272c707d49de68add532c452dd4b0f.
* | SI-7854, SI-6768 better parsing/positioning in parserPaul Phillips2013-09-181-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | The parser hole I found while working on the generated positions serves as the umbrella for a host of improvements. Upgraded positions assigned during some specific challenging situations mostly involving the creation of synthetic trees, e.g. for comprehensions and closures. While doing so improved some error messages. Eliminated some of the most glaring duplication in the parser. It's written like there is some payoff associated with being spectacularly imperative. Not so far.
* | SI-7715 String inpatternation s"$_" for s"${_}"Som Snytt2013-08-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a pattern, ``` scala> implicit class RX(val sc: StringContext) { | def rx = sc.parts.mkString("(.+)").r } defined class RX scala> "2 by 4" match { case rx"$a by $_" => a } res0: String = 2 scala> val rx"$_ by $b" = "2 by 4" b: String = 4 ```
* | Merge pull request #2690 from soc/SI-7620Adriaan Moors2013-07-291-7/+4
|\ \ | | | | | | SI-7620 Remove floating-point-literals-without-digit-after-dot
| * | SI-7620 Remove floating-point-literals-without-digit-after-dotSimon Ochsenreither2013-06-281-7/+4
| | |
* | | adds the lookahead routine to the parserDen Shabalin2013-07-081-10/+23
|/ / | | | | | | | | | | | | | | | | Introduces a scoping operator used to temporarily look into the future. Backs up scanner data before evaluating a block and restores it after. Not used anywhere, only necessary for the upcoming quasiquote patch in order to reliably detect and accordingly process holes in quasiquoted Scala syntax.
* | Merge pull request #2667 from adriaanm/modularize-xmlAdriaan Moors2013-06-241-1/+1
|\ \ | | | | | | Spin off xml library as scala-library-xml.
| * | Remove dependency on xml in ast.parserAdriaan Moors2013-06-201-1/+1
| | | | | | | | | | | | | | | | | | Copied the following files from scala.xml to ast.parser.xml: - MarkupParsers differs from scala.xml.MarkupParsers only in the first 17 lines - Utility.scala was refactored and reduced (also includes TokenTests)
* | | Merge pull request #2342 from soc/SI-7292Adriaan Moors2013-06-201-0/+7
|\ \ \ | |/ / |/| | SI-7292 Deprecate octal escape literals
| * | SI-7292 Deprecate octal escape literalsSimon Ochsenreither2013-04-041-0/+7
| | |
* | | Make all numeric coercions explicit.Paul Phillips2013-05-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimistically, this is preparation for a day when we don't let numeric types drift with the winds. Even without the optimism it's a good idea. It flushed out an undocumented change in the math package object relative to the methods being forwarded (a type is widened from what is returned in java) so I documented the intentionality of it. Managing type coercions manually is a bit tedious, no doubt, but it's not tedious enough to warrant abandoning type safety just because java did it.
* | | Merge v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-masterJason Zaugg2013-05-171-161/+125
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ================================================================ Merge commit 'v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-master Conflicts: src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala src/reflect/scala/reflect/runtime/JavaMirrors.scala ================================================================ Merge -s ours 4e64a27 ([nomaster commit range]) ================================================================ Merge commit '0ae7e55' into merge/v2.10.1-326-g4f8c306-to-master Conflicts: src/compiler/scala/tools/nsc/typechecker/Macros.scala
| * | Absolutized paths involving the scala package.Paul Phillips2013-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confusing, now-it-happens now-it-doesn't mysteries lurk in the darkness. When scala packages are declared like this: package scala.collection.mutable Then paths relative to scala can easily be broken via the unlucky presence of an empty (or nonempty) directory. Example: // a.scala package scala.foo class Bar { new util.Random } % scalac ./a.scala % mkdir util % scalac ./a.scala ./a.scala:4: error: type Random is not a member of package util new util.Random ^ one error found There are two ways to play defense against this: - don't use relative paths; okay sometimes, less so others - don't "opt out" of the scala package This commit mostly pursues the latter, with occasional doses of the former. I created a scratch directory containing these empty directories: actors annotation ant api asm beans cmd collection compat concurrent control convert docutil dtd duration event factory forkjoin generic hashing immutable impl include internal io logging macros man1 matching math meta model mutable nsc parallel parsing partest persistent process pull ref reflect reify remote runtime scalap scheduler script swing sys text threadpool tools transform unchecked util xml I stopped when I could compile the main src directories even with all those empties on my classpath.
| * | Eliminated the accumulated feature warnings.Paul Phillips2013-04-231-0/+1
| |/ | | | | | | | | | | | | | | | | No, this isn't busywork, how dare you suggest such a thing. I intend my tombstone to say HERE LIES EXTEMPORE, WHO ELIMINATED A LOT OF SIP-18 WARNINGS REST IN PEACE
| * SI-7261 Implicit conversion of BooleanSetting to Boolean and BooleanFlagSom Snytt2013-03-271-3/+3
| | | | | | | | | | | | | | This commit shortens expressions of the form `if (settings.debug.value)` to `if (settings.debug)` for various settings. Rarely, the setting is supplied as a method argument. The conversion is not employed in simple definitions where the Boolean type would have to be specified.
| * Doc -> C-style comments for local symbols to avoid "discardingEugene Vigdorchik2013-03-211-12/+12
| | | | | | | | | | unmoored doc comment" warning when building distribution for scala itself.
| * Moved scaladoc code into src/scaladoc.Paul Phillips2013-03-091-86/+69
| | | | | | | | | | | | This leverages the preceding several commits to push scaladoc specific code into src/scaladoc. It also renders some scanner code more comprehensible.