Commit 18c59ade by Hampton Catlin

ZOMG SO MUCH WORK DONE

parent f0e44dc2
......@@ -4,26 +4,33 @@ CFLAGS=-I. -Wall -g
BIN=bin/
sassc: sassc.o
$(CC) $(CFLAGS) -o $(BIN)sassc sassc.o libsass.o context.o
$(CC) $(CFLAGS) -o $(BIN)sassc sassc.o libsass.o context.o parser.o emitter.o transforms.o
sassc.o: libsass.o
libsass.o: context.o
libsass.o: context.o parser.o emitter.o transforms.o
bstr: bstr/bsafe.o
bstr/bsafe.o:
build: prefix.o context.o exception.o
build: prefix.o context.o exception.o parser.o
prefix.o:
context.o:
exception.o:
context.o: tree.h
parser.o: context.o
emitter.o: context.o
transforms.o: context.o
test: clean build sassc
./spec.rb spec/basic/
test_context: context.o test_context.o
$(CC) $(CFLAGS) -o $(BIN)test_context test_context.o context.o
./$(BIN)test_context
test_context.o:
clean:
clean: clean_bin
rm -rf *.o
rm -rf sassc
\ No newline at end of file
clean_bin:
rm -rf bin/*
\ No newline at end of file
#include <setjmp.h>
#include <stdlib.h>
#include "tree.h"
#define CONTEXT_HEADER
typedef struct {
char *path; /* the full directory+filename of the source file */
char *src; /* the text of the entire source file */
char *pos; /* keeps track of the parser/scanner's current position */
size_t line; /* the number of the line currently being parsed/scanned */
jmp_buf env; /* the top of the exception-handling stack */
char *path; /* the full directory+filename of the source file */
char *src; /* the text of the entire source file */
char *result; /* the final result, after all compiling */
char *pos; /* keeps track of the parser's current position */
size_t line; /* the number of the line currently being parsed */
jmp_buf env; /* the top of the exception-handling stack */
sass_document *doc; /* the primary AST tree */
sass_document **imports; /* all imported files */
/* more to come */
} sass_context;
......
#include "emitter.h"
int sass_emit(sass_context *ctx) {
ctx->result = ctx->doc->src;
return 0;
}
\ No newline at end of file
#ifndef CONTEXT_HEADER
#include "context.h"
#endif
int sass_emit(sass_context *ctx);
\ No newline at end of file
#include <stdlib.h>
#include <stdio.h>
#include "exceptions.h"
#include "exception.h"
raise(int code) {
printf("Aborted with error code %d.", code);
......
#include "libsass.h"
#include "emitter.h"
#include "transforms.h"
#include "parser.h"
char * sass_file_compile(char *filepath, int options) {
sass_context *ctx = sass_make_context_from_file(filepath);
......@@ -9,4 +12,11 @@ char * sass_file_compile(char *filepath, int options) {
char * sass_string_compile(char *input, int options) {
sass_context *ctx = sass_make_context_from_string(input);
return ctx->src;
}
char * sass_compile(sass_context *ctx) {
sass_parse(ctx);
sass_transform(ctx);
sass_emit(ctx);
return ctx->result;
}
\ No newline at end of file
#include "bstr/bstrlib.h"
#include "context.h"
char * sass_file_compile(char *filepath, int options);
char * sass_string_compile(char *input, int options);
#include "parser.h"
#include <stdlib.h>
int sass_parse(sass_context *ctx) {
sass_document *doc = (sass_document*)malloc(sizeof(sass_document));
doc->src = ctx->src;
return 0;
}
\ No newline at end of file
#ifndef CONTEXT_HEADER
#include "context.h"
#endif
int sass_parse(sass_context *ctx);
\ No newline at end of file
#!/usr/bin/env ruby
searchpath = ARGV[0]
......
#include "transforms.h"
int sass_transform(sass_context *ctx) {
return 0;
}
\ No newline at end of file
#ifndef CONTEXT_HEADER
#include "context.h"
#endif
int sass_transform(sass_context *ctx);
\ No newline at end of file
typedef struct {
char *value;
} sass_expression;
typedef struct {
char *path; /* the full directory+filename of the source file */
sass_ruleset *rules[];
} sass_document;
char *value;
} sass_selector;
typedef struct {
sass_selector_group *selector;
sass_ruleset *rules[];
sass_declaration *declarations[];
} sass_ruleset;
char *value; // Strip out the #{} nonsense
int *indexes;
sass_expression **expressions;
} sass_property;
typedef struct {
sass_property *property;
......@@ -17,19 +18,17 @@ typedef struct {
} sass_declaration;
typedef struct {
char *value; // Strip out the #{} nonsense
int indexes[];
sass_expression *expressions[];
} sass_property;
typedef struct {
sass_selector *selectors[];
sass_selector **selectors;
} sass_selector_group;
typedef struct {
char *value;
} sass_selector;
sass_selector_group *selector;
struct sass_ruleset **rules;
sass_declaration **declarations;
} sass_ruleset;
typedef struct {
char *value;
} sass_expression;
\ No newline at end of file
char *path; /* the full directory+filename of the source file */
char *src; /* CHEAAAAATTTTT */
sass_ruleset **rules;
} sass_document;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment