]> mj.ucw.cz Git - leo.git/blobdiff - css-lex.c
Inline styles can be specified in object tags
[leo.git] / css-lex.c
index 754c52674849200f444ed380a6b41536ef44ca3a..ae6727168b5315161f8df805c770bb544e63059c 100644 (file)
--- a/css-lex.c
+++ b/css-lex.c
@@ -1,7 +1,7 @@
 /*
  *     Experimenta lMai Renderer -- MapCSS Lexer
  *
- *     (c) 2014 Martin Mares <mj@ucw.cz>
+ *     (c) 2014--2015 Martin Mares <mj@ucw.cz>
  */
 
 #include <ucw/lib.h>
@@ -17,6 +17,7 @@
 #include "css-parse.h"
 
 static struct fastbuf *fb;
+static struct fastbuf fbbuf;
 static int lino;
 
 void css_error(char *err, ...)
@@ -38,11 +39,23 @@ void css_lex_close(void)
   bclose(fb);
 }
 
+void css_lex_string(const char *str)
+{
+  fbbuf_init_read(&fbbuf, (char *) str, strlen(str), 0);
+  fb = &fbbuf;
+}
+
 int css_lex(void)
 {
   struct mempool *mp = css_this->pool;
   char *p;
-  int c, next, len;
+  int c, next, len, tok;
+
+  if (tok = css_this->pushed_token)
+    {
+      css_this->pushed_token = 0;
+      return tok;
+    }
 
   for (;;)
     {