diff lwcc/cpp/file.c @ 294:048adfee2933 ccdev

Checkpoint on lwcc-cpp development This checkpoint includes a tokenizer and basic implementation of #if, #ifdef, #ifndef, #else, #endif, #elif, and #undef along with basic symbol table management.
author William Astle <lost@l-w.ca>
date Tue, 10 Sep 2013 19:56:05 -0600
parents c419b3b3d43f
children
line wrap: on
line diff
--- a/lwcc/cpp/file.c	Mon Sep 09 23:07:19 2013 -0600
+++ b/lwcc/cpp/file.c	Tue Sep 10 19:56:05 2013 -0600
@@ -269,6 +269,30 @@
 	return c;
 }
 
+void skip_eol(void)
+{
+	int c;
+	for (;;)
+	{
+		c = fetch_byte();
+		if (c == CPP_EOF || c == CPP_EOL)
+		{
+			unfetch_byte(c);
+			return;
+		}
+		if (c == '/')
+		{
+			c = munch_comment();
+			if (c > 0)
+			{
+				while (c--)
+					outchr(CPP_EOL);
+			}
+		}
+	}
+}
+
+
 /* This function opens (if not stdin) the file f and pushes it onto the
    top of the input file stack. It then proceeds to process the file
    and return. Nonzero return means the file could not be opened. */