~ubuntu-branches/ubuntu/precise/pcb/precise

« back to all changes in this revision

Viewing changes to src/res_lex.l

  • Committer: Bazaar Package Importer
  • Author(s): Hamish Moffatt
  • Date: 2005-02-20 13:14:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050220131400-pfz66g5vhx0azl8f
Tags: 1.99j+20050127-2
* Improved package description: (closes: #295405)
* Fixed dependency: tk84 -> tk8.4 (closes: #295404)
* Updated README.debian (closes: #269578)
* Applied patch to src/djopt.c to allow compilation with gcc-4.0
  (closes: #294319), thanks to Andreas Jochens for the patch.
* Prevent example files from being compressed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: res_lex.l,v 1.6 2004/10/27 14:11:58 djdelorie Exp $ */
 
2
 
 
3
%{
 
4
 
 
5
#ifdef HAVE_CONFIG_H
 
6
#include "config.h"
 
7
#endif
 
8
 
 
9
#ifdef HAVE_STRING_H
 
10
#include <string.h>
 
11
#endif
 
12
 
 
13
#include "global.h"
 
14
#include "resource.h"
 
15
#include "res_parse.h"
 
16
 
 
17
#ifdef HAVE_LIBDMALLOC
 
18
#include <dmalloc.h>
 
19
#endif
 
20
 
 
21
RCSID("$Id: res_lex.l,v 1.6 2004/10/27 14:11:58 djdelorie Exp $");
 
22
 
 
23
#define YY_INPUT(buf,result,max_size) { result = res_parse_getchars(buf, max_size); }
 
24
 
 
25
extern int res_lineno;
 
26
extern int res_parse_getchars(char *buf, int max_size);
 
27
 
 
28
%}
 
29
 
 
30
%option prefix="res"
 
31
%option outfile="lex.yy.c"
 
32
%option yylineno
 
33
%option noyywrap
 
34
 
 
35
PARENSTR        ([^ (){}=\"\'\t\r\n]|\([^\)]*\))+
 
36
INCSTR          @[a-z0-9A-Z_]+
 
37
COMMENT         #[^\n]*
 
38
 
 
39
%%
 
40
 
 
41
\"[^"]*\"       { reslval.sval = strdup(yytext+1);
 
42
                  reslval.sval[strlen(reslval.sval) - 1] = 0;
 
43
                  return STRING; }
 
44
 
 
45
\'[^']*\'       { reslval.sval = strdup(yytext+1);
 
46
                  reslval.sval[strlen(reslval.sval) - 1] = 0;
 
47
                  return STRING; }
 
48
 
 
49
{COMMENT}\n     { res_lineno++; }
 
50
[ \t\r\n]       { if (yytext[0] == '\n') res_lineno++; }
 
51
 
 
52
{INCSTR}        { reslval.sval = strdup(yytext+1);
 
53
                          return INCLUDE; }
 
54
 
 
55
{PARENSTR}      { reslval.sval = strdup(yytext);
 
56
                          return STRING; }
 
57
 
 
58
.               { return yytext[0]; }
 
59
 
 
60
%%
 
61
 
 
62
/* ' */