Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Formatter problems(wrong result in formatter (using formatter2))
Formatter problems [message #1806900] Fri, 17 May 2019 09:38 Go to next message
Christian Sodomka is currently offline Christian SodomkaFriend
Messages: 2
Registered: May 2019
Junior Member
Dear community

I have currently a problem with formatting of an xtext based content.
I have put 2 debug lines into my formatter code after all formatting is done:
		println(document)
		println(document.renderToTextReplacements())

It produces the following output:
----------- RootDocument with ITextReplacers (syntax: <offset|text>) -----------
use procedure BABE_GET_MAX_KAGE as BABE_GET_MAX_KAGE<52|>;
use procedure BABE_GVHEX_SET_BDFL_ATTR as KOPIE_SET_BDFL_ATTR_MAX_KAGE<124|>;<125|

// comment top
>ablauf<148| >BABE_ABS_GV_BDFL_SPEZIAL(in VARCHAR2 PI_FEATURE_TYP, in NUMBER PI_FART_ID, in NUMBER PI_ABRNR, in NUMBER PI_MAX_AREA_DIFF, in VARCHAR2 PI_TARGETSTATUS, in NUMBER PI_BRLAY_ID, in DATE PI_STICHTAG, in VARCHAR2 PI_TSL_ODER_KETTEN, in NUMBER PI_BETR_ID, in NUMBER PI_BABE_ID, in NUMBER PI_BRBT_ID, in NUMBER PI_BDFL_FART_ID, in NUMBER PI_HEXL_PLAUSI_NR, in NUMBER PI_PARTITION_WERT)<527|
>var NUMBER test1<544|   >;<548|
>var NUMBER test2<565|>;<566|
>var NUMBER     
	test3<589|>;<590|
>var NUMBER test4<607|>;<608|
>var NUMBER test5<625|>;<626|
>if (GLOBAL.PI_FEATURE_TYP = 'FINANZ_BODEN_SCHAETZUNG') "Layer = FINANZ_BODEN_SCHAETZUNG (EMZ)" {<723|
>loop<728| >DLC_GVHEX_GEO_MASTER_E  "DLC_GVHEX_GEO_MASTER_EMZ" 
// SET_BDFL_ATTR - Attribute in Geo-Master-Tabelle setzen #00075
call SET_BDFL_ATTR2(PI_GEWI_EMZ => DLC_GVHEX_GEO_MASTER_E.EMZ_GEWICHTET, PI_BTGEOMA_ID => DLC_GVHEX_GEO_MASTER_E.ID, PI_FEATURE_TYP => PI_FEATURE_TYP);<997|
>endloop<1005|
>}
else  "Layer = FINANZ_BODEN_SCHAETZUNG (EMZ)" {<1055|
>if (GLOBAL.PI_FEATURE_TYP = 'NEIGUNGSDATEN') "Layer = NEIGUNGSDATEN" {<1126|
// HAECKSEL_GEO_LISTE - Geometrieliste zum BDFL-Feature-Typ (PI_FEATURE_TYP) verhäckseln #00071
>call HAECKSEL_GEO_LISTE_N(PI_FEATURE_TYP => PI_FEATURE_TYP, PI_MAX_AREA_DIFF => PI_MAX_AREA_DIFF, PI_FART_ID => PI_BDFL_FART_ID, PI_PARTITION_WERT => PI_PARTITION_WERT);
// BABE_ABS_GV_BDFL_GEO_KAPUTT - Logging der kaputten Geometrien mit BABE-Plausi 40105
start ABS_GV_BDFL_GEO_KAPUTT_NEIG(PI_FEATURE_TYP => PI_FEATURE_TYP, PI_ABRNR => PI_ABRNR, PI_TARGETSTATUS => PI_TARGETSTATUS, PI_FART_ID => PI_FART_ID, PI_STICHTAG => PI_STICHTAG, PI_TSL_ODER_KETTEN => PI_TSL_ODER_KETTEN, PI_BETR_ID => PI_BETR_ID, PI_BABE_ID => PI_BABE_ID, PI_BRBT_ID => PI_BRBT_ID, PI_PLAUSI_FEHLERNR => PI_HEXL_PLAUSI_NR);
loop<1826| >DLC_GVHEX_NEIGUNGEN  "DLC_GVHEX_NEIGUNGEN" 
// SET_BDFL_ATTR - Attribute in Geo-Master-Tabelle setzen #00075
call SET_BDFL_ATTR_NEIG(PI_BTGEOMA_ID => DLC_GVHEX_NEIGUNGEN.OTHER_ID, PI_FL_NEIG_6 => DLC_GVHEX_NEIGUNGEN.FL_NEIG_6, PI_FL_NEIG_5 => DLC_GVHEX_NEIGUNGEN.FL_NEIG_5, PI_FL_NEIG_4 => DLC_GVHEX_NEIGUNGEN.FL_NEIG_4, PI_FL_NEIG_3 => DLC_GVHEX_NEIGUNGEN.FL_NEIG_3, PI_FL_NEIG_2 => DLC_GVHEX_NEIGUNGEN.FL_NEIG_2, PI_FL_NEIG_1 => DLC_GVHEX_NEIGUNGEN.FL_NEIG_1, PI_FEATURE_TYP => PI_FEATURE_TYP);<2323|
>endloop<2331|
>}<2333|
>}<2335|
>endablauf
		
--------------------------------------------------------------------------------
  52  0 "": HiddenRegionReplacer: space=''
 124  0 "": HiddenRegionReplacer: space=''
 125 17 "\n\n// comment top\n": HiddenRegionReplacer: newLine=2
 148  1 " ": HiddenRegionReplacer: indentInc=1
 527  1 "\n": HiddenRegionReplacer: space=' ';newLine=1
 544  3 "   ": HiddenRegionReplacer: space=''
 548  1 "\n": HiddenRegionReplacer: space=' ';newLine=1
 565  0 "": HiddenRegionReplacer: space=''
 566  1 "\n": HiddenRegionReplacer: space=' ';newLine=1
 589  0 "": HiddenRegionReplacer: space=''
 590  1 "\n": HiddenRegionReplacer: space=' ';newLine=1
 607  0 "": HiddenRegionReplacer: space=''
 608  1 "\n": HiddenRegionReplacer: space=' ';newLine=1
 625  0 "": HiddenRegionReplacer: space=''
 626  1 "\n": HiddenRegionReplacer: newLine=2
 723  1 "\n": HiddenRegionReplacer: indentInc=1
 728  1 " ": HiddenRegionReplacer: indentInc=1
 997  1 "\n": HiddenRegionReplacer: indentDec=1
1005  1 "\n": HiddenRegionReplacer: indentDec=1
1055  1 "\n": HiddenRegionReplacer: indentInc=1
1126 97 "\n// HAECKSEL_GEO_...": HiddenRegionReplacer: indentInc=1
1826  1 " ": HiddenRegionReplacer: indentInc=1
2323  1 "\n": HiddenRegionReplacer: indentDec=1
2331  1 "\n": HiddenRegionReplacer: indentDec=1
2333  1 "\n": HiddenRegionReplacer: indentDec=1
2335  1 "\n": HiddenRegionReplacer: indentDec=1
----------------- TextReplacementList (syntax: <offset|text>) ------------------
use procedure BABE_GET_MAX_KAGE as BABE_GET_MAX_KAGE;
use procedure BABE_GVHEX_SET_BDFL_ATTR as KOPIE_SET_BDFL_ATTR_MAX_KAGE;

// comment top
<142|>ablauf BABE_ABS_GV_BDFL_SPEZIAL(in VARCHAR2 PI_FEATURE_TYP, in NUMBER PI_FART_ID, in NUMBER PI_ABRNR, in NUMBER PI_MAX_AREA_DIFF, in VARCHAR2 PI_TARGETSTATUS, in NUMBER PI_BRLAY_ID, in DATE PI_STICHTAG, in VARCHAR2 PI_TSL_ODER_KETTEN, in NUMBER PI_BETR_ID, in NUMBER PI_BABE_ID, in NUMBER PI_BRBT_ID, in NUMBER PI_BDFL_FART_ID, in NUMBER PI_HEXL_PLAUSI_NR, in NUMBER PI_PARTITION_WERT)<527:1|
	>var NUMBER test1<544:3|>;<548:1|
	>var NUMBER test2;<566:1|
	>var NUMBER     
	test3;<590:1|
	>var NUMBER test4;<608:1|
	>var NUMBER test5;<626:1|

	>if (GLOBAL.PI_FEATURE_TYP = 'FINANZ_BODEN_SCHAETZUNG') "Layer = FINANZ_BODEN_SCHAETZUNG (EMZ)" {
loop DLC_GVHEX_GEO_MASTER_E  "DLC_GVHEX_GEO_MASTER_EMZ" 
// SET_BDFL_ATTR - Attribute in Geo-Master-Tabelle setzen #00075
call SET_BDFL_ATTR2(PI_GEWI_EMZ => DLC_GVHEX_GEO_MASTER_E.EMZ_GEWICHTET, PI_BTGEOMA_ID => DLC_GVHEX_GEO_MASTER_E.ID, PI_FEATURE_TYP => PI_FEATURE_TYP);
endloop
}
else  "Layer = FINANZ_BODEN_SCHAETZUNG (EMZ)" {
if (GLOBAL.PI_FEATURE_TYP = 'NEIGUNGSDATEN') "Layer = NEIGUNGSDATEN" {
// HAECKSEL_GEO_LISTE - Geometrieliste zum BDFL-Feature-Typ (PI_FEATURE_TYP) verhäckseln #00071
<1223:0|			>call HAECKSEL_GEO_LISTE_N(PI_FEATURE_TYP => PI_FEATURE_TYP, PI_MAX_AREA_DIFF => PI_MAX_AREA_DIFF, PI_FART_ID => PI_BDFL_FART_ID, PI_PARTITION_WERT => PI_PARTITION_WERT);
// BABE_ABS_GV_BDFL_GEO_KAPUTT - Logging der kaputten Geometrien mit BABE-Plausi 40105
start ABS_GV_BDFL_GEO_KAPUTT_NEIG(PI_FEATURE_TYP => PI_FEATURE_TYP, PI_ABRNR => PI_ABRNR, PI_TARGETSTATUS => PI_TARGETSTATUS, PI_FART_ID => PI_FART_ID, PI_STICHTAG => PI_STICHTAG, PI_TSL_ODER_KETTEN => PI_TSL_ODER_KETTEN, PI_BETR_ID => PI_BETR_ID, PI_BABE_ID => PI_BABE_ID, PI_BRBT_ID => PI_BRBT_ID, PI_PLAUSI_FEHLERNR => PI_HEXL_PLAUSI_NR);
--------------------------------------------------------------------------------
 142 0 "" -> ""
 527 1 "\n" -> "\n	"
 544 3 "   " -> ""
 548 1 "\n" -> "\n	"
 566 1 "\n" -> "\n	"
 590 1 "\n" -> "\n	"
 608 1 "\n" -> "\n	"
 626 1 "\n" -> "\n\n	"
1223 0 "" -> "			"


The first part of the output it perfectly that what I want, but the "rendered" output (second part) is wrong.
The change with the number 1223, does not even exist in the first output part and is totally wrong. Also the rendering ceases here, which is also wrong.
The visible result unfortunately confirms to the second (wrong) output.

Any help would be appreciated.

Christian
Re: Formatter problems [message #1807029 is a reply to message #1806900] Tue, 21 May 2019 12:17 Go to previous message
Christian Sodomka is currently offline Christian SodomkaFriend
Messages: 2
Registered: May 2019
Junior Member
I have found the problem. You have to assure that in each and every line of you grammar you have to have a newLine attached (either with append or prepend) otherwise the indent commands have no effect. For me this is and "uncommented" feature.
Previous Topic:Deprecating keywords
Next Topic:How to Test custom validation with JUnit
Goto Forum:
  


Current Time: Sat Aug 24 08:45:28 GMT 2019

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

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

Back to the top