Skip to content

Commit 9221ece

Browse files
committed
reserve implements and interface as reserved words in BASIC
1 parent 0dc7774 commit 9221ece

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

Changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Version 6.1.6
55
- Implemented flush() for FATFS files (thanks to Ada)
66
- Improved some error messages
77
- In C++ output, treat unknown types in prints as generic
8+
- Made `interface` and `implements` reserved keywords in BASIC
89
- Optimized a few BASIC string expressions
910
- Optimized calculating length of string literals
1011
- Revised BASIC use of + operator on strings

doc/basic.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,10 @@ goto
253253
_hasmethod
254254
if
255255
import
256+
implements
256257
input
257258
integer
259+
interface
258260
len
259261
let
260262
lib
@@ -1347,8 +1349,7 @@ Used in a `try` statement to indicate the start of an error handling block.
13471349

13481350
### CHR$
13491351

1350-
Not actually a reserved word, but a built-in function. Converts an ascii
1351-
value to a string (so the reverse of ASC). For example:
1352+
A special built-in function which converts an ascii value to a string (so the reverse of ASC). For example:
13521353
```
13531354
print chr$(65)
13541355
```
@@ -2386,6 +2387,10 @@ else
23862387
end if
23872388
```
23882389

2390+
### IMPLEMENTS
2391+
2392+
Keyword reserved for future use.
2393+
23892394
### IMPORT
23902395

23912396
Keyword reserved for future use.
@@ -2480,6 +2485,10 @@ Warning: truncation will sometimes result in surprising results (e.g. `int(23.99
24802485

24812486
A 32 bit signed integer type. The unsigned 32 bit integer type is `uinteger`.
24822487

2488+
### INTERFACE
2489+
2490+
Keyword reserved for future use.
2491+
24832492
### KILL
24842493

24852494
```

frontends/basic/basic.y

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,12 @@ AdjustParamForByVal(AST *param)
457457
%token BAS_GOSUB "gosub"
458458
%token BAS_HASMETHOD "_hasmethod"
459459
%token BAS_IF "if"
460+
%token BAS_IMPLEMENTS "implements"
460461
%token BAS_IMPORT "import"
461462
%token BAS_INPUT "input"
462463
%token BAS_CAST_INT "int"
463464
%token BAS_INTEGER_KW "integer"
465+
%token BAS_INTERFACE "interface"
464466
%token BAS_LEN "len"
465467
%token BAS_LET "let"
466468
%token BAS_LIB "lib"

frontends/lexer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,10 +2314,12 @@ struct reservedword basic_keywords[] = {
23142314
{ "gosub", BAS_GOSUB },
23152315
{ "_hasmethod", BAS_HASMETHOD },
23162316
{ "if", BAS_IF },
2317+
{ "implements", BAS_IMPLEMENTS },
23172318
{ "import", BAS_IMPORT },
23182319
{ "input", BAS_INPUT },
23192320
{ "int", BAS_CAST_INT },
23202321
{ "integer", BAS_INTEGER_KW },
2322+
{ "interface", BAS_INTERFACE },
23212323
{ "len", BAS_LEN },
23222324
{ "let", BAS_LET },
23232325
{ "lib", BAS_LIB },

0 commit comments

Comments
 (0)