Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XExpressions and Statements(Understanding the XExpression and behavior of ";")
XExpressions and Statements [message #1842367] Thu, 17 June 2021 08:32 Go to next message
Frä Fröhlich is currently offline Frä FröhlichFriend
Messages: 18
Registered: June 2021
Junior Member
I wanted to rebuild the Java Syntax and use XBase for that.
I thought, that the XExpression was made for that, but then I've seen this:
Quote:
Expressions are the main language constructs which are used to express behavior and compute values. The concept of statements is not supported, but instead powerful expressions are used to handle situations in which the imperative nature of statements would be helpful.

And I found pretty much everything I need in the XExpressions. However, I Java does a ";" after every Statement. I know that Expressions are not Statements, but I prefer forcing them in the DSL (even though the Rules do not need them).
I've seen that, the XBlockExpression has a semicolon and thus an "if" with curly braces have them as well, but while statements with curly braces do not use semicolon (should be XBlockExpression as well).
if (i==2) {
  while (i< 3) {
    i++
  }
} else {
  j++;
}

Can you help me understanding the difference and is there a way to add semicolons?
Re: XExpressions and Statements [message #1842369 is a reply to message #1842367] Thu, 17 June 2021 08:34 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14026
Registered: July 2009
Senior Member
maybe https://github.com/LorenzoBettini/jbase is what you are looking for

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:What is the use of completeRuleCall
Next Topic:Cannot build old Xtext projects with maven since 2021-06-16
Goto Forum:
  


Current Time: Wed Jul 28 23:28:45 GMT 2021

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

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

Back to the top