now whitespaces are ignored & add makefile
This commit is contained in:
1 parent
d7257cfb96
commit
2ec690f514
7 files changed
+23
-8
No files matched your search
@@ -0,0 +1,15 @@
|
||||
CC=gcc
|
||||
CFLAGS=-c -Wall -std=c99 -O3
|
||||
LDFLAGS=
|
||||
SOURCES=src/main.c src/Scanner.c src/Generator.c
|
||||
OBJECTS=$(SOURCES:.c=.o)
|
||||
EXEC=pl0syntaxcolor
|
||||
|
||||
all: $(SOURCES) $(EXEC)
|
||||
|
||||
$(EXEC): $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
#include <fcntl.h>
|
||||
#include "Scanner.h"
|
||||
#include "Generator.h"
|
||||
#include "../include/Scanner.h"
|
||||
#include "../include/Generator.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
char* bottom(){
|
||||
@@ -12,7 +12,8 @@ char* header(){
|
||||
}
|
||||
|
||||
char* convertTokenToHtml(struct Token* token,char **colorTable){
|
||||
|
||||
if(token->type == whitespace)
|
||||
return token->buffer;
|
||||
char *buffer =(char*)malloc(sizeof(char)*2048);
|
||||
if(buffer == NULL){
|
||||
perror("problem with malloc:");
|
||||
@@ -34,7 +35,6 @@ void converToHtml(char *path,char **colorTable)
|
||||
appendTofile(header(),f);
|
||||
while(token.type != eof){
|
||||
token = scan(&file);
|
||||
printf("%s",token.buffer);
|
||||
appendTofile(convertTokenToHtml(&token,colorTable),f);
|
||||
}
|
||||
appendTofile(bottom(),f);
|
||||
|
||||
Binary file not shown.
+2
-2
@@ -1,10 +1,10 @@
|
||||
#include <fcntl.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "Scanner.h"
|
||||
#include "../include/Scanner.h"
|
||||
#include "errno.h"
|
||||
#include "stdlib.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
+2
-2
@@ -1,6 +1,6 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "Generator.h"
|
||||
#include "../include/Generator.h"
|
||||
#include "errno.h"
|
||||
#include "stdlib.h"
|
||||
#include <stdio.h>
|
||||
@@ -16,4 +16,4 @@ int main(){
|
||||
converToHtml("./test.txt",colorTable);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
Reference in new issue
Block a user