Make fixes, improvements, and chibicc python bindings

- python now mixes audio 10x faster
- python octal notation is restored
- chibicc now builds code 3x faster
- chibicc now has help documentation
- chibicc can now generate basic python bindings
- linenoise now supports some paredit-like features

See #141
This commit is contained in:
Justine Tunney 2021-10-08 08:11:51 -07:00
parent 28997f3acb
commit 7061c79c22
121 changed files with 5272 additions and 1928 deletions

View file

@ -1702,7 +1702,7 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)
} while (c == '_');
}
else {
int nonzero = 0;
int nonoctal = 0;
/* maybe old-style octal; c is first char of it */
/* in any case, allow '0' as a literal */
while (1) {
@ -1719,8 +1719,25 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)
}
c = tok_nextc(tok);
}
/* [jart] restore octal */
if ('1' <= c && c <= '7') {
while (1) {
if (c == '_') {
c = tok_nextc(tok);
if (!('0' <= c && c <= '7')) {
tok->done = E_TOKEN;
tok_backup(tok, c);
return ERRORTOKEN;
}
}
if (!('0' <= c && c <= '7')) {
break;
}
c = tok_nextc(tok);
}
}
if (isdigit(c)) {
nonzero = 1;
nonoctal = 1;
c = tok_decimal_tail(tok);
if (c == 0) {
return ERRORTOKEN;
@ -1736,8 +1753,7 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)
else if (c == 'j' || c == 'J') {
goto imaginary;
}
else if (nonzero) {
/* Old-style octal: now disallowed. */
else if (nonoctal) {
tok->done = E_TOKEN;
tok_backup(tok, c);
return ERRORTOKEN;