mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
b420ed8248
This change gets the Python codebase into a state where it conforms to the conventions of this codebase. It's now possible to include headers from Python, without worrying about ordering. Python has traditionally solved that problem by "diamonding" everything in Python.h, but that's problematic since it means any change to any Python header invalidates all the build artifacts. Lastly it makes tooling not work. Since it is hard to explain to Emacs when I press C-c C-h to add an import line it shouldn't add the header that actually defines the symbol, and instead do follow the nonstandard Python convention. Progress has been made on letting Python load source code from the zip executable structure via the standard C library APIs. System calss now recognizes zip!FILENAME alternative URIs as equivalent to zip:FILENAME since Python uses colon as its delimiter. Some progress has been made on embedding the notice license terms into the Python object code. This is easier said than done since Python has an extremely complicated ownership story. - Some termios APIs have been added - Implement rewinddir() dirstream API - GetCpuCount() API added to Cosmopolitan Libc - More bugs in Cosmopolitan Libc have been fixed - zipobj.com now has flags for mangling the path - Fixed bug a priori with sendfile() on certain BSDs - Polyfill F_DUPFD and F_DUPFD_CLOEXEC across platforms - FIOCLEX / FIONCLEX now polyfilled for fast O_CLOEXEC changes - APE now supports a hybrid solution to no-self-modify for builds - Many BSD-only magnums added, e.g. O_SEARCH, O_SHLOCK, SF_NODISKIO
85 lines
1.8 KiB
C
85 lines
1.8 KiB
C
#ifndef Py_LIMITED_API
|
|
#ifndef Py_TOKEN_H
|
|
#define Py_TOKEN_H
|
|
COSMOPOLITAN_C_START_
|
|
/* clang-format off */
|
|
|
|
#undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */
|
|
|
|
#define ENDMARKER 0
|
|
#define NAME 1
|
|
#define NUMBER 2
|
|
#define STRING 3
|
|
#define NEWLINE 4
|
|
#define INDENT 5
|
|
#define DEDENT 6
|
|
#define LPAR 7
|
|
#define RPAR 8
|
|
#define LSQB 9
|
|
#define RSQB 10
|
|
#define COLON 11
|
|
#define COMMA 12
|
|
#define SEMI 13
|
|
#define PLUS 14
|
|
#define MINUS 15
|
|
#define STAR 16
|
|
#define SLASH 17
|
|
#define VBAR 18
|
|
#define AMPER 19
|
|
#define LESS 20
|
|
#define GREATER 21
|
|
#define EQUAL 22
|
|
#define DOT 23
|
|
#define PERCENT 24
|
|
#define LBRACE 25
|
|
#define RBRACE 26
|
|
#define EQEQUAL 27
|
|
#define NOTEQUAL 28
|
|
#define LESSEQUAL 29
|
|
#define GREATEREQUAL 30
|
|
#define TILDE 31
|
|
#define CIRCUMFLEX 32
|
|
#define LEFTSHIFT 33
|
|
#define RIGHTSHIFT 34
|
|
#define DOUBLESTAR 35
|
|
#define PLUSEQUAL 36
|
|
#define MINEQUAL 37
|
|
#define STAREQUAL 38
|
|
#define SLASHEQUAL 39
|
|
#define PERCENTEQUAL 40
|
|
#define AMPEREQUAL 41
|
|
#define VBAREQUAL 42
|
|
#define CIRCUMFLEXEQUAL 43
|
|
#define LEFTSHIFTEQUAL 44
|
|
#define RIGHTSHIFTEQUAL 45
|
|
#define DOUBLESTAREQUAL 46
|
|
#define DOUBLESLASH 47
|
|
#define DOUBLESLASHEQUAL 48
|
|
#define AT 49
|
|
#define ATEQUAL 50
|
|
#define RARROW 51
|
|
#define ELLIPSIS 52
|
|
/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */
|
|
#define OP 53
|
|
#define AWAIT 54
|
|
#define ASYNC 55
|
|
#define ERRORTOKEN 56
|
|
#define N_TOKENS 57
|
|
|
|
/* Special definitions for cooperation with parser */
|
|
|
|
#define NT_OFFSET 256
|
|
|
|
#define ISTERMINAL(x) ((x) < NT_OFFSET)
|
|
#define ISNONTERMINAL(x) ((x) >= NT_OFFSET)
|
|
#define ISEOF(x) ((x) == ENDMARKER)
|
|
|
|
|
|
extern const char * _PyParser_TokenNames[]; /* Token names */
|
|
int PyToken_OneChar(int);
|
|
int PyToken_TwoChars(int, int);
|
|
int PyToken_ThreeChars(int, int, int);
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !Py_TOKEN_H */
|
|
#endif /* Py_LIMITED_API */
|