Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Regex and Xtext(to dump to create a new terminal definittion)
Regex and Xtext [message #704432] Thu, 28 July 2011 12:08 Go to next message
Eclipse UserFriend
I try to define a new terminal similar to ID.

This new ID should look like

urn:<DOMAIN-NAME>:<OBJECT-NAME>

DOMAIN-NAME should be a fixed String
OBJECT-NAME should be the same like ID

Could any body help me ??

Re: Regex and Xtext [message #704480 is a reply to message #704432] Thu, 28 July 2011 13:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

i'd do this with a Datatype rule

e.g.

NewId: "urn" ":" STRING ":" ID;

~Christian
Re: Regex and Xtext [message #704827 is a reply to message #704480] Fri, 29 July 2011 01:41 Go to previous messageGo to next message
Eclipse UserFriend
This is not what i need.


Here is my definition:

Model:
objects+=BASE_OBJECTS*;

BASE_OBJECTS:
(USER | GROUP | RESOURCE)
;


USER:
"user" name=URN
;

USERS:
{USERS}
"users ""{"
(users+=[USER])+
"}"
;


GROUP:
"group" name=URN
;

GROUPS:
{GROUPS}
"groups" "{"
(groups+=[GROUP])+
"}"
;

RESOURCE:
"resource" name=URN
"{"
(users=USERS)?
(groups=GROUPS)?
"}"
;

URN: "urn" ":" "nfon.net" ":" ID;


If i try to use with this data:

user urn:nfon.net:joerg

group urn:nfon.net:test2

resource urn:nfon.net:dummy {
users {
urn:nfon.net:joerg
}
groups {
urn:nfon.net:test
}
}

i get several problems:

1. If i try to enter a URN for user/group i don´t get any suggestions for autocomplete.
2. with the solution "URN: "urn" ":" "nfon.net" ":" ID;" it accept WS between the Elements. It is not a "unique" name
3. if i try to use a reference to user or group i get an error in the GUI.
4. if i try to get autocompletion for references inside users/group i get nothing

Maybe i have to implement/extend some classes. Could give me a hint which classes ???

What I want to do is to have a URN which works exactly like the ID. In other words: to overwrite the definition for ID

any clues ???
Re: Regex and Xtext [message #704840 is a reply to message #704827] Fri, 29 July 2011 02:05 Go to previous message
Eclipse UserFriend
Hi,

You try to reference user etc via an ID ([USER] is short for [USER|ID]). You need to reference them via URN, ie. use [USER|URN] or write a custom scope provider, that makes them visible via a simple ID-name.

You should stick to naming conventions to make the grammar more readable. Terminal rules all uppercase, Parser rules first letter upper case (Group instead of GROUP).

Alex
Previous Topic:Not resolving proxies after reloading model
Next Topic:Xtend help
Goto Forum:
  


Current Time: Sun Jul 13 09:19:22 EDT 2025

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

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

Back to the top