Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » using qualifiedNameConverter for the output
using qualifiedNameConverter for the output [message #1771731] Wed, 30 August 2017 03:57 Go to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member
Hello Experts,

This is my dsl(or I am trying to implement this)

  augment "/if-mib:IF-MIB/if-mib:ifTable/if-mib:ifEntry"
  {
    status deprecated;
    description
     "An entry containing objects for invoking tests on an
      interface.";
    smiv2:oid "1.3.6.1.2.1.31.1.3.1";

    leaf ifTestId {
      type snmpv2-tc:TestAndIncr;
      status deprecated;
      description
       "This object identifies the current invocation of the
        interface's test.";
      smiv2:max-access "read-write";
      smiv2:oid "1.3.6.1.2.1.31.1.3.1.1";
    }






This is my Xtext grammar.

DatadefStatement:
	ContainerStatement |
	LeafStatement |
	ListStatement |
	LeafListStatement
;


AugmentStatement:
	'augment' path = SchemaNodeIdentifier 
	(';' | '{' 
		(augmentsubstatements+= AugmentSubStatement)*
		'}'
	)
;

AugmentSubStatement:
	DescriptionStatement |
	ContainerStatement |
	UsesStatement |
	LeafStatement |
	StatusStatement |
	UnknownStatement
;

SchemaNodeIdentifier returns SchemaNodeIdentifier:
	 RootSchemaNodeIdentifier ({SchemaNodeIdentifier.target=current}'/'((prefix=STRINGARG':')? schemaNode=[DatadefStatement]))*
;

RootSchemaNodeIdentifier returns SchemaNodeIdentifier:
	isAbsolute?='/'? ((prefix=STRINGARG':')?schemaNode=[DatadefStatement])
;




This is my qualifiedNameProvider


public class YangDefinitionQualifiedNameProvider extends DefaultDeclarativeQualifiedNameProvider {

	@Inject
	private IQualifiedNameConverter qnc;
	public QualifiedNameValueConverter qualifiedNameValueConverter(DatadefStatement d) 
	{
		return qualifiedNameValueConverter(d);
	}




I am getting this error:

mismatched input '{' expecting ':'

When I try to implement my grammar,
I am getting an output like mentioned below:

[color=darkred] augment / if-mib:IF-MIB / if-mib:IF-MIB.ifTable / if-mib:IF-MIB.ifTable.ifEntry [/color]
  {
    status deprecated;
    description
     "An entry containing objects for invoking tests on an
      interface.";
    smiv2:oid "1.3.6.1.2.1.31.1.3.1";

    leaf ifTestId {
      type snmpv2-tc:TestAndIncr;
      status deprecated;
      description
       "This object identifies the current invocation of the
        interface's test.";
      smiv2:max-access "read-write";
      smiv2:oid "1.3.6.1.2.1.31.1.3.1.1";
    }



I am not using scope provider.
Re: using qualifiedNameConverter for the output [message #1771734 is a reply to message #1771731] Wed, 30 August 2017 04:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12325
Registered: July 2009
Senior Member
this makes no sense. mismatched input '{' expecting ':' is a parse error.
this runs before any qualified name providers and qualifiednameconverters

public QualifiedNameValueConverter qualifiedNameValueConverter(DatadefStatement d)
{
return qualifiedNameValueConverter(d);
}

makes no sense as well
have no idea what you try to achieve


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: using qualifiedNameConverter for the output [message #1771736 is a reply to message #1771734] Wed, 30 August 2017 04:52 Go to previous messageGo to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member
Hi Christian,

Actually yes, qualifiednameprovider doen't make sense. i try it and it doesn't matter if I write it or not.

The actual error is :-

no viable alternative at input '"/if-mib:IF-MIB/if-mib:ifTable/IF-MIB.ifTable.ifEntry"'

I am new in programming, so trying new codes and new techniques.


Regards,
Kaushal
Re: using qualifiedNameConverter for the output [message #1771737 is a reply to message #1771736] Wed, 30 August 2017 04:54 Go to previous messageGo to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member
This is my dsl
This is what I am trying to achieve.
  augment "/if-mib:IF-MIB/if-mib:ifTable/if-mib:ifEntry"
  {
    status deprecated;
    description
     "An entry containing objects for invoking tests on an
      interface.";
    smiv2:oid "1.3.6.1.2.1.31.1.3.1";

    leaf ifTestId {
      type snmpv2-tc:TestAndIncr;
      status deprecated;
      description
       "This object identifies the current invocation of the
        interface's test.";
      smiv2:max-access "read-write";
      smiv2:oid "1.3.6.1.2.1.31.1.3.1.1";
    }

[Updated on: Wed, 30 August 2017 04:55]

Report message to a moderator

Re: using qualifiedNameConverter for the output [message #1771740 is a reply to message #1771737] Wed, 30 August 2017 05:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12325
Registered: July 2009
Senior Member
yes but i cannot help you. you need to find out whats wrong with your grammar

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: using qualifiedNameConverter for the output [message #1771742 is a reply to message #1771740] Wed, 30 August 2017 06:25 Go to previous messageGo to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member
Hi Chrisitan,

I have checked my grammar. I have some doubts.

1) I am getting whitespace in between two nodes. Can I get rid of those whitespace? If yes, then How?

/if-mib:IF-MIB /if-mib:ifTable /if-mib:ifEntry



2) Can I use cross-reference with double quotes?
like this:
"if-mib:IF-MIB"

When I am trying to use cross-reference with double quotes, it behaves like string value.


i am using cross-reference for both codes.

Here,
if-mib:IF-MIB
PrefixStatement:ContainerStatement
Re: using qualifiedNameConverter for the output [message #1771747 is a reply to message #1771742] Wed, 30 August 2017 07:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12325
Registered: July 2009
Senior Member
as i said in other questions before.
i need a reproducible grammar.
i need a MINIMAL reproduible grammar.
and i like to have a unit test.
otherwise supporting such questions is pain


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: using qualifiedNameConverter for the output [message #1771750 is a reply to message #1771747] Wed, 30 August 2017 07:32 Go to previous messageGo to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member
This is my grammar.


AugmentStatement:
	'augment' path=SchemaNodeIdentifier
	(';' | '{' 
		(augmentsubstatements+= AugmentSubStatement)*
		'}'
	)
;

AugmentSubStatement:
	DescriptionStatement |
	ContainerStatement |
	UsesStatement |
	LeafStatement |
	StatusStatement |
	UnknownStatement
;

SchemaNodeIdentifier returns SchemaNodeIdentifier:
	 RootSchemaNodeIdentifier ({SchemaNodeIdentifier.target=current}'/'((pre=STRINGARG':')?schemaNode=[DatadefStatement]))*
;

RootSchemaNodeIdentifier returns SchemaNodeIdentifier:
	isAbsolute='/'?((pre=STRINGARG ':')?schemaNode=[DatadefStatement])
;
Re: using qualifiedNameConverter for the output [message #1771751 is a reply to message #1771750] Wed, 30 August 2017 07:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12325
Registered: July 2009
Senior Member
well that grammar is neither minimal nor complete

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: using qualifiedNameConverter for the output [message #1771752 is a reply to message #1771751] Wed, 30 August 2017 07:50 Go to previous messageGo to next message
Kaushal Patel is currently offline Kaushal PatelFriend
Messages: 72
Registered: June 2017
Member

DatadefStatement:
	ContainerStatement |
	LeafStatement |
	ListStatement |
	LeafListStatement
;

ContainerStatement:
	'container' name=STRINGARG33 (';' | '{'
		(containersubstatements+= ContainerSubStatement)*
	'}')
;

ContainerSubStatement:
	ContainerStatement |
	LeafStatement |
	ListStatement |
	LeafListStatement |
	AugmentStatement |	
;

LeafStatement:
	'leaf' name=STRINGARG33 (';' | '{'
		(leafsubstatements+= LeafSubStatement)*
		'}'
	);
	
LeafSubStatement:
	ContainerStatement 
;

ListStatement:
	'list' name= (STRINGARG | KEY_IDENTIFIER) (';' | '{'
		(listsubstatements+= ListSubStatement)*
		'}'
	)
;

ListSubStatement:
	LeafStatement | 
	LeafListStatement |
	ContainerStatement 
;

LeafListStatement:
	'leaf-list' name=STRINGARG ';' 
;

AugmentStatement:
	'augment' path=SchemaNodeIdentifier
	(';' | '{' 
		(augmentsubstatements+= AugmentSubStatement)*
		'}'
	)
;

AugmentSubStatement:
	ContainerStatement |
	LeafStatement 
;

SchemaNodeIdentifier returns SchemaNodeIdentifier:
	 RootSchemaNodeIdentifier ({SchemaNodeIdentifier.target=current}'/'((pre=STRINGARG':')?schemaNode=[DatadefStatement]))*
;

RootSchemaNodeIdentifier returns SchemaNodeIdentifier:
	isAbsolute='/'?((pre=STRINGARG ':')?schemaNode=[DatadefStatement])
;

STRINGARG:
	ID | 'default' | INT | CUSTOMSTRING ;
	
CUSTOMSTRING:
	(STRING ('+' STRING)*);

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



Check the attached file for full grammar.

Thanks.
Re: using qualifiedNameConverter for the output [message #1771754 is a reply to message #1771752] Wed, 30 August 2017 08:01 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12325
Registered: July 2009
Senior Member
sorry i want a minimal but complete reproducing grammar and a unit test

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Support EFS in Xtext
Next Topic:Custom scope for only one Resource [solved]
Goto Forum:
  


Current Time: Tue Oct 23 09:08:07 GMT 2018

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

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

Back to the top