Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Java-like dot notation
Java-like dot notation [message #490016] Tue, 06 October 2009 17:28 Go to previous message
Eclipse UserFriend
Hi everyone,
I'm trying to implement a java-like syntax for accessing class members. Namely,

class type1{
int a = 1;
}

class type2{
type1 aType1;
}

class type3{
type2 aType2;
int b = aType2.aType1.a;
}

should work, to infinite depth.

I've done some scoping that's similar, but I'm having some trouble putting it together with the grammar rules.

I'm using the rule
Dotted_field
: lhField=[Class_var] ('.' rhs=Dotted_field)?
;
Does this work when there are no spaces around the dot? It doesn't seem to.

Then I'm using scoping to restrict class_var to choices within scope, either the vars of the current class or the type of the previous part of the dotted list.

I'd appreciate any feedback or pointers.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Xtext Editor + Nullpointer
Next Topic:Errors in grammar with Xtext 0.8.0
Goto Forum:
  


Current Time: Fri Nov 07 20:14:34 EST 2025

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

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

Back to the top