X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=src%2Ftoken.c;h=9731605c7a4189aef2e7464cd0792aeec38abd83;hp=02e304dd896a66019a40a020c91d6e3a79b89cb2;hb=7f7bde5dd1305cfc598fe09030c69aad0dc01368;hpb=555c5e8b851becc08ba661a9cb19f617d5a00c12 diff --git a/src/token.c b/src/token.c index 02e304d..9731605 100644 --- a/src/token.c +++ b/src/token.c @@ -1,7 +1,12 @@ -#include "casl2.h" +#include +#include +#include "cerr.h" +#include "cmem.h" #include "assemble.h" -/* 「,」区切りの文字列から、オペランドのトークンを取得 */ +/** + * 「,」区切りの文字列から、オペランドのトークンを取得 + */ OPD *opdtok(const char *str) { OPD *opd = malloc_chk(sizeof(OPD), "opd"); @@ -9,6 +14,13 @@ OPD *opdtok(const char *str) int sepc = ',', rcnt = 0; bool quoting = false; + CERR cerr_opdtok[] = { + { 117, "operand too many in DC" }, + { 118, "operand length too long" }, + { 121, "cannot get operand token" }, + { 123, "unclosed quote" }, + }; + addcerrlist(ARRAYSIZE(cerr_opdtok), cerr_opdtok); opd->opdc = 0; if(str == NULL) { return opd; @@ -63,13 +75,20 @@ OPD *opdtok(const char *str) return opd; } -/* 空白またはタブで区切られた1行から、トークンを取得 */ +/** + * 空白またはタブで区切られた1行から、トークンを取得する + */ CMDLINE *linetok(const char *line) { char *tokens, *p, *sepp; bool quoting = false; CMDLINE *cmdl = malloc_chk(sizeof(CMDLINE), "cmdl"); + CERR cerr_linetok[] = { + { 104, "label length is too long" }, + { 105, "no command in the line" }, + }; + addcerrlist(ARRAYSIZE(cerr_linetok), cerr_linetok); if(line == NULL || strlen(line) == 0) { return NULL; }