eval: basic done
This commit is contained in:
parent
8619caa1b6
commit
3603776303
13
eval.c
13
eval.c
|
@ -3,6 +3,8 @@
|
|||
#include "lexer.h"
|
||||
#include "form.h"
|
||||
|
||||
// TODO: BLOCKQUOTE OL PROGRESS CODE TABLE
|
||||
|
||||
#define PAGE_WIDTH 80
|
||||
|
||||
#define EXPAND_LIT(x) x, sizeof(x)
|
||||
|
@ -45,8 +47,15 @@ void evaluate(Token* token){
|
|||
printf(FC_nBOLD);
|
||||
break_line();
|
||||
}
|
||||
else if (token->type == UL){
|
||||
state.inList = 1;
|
||||
}
|
||||
else if (token->type == UL){
|
||||
state.inList = 0;
|
||||
}
|
||||
else if (token->type == LI)
|
||||
{
|
||||
break_line();
|
||||
print_text(EXPAND_LIT("- "));
|
||||
}
|
||||
else if (token->type == END_LI)
|
||||
|
@ -92,6 +101,10 @@ void evaluate(Token* token){
|
|||
printf(FC_nUDL);
|
||||
print_text(EXPAND_LIT(" "));
|
||||
}
|
||||
else if (token->type == P)
|
||||
{
|
||||
if (!state.inList) break_line();
|
||||
}
|
||||
else if (token->type == END_P)
|
||||
{
|
||||
break_line();
|
||||
|
|
1
eval.h
1
eval.h
|
@ -8,6 +8,7 @@ typedef struct PageState {
|
|||
int x;
|
||||
int y;
|
||||
int beginLine;
|
||||
int inList;
|
||||
} PageState;
|
||||
|
||||
void evaluate(Token* token);
|
||||
|
|
2
lexer.c
2
lexer.c
|
@ -245,6 +245,8 @@ TokenType token_by_name(const char name[HTML_BALISE_LEN]){
|
|||
return HR;
|
||||
} else if (strncmp(name, "br", HTML_BALISE_LEN) == 0){
|
||||
return BR;
|
||||
} else if (strncmp(name, "p", HTML_BALISE_LEN) == 0){
|
||||
return P;
|
||||
} else if (strncmp(name, "/p", HTML_BALISE_LEN) == 0){
|
||||
return END_P;
|
||||
} else if (strncmp(name, "a", HTML_BALISE_LEN) == 0){
|
||||
|
|
Loading…
Reference in New Issue