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: 22
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: 14285
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:xtext 2.25.0 + jdk 11.0.11
Next Topic:Cannot build old Xtext projects with maven since 2021-06-16
Goto Forum:
  


Current Time: Thu Jun 30 02:11:21 GMT 2022

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

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

Back to the top