summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala
Commit message (Collapse)AuthorAgeFilesLines
* Retain javadoc comments in scaladocJakob Odersky2016-07-151-1/+1
| | | | | * Hook into java parser to generate doc comments * Generate empty trees for java implementation bodies
* 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.
* Rip out reporting indirection from CompilationUnitAdriaan Moors2014-07-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Move reporting logic into Reporting traitAdriaan Moors2014-07-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move code from Global/SymbolTable to separate Reporting traits to start carving out an interface in scala.reflect.internal.Reporting, with internals in scala.tools.nsc. Reporting is mixed into the cake. It contains a nested class PerRunReporting. Should do the same for debugging/logging. The idea is that CompilationUnit and Global forward all reporting to Reporter. The Reporting trait contains these forwarders, and PerRunReporting, which accumulates warning state during a run. In the process, I slightly changed the behavior of `globalError` in reflect.internal.SymbolTable: it used to abort, weirdly. I assume that was dummy behavior to avoid introducing an abstract method. It's immediately overridden in Global, and I couldn't find any other subclasses, so I don't think the behavior in SymbolTable was ever observed. Provide necessary hooks for scala.reflect.macros.Parsers#parse. See scala/reflect/macros/contexts/Parsers.scala's parse method, which overrides the reporter to detect when parsing goes wrong. This should be refactored, but that goes beyond the scope of this PR. Don't pop empty macro context stack. (Ran into this while reworking -Xfatal-warnings logic.) Fix -Xfatal-warnings behavior (and check files): it wasn't meant to influence warning reporting, except for emitting one final error; if necessary to fail the compile (when warnings but no errors were reported). Warnings should stay warnings. This was refactored in fbbbb22946, but we soon seem to have relapsed. An hour of gitfu did not lead to where it went wrong. Must've been a merge.
* -Yshow-member-pos, print the positions of members.Paul Phillips2013-04-201-12/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here for instance is a command line which leverages the output of this option to print the method bodies of all methods called 'transformInfo' found under src. Given 1500 source files it accomplishes this in four seconds, thanks to -Ystop-after:parser. % scalac -Yshow-member-pos sed -Ystop-after:parser \ $(find src/compiler -name '*.scala') | \ grep transformInfo | sed 's/ # .*//;' | \ while read line; do echo "// $line" && gsed -n $line && echo; done Or more simply, the start/end lines of each member of Random: % scalac -Yshow-member-pos "" ./src/library/scala/util/Random.scala ./src/library/scala/util/Random.scala 20,134 class Random 33 def nextBoolean 38 def nextBytes 43 def nextDouble 48 def nextFloat 54 def nextGaussian 59 def nextInt 65 def nextInt 70 def nextLong 81,89 def nextString 82,86 def safeChar 83 val surrogateStart 84 val res 94,98 def nextPrintableChar [snip] It makes me sad I'm always in the position of having to hack the compiler to do this sort of thing. All we need is something like -Yinsert-phase:Foo where Foo is a class implementing a (Phase, Tree) => Tree method, and the compiler runs all the unit.bodies through it after each phase, and then one could easily accomplish this in the privacy of one's own compiler.
* SI-7261 Implicit conversion of BooleanSetting to Boolean and BooleanFlagSom Snytt2013-03-271-1/+1
| | | | | | | 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.
* Enabling commit for interactive/scaladoc modules.Paul Phillips2013-03-091-2/+2
| | | | | | This is a non-behaviorally-changing setup commit which re-routes bits of code through avenues which can more easily be influenced by subclasses of Global.
* adds c.introduceTopLevelEugene Burmako2013-01-051-4/+8
| | | | | | | | | | | | | | | | | | | The first in the family of mutators for the global symbol table, `introduceTopLevel` is capable of creating synthetic top-level classes and modules. The addition of nme.EMPTY_PACKAGE_NAME is necessary to let programmers insert definitions into the empty package. That's explicitly discouraged in the docs, but at times might come in handy. This patch introduce workarounds to avoid incompatibilities with SBT. First of all SBT doesn't like VirtualFiles having JFile set to null. Secondly SBT gets confused when someone depends on synthetic files added by c.introduceTopLevel. Strictly speaking these problems require changes to SBT, and that will be done later. However the main target of the patch is paradise/macros, which needs to be useful immediately, therefore we apply workarounds.
* Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
|
* update and normalize copyright noticeAdriaan Moors2012-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are the regexp replacements performed: Sxcala -> Scala Copyright (\d*) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*)(,?) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*) Scala Solutions and LAMP/EPFL -> Copyright $1-2012 Scala Solutions and LAMP/EPFL \(C\) (\d*)-(\d*) LAMP/EPFL -> (C) $1-2012 LAMP/EPFL Copyright \(c\) (\d*)-(\d*)(.*?)EPFL -> Copyright (c) $1-2012$3EPFL The last one was needed for two HTML-ified copyright notices. Here's the summarized diff: Created using ``` git diff -w | grep ^- | sort | uniq | mate git diff -w | grep ^+ | sort | uniq | mate ``` ``` - <div id="footer">Scala programming documentation. Copyright (c) 2003-2011 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> - copyright.string=Copyright 2002-2011, LAMP/EPFL - <meta name="Copyright" content="(C) 2002-2011 LAMP/EPFL"/> - * Copyright 2002-2011 LAMP/EPFL - * Copyright 2004-2011 LAMP/EPFL - * Copyright 2005 LAMP/EPFL - * Copyright 2005-2011 LAMP/EPFL - * Copyright 2006-2011 LAMP/EPFL - * Copyright 2007 LAMP/EPFL - * Copyright 2007-2011 LAMP/EPFL - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL - * Copyright 2009-2011 Scxala Solutions and LAMP/EPFL - * Copyright 2010-2011 LAMP/EPFL - * Copyright 2012 LAMP/EPFL -# Copyright 2002-2011, LAMP/EPFL -* Copyright 2005-2011 LAMP/EPFL -/* NSC -- new Scala compiler -- Copyright 2007-2011 LAMP/EPFL */ -rem # Copyright 2002-2011, LAMP/EPFL ``` ``` + <div id="footer">Scala programming documentation. Copyright (c) 2003-2012 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> + copyright.string=Copyright 2002-2012 LAMP/EPFL + <meta name="Copyright" content="(C) 2002-2012 LAMP/EPFL"/> + * Copyright 2002-2012 LAMP/EPFL + * Copyright 2004-2012 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL + * Copyright 2010-2012 LAMP/EPFL + * Copyright 2011-2012 LAMP/EPFL +# Copyright 2002-2012 LAMP/EPFL +* Copyright 2005-2012 LAMP/EPFL +/* NSC -- new Scala compiler -- Copyright 2007-2012 LAMP/EPFL */ +rem # Copyright 2002-2012 LAMP/EPFL ```
* Intercept assert and require calls.Paul Phillips2012-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | And abort calls, and unhandled exceptions, all so I can supplement the error message with a little of the vast quantity of useful information which we possess but do not reveal. "Details are sketchy," says the officer tasked with investigating the crash, but no longer. Also took the opportunity to eliminate a bunch of one-argument assertions and requirements if I thought there was any chance I'd someday be facing them on the wrong end of an incident. Have you ever dreamed that instead of this experience: % scalac -optimise <long list of files> error: java.lang.AssertionError: assertion failed: Record Record(anonymous class JavaToScala$$anonfun$makeScalaPackage$1,Map()) does not contain a field value owner$1 Things could proceed more like this: % scalac -optimise <long list of files> error: while compiling: src/compiler/scala/reflect/runtime/JavaToScala.scala current phase: closelim library version: version 2.10.0.rdev-4267-2012-01-25-gc94d342 compiler version: version 2.10.0.rdev-4270-2012-01-26-gd540ddf reconstructed args: -Ydead-code -optimise -Yinline -Yclosure-elim -Yinline-handlers -d /tmp error: java.lang.AssertionError: [etc] You are not dreaming! IT'S ALL HAPPENING
* Removed special comments on Martin's requestmichelou2011-09-291-1/+1
|
* fixed svn props, did some cleanupmichelou2011-09-191-1/+1
|
* Moved some pure string manipulation functions o...Paul Phillips2011-05-311-4/+7
| | | | | | | | | Moved some pure string manipulation functions out of the base class for all Reporters and into a more suitable home. "Please, help stamp out inheritance abuse. If you won't do it for yourself do it for your children... or your subclass's children." Also removed some dead reporter code (not used anywhere, including the IDE.) No review.
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* Changed the way special overrides are implemented.Iulian Dragos2010-04-211-0/+2
| | | | | | | the source tree, it is moved from the generic method to its specialized variant. The owners are changed, and value/type parameter symbols are updated. This should fix most bugs involving call-by-name parameters.
* Updated copyright notices to 2010Antonio Cunei2009-12-071-1/+1
|
* Fix and test for #1674; we aren't supposed to b...Miles Sabin2009-10-191-1/+1
| | | | | | | Fix and test for #1674; we aren't supposed to be validating positions if there are syntax errors ... ensure that's so; we are supposed to be validating positions when -Yide-debug is set ... ensure that's so.
* [no content change] Fixed all SVN properties: m...Gilles Dubochet2009-09-241-1/+1
| | | | | | | | [no content change] Fixed all SVN properties: mimes, EOL, executable. Id expansion is consistently enabled for Scala/Java/C# sources in 'src/' and consistently disabled and removed from everywhere else: there should not be any dead Id tags anymore.
* rewrite of positions in compilerMartin Odersky2009-07-301-5/+2
|
* switch to unnested packages.Martin Odersky2009-07-241-1/+2
|
* refined range positions some more; eliminated A...Martin Odersky2009-07-021-1/+5
| | | | | refined range positions some more; eliminated Array.withDims
* fixed variance bug; added smart brace insertion...Martin Odersky2009-06-241-0/+1
| | | | | | fixed variance bug; added smart brace insertion to parser. moved interactive compiler interface along.
* Named and default argumentsLukas Rytz2009-05-301-1/+1
| | | | | | | - MethodTypes now have (params: List[Symbol]) - "copy"-methods for case classes - the "copy" object in the compiler is now called "treeCopy"
* Switch over to new scanner/parser.Miles Sabin2009-05-181-2/+2
|
* Updated (all) copyright notices to 2009Antonio Cunei2009-01-131-1/+1
|
* Phases now have a checkable flag, used by the n...Geoffrey Washburn2008-09-031-0/+1
| | | | | Phases now have a checkable flag, used by the new -Ycheck:all option.
* 1) Fix in backend to print meaningful filenames...Martin Odersky2008-05-201-3/+6
| | | | | | | 1) Fix in backend to print meaningful filenames (previously it was "[wrote DataOutputStream@6747]" 2) Treat java varargs as Scala varargs 3) Allow parsing of Java source files
* Massive check-in for IDE.Sean McDirmid2007-09-171-2/+3
|
* removed some more type aliasesmichelou2007-07-231-2/+2
|
* Switching over to position objects from positio...Sean McDirmid2007-04-191-1/+1
| | | | | | Switching over to position objects from position type parameters. Positions are no longer ints.
* removed leading/trailing tabs/blanks in parser/...michelou2006-09-141-7/+8
| | | | | removed leading/trailing tabs/blanks in parser/*.scala
* Modified scopes and positions so they can be co...Sean McDirmid2006-08-251-0/+3
| | | | | Modified scopes and positions so they can be configured more flexibly.
* removed a hack for supporting the interpreter t...Lex Spoon2006-02-161-5/+0
| | | | | removed a hack for supporting the interpreter that is no longer needed
* Switching to the new build system and to the ne...Gilles Dubochet2005-12-191-0/+25
Switching to the new build system and to the new build system. This is a MAJOR commit, so be careful when updating.