Skip to content

Commit abca8b9

Browse files
committed
Allow underscores in number literals & update docs
1 parent 28a6543 commit abca8b9

14 files changed

+409
-350
lines changed

packages/cashc/src/ast/AstBuilder.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,11 @@ export default class AstBuilder
413413
}
414414

415415
const parseNumberString = (numberString: string): bigint => {
416-
const isScientificNotation = /[eE]/.test(numberString);
417-
if (!isScientificNotation) return BigInt(numberString);
416+
const cleanedNumberString = numberString.replace(/_/g, '');
418417

419-
const [coefficient, exponent] = numberString.split(/[eE]/);
418+
const isScientificNotation = /[eE]/.test(cleanedNumberString);
419+
if (!isScientificNotation) return BigInt(cleanedNumberString);
420+
421+
const [coefficient, exponent] = cleanedNumberString.split(/[eE]/);
420422
return BigInt(coefficient) * BigInt(10) ** BigInt(exponent);
421423
};

packages/cashc/src/grammar/CashScript.g4

+9-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,15 @@ NumberUnit
165165
;
166166

167167
NumberLiteral
168-
: [-]?[0-9]+ ([eE] [0-9]+)?
168+
: '-'? NumberPart ExponentPart?
169+
;
170+
171+
NumberPart
172+
: [0-9]+ ('_' [0-9]+)*
173+
;
174+
175+
ExponentPart
176+
: [eE] NumberPart
169177
;
170178

171179
Bytes

packages/cashc/src/grammar/CashScript.interp

+5-1
Large diffs are not rendered by default.

packages/cashc/src/grammar/CashScript.tokens

+13-11
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,19 @@ VersionLiteral=58
5959
BooleanLiteral=59
6060
NumberUnit=60
6161
NumberLiteral=61
62-
Bytes=62
63-
Bound=63
64-
StringLiteral=64
65-
DateLiteral=65
66-
HexLiteral=66
67-
TxVar=67
68-
NullaryOp=68
69-
Identifier=69
70-
WHITESPACE=70
71-
COMMENT=71
72-
LINE_COMMENT=72
62+
NumberPart=62
63+
ExponentPart=63
64+
Bytes=64
65+
Bound=65
66+
StringLiteral=66
67+
DateLiteral=67
68+
HexLiteral=68
69+
TxVar=69
70+
NullaryOp=70
71+
Identifier=71
72+
WHITESPACE=72
73+
COMMENT=73
74+
LINE_COMMENT=74
7375
'pragma'=1
7476
';'=2
7577
'cashscript'=3

packages/cashc/src/grammar/CashScriptLexer.interp

+7-1
Large diffs are not rendered by default.

packages/cashc/src/grammar/CashScriptLexer.tokens

+13-11
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,19 @@ VersionLiteral=58
5959
BooleanLiteral=59
6060
NumberUnit=60
6161
NumberLiteral=61
62-
Bytes=62
63-
Bound=63
64-
StringLiteral=64
65-
DateLiteral=65
66-
HexLiteral=66
67-
TxVar=67
68-
NullaryOp=68
69-
Identifier=69
70-
WHITESPACE=70
71-
COMMENT=71
72-
LINE_COMMENT=72
62+
NumberPart=62
63+
ExponentPart=63
64+
Bytes=64
65+
Bound=65
66+
StringLiteral=66
67+
DateLiteral=67
68+
HexLiteral=68
69+
TxVar=69
70+
NullaryOp=70
71+
Identifier=71
72+
WHITESPACE=72
73+
COMMENT=73
74+
LINE_COMMENT=74
7375
'pragma'=1
7476
';'=2
7577
'cashscript'=3

packages/cashc/src/grammar/CashScriptLexer.ts

+280-271
Large diffs are not rendered by default.

packages/cashc/src/grammar/CashScriptParser.ts

+46-42
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,19 @@ export default class CashScriptParser extends Parser {
7979
public static readonly BooleanLiteral = 59;
8080
public static readonly NumberUnit = 60;
8181
public static readonly NumberLiteral = 61;
82-
public static readonly Bytes = 62;
83-
public static readonly Bound = 63;
84-
public static readonly StringLiteral = 64;
85-
public static readonly DateLiteral = 65;
86-
public static readonly HexLiteral = 66;
87-
public static readonly TxVar = 67;
88-
public static readonly NullaryOp = 68;
89-
public static readonly Identifier = 69;
90-
public static readonly WHITESPACE = 70;
91-
public static readonly COMMENT = 71;
92-
public static readonly LINE_COMMENT = 72;
82+
public static readonly NumberPart = 62;
83+
public static readonly ExponentPart = 63;
84+
public static readonly Bytes = 64;
85+
public static readonly Bound = 65;
86+
public static readonly StringLiteral = 66;
87+
public static readonly DateLiteral = 67;
88+
public static readonly HexLiteral = 68;
89+
public static readonly TxVar = 69;
90+
public static readonly NullaryOp = 70;
91+
public static readonly Identifier = 71;
92+
public static readonly WHITESPACE = 72;
93+
public static readonly COMMENT = 73;
94+
public static readonly LINE_COMMENT = 74;
9395
public static readonly EOF = Token.EOF;
9496
public static readonly RULE_sourceFile = 0;
9597
public static readonly RULE_pragmaDirective = 1;
@@ -191,6 +193,8 @@ export default class CashScriptParser extends Parser {
191193
"BooleanLiteral",
192194
"NumberUnit",
193195
"NumberLiteral",
196+
"NumberPart",
197+
"ExponentPart",
194198
"Bytes", "Bound",
195199
"StringLiteral",
196200
"DateLiteral",
@@ -494,7 +498,7 @@ export default class CashScriptParser extends Parser {
494498
this.state = 104;
495499
this._errHandler.sync(this);
496500
_la = this._input.LA(1);
497-
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 2883584) !== 0) || ((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 132159) !== 0)) {
501+
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 2883584) !== 0) || ((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 528447) !== 0)) {
498502
{
499503
{
500504
this.state = 101;
@@ -537,7 +541,7 @@ export default class CashScriptParser extends Parser {
537541
this.state = 121;
538542
this._errHandler.sync(this);
539543
_la = this._input.LA(1);
540-
if (((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 1087) !== 0)) {
544+
if (((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 4159) !== 0)) {
541545
{
542546
this.state = 110;
543547
this.parameter();
@@ -634,7 +638,7 @@ export default class CashScriptParser extends Parser {
634638
this.state = 132;
635639
this._errHandler.sync(this);
636640
_la = this._input.LA(1);
637-
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 2883584) !== 0) || ((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 132159) !== 0)) {
641+
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 2883584) !== 0) || ((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 528447) !== 0)) {
638642
{
639643
{
640644
this.state = 129;
@@ -658,8 +662,8 @@ export default class CashScriptParser extends Parser {
658662
case 55:
659663
case 56:
660664
case 57:
661-
case 62:
662-
case 69:
665+
case 64:
666+
case 71:
663667
this.enterOuterAlt(localctx, 2);
664668
{
665669
this.state = 136;
@@ -1078,7 +1082,7 @@ export default class CashScriptParser extends Parser {
10781082
this.state = 213;
10791083
this._errHandler.sync(this);
10801084
switch (this._input.LA(1)) {
1081-
case 69:
1085+
case 71:
10821086
this.enterOuterAlt(localctx, 1);
10831087
{
10841088
this.state = 211;
@@ -1087,9 +1091,9 @@ export default class CashScriptParser extends Parser {
10871091
break;
10881092
case 59:
10891093
case 61:
1090-
case 64:
1091-
case 65:
10921094
case 66:
1095+
case 67:
1096+
case 68:
10931097
this.enterOuterAlt(localctx, 2);
10941098
{
10951099
this.state = 212;
@@ -1128,7 +1132,7 @@ export default class CashScriptParser extends Parser {
11281132
this.state = 227;
11291133
this._errHandler.sync(this);
11301134
_la = this._input.LA(1);
1131-
if (((((_la - 59)) & ~0x1F) === 0 && ((1 << (_la - 59)) & 1253) !== 0)) {
1135+
if (((((_la - 59)) & ~0x1F) === 0 && ((1 << (_la - 59)) & 4997) !== 0)) {
11321136
{
11331137
this.state = 216;
11341138
this.consoleParameter();
@@ -1222,7 +1226,7 @@ export default class CashScriptParser extends Parser {
12221226
this.state = 246;
12231227
this._errHandler.sync(this);
12241228
_la = this._input.LA(1);
1225-
if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 2193653760) !== 0) || ((((_la - 39)) & ~0x1F) === 0 && ((1 << (_la - 39)) & 1859641347) !== 0)) {
1229+
if (((((_la - 15)) & ~0x1F) === 0 && ((1 << (_la - 15)) & 50398593) !== 0) || ((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 905919) !== 0)) {
12261230
{
12271231
this.state = 235;
12281232
this.expression(0);
@@ -1450,7 +1454,7 @@ export default class CashScriptParser extends Parser {
14501454
this.state = 297;
14511455
this._errHandler.sync(this);
14521456
_la = this._input.LA(1);
1453-
if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 2193653760) !== 0) || ((((_la - 39)) & ~0x1F) === 0 && ((1 << (_la - 39)) & 1859641347) !== 0)) {
1457+
if (((((_la - 15)) & ~0x1F) === 0 && ((1 << (_la - 15)) & 50398593) !== 0) || ((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 905919) !== 0)) {
14541458
{
14551459
this.state = 286;
14561460
this.expression(0);
@@ -1823,21 +1827,21 @@ export default class CashScriptParser extends Parser {
18231827
this.numberLiteral();
18241828
}
18251829
break;
1826-
case 64:
1830+
case 66:
18271831
this.enterOuterAlt(localctx, 3);
18281832
{
18291833
this.state = 353;
18301834
this.match(CashScriptParser.StringLiteral);
18311835
}
18321836
break;
1833-
case 65:
1837+
case 67:
18341838
this.enterOuterAlt(localctx, 4);
18351839
{
18361840
this.state = 354;
18371841
this.match(CashScriptParser.DateLiteral);
18381842
}
18391843
break;
1840-
case 66:
1844+
case 68:
18411845
this.enterOuterAlt(localctx, 5);
18421846
{
18431847
this.state = 355;
@@ -1907,7 +1911,7 @@ export default class CashScriptParser extends Parser {
19071911
{
19081912
this.state = 362;
19091913
_la = this._input.LA(1);
1910-
if(!(((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 1087) !== 0))) {
1914+
if(!(((((_la - 52)) & ~0x1F) === 0 && ((1 << (_la - 52)) & 4159) !== 0))) {
19111915
this._errHandler.recoverInline(this);
19121916
}
19131917
else {
@@ -1968,7 +1972,7 @@ export default class CashScriptParser extends Parser {
19681972
return true;
19691973
}
19701974

1971-
public static readonly _serializedATN: number[] = [4,1,72,365,2,0,7,0,2,
1975+
public static readonly _serializedATN: number[] = [4,1,74,365,2,0,7,0,2,
19721976
1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,
19731977
10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,
19741978
7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,
@@ -1998,7 +2002,7 @@ export default class CashScriptParser extends Parser {
19982002
3,27,361,8,27,1,28,1,28,1,28,0,1,48,29,0,2,4,6,8,10,12,14,16,18,20,22,24,
19992003
26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,0,10,1,0,4,10,1,0,26,30,
20002004
2,0,26,30,32,35,1,0,39,40,1,0,41,43,2,0,40,40,44,44,1,0,6,9,1,0,45,46,1,
2001-
0,36,37,2,0,52,57,62,62,394,0,61,1,0,0,0,2,67,1,0,0,0,4,72,1,0,0,0,6,74,
2005+
0,36,37,2,0,52,57,64,64,394,0,61,1,0,0,0,2,67,1,0,0,0,4,72,1,0,0,0,6,74,
20022006
1,0,0,0,8,79,1,0,0,0,10,83,1,0,0,0,12,85,1,0,0,0,14,97,1,0,0,0,16,109,1,
20032007
0,0,0,18,125,1,0,0,0,20,137,1,0,0,0,22,146,1,0,0,0,24,148,1,0,0,0,26,160,
20042008
1,0,0,0,28,169,1,0,0,0,30,174,1,0,0,0,32,186,1,0,0,0,34,196,1,0,0,0,36,
@@ -2010,17 +2014,17 @@ export default class CashScriptParser extends Parser {
20102014
0,71,3,1,0,0,0,72,73,5,3,0,0,73,5,1,0,0,0,74,76,3,8,4,0,75,77,3,8,4,0,76,
20112015
75,1,0,0,0,76,77,1,0,0,0,77,7,1,0,0,0,78,80,3,10,5,0,79,78,1,0,0,0,79,80,
20122016
1,0,0,0,80,81,1,0,0,0,81,82,5,58,0,0,82,9,1,0,0,0,83,84,7,0,0,0,84,11,1,
2013-
0,0,0,85,86,5,11,0,0,86,87,5,69,0,0,87,88,3,16,8,0,88,92,5,12,0,0,89,91,
2017+
0,0,0,85,86,5,11,0,0,86,87,5,71,0,0,87,88,3,16,8,0,88,92,5,12,0,0,89,91,
20142018
3,14,7,0,90,89,1,0,0,0,91,94,1,0,0,0,92,90,1,0,0,0,92,93,1,0,0,0,93,95,
20152019
1,0,0,0,94,92,1,0,0,0,95,96,5,13,0,0,96,13,1,0,0,0,97,98,5,14,0,0,98,99,
2016-
5,69,0,0,99,100,3,16,8,0,100,104,5,12,0,0,101,103,3,22,11,0,102,101,1,0,
2020+
5,71,0,0,99,100,3,16,8,0,100,104,5,12,0,0,101,103,3,22,11,0,102,101,1,0,
20172021
0,0,103,106,1,0,0,0,104,102,1,0,0,0,104,105,1,0,0,0,105,107,1,0,0,0,106,
20182022
104,1,0,0,0,107,108,5,13,0,0,108,15,1,0,0,0,109,121,5,15,0,0,110,115,3,
20192023
18,9,0,111,112,5,16,0,0,112,114,3,18,9,0,113,111,1,0,0,0,114,117,1,0,0,
20202024
0,115,113,1,0,0,0,115,116,1,0,0,0,116,119,1,0,0,0,117,115,1,0,0,0,118,120,
20212025
5,16,0,0,119,118,1,0,0,0,119,120,1,0,0,0,120,122,1,0,0,0,121,110,1,0,0,
20222026
0,121,122,1,0,0,0,122,123,1,0,0,0,123,124,5,17,0,0,124,17,1,0,0,0,125,126,
2023-
3,56,28,0,126,127,5,69,0,0,127,19,1,0,0,0,128,132,5,12,0,0,129,131,3,22,
2027+
3,56,28,0,126,127,5,71,0,0,127,19,1,0,0,0,128,132,5,12,0,0,129,131,3,22,
20242028
11,0,130,129,1,0,0,0,131,134,1,0,0,0,132,130,1,0,0,0,132,133,1,0,0,0,133,
20252029
135,1,0,0,0,134,132,1,0,0,0,135,138,5,13,0,0,136,138,3,22,11,0,137,128,
20262030
1,0,0,0,137,136,1,0,0,0,138,21,1,0,0,0,139,147,3,24,12,0,140,147,3,26,13,
@@ -2029,11 +2033,11 @@ export default class CashScriptParser extends Parser {
20292033
142,1,0,0,0,146,143,1,0,0,0,146,144,1,0,0,0,146,145,1,0,0,0,147,23,1,0,
20302034
0,0,148,152,3,56,28,0,149,151,3,50,25,0,150,149,1,0,0,0,151,154,1,0,0,0,
20312035
152,150,1,0,0,0,152,153,1,0,0,0,153,155,1,0,0,0,154,152,1,0,0,0,155,156,
2032-
5,69,0,0,156,157,5,10,0,0,157,158,3,48,24,0,158,159,5,2,0,0,159,25,1,0,
2033-
0,0,160,161,3,56,28,0,161,162,5,69,0,0,162,163,5,16,0,0,163,164,3,56,28,
2034-
0,164,165,5,69,0,0,165,166,5,10,0,0,166,167,3,48,24,0,167,168,5,2,0,0,168,
2035-
27,1,0,0,0,169,170,5,69,0,0,170,171,5,10,0,0,171,172,3,48,24,0,172,173,
2036-
5,2,0,0,173,29,1,0,0,0,174,175,5,18,0,0,175,176,5,15,0,0,176,177,5,67,0,
2036+
5,71,0,0,156,157,5,10,0,0,157,158,3,48,24,0,158,159,5,2,0,0,159,25,1,0,
2037+
0,0,160,161,3,56,28,0,161,162,5,71,0,0,162,163,5,16,0,0,163,164,3,56,28,
2038+
0,164,165,5,71,0,0,165,166,5,10,0,0,166,167,3,48,24,0,167,168,5,2,0,0,168,
2039+
27,1,0,0,0,169,170,5,71,0,0,170,171,5,10,0,0,171,172,3,48,24,0,172,173,
2040+
5,2,0,0,173,29,1,0,0,0,174,175,5,18,0,0,175,176,5,15,0,0,176,177,5,69,0,
20372041
0,177,178,5,6,0,0,178,181,3,48,24,0,179,180,5,16,0,0,180,182,3,38,19,0,
20382042
181,179,1,0,0,0,181,182,1,0,0,0,182,183,1,0,0,0,183,184,5,17,0,0,184,185,
20392043
5,2,0,0,185,31,1,0,0,0,186,187,5,18,0,0,187,188,5,15,0,0,188,191,3,48,24,
@@ -2042,13 +2046,13 @@ export default class CashScriptParser extends Parser {
20422046
0,0,197,198,5,15,0,0,198,199,3,48,24,0,199,200,5,17,0,0,200,203,3,20,10,
20432047
0,201,202,5,20,0,0,202,204,3,20,10,0,203,201,1,0,0,0,203,204,1,0,0,0,204,
20442048
35,1,0,0,0,205,206,5,21,0,0,206,207,3,42,21,0,207,208,5,2,0,0,208,37,1,
2045-
0,0,0,209,210,5,64,0,0,210,39,1,0,0,0,211,214,5,69,0,0,212,214,3,52,26,
2049+
0,0,0,209,210,5,66,0,0,210,39,1,0,0,0,211,214,5,71,0,0,212,214,3,52,26,
20462050
0,213,211,1,0,0,0,213,212,1,0,0,0,214,41,1,0,0,0,215,227,5,15,0,0,216,221,
20472051
3,40,20,0,217,218,5,16,0,0,218,220,3,40,20,0,219,217,1,0,0,0,220,223,1,
20482052
0,0,0,221,219,1,0,0,0,221,222,1,0,0,0,222,225,1,0,0,0,223,221,1,0,0,0,224,
20492053
226,5,16,0,0,225,224,1,0,0,0,225,226,1,0,0,0,226,228,1,0,0,0,227,216,1,
20502054
0,0,0,227,228,1,0,0,0,228,229,1,0,0,0,229,230,5,17,0,0,230,43,1,0,0,0,231,
2051-
232,5,69,0,0,232,233,3,46,23,0,233,45,1,0,0,0,234,246,5,15,0,0,235,240,
2055+
232,5,71,0,0,232,233,3,46,23,0,233,45,1,0,0,0,234,246,5,15,0,0,235,240,
20522056
3,48,24,0,236,237,5,16,0,0,237,239,3,48,24,0,238,236,1,0,0,0,239,242,1,
20532057
0,0,0,240,238,1,0,0,0,240,241,1,0,0,0,241,244,1,0,0,0,242,240,1,0,0,0,243,
20542058
245,5,16,0,0,244,243,1,0,0,0,244,245,1,0,0,0,245,247,1,0,0,0,246,235,1,
@@ -2058,15 +2062,15 @@ export default class CashScriptParser extends Parser {
20582062
16,0,0,259,261,3,48,24,0,260,258,1,0,0,0,260,261,1,0,0,0,261,263,1,0,0,
20592063
0,262,264,5,16,0,0,263,262,1,0,0,0,263,264,1,0,0,0,264,265,1,0,0,0,265,
20602064
266,5,17,0,0,266,304,1,0,0,0,267,304,3,44,22,0,268,269,5,22,0,0,269,270,
2061-
5,69,0,0,270,304,3,46,23,0,271,272,5,25,0,0,272,273,5,23,0,0,273,274,3,
2065+
5,71,0,0,270,304,3,46,23,0,271,272,5,25,0,0,272,273,5,23,0,0,273,274,3,
20622066
48,24,0,274,275,5,24,0,0,275,276,7,1,0,0,276,304,1,0,0,0,277,278,5,31,0,
20632067
0,278,279,5,23,0,0,279,280,3,48,24,0,280,281,5,24,0,0,281,282,7,2,0,0,282,
20642068
304,1,0,0,0,283,284,7,3,0,0,284,304,3,48,24,14,285,297,5,23,0,0,286,291,
20652069
3,48,24,0,287,288,5,16,0,0,288,290,3,48,24,0,289,287,1,0,0,0,290,293,1,
20662070
0,0,0,291,289,1,0,0,0,291,292,1,0,0,0,292,295,1,0,0,0,293,291,1,0,0,0,294,
20672071
296,5,16,0,0,295,294,1,0,0,0,295,296,1,0,0,0,296,298,1,0,0,0,297,286,1,
2068-
0,0,0,297,298,1,0,0,0,298,299,1,0,0,0,299,304,5,24,0,0,300,304,5,68,0,0,
2069-
301,304,5,69,0,0,302,304,3,52,26,0,303,250,1,0,0,0,303,255,1,0,0,0,303,
2072+
0,0,0,297,298,1,0,0,0,298,299,1,0,0,0,299,304,5,24,0,0,300,304,5,70,0,0,
2073+
301,304,5,71,0,0,302,304,3,52,26,0,303,250,1,0,0,0,303,255,1,0,0,0,303,
20702074
267,1,0,0,0,303,268,1,0,0,0,303,271,1,0,0,0,303,277,1,0,0,0,303,283,1,0,
20712075
0,0,303,285,1,0,0,0,303,300,1,0,0,0,303,301,1,0,0,0,303,302,1,0,0,0,304,
20722076
346,1,0,0,0,305,306,10,13,0,0,306,307,7,4,0,0,307,345,3,48,24,14,308,309,
@@ -2083,7 +2087,7 @@ export default class CashScriptParser extends Parser {
20832087
0,0,344,326,1,0,0,0,344,329,1,0,0,0,344,332,1,0,0,0,344,336,1,0,0,0,344,
20842088
338,1,0,0,0,345,348,1,0,0,0,346,344,1,0,0,0,346,347,1,0,0,0,347,49,1,0,
20852089
0,0,348,346,1,0,0,0,349,350,5,51,0,0,350,51,1,0,0,0,351,357,5,59,0,0,352,
2086-
357,3,54,27,0,353,357,5,64,0,0,354,357,5,65,0,0,355,357,5,66,0,0,356,351,
2090+
357,3,54,27,0,353,357,5,66,0,0,354,357,5,67,0,0,355,357,5,68,0,0,356,351,
20872091
1,0,0,0,356,352,1,0,0,0,356,353,1,0,0,0,356,354,1,0,0,0,356,355,1,0,0,0,
20882092
357,53,1,0,0,0,358,360,5,61,0,0,359,361,5,60,0,0,360,359,1,0,0,0,360,361,
20892093
1,0,0,0,361,55,1,0,0,0,362,363,7,9,0,0,363,57,1,0,0,0,32,61,76,79,92,104,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
contract Test() {
2+
function hello() {
3+
require(1000 == 1__000);
4+
}
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
contract Test() {
2+
function hello() {
3+
require(1000 == _1000);
4+
}
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
contract Test() {
2+
function hello() {
3+
require(1000 == 1000_);
4+
}
5+
}

packages/cashc/test/generation/fixtures.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -745,12 +745,12 @@ export const fixtures: Fixture[] = [
745745
abi: [
746746
{ name: 'test', inputs: [] },
747747
],
748-
bytecode: '00ca9a3b 00ca9a3b 00ca9a3b OP_ROT OP_OVER OP_NUMEQUALVERIFY OP_NUMEQUAL',
748+
bytecode: '0010a5d4e800 0010a5d4e800 0010a5d4e800 0010a5d4e800 0010a5d4e800 OP_4 OP_ROLL OP_OVER OP_NUMEQUALVERIFY OP_3 OP_ROLL OP_OVER OP_NUMEQUALVERIFY OP_ROT OP_OVER OP_NUMEQUALVERIFY OP_NUMEQUAL',
749749
debug: {
750-
bytecode: '0400ca9a3b0400ca9a3b0400ca9a3b527a51799c69517a517a9c',
750+
bytecode: '060010a5d4e800060010a5d4e800060010a5d4e800060010a5d4e800060010a5d4e800547a51799c69537a51799c69527a51799c69517a517a9c',
751751
logs: [],
752-
requires: [{ ip: 8, line: 8 }, { ip: 14, line: 9 }],
753-
sourceMap: '3:26:3:29;4::4;6:22:6:32;8:16:8:27;;:31::38;;:16:::1;:8::40;9:16:9:27:0;;:31::38;;:16:::1',
752+
requires: [{ ip: 10, line: 10 }, { ip: 16, line: 11 }, { ip: 22, line: 12 }, { ip: 28, line: 13 }],
753+
sourceMap: '3:26:3:30;4::4;5::5:43;6:23:6:30;8:22:8:35;10:16:10:27;;:31::38;;:16:::1;:8::40;11:16:11:27:0;;:31::38;;:16:::1;:8::40;12:16:12:27:0;;:31::38;;:16:::1;:8::40;13:16:13:24:0;;:28::35;;:16:::1',
754754
},
755755
source: fs.readFileSync(new URL('../valid-contract-files/integer_formatting.cash', import.meta.url), { encoding: 'utf-8' }),
756756
compiler: {

0 commit comments

Comments
 (0)