Skip to content

Commit adde247

Browse files
committed
[sbyte] Add the sbyte type.
1 parent 78b6914 commit adde247

12 files changed

Lines changed: 32 additions & 11 deletions

File tree

AST.fu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,6 +1690,9 @@ public class FuSystem : FuScope
16901690
Add(LongType);
16911691
ByteType.Name = "byte";
16921692
Add(ByteType);
1693+
FuRangeType# sByteType = FuRangeType.New(-0x80, 0x7f);
1694+
sByteType.Name = "sbyte";
1695+
Add(sByteType);
16931696
FuRangeType# shortType = FuRangeType.New(-0x8000, 0x7fff);
16941697
shortType.Name = "short";
16951698
Add(shortType);

Lexer.fu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ public abstract class FuLexer
561561
case ';': return FuToken.Semicolon;
562562
case '.':
563563
if (PeekChar() == '.')
564-
ReportError("Range types have been removed - replace with byte/short/ushort/int/uint");
564+
ReportError("Range types have been removed - replace with byte/sbyte/short/ushort/int/uint");
565565
return FuToken.Dot;
566566
case ',': return FuToken.Comma;
567567
case '(': return FuToken.LeftParenthesis;

doc/reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ These are the available integer types:
6666
| Type | Min value | Max value |
6767
| -------- | -------------------: | ------------------: |
6868
| `byte` | 0 | 255 |
69+
| `sbyte` | -128 | 127 |
6970
| `short` | -32768 | 32767 |
7071
| `ushort` | 0 | 65535 |
7172
| `int` | -2147483648 | 2147483647 |

editors/notepad-plus-plus/Fusion.udl.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<Keywords name="Folders in comment, middle"></Keywords>
2626
<Keywords name="Folders in comment, close"></Keywords>
2727
<Keywords name="Keywords1">abstract assert base break case class const continue default do else enum false for foreach if in internal is lock native new null override protected public resource return sealed static switch this throw throws true virtual when while</Keywords>
28-
<Keywords name="Keywords2">bool byte double float int long nint short string uint ushort void</Keywords>
28+
<Keywords name="Keywords2">bool byte double float int long nint sbyte short string uint ushort void</Keywords>
2929
<Keywords name="Keywords3">Console Convert Dictionary Encoding Environment Exception HashSet JsonElement List Lock Match Math OrderedDictionary PriorityQueue Queue Regex RegexOptions SortedDictionary SortedSet Stack StringWriter TextWriter</Keywords>
3030
<Keywords name="Keywords4">#elif #else #endif #if</Keywords>
3131
<Keywords name="Keywords5"></Keywords>

editors/scite/fusion.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class const continue default do double else enum \
1414
false float for foreach if \
1515
in int internal is lock long native new nint null \
1616
override protected public \
17-
resource return sealed short static \
17+
resource return sbyte sealed short static \
1818
string switch this throw throws true uint \
1919
ushort virtual void when while
2020
keywords.$(file.patterns.fu)=$(keywordclass.fu)

editors/sublime/Fusion.tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@
13481348
<key>type-builtin</key>
13491349
<dict>
13501350
<key>match</key>
1351-
<string>\b(bool|byte|double|float|int|long|nint|short|string|uint|ushort|void)\b</string>
1351+
<string>\b(bool|byte|double|float|int|long|nint|sbyte|short|string|uint|ushort|void)\b</string>
13521352
<key>captures</key>
13531353
<dict>
13541354
<key>1</key>

editors/vscode/syntaxes/fusion.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@
894894
]
895895
},
896896
"type-builtin": {
897-
"match": "\\b(bool|byte|double|float|int|long|nint|short|string|uint|ushort|void)\\b",
897+
"match": "\\b(bool|byte|double|float|int|long|nint|sbyte|short|string|uint|ushort|void)\\b",
898898
"captures": {
899899
"1": {
900900
"name": "keyword.type.fu"

libfut.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ FuToken FuLexer::readPreToken()
451451
return FuToken::semicolon;
452452
case '.':
453453
if (peekChar() == '.')
454-
reportError("Range types have been removed - replace with byte/short/ushort/int/uint");
454+
reportError("Range types have been removed - replace with byte/sbyte/short/ushort/int/uint");
455455
return FuToken::dot;
456456
case ',':
457457
return FuToken::comma;
@@ -2751,6 +2751,9 @@ FuSystem::FuSystem()
27512751
add(this->longType);
27522752
this->byteType->name = "byte";
27532753
add(this->byteType);
2754+
std::shared_ptr<FuRangeType> sByteType = FuRangeType::new_(-128, 127);
2755+
sByteType->name = "sbyte";
2756+
add(sByteType);
27542757
std::shared_ptr<FuRangeType> shortType = FuRangeType::new_(-32768, 32767);
27552758
shortType->name = "short";
27562759
add(shortType);

libfut.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ FuToken ReadPreToken()
576576
return FuToken.Semicolon;
577577
case '.':
578578
if (PeekChar() == '.')
579-
ReportError("Range types have been removed - replace with byte/short/ushort/int/uint");
579+
ReportError("Range types have been removed - replace with byte/sbyte/short/ushort/int/uint");
580580
return FuToken.Dot;
581581
case ',':
582582
return FuToken.Comma;
@@ -3239,6 +3239,9 @@ internal FuSystem()
32393239
Add(this.LongType);
32403240
this.ByteType.Name = "byte";
32413241
Add(this.ByteType);
3242+
FuRangeType sByteType = FuRangeType.New(-128, 127);
3243+
sByteType.Name = "sbyte";
3244+
Add(sByteType);
32423245
FuRangeType shortType = FuRangeType.New(-32768, 32767);
32433246
shortType.Name = "short";
32443247
Add(shortType);

libfut.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ export class FuLexer
562562
return FuToken.SEMICOLON;
563563
case 46:
564564
if (this.peekChar() == 46)
565-
this.reportError("Range types have been removed - replace with byte/short/ushort/int/uint");
565+
this.reportError("Range types have been removed - replace with byte/sbyte/short/ushort/int/uint");
566566
return FuToken.DOT;
567567
case 44:
568568
return FuToken.COMMA;
@@ -3481,6 +3481,9 @@ export class FuSystem extends FuScope
34813481
this.add(this.longType);
34823482
this.byteType.name = "byte";
34833483
this.add(this.byteType);
3484+
let sByteType = FuRangeType.new(-128, 127);
3485+
sByteType.name = "sbyte";
3486+
this.add(sByteType);
34843487
let shortType = FuRangeType.new(-32768, 32767);
34853488
shortType.name = "short";
34863489
this.add(shortType);

0 commit comments

Comments
 (0)