diff lwasm/parse.c @ 255:6363b9ebf825 2.x

Support files with line numbers in lwasm
author lost
date Sun, 20 Dec 2009 05:40:47 +0000
parents c7a41b4c89b3
children 6d09310438a4
line wrap: on
line diff
--- a/lwasm/parse.c	Sat Dec 19 06:38:43 2009 +0000
+++ b/lwasm/parse.c	Sun Dec 20 05:40:47 2009 +0000
@@ -60,6 +60,18 @@
 	// also used by some pseudo ops on pass 2
 	if (as -> passnum == 1)
 		l -> codeaddr = as -> addr;
+
+	// check if there is a line number and ignore it if there is
+	if (isdigit(*p))
+	{
+		for (p2 = p; *p2 && isdigit(*p2); p2++)
+			/* do nothing */ ;
+		
+		// we have a line number, skip it and the *first*
+		// whitespace character
+		if (!*p2 || isspace(*p2))
+			p = p2 + 1;
+	}
 	
 	// if it's a comment, return (this doesn't cause a context change)
 	if (*p == '*' || *p == ';')