Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Exception when testing language
Exception when testing language [message #800914] Fri, 17 February 2012 17:25 Go to next message
Vlad Dumitrescu is currently offline Vlad Dumitrescu
Messages: 318
Registered: July 2009
Location: Gothenburg
Senior Member
Hi!

I am using org.eclipselabs.xtext.utils.unittesting to test my grammar and for a certain construct I get the exception below.

First of all, I'd like to know if the problem seems to be with xtext or with xtext.unittesting.

Second, is this something known or that someone can help me with from just this small bit of information?

If not, I will try to get a minimal example and file a bugzilla report.

best regards,
Vlad

java.lang.NullPointerException
	at org.eclipse.xtext.serializer.analysis.SemanticSequencerNfaProvider$SemStateFactory.create(SemanticSequencerNfaProvider.java:123)
	at org.eclipse.xtext.serializer.analysis.SemanticSequencerNfaProvider$SemStateFactory.create(SemanticSequencerNfaProvider.java:1)
	at org.eclipse.xtext.util.formallang.NfaUtil.create(NfaUtil.java:238)
	at org.eclipse.xtext.serializer.analysis.SemanticSequencerNfaProvider.getNFA(SemanticSequencerNfaProvider.java:152)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:397)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_Expr700(AbstractErlangSemanticSequencer.java:1463)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:889)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptAction(SequenceFeeder.java:292)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:95)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:389)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:423)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_Expr700(AbstractErlangSemanticSequencer.java:1454)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:514)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:380)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:423)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_Expressions(AbstractErlangSemanticSequencer.java:1535)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:449)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:387)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:423)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_FunctionClause(AbstractErlangSemanticSequencer.java:1590)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:581)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:380)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:423)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_Function(AbstractErlangSemanticSequencer.java:1599)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:575)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
	at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:380)
	at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:423)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_Module(AbstractErlangSemanticSequencer.java:1725)
	at org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:765)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:84)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:103)
	at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:125)
	at org.eclipse.xtext.resource.XtextResource.doSave(XtextResource.java:313)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1423)
	at org.eclipselabs.xtext.utils.unittesting.XtextTest.loadAndSaveModule(XtextTest.java:380)
	at org.eclipselabs.xtext.utils.unittesting.XtextTest.testFile(XtextTest.java:178)
	at org.erlide.erlang.FilesTest.test3(FilesTest.java:34)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.eclipse.xtext.junit4.XtextRunner$1.evaluate(XtextRunner.java:55)
	at org.eclipselabs.xtext.utils.unittesting.XtextRunner2$1.evaluate(XtextRunner2.java:36)
	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Re: Exception when testing language [message #800992 is a reply to message #800914] Fri, 17 February 2012 19:52 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad Dumitrescu
Messages: 318
Registered: July 2009
Location: Gothenburg
Senior Member
I managed to get a small example grammar that exhibits the issue. The trouble is in the Expression rule.

Module:
	Expression '.';

Expression :
	  ExprMax 
	  (
	  	  {A1.ref=current} val=ID 
	  )? 
	| '#' {A1} rec=ID    
;

ExprMax returns Expression:
	  Literal
	| '(' Expression ')' 
;

Literal:
	  value=ID;

// Literals

terminal ID:
	('a'..'z')+ ;

terminal WS:
	(' ' | '\t' | '\r' | '\n')+ ;


I can't move the alternative that begins with '#' to ExprMax because the real rule looks more like

Expression :
	  ExprMax 
	  (
	  	  '(' {A1.ref=current} val=ID ')'
	  	  | '#' {A1.ref=current} rec=ID 
	  )? 
	| '#' {A1} rec=ID    
;



This might be a weird construct, but couldn't one get a warning or something?

best regards,
Vlad
Re: Exception when testing language [message #801143 is a reply to message #800992] Sat, 18 February 2012 00:27 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2500
Registered: July 2009
Senior Member
Can't really make heads or tails of this...

What is A1? It is not shown in your grammar.

With this construct
ExprMax (
'(' {A1.ref=current} val=ID ')'
| '#' {A1.ref=current} rec=ID )? | '#' {A1} rec=ID ;

You are stating:
ExprMax ('(' ID ')' | '#' ID )? | '#' ID

This looks odd.
Using "a" as ID; ExprMax may optionally be followed by "(a)" or "#a" or
followed by "#a" - thus if the input is "a #a", there is an ambiguity -
does this input match the first #ID or the second?

Your assignment rules also looks odd.

The result is:
"a #b" => A1 with rec = "b" (the "a" is lost)
OR (ambiguous)
=> A1 with ref = Literal "a" rec = "b"

"a (b)" => A1 with ref = Literal "a", val = "b"

The "fixed" version simply avoids the ambiguity, but has the strange
looking assignment '#' {A1} rec=ID where again, you would be producing a
new A1 instance with rec = ID and thus drop the ExprMax (the current).

Can you give examples in your source language and what you expect as result?

Sorry for not being able to give more help - need more input.

Regards
- henrik

On 2012-17-02 20:52, Vlad Dumitrescu wrote:
> I managed to get a small example grammar that exhibits the issue. The
> trouble is in the Expression rule.
>
> Module:
> Expression '.';
>
> Expression :
> ExprMax (
> {A1.ref=current} val=ID )? | '#' {A1} rec=ID ;
>
> ExprMax returns Expression:
> Literal
> | '(' Expression ')' ;
>
> Literal:
> value=ID;
>
> // Literals
>
> terminal ID:
> ('a'..'z')+ ;
>
> terminal WS:
> (' ' | '\t' | '\r' | '\n')+ ;
>
>
> I can't move the alternative that begins with '#' to ExprMax because the
> real rule looks more like
>
>
> Expression :
> ExprMax (
> '(' {A1.ref=current} val=ID ')'
> | '#' {A1.ref=current} rec=ID )? | '#' {A1} rec=ID ;
>
>
>
> This might be a weird construct, but couldn't one get a warning or
> something?
>
> best regards,
> Vlad
>
Re: Exception when testing language [message #801447 is a reply to message #801143] Sat, 18 February 2012 11:51 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad Dumitrescu
Messages: 318
Registered: July 2009
Location: Gothenburg
Senior Member
Hello Henrik and thanks for your heroic attempt to make sense of my scribblings! I probably tried too hard to simplify the context.

There are two issues in my mind:
1. if the grammar is nonsense, couldn't the compiler give a warning or error? It feels like the root cause for a NPE in the serializer could have been detected by the compiler.

2. what would be the right way to write the grammar rules?

There are four expressions that I need to parse here:
* ExprMax
* ExprMax(arg) which is a function call
* ExprMax#type which is a typed expression
* #type which is a type constructor

The way I started with it was something like

Expression: FunCall | TypedExpr;
FunCall: ExprMax ('(' ')')?;
TypedExpr: ExprMax? => '#' ID;


but that is ambiguos on ExprMax. Maybe it would be enough to set "k=2" on the ANTLR grammar? Problem is that I get syntax errors when I try it - "backtrack=true" works, but "k=2" gives "no viable alternative at input '2'"...

best regards,
Vlad
Re: Exception when testing language [message #801536 is a reply to message #801447] Sat, 18 February 2012 15:04 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2500
Registered: July 2009
Senior Member
On 2012-18-02 12:51, Vlad Dumitrescu wrote:
> Hello Henrik and thanks for your heroic attempt to make sense of my
> scribblings! I probably tried too hard to simplify the context.
>
> There are two issues in my mind:
> 1. if the grammar is nonsense, couldn't the compiler give a warning or
> error? It feels like the root cause for a NPE in the serializer could
> have been detected by the compiler.
>
An NPE is never good, should have done something else. Note that there
are valid grammars that are not serializeable - they still serve a
purpose but are essentially one way (they can be used to parse). The
serialization validation should have caught the problem IMO.

> 2. what would be the right way to write the grammar rules?
>
Depends on what you really want... which is what I am trying to figure
out :)

> There are four expressions that I need to parse here:
> * ExprMax * ExprMax(arg) which is a function call
> * ExprMax#type which is a typed expression
> * #type which is a type constructor
>
> The way I started with it was something like
>
>
> Expression: FunCall | TypedExpr;
> FunCall: ExprMax ('(' ')')?;
> TypedExpr: ExprMax? => '#' ID;
>
>
This is ambiguous since a FunCall can consist of only an ExprMax, and it
is impossible to detect if a following '#' ID belongs to the ExprMax or
is free standing. Using 'a' for literal, given "a#b" is this a FunCall
followed by a TypedExpr or a TypedExpr?

Try something like:

Expression : TypedExpression ;

TypedExpression
: FunctionCall
({TypedExpression.left = current}
'#' type = ID)?
;

FunctionCall
: PrimaryExpression
({FunctionCall.left = current}
'(' args += Expression* ')')?
;

PrimaryExpression
: Literal
| ParenthesizedExpression
;

Literal : value = ID;

ParenthesizedExpression : '(' Expression ')' ;

This allows any primary expression to be used as LHS in FunctionCall,
and anything can be typed. If you need to disallow certain input - say
"(a)#b" simply add validation to TypedExpression and check the class of
the LHS. Likewise, if you do not allow "(a)()", simply check LHS of
FunctionCall for acceptable class.

a => (Literal a)
a#b => (TypedExpression (Literal a) b)
a() => (FunctionCall (Literal a))
a()#b => (TypeExpression (FunctionCall (Literal a)) b)

etc.

Did you want #ID to mean "type creation expression"? You could do this:

PrimaryExpression
: Literal
| ParenthesizedExpression
| TypeDeclaration
;

TypeDeclaration
: '#' type = ID
;


You also need to have a separator (e.g. ',') between the arguments in
the function call as Expression* becomes ambiguous.
This could work but results in possibility to express things that seems
nonsensical - i.e. passing a TypeDeclaration as an argument, calling it
etc. i.e. these expression would be valid:

#b
#b()
#b#c
a(#b, #c)
....

You probably want to have it at a higher level in the grammar.
Something like this perhaps:

Statements :
statements += Statement+

Statement : Expression '.' | TypeDeclaration ;

Note that a separator between expressions is required.

> but that is ambiguos on ExprMax. Maybe it would be enough to set "k=2"
> on the ANTLR grammar? Problem is that I get syntax errors when I try it
> - "backtrack=true" works, but "k=2" gives "no viable alternative at
> input '2'"...
>
These are the kinds of things that are getting you into trouble - you
have to start with a grammar that is not ambiguous. When you turn on
backtracking without knowing why, you are basically letting the parser
guess for you. If you set k to a number you are basically setting
look-ahead to 2, better to leave it to its default.

> best regards,
> Vlad
>
Hope that helps you.
- henrik
Re: Exception when testing language [message #801547 is a reply to message #800914] Sat, 18 February 2012 15:23 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2903
Registered: July 2009
Senior Member
Hi Vlad,

a bugzilla report is most welcome. Even strange grammar constructs
should never produce a NPE.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 17.02.12 18:25, schrieb Vlad Dumitrescu:
> Hi!
>
> I am using org.eclipselabs.xtext.utils.unittesting to test my grammar
> and for a certain construct I get the exception below.
> First of all, I'd like to know if the problem seems to be with xtext or
> with xtext.unittesting.
> Second, is this something known or that someone can help me with from
> just this small bit of information?
>
> If not, I will try to get a minimal example and file a bugzilla report.
>
> best regards,
> Vlad
>
>
> java.lang.NullPointerException
> at
> org.eclipse.xtext.serializer.analysis.SemanticSequencerNfaProvider$SemStateFactory.create(SemanticSequencerNfaProvider.java:123)
>
> at
> org.eclipse.xtext.serializer.analysis.SemanticSequencerNfaProvider$SemStateFactory.create(SemanticSequencerNfaProvider.java:1)
>
> at org.eclipse.xtext.util.formallang.NfaUtil.create(NfaUtil.java:238)
> at
> org.eclipse.xtext.serializer.analysis.SemanticSequencerNfaProvider.getNFA(SemanticSequencerNfaProvider.java:152)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:397)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_Expr700(AbstractErlangSemanticSequencer.java:1463)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:889)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptAction(SequenceFeeder.java:292)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:95)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:389)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:423)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_Expr700(AbstractErlangSemanticSequencer.java:1454)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:514)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:380)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:423)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_Expressions(AbstractErlangSemanticSequencer.java:1535)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:449)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:222)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:387)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:423)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_FunctionClause(AbstractErlangSemanticSequencer.java:1590)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:581)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:380)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:423)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_Function(AbstractErlangSemanticSequencer.java:1599)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:575)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325)
>
> at
> org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:380)
>
> at
> org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:423)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.sequence_Module(AbstractErlangSemanticSequencer.java:1725)
>
> at
> org.erlide.serializer.AbstractErlangSemanticSequencer.createSequence(AbstractErlangSemanticSequencer.java:765)
>
> at
> org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:84)
> at
> org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:103)
> at
> org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:125)
> at org.eclipse.xtext.resource.XtextResource.doSave(XtextResource.java:313)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1423)
>
> at
> org.eclipselabs.xtext.utils.unittesting.XtextTest.loadAndSaveModule(XtextTest.java:380)
>
> at
> org.eclipselabs.xtext.utils.unittesting.XtextTest.testFile(XtextTest.java:178)
>
> at org.erlide.erlang.FilesTest.test3(FilesTest.java:34)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> at org.eclipse.xtext.junit4.XtextRunner$1.evaluate(XtextRunner.java:55)
> at
> org.eclipselabs.xtext.utils.unittesting.XtextRunner2$1.evaluate(XtextRunner2.java:36)
>
> at
> org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
>
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
>
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
>
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>
> at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
>
Re: Exception when testing language [message #802354 is a reply to message #801547] Sun, 19 February 2012 21:19 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad Dumitrescu
Messages: 318
Registered: July 2009
Location: Gothenburg
Senior Member
Submitted bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=371999

Thanks!
/Vlad
Re: Exception when testing language [message #802357 is a reply to message #801536] Sun, 19 February 2012 21:25 Go to previous message
Vlad Dumitrescu is currently offline Vlad Dumitrescu
Messages: 318
Registered: July 2009
Location: Gothenburg
Senior Member
Thank you very much Henrik!

There's always a lot to learn from your replies, as it feels that constructing the "right" grammar for an existing language is something of a black art. I converted it from the original one that uses a completely different parser generator, slowly got it to parse existing code without the need for backtracking and now I am fighting with it so that the AST makes sense. Next will be cross-references and scoping... and that's just the things I know about Smile

best regards,
Vlad
Previous Topic:change font from mydsl
Next Topic:[ report ""
Goto Forum:
  


Current Time: Thu Oct 23 00:39:59 GMT 2014

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

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