File: command_lexer.l

package info (click to toggle)
cgdb 0.6.6-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 4,052 kB
  • sloc: ansic: 19,106; sh: 4,798; exp: 1,019; lex: 392; yacc: 255; makefile: 246; php: 28; cpp: 10
file content (74 lines) | stat: -rw-r--r-- 1,919 bytes parent folder | download | duplicates (3)
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
70
71
72
73
74
D           [0-9]
L           [a-zA-Z_]

%{
/* config_lexer.c
 * --------------
 * THIS FILE IS GENERATED, DO NOT EDIT 
 */

#include <string.h>
#include "command_lexer.h"

const char * get_token( void )
{
    return yytext;
}


%}

        int enter_map_id = 0;

/* An identifier used in a map like command */
%x MAP_ID

%%
        if (enter_map_id)
                BEGIN (MAP_ID);
        else
                BEGIN (INITIAL);

<INITIAL>
{
#[^\n]*                                                    { /* ignore comments */ }
"unset"                                                    { return UNSET; }
"set"                                                      { return SET; }
"bind"                                                     { return BIND; } 
"macro"                                                    { return MACRO; } 

(yes|YES|Yes|Y|y|no|NO|No|n|N)                             { return BOOLEAN; }
((<({L}|{D}|[^>])*>)|({L}({L}|{D})*))+\!?                   { return IDENTIFIER; }
[+-]?{D}+                                                  { return NUMBER; }
\"(\\.|[^\\"])*\"                                          { return STRING; }

"="                                                        { return '='; }
";"                                                        { return ';'; }
","                                                        { return ','; }


(\r\n|\n\r|\n|\r)                                          { return EOL; }
[ \t\v\f]                                                  { /* ignore white-space */ }
.                                                          { /* ignore bad-characters */ }
}

<MAP_ID>
{
" "     { /* ignore white space */ }
[^ ]+   { return IDENTIFIER; }
.       { /* ignore bad-characters */ }
}

%%

int yywrap( void )
{
	{
		/* Silly impossible function call to stop warning of unused functions */
		if ( 0 ) {
			yyunput(0, "");
		}
	}

    return 1;
}