[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [imp-dev] Double call to parser when loading file with imports
|
Stan,
Actually, it is a significant issue for me. I build
semantic models from the parsed file, and when it gets parsed twice with the
same ParseController, it looks like duplicate definitions, which creates error
markers. I am waiting for this to be resolved before moving up to Eclipse 3.3
and the versions of IMP from eclipse.org.
Hope all is going well, and thanks for the
update,
Andy
Andy,
Apologies for not getting back to you sooner with more
information about this. I've had some non-IMP duties to attend to
lately, and Bob has been on vacation.
I believe that I know why the parser is getting called twice when a
file is first loaded. In UniversalEditor, the main method that is
responsible for setting up a new editor is createPartControl(..). The
logic in createPartControl(..) can be divided roughly into three parts:
1) preliminary initializations, 2) initializations of most language
services, and 3) later initializations. In the middle phase, when we
initialize the language services, we also initialize the parse controller and
call the parser. (That's what you see happening in the main thread.)
In the last phase we call a method watchDocument() that does two things.
One is to put a documentChanged listener onto the editor's document, the
other is to run the parser scheduler directly to catch any changes that may
have happened before the listener could be added. (This results in the
call to the parser that you see in the worker thread.)
This code was written by Bob originally and has been
extended and refactored a few times since then. At this point I don't
know if the double invocation of the parser is intentional or accidental, or
whether it's really necessary, just helpful, or superfluous (or even possibly
harmful). I'll discuss this with Bob next week. I did a couple of
quick experiments where I commented out one or the other of those parser
invocations and found that I could run a couple of different editors with no
real (or apparent) problems. I imagine that in either case the
consequences would be short-lived and probably not apparent to the user.
Still, I haven't had a chance to trace through the logic in detail.
In any case, we'll discuss it and see if there's something to be
done.
If this is actually causing
a problem for you (or your users) please let us know. If it's just
confusing, that's still reason enough to remove the double invocation if it's
not needed, and there'd be nothing wrong with eliminating a little overhead in
the start-up process, as well.
Regards,
Stan
Stan Sutton, Ph. D.
IBM T. J.
Watson Research Center
19 Skyline Drive, Hawthorne, NY 10532
USA
telephone: 1-914-784-7316, FAX: 1-914-784-7455, T/L
863
e-mail: suttons@xxxxxxxxxx, Stan
Sutton/Watson/IBM@IBMUS
"Crapo, Andrew (GE,
Research)" <crapo@xxxxxx> Sent by: imp-dev-bounces@xxxxxxxxxxx
09/05/2008 09:55 AM
Please respond
to IMP Developers List
<imp-dev@xxxxxxxxxxx> |
|
To
| <imp-dev@xxxxxxxxxxx>
|
cc
|
|
Subject
| [imp-dev] Double call to parser
when loading file with imports |
|
I am having a problem, reminiscent of an old issue from almost a year
ago, having to do with the parser getting called twice while loading a file.
Given two files, f1.sadl and f2.sadl, and f2.sadl
imports f1.sadl (meaning that when f2.sadl is parsed, if f1.sadl isn't already
parsed and the resulting model available to use in error checking, f1.sadl
will be parsed (although not shown in an editor).
If f1.sadl is opened in the editor, the parser is
only called once. However, if f2.sadl is opened, the parser is called for
f2.sadl, then f1.sadl is parsed, and then a different thread invokes the
parser a second time for f2.sadl. At this point the call stack is:
I can't see what in my code would be causing this
to happen. This is an IMP application created with Eclipse 3.2.2 some time ago
and I'm moving it to Eclipse 3.3.2 and the latest IMP. I don't believe I was
seeing this until I upgraded to 0.1.75.
Any insights would be greatly
appreciated.
Andrew Crapo
GE Global Research
Information Scientist
T 518 387 5729
F 518 387 6104
D *833 5729
E crapo@xxxxxxxxxxxxxxx
www.research.ge.com
One Research Circle
Niskayuna, NY 12309 USA
General Electric Company _______________________________________________
imp-dev mailing
list
imp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/imp-dev