diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-12-15 16:47:22 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-12-15 16:47:22 -0500 |
| commit | 195c332a2314305392ee2a09272e3fbd4f1b134a (patch) | |
| tree | 83c347400389e7d5c8693d6e089b233fa9fb8f3f | |
| parent | 7d3b0b917cdb93d249dc356db8471fe9e6863424 (diff) | |
| download | libctemplates-195c332a2314305392ee2a09272e3fbd4f1b134a.tar.gz libctemplates-195c332a2314305392ee2a09272e3fbd4f1b134a.tar.bz2 libctemplates-195c332a2314305392ee2a09272e3fbd4f1b134a.zip | |
Make tokenize return double-linked list
Tokenize now has a doubly linked list of toekns, for additionall
help parsing break/continue instructions.
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | src/ctemplates.c | 1 | ||||
| -rw-r--r-- | src/ctemplates.h | 1 |
3 files changed, 3 insertions, 1 deletions
@@ -23,7 +23,7 @@ $(objfiles) : build/%.o : src/%.c src/%.h $(CC) $(CFLAGS) -c -o $@ $< clean: - rm -f build/*.o *.a template + $(RM) build/*.o *.a $(LIBNAME) $(TEST_1_NAME): t/test_1.c $(LIBNAME) $(CC) $(CFLAGS) -o $(TEST_1_NAME) t/test_1.c -lctemplates diff --git a/src/ctemplates.c b/src/ctemplates.c index b8d9931..8138f7c 100644 --- a/src/ctemplates.c +++ b/src/ctemplates.c @@ -456,6 +456,7 @@ TMPL_tokenize(const char* tmplstr, size_t m_strlen){ newnode = scan_tag(textcursor,m_strlen,&newlength); newnode->type = ttype; } + newnode->last = tokencursor; tokencursor->next = newnode; textcursor += newlength; m_strlen -= newlength; diff --git a/src/ctemplates.h b/src/ctemplates.h index 1df0f43..eafabac 100644 --- a/src/ctemplates.h +++ b/src/ctemplates.h @@ -175,6 +175,7 @@ struct TMPL_token{ enum TMPL_tagtype type;//The type of token size_t length;//Length of token, should always be end-start struct TMPL_token* next;//The next token + struct TMPL_token* last;//The last token unsigned int line;// Not used currently unsigned int character;// Not used currently }TMPL_token; |
