Skip to content

Commit e3fcca5

Browse files
Merge pull request #763 from IETS3/feature/NumberLiteral_getValue
Implement NumberLiteral#toBigDecimal
2 parents e25ca55 + 5df519e commit e3fcca5

File tree

3 files changed

+507
-42
lines changed

3 files changed

+507
-42
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ The project does _not_ follow Semantic Versioning and the changes are documented
1212
- The PCollections library was updated to version 4.0.1.
1313

1414
### Fixed
15-
- Uncatched `DateTimeException` during check DateLiteral
15+
16+
- Uncatched `DateTimeException` during check DateLiteral.
17+
18+
### Added
19+
20+
- `NumberLiteral` can now be converted to a `BigDecimal` with the method `toBigDecimal`.
1621

1722
## December 2023
1823

code/languages/org.iets3.opensource/languages/org.iets3.core.expr.simpleTypes/models/behavior.mps

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@
114114
<property id="1176718929932" name="isFinal" index="3TUv4t" />
115115
<child id="1068431790190" name="initializer" index="33vP2m" />
116116
</concept>
117+
<concept id="1513279640923991009" name="jetbrains.mps.baseLanguage.structure.IGenericClassCreator" flags="ng" index="366HgL">
118+
<property id="1513279640906337053" name="inferTypeParams" index="373rjd" />
119+
</concept>
117120
<concept id="1068498886296" name="jetbrains.mps.baseLanguage.structure.VariableReference" flags="nn" index="37vLTw">
118121
<reference id="1068581517664" name="variableDeclaration" index="3cqZAo" />
119122
</concept>
@@ -786,11 +789,13 @@
786789
</node>
787790
<node concept="17QB3L" id="2ft7KAXZWdI" role="3clF45" />
788791
</node>
789-
<node concept="13i0hz" id="3p6$WoEl3wd" role="13h7CS">
790-
<property role="TrG5h" value="numberOfDecimals" />
791-
<node concept="3Tm1VV" id="3p6$WoEl3we" role="1B3o_S" />
792-
<node concept="10Oyi0" id="3p6$WoEl62_" role="3clF45" />
793-
<node concept="3clFbS" id="3p6$WoEl3wg" role="3clF47">
792+
<node concept="13i0hz" id="6v8$kf$4zsT" role="13h7CS">
793+
<property role="TrG5h" value="toBigDecimal" />
794+
<node concept="3Tm1VV" id="6v8$kf$4zsU" role="1B3o_S" />
795+
<node concept="3uibUv" id="6v8$kf$4$vf" role="3clF45">
796+
<ref role="3uigEE" to="xlxw:~BigDecimal" resolve="BigDecimal" />
797+
</node>
798+
<node concept="3clFbS" id="6v8$kf$4zsW" role="3clF47">
794799
<node concept="3cpWs8" id="54whuzIxDP3" role="3cqZAp">
795800
<node concept="3cpWsn" id="54whuzIxDP6" role="3cpWs9">
796801
<property role="TrG5h" value="parsedValue" />
@@ -828,8 +833,8 @@
828833
</node>
829834
</node>
830835
<node concept="2YIFZM" id="54whuzIxFNi" role="3clFbw">
831-
<ref role="1Pybhc" to="xfg9:2Qbt$1tTQaH" resolve="PTF" />
832836
<ref role="37wK5l" to="xfg9:2oUyrt$QKcQ" resolve="useCommaInsteadOfDotForDecimals" />
837+
<ref role="1Pybhc" to="xfg9:2Qbt$1tTQaH" resolve="PTF" />
833838
</node>
834839
</node>
835840
<node concept="3SKdUt" id="54whuzIxVFn" role="3cqZAp">
@@ -840,64 +845,61 @@
840845
<node concept="3oM_SD" id="54whuzIxVIF" role="1PaTwD">
841846
<property role="3oM_SC" value="scientific" />
842847
</node>
843-
<node concept="3oM_SD" id="54whuzIxVII" role="1PaTwD">
848+
<node concept="3oM_SD" id="6v8$kf$7q$T" role="1PaTwD">
844849
<property role="3oM_SC" value="notation" />
845850
</node>
846-
<node concept="3oM_SD" id="54whuzIygWw" role="1PaTwD">
847-
<property role="3oM_SC" value="+" />
848-
</node>
849-
<node concept="3oM_SD" id="54whuzIygWP" role="1PaTwD">
850-
<property role="3oM_SC" value="convert" />
851-
</node>
852-
<node concept="3oM_SD" id="54whuzIygX3" role="1PaTwD">
853-
<property role="3oM_SC" value="to" />
854-
</node>
855-
<node concept="3oM_SD" id="54whuzIygXa" role="1PaTwD">
856-
<property role="3oM_SC" value="positive" />
857-
</node>
858-
<node concept="3oM_SD" id="54whuzIygXE" role="1PaTwD">
859-
<property role="3oM_SC" value="value" />
860-
</node>
861851
</node>
862852
</node>
863853
<node concept="3cpWs8" id="54whuzIxRVv" role="3cqZAp">
864854
<node concept="3cpWsn" id="54whuzIxRVw" role="3cpWs9">
865855
<property role="TrG5h" value="parsedAbsoluteValue" />
866856
<node concept="17QB3L" id="54whuzIxU9$" role="1tU5fm" />
867857
<node concept="2OqwBi" id="54whuzIxTMF" role="33vP2m">
868-
<node concept="2OqwBi" id="54whuzIxTcl" role="2Oq$k0">
869-
<node concept="2ShNRf" id="54whuzIxSmJ" role="2Oq$k0">
870-
<node concept="1pGfFk" id="54whuzIxSuf" role="2ShVmc">
871-
<ref role="37wK5l" to="xlxw:~BigDecimal.&lt;init&gt;(java.lang.String)" resolve="BigDecimal" />
872-
<node concept="37vLTw" id="54whuzIxSw5" role="37wK5m">
873-
<ref role="3cqZAo" node="54whuzIxDP6" resolve="parsedValue" />
874-
</node>
858+
<node concept="2ShNRf" id="54whuzIxSmJ" role="2Oq$k0">
859+
<node concept="1pGfFk" id="54whuzIxSuf" role="2ShVmc">
860+
<ref role="37wK5l" to="xlxw:~BigDecimal.&lt;init&gt;(java.lang.String)" resolve="BigDecimal" />
861+
<node concept="37vLTw" id="54whuzIxSw5" role="37wK5m">
862+
<ref role="3cqZAo" node="54whuzIxDP6" resolve="parsedValue" />
875863
</node>
876864
</node>
877-
<node concept="liA8E" id="54whuzIxTKp" role="2OqNvi">
878-
<ref role="37wK5l" to="xlxw:~BigDecimal.abs()" resolve="abs" />
879-
</node>
880865
</node>
881866
<node concept="liA8E" id="54whuzIxTR0" role="2OqNvi">
882867
<ref role="37wK5l" to="xlxw:~BigDecimal.toPlainString()" resolve="toPlainString" />
883868
</node>
884869
</node>
885870
</node>
886871
</node>
887-
<node concept="3clFbH" id="54whuzIxVIM" role="3cqZAp" />
888-
<node concept="3cpWs6" id="54whuzIxUO8" role="3cqZAp">
889-
<node concept="2OqwBi" id="54whuzIxWR$" role="3cqZAk">
890-
<node concept="2ShNRf" id="54whuzIxUOD" role="2Oq$k0">
891-
<node concept="1pGfFk" id="54whuzIxVdI" role="2ShVmc">
892-
<ref role="37wK5l" to="xlxw:~BigDecimal.&lt;init&gt;(java.lang.String)" resolve="BigDecimal" />
893-
<node concept="37vLTw" id="54whuzIxW6f" role="37wK5m">
894-
<ref role="3cqZAo" node="54whuzIxRVw" resolve="parsedAbsoluteValue" />
895-
</node>
872+
<node concept="3clFbF" id="6v8$kf$4Ax3" role="3cqZAp">
873+
<node concept="2ShNRf" id="6v8$kf$4AwZ" role="3clFbG">
874+
<node concept="1pGfFk" id="6v8$kf$4C9_" role="2ShVmc">
875+
<property role="373rjd" value="true" />
876+
<ref role="37wK5l" to="xlxw:~BigDecimal.&lt;init&gt;(java.lang.String)" resolve="BigDecimal" />
877+
<node concept="37vLTw" id="6v8$kf$4CAe" role="37wK5m">
878+
<ref role="3cqZAo" node="54whuzIxRVw" resolve="parsedAbsoluteValue" />
896879
</node>
897880
</node>
881+
</node>
882+
</node>
883+
</node>
884+
</node>
885+
<node concept="13i0hz" id="3p6$WoEl3wd" role="13h7CS">
886+
<property role="TrG5h" value="numberOfDecimals" />
887+
<node concept="3Tm1VV" id="3p6$WoEl3we" role="1B3o_S" />
888+
<node concept="10Oyi0" id="3p6$WoEl62_" role="3clF45" />
889+
<node concept="3clFbS" id="3p6$WoEl3wg" role="3clF47">
890+
<node concept="3cpWs6" id="54whuzIxUO8" role="3cqZAp">
891+
<node concept="2OqwBi" id="54whuzIxWR$" role="3cqZAk">
898892
<node concept="liA8E" id="54whuzIxXs$" role="2OqNvi">
899893
<ref role="37wK5l" to="xlxw:~BigDecimal.scale()" resolve="scale" />
900894
</node>
895+
<node concept="2OqwBi" id="6v8$kf$7qHM" role="2Oq$k0">
896+
<node concept="BsUDl" id="6v8$kf$4DTR" role="2Oq$k0">
897+
<ref role="37wK5l" node="6v8$kf$4zsT" resolve="toBigDecimal" />
898+
</node>
899+
<node concept="liA8E" id="6v8$kf$7qK_" role="2OqNvi">
900+
<ref role="37wK5l" to="xlxw:~BigDecimal.abs()" resolve="abs" />
901+
</node>
902+
</node>
901903
</node>
902904
</node>
903905
</node>

0 commit comments

Comments
 (0)