From 26dc02ea577d4f880436d3c8d9e5611b8c8f2724 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 15 Dec 2010 00:45:49 -0300 Subject: [PATCH] cameo: fixed processing of omitted file names, documented file name usage - README: document that file names can contain almost anything - lang.l: reset the scanner state on \n, so that we stop looking for a file name if the file name has simply been omitted --- cameo/README | 13 +++++++++++++ cameo/lang.l | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cameo/README b/cameo/README index 1291851..281d763 100644 --- a/cameo/README +++ b/cameo/README @@ -48,6 +48,19 @@ File output: Writes all loaded paths in gnuplot format to the specified file. If the file name is omitted, "write" writes to standard output. +File names can contain spaces and any printable characters, but no leading +or trailing spaces. It is not possible to place a comment after a file +name or at a place where a file name could be. + +E.g., + + write foo.gp # wrong + +but + + write foo.gp + # right + Units: diff --git a/cameo/lang.l b/cameo/lang.l index 4672734..fedd1e8 100644 --- a/cameo/lang.l +++ b/cameo/lang.l @@ -84,7 +84,8 @@ NUM -?[0-9]+\.?[0-9]* return STRING; } [ \t] ; -\n lineno++; +\n { BEGIN(INITIAL); + lineno++; } ^#\ [0-9]+\ \"[^"]*\"(\ [0-9]+)*\n { lineno = strtol(yytext+2, NULL, 0); }