File: dotImportLexer.l

package info (click to toggle)
tulip 4.8.0dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 179,264 kB
  • ctags: 64,517
  • sloc: cpp: 600,444; ansic: 36,311; makefile: 22,136; python: 1,304; sh: 946; yacc: 522; xml: 337; pascal: 157; php: 66; lex: 55
file content (69 lines) | stat: -rw-r--r-- 2,006 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
// DOT language parser for the Tulip software
// [ http://www.research.att.com/sw/tools/graphviz/ ]
//
// 08/02/2004 - Gerald Gainant (aka maGicG)
//
//		First (quick) support of the AT&T DOT language
//		o main graph entities are extracted (node/edges)
//		o subgraphes are not already supported
//		o several attributes (node & edge) are supported
//		o based on a modified grammar file available with the graphviz' softwares
//		o this parser can be largely optimised ...
*/

%option noyywrap

%{

#define YY_NO_UNPUT
int line_num  = 1;
int html_nest = 0;

%}

mep							[ \t\r]+
alpha						[A-Za-z]
digit						[0-9]
id							([_]|{alpha})([_]|{alpha}|{digit})*
inum						[-+]?{digit}+\.?([eE][-+]?{digit}+)?
fnum						[-+]?{digit}*\.{digit}+([eE][-+]?{digit}+)?
num							{inum}|{fnum}

%x comment qstring hstring

%%

{mep}
<INITIAL,comment>\n			line_num++;
"/*"						BEGIN(comment);
<comment>[^*\n]*
<comment>"*"+[^*/\n]*
<comment>"*"+"/"			BEGIN(INITIAL);
"//".*
"#".*
"strict"					yylval.s = yytext; return _STRICT;
"digraph"					yylval.s = yytext; return _DIGRAPH;
"graph"						yylval.s = yytext; return _GRAPH;
"node"						yylval.s = yytext; return _NODE;
"edge"						yylval.s = yytext; return _EDGE;
"subgraph"					yylval.s = yytext; return _SUBGRAPH;
"--"|"->"					yylval.s = yytext; return _EDGEOP;
{num}						yylval.s = yytext; return NUMBER;
{id}						yylval.s = yytext; return IDENT;
["]							BEGIN(qstring); yylval.s.resize(0);
<qstring>["]				BEGIN(INITIAL); return STRING;
<qstring>[\\][\n]			line_num++;
<qstring>[^"\\]*			yylval.s += yytext;
<qstring>[\\].				yylval.s += yytext;
[<]							BEGIN(hstring); html_nest = 1; yylval.s.resize(0);
<hstring>[>]				html_nest--; if(html_nest) yylval.s+=yytext; else {BEGIN(INITIAL); return STRING;}
<hstring>[<]				html_nest++; yylval.s+=yytext;
<hstring>[\\][<]			yylval.s+="<";
<hstring>[\\][>]			yylval.s+=">";
<hstring>[\\][\n]			line_num++;
<hstring>([^><\\]*|[\\].)	yylval.s+=yytext;
.							yylval.s = yytext; return yytext[0];

%%