7 * Copyright (c) 2006 Maksim Yevmenkin <m_evmenkin@yahoo.com>
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * $Id: lexer.l,v 1.3 2006/09/07 21:06:53 max Exp $
34 #define L2CAP_SOCKET_CHECKED
35 #include <bluetooth.h>
41 #define YY_DECL int yylex(void)
44 %option yylineno noyywrap nounput noinput
52 hexbyte {hexdigit}{hexdigit}?
56 control_psm_word control_psm
57 interrupt_psm_word interrupt_psm
58 reconnect_initiate_word reconnect_initiate
59 battery_power_word battery_power
60 normally_connectable_word normally_connectable
61 hid_descriptor_word hid_descriptor
65 bdaddrstring {hexbyte}:{hexbyte}:{hexbyte}:{hexbyte}:{hexbyte}:{hexbyte}
66 hexbytestring 0x{hexbyte}
79 {device_word} return (T_DEVICE);
80 {bdaddr_word} return (T_BDADDR);
81 {control_psm_word} return (T_CONTROL_PSM);
82 {interrupt_psm_word} return (T_INTERRUPT_PSM);
83 {reconnect_initiate_word} return (T_RECONNECT_INITIATE);
84 {battery_power_word} return (T_BATTERY_POWER);
85 {normally_connectable_word} return (T_NORMALLY_CONNECTABLE);
86 {hid_descriptor_word} return (T_HID_DESCRIPTOR);
87 {true_word} return (T_TRUE);
88 {false_word} return (T_FALSE);
91 return (bt_aton(yytext, &yylval.bdaddr)?
92 T_BDADDRSTRING : T_ERROR);
98 yylval.num = strtoul(yytext, &ep, 16);
100 return (*ep == '\0'? T_HEXBYTE : T_ERROR);