1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2025-04-21 12:27:27 +03:00

cameo: various scanner and parser fixes

- README, lang.y: changed depth parameter of "z" command to position
  (sign changes)
- lang.l: defer FILENAME after "gerber" and "gnuplot", so that we don't
  mis-read the number
- lang.l, lang.y: return the reference point after "align" as new token
  REF, not as NUMEBER, so that we can catch syntax errors that would
  cause scanner and parser to become unsynchronized
- lang.l: accept negative numbers
- lang.l: added support for comments beginning with #
This commit is contained in:
Werner Almesberger
2010-12-14 16:49:26 -03:00
parent fe50addf65
commit ddcf5191db
3 changed files with 27 additions and 16 deletions

View File

@@ -118,7 +118,7 @@ static void align(int ref, double x, double y)
%token TOK_GERBER TOK_GNUPLOT TOK_WRITE
%token TOK_DOG
%token <num> NUMBER
%token <num> NUMBER REF
%token <str> STRING
%type <str> opt_filename
@@ -130,11 +130,11 @@ all:
;
command:
TOK_ALIGN NUMBER NUMBER NUMBER
TOK_ALIGN REF NUMBER NUMBER
{
align((int) $2, $3, $4);
}
| TOK_ALIGN NUMBER NUMBER NUMBER NUMBER NUMBER
| TOK_ALIGN REF NUMBER NUMBER NUMBER NUMBER
{
int ref = $2;
double x, y;
@@ -179,11 +179,11 @@ command:
}
| TOK_Z NUMBER
{
zo -= $2;
zo += $2;
}
| TOK_Z NUMBER NUMBER
{
zo -= $2+$3;
zo += $3-$2;
}
| TOK_GERBER NUMBER opt_filename
{