Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Formatting Scientific Notation (Formatting Scientific Notation Across Files)
Formatting Scientific Notation [message #1791673] Tue, 03 July 2018 22:52 Go to next message
Jo W is currently offline Jo WFriend
Messages: 4
Registered: June 2018
Junior Member
Grammar A:
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

Hold:
name=ID
scinots+=(SCIENTIFICNOTATION)
tests+=test;

SCIENTIFICNOTATION returns ecore::EDouble:
DOUBLE (('e'|'E') ('+'|'-')? INT)?;

DOUBLE returns ecore::EDouble:
('-')? INT ('.' INT)?;

Grammar B

RuleA:
'number' value=SCIENTIFICNOTATION;


when I write a formatter for File b: how would I format value if it was entered as number 1. 5 e-5
and I wanted it to be number 1.5 e-5

It is difficult to see or notice above, but what I want is no space around the period, if a decimal is used

[Updated on: Tue, 03 July 2018 23:13]

Report message to a moderator

Re: Formatting Scientific Notation [message #1791678 is a reply to message #1791673] Wed, 04 July 2018 04:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
Hi what is your actual question? parsing? formatting?

https://stackoverflow.com/questions/50904789/formatting-string-content-xtext-2-14/50912579#50912579


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 04 July 2018 04:46]

Report message to a moderator

Re: Formatting Scientific Notation [message #1791909 is a reply to message #1791678] Fri, 06 July 2018 17:28 Go to previous message
Jo W is currently offline Jo WFriend
Messages: 4
Registered: June 2018
Junior Member
It is formatting, the link you posted is very helpful, thanks!
Previous Topic:Problems using AbstractLanguageServerTest
Next Topic:RPGLE - String Literal Parsing
Goto Forum:
  


Current Time: Thu Sep 20 02:11:29 GMT 2018

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

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

Back to the top