Hi Folks,
Yesterday I committed a bunch of changes to SVN HEAD that I had been cooking up during my preparations for the EclipseCon tutorial, and later during EclipseCon.
This is a pretty big list of changes, so I've broken it out by section to help you wade through it.
N.B.: I think most of this *is* actually relevant to IMP users, not just IMP developers.
Anyway, here's the blow-by-blow:
*************** *** Global: *** 1) Added type parameters to various places to quiet the Java 5+ compilers about use of raw types, etc.
2) No longer uses deprecated API on LPG runtime classes (e.g., use getIPrsStream() in lieu of getParseStream()).
3) Added icons for various actions (menu items) that were missing one.
4) We're back in the habit of tagging plugin projects for each release. The IMP RelEng tools now support this for SVN-hosted projects (at least when using the Subclipse client).
************************************* *** IParseController and friends: *** *************************************
1) Removed the "boolean scanOnly" argument from IParseController.parse(), and made the appropriate changes in all the known parsers.
2) Renamed IParseController.getNodeLocator() to getSourcePositionLocator(), for consistency with the name of the interface that it returns.
3) There is now a base class ParseControllerBase, which provides support for the language- and parser-independent parts of the IParseController interface, e.g., getProject(), getLanguage(), getPath(), getHandler(), and getCurrentAst(). The existing class SimpleLPGParseController now extends this with LPG-specific behavior.
4) Removed unnecessary overrides of ParseController.initialize() from various IParseController implementations that just called super.
5) Added a reset() method to the IParser and ILexer interfaces, renamed IParser.getParseStream() to getIPrsStream(), and renamed ILexer.getLexStream() to getILexStream(), for consistency with the LPG runtime interfaces. Now there's enough API on these interfaces to make more of the ParseController implementation language-independent. Pulled up the implementation of the IParser- and ILexer-related stuff to SimpleLPGParseController (and out of the corresponding template).
I believe that in particular the parse() method can be moved from the parse controller template to the SimpleLPGParseController base class, but I haven't done that yet.
6) Removed the unnecessary declaration of non-aliased terminals from the parser template (grammar.g). Adjusted the comment to clarify the purpose of declaring terminals here as opposed to in the lexer file.
7) Added "suppression suffixes" to the various terminals in the parser template (grammar.g) so that terminals like "(" don't get stored in the generated AST.
******************** *** IMP Runtime: *** 1) I've added folding-related actions and breakpoint-related actions to the ruler's context menu. Previously, this menu had only the bare text editor actions.
N.B.: I believe breakpoint functionality is actually broken right now, due to the incorporation of new code to use much simpler API from Platform Debug (to set line breakpoints in the presence of SMAP attributes).
2) There is now a global console named "IMP Runtime" that any (lazy) IDE plugin can use to emit messages. 3) There is now API for BuilderBase-derived builders to access a console: getConsoleStream(). By default, this will use a global IMP- provided console named "IMP Builders". Builders wanting their own console can simply override the method BuilderBase.getConsoleName() to specify a different console name.
4) ParserScheduler is now partially prepared to use preference settings and the console to control/output diagnostic messages relating to parsing and notifying model listeners (including most of the service controllers).
N.B. A bit more work needs to be done to switch the IMP runtime over to the new preferences service (cf. the preference store) to make this work as intended. In particular, my intent here is to permit per-language control of diagnostic output, and to place the diagnostics for each language in its own console (assuming the language IDE defines its own console).
5) If the language descriptor specifies an icon, it's actually used now for the icon of the editor associated with the given filename extensions. This appears in the File Associations part of the Preferences.
I tried to get the language name to be used as part of the editor name (so that it would appear in the same place), but apparently there's not quite enough API (even internal) to do this. I've logged a bug report against the Platform, but of course the API is already frozen for 3.5. I've been encouraged to join the "e4" effort (Eclipse 4.0) as an early adopter, but honestly, I don't know that I can muster the bandwidth for yet more churn. (e4 does look like some nice forward progress, though.)
6) FolderBase now supports a "debug mode" which, when enabled, dumps the computed folding annotations to the IMP console. Debug mode is disabled by default, and can presently only be enabled by modifying the initializer of the field FolderBase.fDebugMode.
N.B.: It turns out that if one has nested folding annotations that overlap in terms of lines, the folding twisties don't behave as you'd expect (e.g., the outer folding twistie will fold all but the last line of the corresponding text region).
We should probably add a checker for that to FolderBase.
As a work-around in the LEG folder, the visitor method for blocks only creates a folding annotation if its parent isn't a functionDeclaration (since in that case the entire functionDeclaration is made foldable, including the block that is its body). This was a source of some confusion for some tutorial participants (and myself).
7) The ServiceFactory and UniversalEditor now support multiple IAutoEditStrategy's per language.
8) There is now an "Open Declaration" action in the source editor's context menu, and it does something sensible.
N.B.: The "something sensible" now uses some EFS API to produce an appropriate IEditorInput for files located outside the workspace. This code should probably be reused/emulated in a couple of other parts of the IMP Runtime (e.g., in the TargetLink class used by source hyperlinking).
[See EditorUtility.getEditorInput(Object) for more details.]
9) The IMP Runtime now registers an IResource-to-ISourceEntity IAdapterFactory with the Platform's AdapterManager. [Honestly, I don't quite remember where this is used, but I *think* it's by the above "Open Declaration" implementation.]
10) Renamed a bunch of String constants in ServiceFactory for consistency with the actual extension point IDs that they refer to.
************************* *** IMP Meta-tooling: *** *************************
1) All of the various IMP "Enable Foo Builder" actions are now in a separate sub-menu "IMP" of the "object contributions" context menu that shows up in the Package Explorer, among other places. This helps cut down on visual clutter in that menu, which is already pretty big.
2) Many changes to the various templates to iron out little issues, like removing unnecessary imports (which cause warnings), to adapt to the latest APIs, hoist language-independent code up to base classes in the IMP runtime, simplify the algorithms and layout, and so on.
3) The "New Preferences Specification" wizard now actually enables the prefspecs compiler on the given project. Also, the template has been updated to the latest language syntax, and includes comments that describe the multi-level preferences concept and its usage.
4) Trimmed a lot of dead code from the PrefSpecs compiler.
5) The IMP wizards now properly initialize the project field when the current selection is located inside the PDE's plugin manifest editor. At least some of the time.
6) Made the wizard IDs more consistent, and added the "New Occurrence Marker" wizard to the shortcut list defined by the IMPPerspectiveFactory.
7) The various builders/compilers now use a console for diagnostic output rather than dumping messages to System.out/err.
8) There is now a "Plugin Sanity Checker" builder that verifies that an IMP IDE plugin satisfies various Eclipse platform-defined constraints for all of the IMP extension points. E.g., it checks that an executable class identified as the implementation of a given service has a default ctor, that the ctor is public, that the owning class is public and not a member class, and so on.
************************************************* *** Language service interfaces/base classes: *** *************************************************
1) I extracted SymbolTable from the LPG parser template to a bona-fide class in the IMP runtime, and gave it a type parameter for the language- specific root AST node type. I also pulled in a few convenience methods from the version in the LPG IDE's parser. All of the parsers (including the parser template) now use this instead of their own local copies.
2) There is now an ISourcePositionLocator implementation that works for all LPG-based parsers using LPG-generated ASTs. As a result of this, there is no longer a need to generate a copy with each LPG parser.
3) Made an LPGFolderBase class for folding updaters for LPG-based parsers with LPG-generated ASTs. Renamed the various client-visible methods from makeAnnotation() to makeFoldable().
4) Introduced a new interface IASTMatchAdapter by pulling up the set of methods from IASTAdapter that are actually used by the AST matching implementation in org.eclipse.imp.box (and I think, org.eclipse.imp.xform).
************************************* *** LPG IDE- and Builder-related: *** *************************************
1) The LPG IDE now examines the keyword filter to locate the definitions of the keywords, so that reference resolution works on them too. As a result, when you hyperlink through a ref to a keyword, it actually takes you to the definition. [See ASTUtils.collectIncludedFiles() for more details.]
2) I extracted the commented-out extensions from the LPG IDE's plugin manifest to a separate file, since the PDE insists on removing it on every change to the manifest.
3) Removed the project-specific LPG preferences from the projects that contain an LPG grammar, since the default preferences should now work properly with the LPG builder.
4) There is now an "LPG Doc Builder" that provides minimal JavaDoc-like functionality. It scans the grammar source file for single-line comments starting with "--**" and produces an HTML file that looks very vaguely like JavaDoc-produced HTML pages. To enable this on a grammar- bearing project, invoke "Enable LPG Doc Builder" from the "IMP" sub- menu of the project's context menu. [Actually, I implemented this some months ago, but I just recently decided to make it visible. That said, it's still bleeding-edge code.]
5) Renamed the start symbol from "JikesPG" to "LPG".
********************** *** Miscellaneous: *** 1) Updated the LEG IDE project to use the latest APIs, and generated a number of additional service implementations. Also simplified the factorial example in the "examples" folder to use "<=". N.B.: This change requires minor changes to the parser and the compiler, which was part of the exercises in the tutorial.
-- Cheers, - Bob ------------------------------------------------- Robert M. Fuhrer Research Staff Member Programming Technologies Dept. IBM T.J. Watson Research Center
|