marrub
/
LoveToken
Archived
1
0
Fork 0
This repository has been archived on 2019-01-29. You can view files and clone it, but cannot push or open issues/pull-requests.
LoveToken/examples/main.c

41 lines
630 B
C

// This file is placed under public domain.
#include "lt.h"
#include <stdio.h>
int main(int argc, char **argv)
{
LT_Config initCfg = { 0 }; // we don't need to set any options here
LT_Token tk;
LT_OpenFile("a.txt");
LT_Init(initCfg);
while(tk.token != LT_TkNames[TOK_EOF])
{
LT_AssertInfo check;
tk = LT_GetToken();
check = LT_CheckAssert();
if(check.failure)
{
printf("%s\n", check.str);
break;
}
if(tk.string != NULL)
{
printf("%s\n", tk.string);
}
else
{
printf("%s\n", tk.token);
}
}
LT_CloseFile();
LT_Quit();
return 0;
}