1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-04 23:29:42 +02:00

b2/: allow ...% to be recognized as a single WORD (for values)

This commit is contained in:
Werner Almesberger 2012-04-28 11:57:47 -03:00
parent 98f2fc8337
commit 433b03a59d
2 changed files with 11 additions and 3 deletions

View File

@ -1,2 +1,2 @@
FOO R101X FP=0603 R=100R TOL=5x
FOO R102Y FP=0603 R=1k TOL=1x
FOO R101X FP=0603 R=100R TOL=5%
FOO R102Y FP=0603 R=1k TOL=1%

View File

@ -46,6 +46,14 @@ void parse_characteristics(void)
%}
/*
* We use ID for a bit of a hack: let %... be recognized as '%' WORD but treat
* ...% still as a single WORD.
*/
ID [-_A-Za-z0-9()+./]
%%
%{
@ -57,7 +65,7 @@ void parse_characteristics(void)
}
%}
[-_A-Za-z0-9()+./]+ { yylval.s = unique(yytext);
{ID}({ID}|"%")* { yylval.s = unique(yytext);
return WORD; }
"<=" return TOK_LE;