File: token.h

package info (click to toggle)
picasm 1.14-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 528 kB
  • ctags: 378
  • sloc: ansic: 4,481; asm: 150; makefile: 72
file content (169 lines) | stat: -rw-r--r-- 2,394 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
 * token.h
 *
 * Copyright 1995-2004 Timo Rossi, <trossi@iki.fi>
 * See the file LICENSE for license terms.
 *
 */

#define TOKSIZE 256

/*
 * token codes
 */
/**/
enum {
  TOK_INVALID,
  TOK_EOF,
  TOK_NEWLINE,
  TOK_COLON,
  TOK_PERIOD,
  TOK_DOLLAR,
  TOK_COMMA,
  TOK_LEFTPAR,
  TOK_RIGHTPAR,
  TOK_LEFTBRAK,
  TOK_RIGHTBRAK,
  TOK_EQUAL,
  TOK_EQ,
  TOK_NOT_EQ,
  TOK_LESS,
  TOK_LESS_EQ,
  TOK_GREATER,
  TOK_GT_EQ,
  TOK_PLUS,
  TOK_MINUS,
  TOK_ASTERISK,
  TOK_SLASH,
  TOK_PERCENT,
  TOK_BITAND,
  TOK_BITOR,
  TOK_BITXOR,
  TOK_BITNOT,
  TOK_LSHIFT,
  TOK_RSHIFT,
  TOK_BACKSLASH,
  TOK_IDENTIFIER,
  TOK_LOCAL_ID,
  TOK_INTCONST,
  TOK_STRCONST, /* used as file name with include, and in EDATA */

  KW_INCLUDE,
  KW_MACRO,
  KW_ENDM,
  KW_EXITM,
  KW_IF,
  KW_ELSE,
  KW_ENDIF,
  KW_EQU,
  KW_SET,
  KW_END,
  KW_ORG,
  KW_DS,
  KW_EDATA,
  KW_DT,
  KW_DATA,
  KW_CBLOCK,
  KW_ENDC,
  KW_CONFIG,
  KW_PICID,
  KW_DEVICE,
  KW_DEFINED,
  KW_HIBYTE,
  KW_STREQ,
  KW_STREQCASE,
  KW_ISSTR,
  KW_CHRVAL,
  KW_OPT,
  KW_LOCAL,
  KW_ENDLOCAL,
  KW_ERROR,

  KW_ADDLW,
  KW_ADDWF,
  KW_ANDLW,
  KW_ANDWF,
  KW_BCF,
  KW_BSF,
  KW_BTFSC,
  KW_BTFSS,
  KW_CALL,
  KW_CLRF,
  KW_CLRW,
  KW_CLRWDT,
  KW_COMF,
  KW_DECF,
  KW_DECFSZ,
  KW_GOTO,
  KW_INCF,
  KW_INCFSZ,
  KW_IORLW,
  KW_IORWF,
  KW_MOVLW,
  KW_MOVF,
  KW_MOVWF,
  KW_NOP,
  KW_OPTION,
  KW_RETFIE,
  KW_RETLW,
  KW_RETURN,
  KW_RLF,
  KW_RRF,
  KW_SLEEP,  
  KW_SUBLW,
  KW_SUBWF,
  KW_SWAPF,
  KW_TRIS,
  KW_XORLW,
  KW_XORWF,

  KW_ADDWFC,
  KW_BTG,
  KW_CPFSEQ,
  KW_CPFSGT,
  KW_CPFSLT,
  KW_DAW,
  KW_DCFSNZ,
  KW_INFSNZ,
  KW_LCALL,
  KW_MOVFP,
  KW_MOVPF,
  KW_MOVLB,
  KW_MOVLR,
  KW_MULLW,
  KW_MULWF,
  KW_NEGW,
  KW_RLCF,
  KW_RLNCF,
  KW_RRCF,
  KW_RRNCF,
  KW_SETF,
  KW_SUBWFB,
  KW_TABLRD,
  KW_TABLWT,
  KW_TLRD,
  KW_TLWT,
  KW_TSTFSZ,

  KW_SET_PIC_TYPE,

  KW_END_POS /* end marker */
};

#define FIRST_KW KW_INCLUDE
#define NUM_KEYWORDS (KW_END_POS-FIRST_KW)

extern int token_type, line_buf_off;
extern char token_string[TOKSIZE];
extern long token_int_val;
extern int tok_char;
extern int ifskip_mode;

/*prototypes*/

void get_token(void), skip_eol(void);
void expand_macro(struct symbol *sym);
void expand_macro_with_args(struct symbol *, char **, int, int);
void begin_include(char *fname, int, int), end_include(void);
void read_src_char(void);
void init_includes(void), add_include_path(char *);