Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Question related to partial parsing (Question related to partial parsing )
Question related to partial parsing [message #1724113] Sun, 21 February 2016 07:13 Go to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
I found that xtext fullReparse the file if it found syntax error.
which means that while writing any statement consists of 100 words, the file will be parsed 100 times !!!!!
Because before reaching keystroke number 100 all previous strokes will cause syntax errors
I tried just to comment it out, but is it a suitable solution?

public class PartialParsingHelper implements IPartialParsingHelper {
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public IParseResult reparse(IParser parser, IParseResult previousParseResult, ReplaceRegion changedRegion) {

...

if (newParseResult == null || newParseResult.hasSyntaxErrors()) {
// TODO: Should we reparse if the complete input was parsed?
// on error fully reparse
return fullyReparse(parser, previousParseResult, replaceRegion);
}
}
}

[Updated on: Sun, 21 February 2016 08:21]

Report message to a moderator

Re: Question related to partial parsing [message #1724122 is a reply to message #1724113] Sun, 21 February 2016 13:43 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Usually that doesn't matter as
1) parsing is lightning fast thanks to Antlr 3
2) parsing is done in background and doesn't block the UI
3) parsing takes only place after you didn't touch the keyboard for 200ms
4) not every keystroke means a syntax error

What issues are you experiencing? Maybe you should rather consider switching off partial parsing, to avoid duplicate parsing.


---
Get professional support from the Xtext committers at www.typefox.io
Re: Question related to partial parsing [message #1724276 is a reply to message #1724122] Mon, 22 February 2016 17:14 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
What i am experiencing is that after any keystroke, all links for all my EOBjects got cleared , so we link all eobjects again, which takes alot of time with big files (Check doLinkModel method in LazyLinker class).

so i was wondering why by each keystroke all eobject model removed and recreated?

[Updated on: Mon, 22 February 2016 18:00]

Report message to a moderator

Re: Question related to partial parsing [message #1724282 is a reply to message #1724276] Mon, 22 February 2016 18:21 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
is it possible to switch off partial parsing?
and how?
Re: Question related to partial parsing [message #1724285 is a reply to message #1724282] Mon, 22 February 2016 19:26 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

Every change could possibly change the scope of the elements, this is why everything gets relinked (in the background).
You should measure and optimize the linking itself.
Re: Question related to partial parsing [message #1724287 is a reply to message #1724285] Mon, 22 February 2016 19:52 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
Is it possible not to clear all the links and clear only links which updated due to change in the editor?
Example:
Object A {
x,y,z
}
Object B {
k,j,h
}

As i understand now by and change we will link A,x,y,z and B,k,j,h even if the change was adding new Object C
Object C{
u,i,o
}
and this new object has no effect (will not affect the links already done) by any mean, so we dont have to remove those links in my case at least.
This is small example, please imagine the time will be lost in huge files.

And as i understood from the code after any change all EObject will be replaced not the updated EOBjects only, I mean by adding Object C as shown above, we will create new EObjects for all the identifiers in the editor not Object C only

[Updated on: Mon, 22 February 2016 19:54]

Report message to a moderator

Re: Question related to partial parsing [message #1724292 is a reply to message #1724287] Mon, 22 February 2016 20:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7266
Registered: July 2009
Senior Member
Hi

It's only software; of course it's possible.

But Sven and his team very sensibly avoid the many hazards of manually
coded incremental parsing.

One day the automation around Xtext associated with the ongoing OCL
parsing auto-generation may support accurate auto-generated incremental
parsing; but don't hold your breath.

Regards

Ed Willink

On 22/02/2016 19:52, kimi raikonnan wrote:
> Is it possible not to clear all the links and clear only links which
> updated due to change in the editor?
> Example:
> Object A {
> x,y,z
> }
> Object B {
> k,j,h
> }
>
> As i understand now by and change we will link A,x,y,z and B,k,j,h
> even if the change was adding new Object C
> Object C{
> u,i,o
> }
> and this new object has no effect (will not affect the links already
> done) by any mean, so we dont have to remove those links in my case at
> least.
> This is small example, please imagine the time will be lost in huge
> files ?
>
Re: Question related to partial parsing [message #1724388 is a reply to message #1724292] Tue, 23 February 2016 14:52 Go to previous messageGo to next message
kimi raikonnan is currently offline kimi raikonnanFriend
Messages: 145
Registered: June 2015
Senior Member
Thanks for your reply, but that means we dont have partial parsing and partial linking in most of the cases, we just do partial parsing in so difficult situations (if the user end his editing without syntax errors) which is so strange
Re: Question related to partial parsing [message #1724403 is a reply to message #1724388] Tue, 23 February 2016 17:20 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

Yes, I actually regret that we have added partial parsing, since it is very complicated and only pays off with very large documents. For very small ones, it is actually a bit slower (but still super fast, so it doesn't matter)
For Xtend we have even switched it off. We haven't done anything into the direction of partial linking and in general in Xtext the granularity for incremental builds/updates is on a per file basis.

I don't know how big your files really are, but measuring and using a profiler and then optimize where it pays off is the way to go and solves performance issues in 90% of all cases. Also trying to split huge files in smaller ones will help.
Previous Topic:how to install antlrWorks in xtext??
Next Topic:Xtext web editor -- debug mode
Goto Forum:
  


Current Time: Wed Sep 22 00:30:19 GMT 2021

Powered by FUDForum. Page generated in 0.01832 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top