#include <sc_os.h>
#include <stdio.h>

#include "kscript_token.h"

int main(int argc, char* argv[])
{
	int i;
	KScriptTokenStatus status;
	KScriptToken*      token;

	status.token   = SC_List_new();
	status.tmpBuff = SC_String_new(256);
	status.ptr     = NULL;
	status.isNowBlockComment = false;
	status.nestingComment    = 0;


	printf("INPUT argv[1] = %s\n", argv[1]);
	KScript_parseLine(&status, argv[1], 0);


	for (i = 0; i < status.token->size; i++)
	{
		token = (KScriptToken*) status.token->get(status.token, i, NULL);
		if (token->tokenString == NULL)
		{
			printf("[%03d] type=%d, key=%d, line=%d\n",
				i, token->tokenType, token->tokenKeyword, token->lineNumber);
		}
		else
		{
			printf("[%03d] type=%d, key=%d, line=%d string=%s\n",
				i, token->tokenType, token->tokenKeyword, token->lineNumber,
				token->tokenString->buffer);
		}
	}
	return 0;
}
