Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Content validation depending on file extension
Content validation depending on file extension [message #1861783] Fri, 03 November 2023 10:10 Go to next message
Eclipse UserFriend
Hi

I would like to have only one grammar supporting multiple file extensions say '.it', '.fr' and '.de' with the following grammar:

HelloModel:
   greetings+=Greeting*;

Greeting:
    ItalianGreeting | GermanGreeting | FrenchGreeting;

ItalianGreeting:
    'Buon' 'giorno' name=ID '!';

GermanGreeting:
    'Guten' 'Tag' name=ID '!';

FrenchGreeting:
    'Bonjour' name=ID '!';


The files with the extension '.it' supports only content with instances of 'ItalianGreeting', etc... How can I relate file extension, the validators and the content being saved in the resource?

Thank you and kind regards,

[Updated on: Fri, 03 November 2023 10:10] by Moderator

Re: Content validation depending on file extension [message #1861785 is a reply to message #1861783] Fri, 03 November 2023 10:47 Go to previous messageGo to next message
Eclipse UserFriend
You can ask any eObject for its eResource. That for its URI and uri has file extension
Re: Content validation depending on file extension [message #1861786 is a reply to message #1861785] Fri, 03 November 2023 11:26 Go to previous message
Eclipse UserFriend
of course... thank you
Previous Topic:How to customize the scope of a reference
Next Topic:Xtext 2.33.0.M3 is out
Goto Forum:
  


Current Time: Sat Aug 30 19:08:09 EDT 2025

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

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

Back to the top