Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Xtext definition and instance in same grammar
Xtext definition and instance in same grammar [message #1302094] Fri, 18 April 2014 14:07 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi,

I have this grammar which has definition of types and instance of them
in the same grammar.


This would be the type definition or Macro in this case:

*********

OBJECT-IDENTITY MACRO ::=
BEGIN
TYPE NOTATION ::=
"STATUS" Status
"DESCRIPTION" Text

VALUE NOTATION ::=
value(VALUE OBJECT IDENTIFIER)

Status ::=
"current"
| "deprecated"
| "obsolete"

ReferPart ::=
"REFERENCE" Text
| empty

-- a character string as defined in section 3.1.1
Text ::= value(IA5String)
END

*********

....and further down an instanceof of it. How do I deal with this?
I can reference the [MACRO] of course, but how does the parser know the
possible attributes and values for the Macro type? Do I need parser
rules in code?


******************

zeroDotZero OBJECT-IDENTITY
STATUS current
DESCRIPTION
"A value used for null identifiers."
::= { 0 0 }

**********************

Thanks ! Christophe
Re: Xtext definition and instance in same grammar [message #1302547 is a reply to message #1302094] Fri, 18 April 2014 20:18 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31781
Registered: July 2009
Senior Member
Christophe,

You seem to have hit the wrong newsgroup again...

On 18/04/2014 4:07 PM, Christophe Bouhier wrote:
> Hi,
>
> I have this grammar which has definition of types and instance of them
> in the same grammar.
>
>
> This would be the type definition or Macro in this case:
>
> *********
>
> OBJECT-IDENTITY MACRO ::=
> BEGIN
> TYPE NOTATION ::=
> "STATUS" Status
> "DESCRIPTION" Text
>
> VALUE NOTATION ::=
> value(VALUE OBJECT IDENTIFIER)
>
> Status ::=
> "current"
> | "deprecated"
> | "obsolete"
>
> ReferPart ::=
> "REFERENCE" Text
> | empty
>
> -- a character string as defined in section 3.1.1
> Text ::= value(IA5String)
> END
>
> *********
>
> ...and further down an instanceof of it. How do I deal with this?
> I can reference the [MACRO] of course, but how does the parser know
> the possible attributes and values for the Macro type? Do I need
> parser rules in code?
>
>
> ******************
>
> zeroDotZero OBJECT-IDENTITY
> STATUS current
> DESCRIPTION
> "A value used for null identifiers."
> ::= { 0 0 }
>
> **********************
>
> Thanks ! Christophe


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:ECP Validation not working if running as part of Kepler Workbench
Next Topic:[Texo] Database foreign key constraints
Goto Forum:
  


Current Time: Mon Mar 08 10:10:51 GMT 2021

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

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

Back to the top