Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [SOLVED] "NullPointerException (..) missing value converter"
[SOLVED] "NullPointerException (..) missing value converter" [message #1734531] Thu, 09 June 2016 08:35 Go to next message
Jonathan L. is currently offline Jonathan L.Friend
Messages: 24
Registered: May 2016
Junior Member
Hi again,

I got an error message within the generated editor:
"A NullPointerException occured. This indicates a missing value converter or a bug in its implementation."

I tried to reproduce the issue with a part of my grammar.

In this case the following should be possible:
// [1] appending of array-like structs and variables or values
// Rule: Vector_constr
[a] .. [ ] .. [42] .. b .. 23
// [2] variable declaration like normal arrays with square brackets after the type
// Rule: Var >> Type
var int[a] x
var int[2] y
var int[ ] z

But the above-mentioned error occurs when:

  • in [1]: I type something without square brackets like ".. b .."
  • in [2]: If I type something between the square brackets. If the square brackets are empty no error occurs..

I really got no idea what the meaning of the error is or what I can do to fix this ..
Someone can help?

Here is the grammar for this:

Note: It works with backtrack=true!
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"

Block:
	stmt+=Stmt*;

Stmt:
	Var | Exp
;
Var:
	'var' type=Type name=ID_VAR
;
Type:
	(		
			type_prim=Types 
		|	type_cls_adt=ID_CLS_ADT
		|	type_nat=ID_NAT
	) 
	('&' | '&&' | '?' | '[' (exp+=Exp)? ']')*
;
ExpList:
	{ExpList} ( exp+=Exp (',' exp+=Exp)* )?
;
Vector_tup:
	'[' e=ExpList ']'
;
Vector_constr:
	(vec+=Vector_tup) ('..' (vec+=Vector_tup | exp+=Exp) )*
;
//------------- Expression -----------------
Exp:
	Exp0
;
Exp0:
	Exp1
;
Exp1:
	left=Exp2 ('or' right+=Exp2)*
;
Exp2:
	left=Exp3 ('and' right+=Exp3)*
;
Exp3:
	left=Exp4 ( ( '!=' | '==' | '<=' | '>=' | '<' | '>' ) right+=Exp4)*
;
Exp4:
	left=Exp5 ('|' right+=Exp5)*
;
Exp5:
	left=Exp6 ('^' right+=Exp6)*
;
Exp6:
	left=Exp7 ('&' right+=Exp7)*
;
Exp7:
	left=Exp8 ( ('>>' | '<<') right+=Exp8)*
;
Exp8:
	left=Exp9 ( ('+'|'-') right+=Exp9)*
;
Exp9:
	left=Exp10 ( ( ('*' | '/') | '%') right+=Exp10)*
;
Exp10:
	('not' | '-' | '+' | '~' | '*' | '&&' | '&' | '$$' | '$' | '(' cast+=Cast ')')*
	expr=Exp11
;
Exp11:
	left=Exp12 
	(
		(
			'()' |
			'(' expList+=ExpList ')' 
			('finalize' 'with' finally+=Finally 'end' )?
		)
		|	'[' exp+=Exp ']' 
		|	(':' | '.') field+=(ID_VAR | ID_NAT | ID_CLS_ADT)
		|	'?'
		|	'!'
	)*
;
Exp12:
	Prim
;
Prim: 
	'(' exp=Exp ')'
	|	Sizeof
	|	var=ID_VAR	|	nat=ID_NAT	|	def=ID_EXT_TAG
	|	Null		|	Number	|	{String} STRING
	|	Global 		|	This	|	Outer	|	=>Vector_constr
	|	'call' Exp
	|	'call/rec' Exp
;

Cast:
	type=Type | cast=('@nohold' | '@plain' | '@pure')
;
Sizeof:
	'sizeof' '(' (Type | Exp) ')'
;
Null:
	{Null} 'null'
;
Number:
	{Number} ( =>(INT ('.' INT)?) | HEX  | 'true' | 'false' )
;
Global:
	{Global} 'global'
;
This:
	{This} 'this'
;
Outer:
	{Outer} 'outer'
;
Types:
	name=(
		'bool' 	| 	'byte' 	| 	'char'	|	'f32'	|	'f64'   
	|	'float' | 	'int'   | 	's16'   | 	's32'   | 	's64'   
	| 	's8'    | 	'u16' 	| 	'u32'   | 	'u64'   | 	'u8'    
	|	'uint'	| 	'void'  | 	'word'
	)
;
Finally:
	Block
;
//------------- ID_RULES -----------------
terminal ID_VAR:
	(('a'..'z') ('a'..'z' | 'A'..'Z' | '0'..'9' | '_')*) | '_'
;
terminal ID_EXT_TAG:
	('A'..'Z') ('A'..'Z' | '0'..'9' | '_')*
;
terminal ID_CLS_ADT:
	('A'..'Z') ('a'..'z' | 'A'..'Z' | '0'..'9' | '_')*
;
terminal ID_NAT:
	'_' ('a'..'z' | 'A'..'Z' | '0'..'9' | '_')+
;
terminal HEX:		//Used in Rule: Number
	('0' ('x'|'X') ('0'..'9'|'A'..'F'|'a'..'f')*)
;

[Updated on: Thu, 09 June 2016 09:44]

Report message to a moderator

Re: "NullPointerException (..) missing value converter" [message #1734536 is a reply to message #1734531] Thu, 09 June 2016 09:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13223
Registered: July 2009
Senior Member
Hi,

first of all solving problems with backtracking is a bad idea

this pattern how you build the expressions looks very very strange to me.
this is usually done different (http://typefox.io/parsing-expressions-with-xtext)

in your case the (one) problem is here
Vector_constr:
	(vec+=Vector_tup) ('..' (vec+=Vector_tup | exp+=Exp) )* //exp is multi value
;

Prim: 
	'(' exp=Exp ')' //exp is single valued
	=>Vector_constr //Vector_constr  subtype of prim

;


solution:

Prim: 
	'(' exp+=Exp ')'


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: "NullPointerException (..) missing value converter" [message #1734543 is a reply to message #1734536] Thu, 09 June 2016 09:44 Go to previous message
Jonathan L. is currently offline Jonathan L.Friend
Messages: 24
Registered: May 2016
Junior Member
That works, thanks!!

Quote:
first of all solving problems with backtracking is a bad idea

this pattern how you build the expressions looks very very strange to me.
this is usually done different (http://typefox.io/parsing-expressions-with-xtext)


Yes, I know..
The problem is that I'm implementing an editor for an existing language.
To be as flexible as possible for grammar changes I decided to orientate towards this grammar.
Previous Topic:Maven Layout and Eclipse plugins
Next Topic:Can't start IntelliJ IDEA with runIDEA
Goto Forum:
  


Current Time: Fri Nov 22 18:56:47 GMT 2019

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

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

Back to the top