1 #ifndef YACASL2_TOKEN_H_INCLUDED
2 #define YACASL2_TOKEN_H_INCLUDED
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 #include <stdbool.h>
8 #include <ctype.h>
9 #include <assert.h>
10 #include <errno.h>
11 #include "cerr.h"
12 #include "cmem.h"
13
14 /**
15 * @brief CASL IIの仕様
16 */
17 enum {
18 LABELSIZE = 8, /**<ラベルの最大文字数 */
19 OPDSIZE = 40, /**<オペラントの最大数。CASL IIシミュレータの制限 */
20 LITERALSIZE = 5, /**<リテラルの文字数。「=」と16進数4桁 */
21 };
22
23 /**
24 * @brief YACASL2の制限
25 */
26 enum {
27 LINESIZE = 1024, /**<行の最大文字数 */
28 TOKENSIZE = 256, /**<トークンの最大文字数 */
29 };
30
31 /**
32 * @brief オペランドを表すデータ型
33 */
34 typedef struct {
35 int opdc; /**<オペランド数 */
36 char *opdv[OPDSIZE]; /**<オペランド配列 */
37 } OPD;
38
39 /**
40 * @brief 命令行を表すデータ型
41 */
42 typedef struct {
43 char *label; /**<ラベル */
44 char *cmd; /**<コマンド */
45 OPD *opd; /**<オペランド */
46 } CMDLINE;
47
48 /**
49 * @brief トークン取得のエラーを追加する
50 *
51 */
52 void addcerrlist_tok();
53
54 /**
55 * @brief 行から、ラベル・コマンド・オペランドを取得する
56 *
57 * @return ラベル・コマンド・オペランド
58 *
59 * @param *line 行
60 */
61 CMDLINE *linetok(const char *line);
62
63 #endif