READMEのCASL II仕様書へのリンクを修正
[YACASL2.git] / include / token.h
1 #ifndef YACASL2_TOKEN_INCLUDE
2 #define YACASL2_TOKEN_INCLUDE
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 };
21
22 /**
23  * @brief YACASL2の制限
24  */
25 enum {
26     LINESIZE = 1024,       /**<行の最大文字数 */
27     TOKENSIZE = 256,       /**<トークンの最大文字数 */
28 };
29
30 /**
31  * @brief オペランドを表すデータ型
32  */
33 typedef struct {
34     int opdc;                   /**<オペランド数 */
35     char *opdv[OPDSIZE];        /**<オペランド配列 */
36 } OPD;
37
38 /**
39  * @brief 命令行を表すデータ型
40  */
41 typedef struct {
42     char *label;                /**<ラベル */
43     char *cmd;                  /**<コマンド */
44     OPD *opd;                   /**<オペランド */
45 } CMDLINE;
46
47 /**
48  * @brief トークン取得のエラーを追加する
49  *
50  * @return なし
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