[genius] Thu Oct 07 12:38:44 2010 Jiri (George) Lebl <jirka 5z com>



commit badde45657ebc6782f8fee945232df57b55bb42d
Author: Jiri (George) Lebl <jirka 5z com>
Date:   Thu Oct 7 12:39:04 2010 -0700

    Thu Oct 07 12:38:44 2010  Jiri (George) Lebl <jirka 5z com>
    
    	* src/lexer.l: note that [^?] is may include newlines,
    	  must explicitly exclude them
    
    	* src/gnome-genius.c:  Add a trailing newline to programs unless
    	  given.  Fixes parse errors at end of file if ends on a comment
    	  or a lexer rule which expects endofline

 ChangeLog          |    9 +++++++++
 src/gnome-genius.c |    2 ++
 src/lexer.l        |   12 ++++++------
 3 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e88c296..e7e1fb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Thu Oct 07 12:38:44 2010  Jiri (George) Lebl <jirka 5z com>
+
+	* src/lexer.l: note that [^?] is may include newlines,
+	  must explicitly exclude them
+
+	* src/gnome-genius.c:  Add a trailing newline to programs unless
+	  given.  Fixes parse errors at end of file if ends on a comment
+	  or a lexer rule which expects endofline
+
 Thu Sep 30 15:28:50 2010  Jiri (George) Lebl <jirka 5z com>
 
 	* lib/linear_algebra/linear_algebra.gel: Fix CrossProduct and
diff --git a/src/gnome-genius.c b/src/gnome-genius.c
index 7acc8df..dff8ce4 100644
--- a/src/gnome-genius.c
+++ b/src/gnome-genius.c
@@ -3986,6 +3986,8 @@ run_program (GtkWidget *menu_item, gpointer data)
 			close (p[0]);
 			if (write (p[1], prog, len) < len) {
 				status = 1;
+			} else if (prog[len-1] != '\n') {
+				write (p[1], "\n", 1);
 			}
 			close (p[1]);
 			_exit (status);
diff --git a/src/lexer.l b/src/lexer.l
index a1b6763..b36fbf0 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -133,7 +133,7 @@ gel_lexer_close(FILE *fp)
 
 #.*$		; /*comment, ignore*/
 
-^[ 	]*load[ 	]+<([^>]|\\>)*>[ 	]*$ {
+^[ 	]*load[ 	]+<([^\n>]|\\>)*>[ 	]*$ {
 			char *s;
 			char *end;
 			char *dir;
@@ -152,7 +152,7 @@ gel_lexer_close(FILE *fp)
 			return LOADFILE;
 		}
 
-^[ 	]*load[ 	]+[^ 	].*$ {
+^[ 	]*load[ 	]+[^\n 	].*$ {
 			char *s;
 			if(gel_parsestack || gel_parenth_depth) {REJECT;}
 			s=strchr(yytext,'d')+1; /*move after the load*/
@@ -164,7 +164,7 @@ gel_lexer_close(FILE *fp)
 			return LOADFILE_GLOB;
 		}
 
-^[ 	]*cd[ 	]+[^ 	].*$ {
+^[ 	]*cd[ 	]+[^\n 	].*$ {
 			char *s;
 			if(gel_parsestack || gel_parenth_depth) {REJECT;}
 			s=strchr(yytext,'d')+1; /*move after the cd*/
@@ -176,7 +176,7 @@ gel_lexer_close(FILE *fp)
 			return CHANGEDIR;
 		}
 
-^[ 	]*plugin[ 	]+[^ 	].*$ {
+^[ 	]*plugin[ 	]+[^\n 	].*$ {
 			char *s;
 			if(gel_parsestack || gel_parenth_depth) {REJECT;}
 			s=strchr(yytext,'n')+1; /*move after the plugin*/
@@ -194,7 +194,7 @@ gel_lexer_close(FILE *fp)
 			return PWD;
 		}
 
-^[ 	]*ls[ 	]+[^ 	].*$ {
+^[ 	]*ls[ 	]+[^\n 	].*$ {
 			char *s;
 			if(gel_parsestack || gel_parenth_depth) {REJECT;}
 			s=strchr(yytext,'s')+1; /*move after the ls*/
@@ -212,7 +212,7 @@ gel_lexer_close(FILE *fp)
 			return LS;
 		}
 
-^[ 	]*help[ 	]+[^ 	].*$ {
+^[ 	]*help[ 	]+[^\n 	].*$ {
 			char *s;
 			if(gel_parsestack || gel_parenth_depth) {REJECT;}
 			s=strchr(yytext,'p')+1; /*move after the help*/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]