changeset 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 6e2d03188d24
files ChangeLog lwasm/parse.c
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Dec 19 06:38:43 2009 +0000
+++ b/ChangeLog	Sun Dec 20 05:40:47 2009 +0000
@@ -35,6 +35,8 @@
 [ ] Added rejection for comment not starting at start of line but which
     looks like a symbol (single word ending in :, no space after ; or *)
     [LWASM]
+[ ] Support input files with line numbers for compatibility with EDTASM
+    and others that use line numbers [LWASM]
 
 Version 2.5
 
--- 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 == ';')