oaknut-basic 13.3.1__tar.gz → 13.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {oaknut_basic-13.3.1/src/oaknut_basic.egg-info → oaknut_basic-13.5.0}/PKG-INFO +24 -5
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/README.md +23 -4
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/__init__.py +1 -1
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/cli.py +3 -1
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0/src/oaknut_basic.egg-info}/PKG-INFO +24 -5
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/LICENSE +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/pyproject.toml +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/setup.cfg +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/datafile.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/detect.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/detokeniser.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/dialect.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/exceptions.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/float5.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/linenumber.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/numbering.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/scanner.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/tokeniser.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut/basic/tokens.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut_basic.egg-info/SOURCES.txt +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut_basic.egg-info/dependency_links.txt +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut_basic.egg-info/entry_points.txt +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut_basic.egg-info/requires.txt +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/src/oaknut_basic.egg-info/top_level.txt +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_basic.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_basic_v.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_cli.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_crunch_rules.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_data_cli.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_datafile.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_detect.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_detokeniser.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_float5.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_greedy_crunch.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_keyword_coverage.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_linenumber.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_numbering.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_packaging.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_rom_golden.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_rom_golden_detokenise.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_scanner.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_tokeniser.py +0 -0
- {oaknut_basic-13.3.1 → oaknut_basic-13.5.0}/tests/test_tokens.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oaknut-basic
|
|
3
|
-
Version: 13.
|
|
3
|
+
Version: 13.5.0
|
|
4
4
|
Summary: BBC BASIC tools: program tokeniser/de-tokeniser and PRINT#/INPUT# data-file reader/writer
|
|
5
5
|
Author-email: Robert Smallshire <robert@smallshire.org.uk>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -92,7 +92,8 @@ Options:
|
|
|
92
92
|
--help Show this message and exit.
|
|
93
93
|
|
|
94
94
|
Commands:
|
|
95
|
-
data Read and write BBC BASIC data files
|
|
95
|
+
data Read and write BBC BASIC data files...
|
|
96
|
+
detect Identify whether each FILE is a tokenised BBC BASIC program.
|
|
96
97
|
detokenise De-tokenise a stored BBC BASIC program into source text.
|
|
97
98
|
number Prepend ascending line numbers to an unnumbered BBC BASIC...
|
|
98
99
|
tokenise Tokenise BBC BASIC source text into a stored program.
|
|
@@ -129,11 +130,21 @@ Programs are handled by the functions `tokenise`, `detokenise`, and
|
|
|
129
130
|
`number_lines`, all importable from `oaknut.basic`:
|
|
130
131
|
|
|
131
132
|
```python
|
|
132
|
-
from oaknut.basic import
|
|
133
|
+
from oaknut.basic import detokenise, tokenise
|
|
133
134
|
|
|
134
135
|
program = tokenise('10 PRINT "HELLO"\n20 GOTO 10\n') # str -> bytes
|
|
135
136
|
listing = detokenise(program) # bytes -> str
|
|
136
137
|
assert tokenise(detokenise(program)) == program # byte-exact
|
|
138
|
+
print(program.hex(" "))
|
|
139
|
+
print(listing, end="")
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Output:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
0d 00 0a 0e 20 f1 20 22 48 45 4c 4c 4f 22 0d 00 14 0b 20 e5 20 8d 54 4a 40 0d ff
|
|
146
|
+
10 PRINT "HELLO"
|
|
147
|
+
20 GOTO 10
|
|
137
148
|
```
|
|
138
149
|
|
|
139
150
|
When the program lives in a disc image, prefer the path-object wrappers
|
|
@@ -155,8 +166,16 @@ with datafile.open("scores.dat", "w") as f:
|
|
|
155
166
|
f.write(3.5) # float -> real record
|
|
156
167
|
|
|
157
168
|
with datafile.open("scores.dat", "r") as f:
|
|
158
|
-
for value in f:
|
|
159
|
-
print(value)
|
|
169
|
+
for value in f:
|
|
170
|
+
print(repr(value))
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Output:
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
'ALICE'
|
|
177
|
+
42
|
|
178
|
+
3.5
|
|
160
179
|
```
|
|
161
180
|
|
|
162
181
|
Strings use the BBC `acorn` character set by default, and reals convert through
|
|
@@ -68,7 +68,8 @@ Options:
|
|
|
68
68
|
--help Show this message and exit.
|
|
69
69
|
|
|
70
70
|
Commands:
|
|
71
|
-
data Read and write BBC BASIC data files
|
|
71
|
+
data Read and write BBC BASIC data files...
|
|
72
|
+
detect Identify whether each FILE is a tokenised BBC BASIC program.
|
|
72
73
|
detokenise De-tokenise a stored BBC BASIC program into source text.
|
|
73
74
|
number Prepend ascending line numbers to an unnumbered BBC BASIC...
|
|
74
75
|
tokenise Tokenise BBC BASIC source text into a stored program.
|
|
@@ -105,11 +106,21 @@ Programs are handled by the functions `tokenise`, `detokenise`, and
|
|
|
105
106
|
`number_lines`, all importable from `oaknut.basic`:
|
|
106
107
|
|
|
107
108
|
```python
|
|
108
|
-
from oaknut.basic import
|
|
109
|
+
from oaknut.basic import detokenise, tokenise
|
|
109
110
|
|
|
110
111
|
program = tokenise('10 PRINT "HELLO"\n20 GOTO 10\n') # str -> bytes
|
|
111
112
|
listing = detokenise(program) # bytes -> str
|
|
112
113
|
assert tokenise(detokenise(program)) == program # byte-exact
|
|
114
|
+
print(program.hex(" "))
|
|
115
|
+
print(listing, end="")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Output:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
0d 00 0a 0e 20 f1 20 22 48 45 4c 4c 4f 22 0d 00 14 0b 20 e5 20 8d 54 4a 40 0d ff
|
|
122
|
+
10 PRINT "HELLO"
|
|
123
|
+
20 GOTO 10
|
|
113
124
|
```
|
|
114
125
|
|
|
115
126
|
When the program lives in a disc image, prefer the path-object wrappers
|
|
@@ -131,8 +142,16 @@ with datafile.open("scores.dat", "w") as f:
|
|
|
131
142
|
f.write(3.5) # float -> real record
|
|
132
143
|
|
|
133
144
|
with datafile.open("scores.dat", "r") as f:
|
|
134
|
-
for value in f:
|
|
135
|
-
print(value)
|
|
145
|
+
for value in f:
|
|
146
|
+
print(repr(value))
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Output:
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
'ALICE'
|
|
153
|
+
42
|
|
154
|
+
3.5
|
|
136
155
|
```
|
|
137
156
|
|
|
138
157
|
Strings use the BBC `acorn` character set by default, and reals convert through
|
|
@@ -11,6 +11,8 @@ installed with its ``[cli]`` extra; the library core never imports it.
|
|
|
11
11
|
|
|
12
12
|
from __future__ import annotations
|
|
13
13
|
|
|
14
|
+
import sys
|
|
15
|
+
|
|
14
16
|
import click
|
|
15
17
|
from asyoulikeit.cli import report_output
|
|
16
18
|
from oaknut.cli.help import use_plain_help
|
|
@@ -358,7 +360,7 @@ def detect(ctx: click.Context, inputs, quiet: bool) -> None:
|
|
|
358
360
|
"""
|
|
359
361
|
from oaknut.basic import detect as detect_blob
|
|
360
362
|
|
|
361
|
-
streams = inputs if inputs else (
|
|
363
|
+
streams = inputs if inputs else (sys.stdin.buffer,)
|
|
362
364
|
all_basic = True
|
|
363
365
|
for stream in streams:
|
|
364
366
|
result = detect_blob(stream.read())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oaknut-basic
|
|
3
|
-
Version: 13.
|
|
3
|
+
Version: 13.5.0
|
|
4
4
|
Summary: BBC BASIC tools: program tokeniser/de-tokeniser and PRINT#/INPUT# data-file reader/writer
|
|
5
5
|
Author-email: Robert Smallshire <robert@smallshire.org.uk>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -92,7 +92,8 @@ Options:
|
|
|
92
92
|
--help Show this message and exit.
|
|
93
93
|
|
|
94
94
|
Commands:
|
|
95
|
-
data Read and write BBC BASIC data files
|
|
95
|
+
data Read and write BBC BASIC data files...
|
|
96
|
+
detect Identify whether each FILE is a tokenised BBC BASIC program.
|
|
96
97
|
detokenise De-tokenise a stored BBC BASIC program into source text.
|
|
97
98
|
number Prepend ascending line numbers to an unnumbered BBC BASIC...
|
|
98
99
|
tokenise Tokenise BBC BASIC source text into a stored program.
|
|
@@ -129,11 +130,21 @@ Programs are handled by the functions `tokenise`, `detokenise`, and
|
|
|
129
130
|
`number_lines`, all importable from `oaknut.basic`:
|
|
130
131
|
|
|
131
132
|
```python
|
|
132
|
-
from oaknut.basic import
|
|
133
|
+
from oaknut.basic import detokenise, tokenise
|
|
133
134
|
|
|
134
135
|
program = tokenise('10 PRINT "HELLO"\n20 GOTO 10\n') # str -> bytes
|
|
135
136
|
listing = detokenise(program) # bytes -> str
|
|
136
137
|
assert tokenise(detokenise(program)) == program # byte-exact
|
|
138
|
+
print(program.hex(" "))
|
|
139
|
+
print(listing, end="")
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Output:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
0d 00 0a 0e 20 f1 20 22 48 45 4c 4c 4f 22 0d 00 14 0b 20 e5 20 8d 54 4a 40 0d ff
|
|
146
|
+
10 PRINT "HELLO"
|
|
147
|
+
20 GOTO 10
|
|
137
148
|
```
|
|
138
149
|
|
|
139
150
|
When the program lives in a disc image, prefer the path-object wrappers
|
|
@@ -155,8 +166,16 @@ with datafile.open("scores.dat", "w") as f:
|
|
|
155
166
|
f.write(3.5) # float -> real record
|
|
156
167
|
|
|
157
168
|
with datafile.open("scores.dat", "r") as f:
|
|
158
|
-
for value in f:
|
|
159
|
-
print(value)
|
|
169
|
+
for value in f:
|
|
170
|
+
print(repr(value))
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Output:
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
'ALICE'
|
|
177
|
+
42
|
|
178
|
+
3.5
|
|
160
179
|
```
|
|
161
180
|
|
|
162
181
|
Strings use the BBC `acorn` character set by default, and reals convert through
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|