]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/mk_cmds/cmd_tbl.l
This commit was generated by cvs2svn to compensate for changes in r73188,
[FreeBSD/FreeBSD.git] / usr.bin / mk_cmds / cmd_tbl.l
1 %{
2 /*
3  * Copyright 1987, 1988 by MIT Student Information Processing Board.
4  *
5  * For copyright info, see copyright.h.
6  */
7
8 #include <string.h>
9 #include "y.tab.h"
10 #include "copyright.h"
11
12 extern char *last_token, *ds();
13
14 static int l_command_table()
15 {
16      last_token = "command_table";
17      return COMMAND_TABLE;
18 }
19
20 static int l_request()
21 {
22      last_token = "request";
23      return REQUEST;
24 }
25
26 static int l_unimplemented()
27 {
28      last_token = "unimplemented";
29      return UNIMPLEMENTED;
30 }
31
32 static int l_end()
33 {
34      last_token = "end";
35      return END;
36 }
37
38 static int l_quoted_string()
39 {
40      register char *p;
41      yylval.dynstr = ds(yytext+1);
42      if ( (p=rindex(yylval.dynstr, '"')) )
43           *p='\0';
44      last_token = ds(yylval.dynstr);
45      return STRING;
46 }
47
48 static int l_string()
49 {
50      yylval.dynstr = ds(yytext);
51      last_token = ds(yylval.dynstr);
52      return STRING;
53 }
54
55
56 %}
57
58 N       [0-9]
59 PC      [^\"]
60 AN      [A-Z_a-z0-9]
61 %%
62
63 command_table   return l_command_table();
64 request         return l_request();
65 unimplemented   return l_unimplemented();
66 end             return l_end();
67
68 [\t\n ]         ;
69
70 \"{PC}*\"       return l_quoted_string();
71
72 {AN}*           return l_string();
73
74 #.*\n           ;
75
76 .               return (*yytext);
77
78 %%
79