Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Parsing exception in xtext grammar(required (...)+ loop did not match anything at input )
Parsing exception in xtext grammar [message #1741156] Tue, 23 August 2016 11:46 Go to next message
kozhaev Vladimir is currently offline kozhaev VladimirFriend
Messages: 108
Registered: July 2009
Senior Member
I have create xtext grammar(see it bellow) but when I run eclipse I have following exception.
required (...)+ loop did not match anything at input 'IPADDR_eth0'

My parsed string is :IPADDR_eth0="10.170.53.101"
I know that problem is probably in the grammar, but don't know where.

So, where I'm wrong?

Regards,
Vladimir

grammar com.iamsoft.net.Validate with org.eclipse.xtext.common.Terminals

generate validate "http://www.iamsoft.com/net/Validate"

Model:
	netDescription+=DescriptionPair+;

DescriptionPair:
	ipaddr | netmask | speed | mtu | tso | gateway |  router | subnet | no_vlans | vlan;

 vlan:
	'VLAN_' name=ID '='
	value=IntList;

IntList:
	valueList+=INT+ | '"' valueList+=INT+ '"';

IPAddrList:
	ipNum1=INT '.' ipNum2=INT '.' ipNum3=INT '.' ipNum4=INT;

//List of numbers with 3 digit
 no_vlans:
	'NO_VLANS_' name=ID '=' list+=IntList;

subnet:
	'SUBNET_' name=ID '=' list+=IPWithQuotes;

router:
	'ROUTER_' name=ID '=' list+=IPWithQuotes;

gateway:
	'GATEWAY_' name=ID '=' list+=IPWithQuotes;

mtu:
	'MTU_' name=ID '=' val=IntWithQuotes;

tso:
	'TSO_' name=ID '=' '"' value=ON_OFF '"';

terminal ON_OFF:
	'on' | 'off';

netmask:
	'NETMASK_' name=ID '=' list+=IPWithQuotes;

speed:
	'SPEED_' name=ID '=' value=IntWithQuotes;

ipaddr:
	'IPADDR_' name=ID '=' list+=IPWithQuotes;

IPWithQuotes:
	IPAddrList | '"' IPAddrList '"';

IntWithQuotes:
	value=INT | '"' value=INT '"';

[Updated on: Tue, 23 August 2016 11:54]

Report message to a moderator

Re: Parsing exception in xtext grammar [message #1741157 is a reply to message #1741156] Tue, 23 August 2016 11:52 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13884
Registered: July 2009
Senior Member
what is your testmodel? IPADDR_eth0 i an id. maybe you actually mean

terminal ID : '^'?('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;

as ID instead of the default impl


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Gets proposal for a position
Next Topic:New line space error
Goto Forum:
  


Current Time: Fri Apr 16 22:40:09 GMT 2021

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

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

Back to the top