token.h 2.79 KB
Newer Older
1 2 3 4 5 6
#ifndef Py_TOKEN_H
#define Py_TOKEN_H
#ifdef __cplusplus
extern "C" {
#endif

7
/***********************************************************
Guido van Rossum's avatar
Guido van Rossum committed
8 9
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
The Netherlands.
10 11 12

                        All Rights Reserved

13 14
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
15
provided that the above copyright notice appear in all copies and that
16
both that copyright notice and this permission notice appear in
17
supporting documentation, and that the names of Stichting Mathematisch
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
Centrum or CWI or Corporation for National Research Initiatives or
CNRI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.

While CWI is the initial source for this software, a modified version
is made available by the Corporation for National Research Initiatives
(CNRI) at the Internet address ftp://ftp.python.org.

STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
35 36 37

******************************************************************/

Guido van Rossum's avatar
Guido van Rossum committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
/* Token types */

#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 BACKQUOTE	25
#define LBRACE		26
#define RBRACE		27
Guido van Rossum's avatar
Guido van Rossum committed
68 69 70 71
#define EQEQUAL		28
#define NOTEQUAL	29
#define LESSEQUAL	30
#define GREATEREQUAL	31
72 73 74 75
#define TILDE		32
#define CIRCUMFLEX	33
#define LEFTSHIFT	34
#define RIGHTSHIFT	35
76
#define DOUBLESTAR	36
77
/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */
78 79 80
#define OP		37
#define ERRORTOKEN	38
#define N_TOKENS	39
Guido van Rossum's avatar
Guido van Rossum committed
81 82 83 84 85 86 87 88 89 90

/* 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)


91 92 93
extern DL_IMPORT(char *) _PyParser_TokenNames[]; /* Token names */
extern DL_IMPORT(int) PyToken_OneChar Py_PROTO((int));
extern DL_IMPORT(int) PyToken_TwoChars Py_PROTO((int, int));
94 95 96 97 98

#ifdef __cplusplus
}
#endif
#endif /* !Py_TOKEN_H */