summaryrefslogtreecommitdiff
path: root/src/genbind-lexer.l
blob: 6150f096b66e8d004a92be63444d262d2ee9a90e (plain)
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
/*
 * binding generator lexer
 */

/* lexer options */
%option never-interactive
%option bison-bridge
%option nodefault
%option warn
%option debug
%option prefix="genbind_"
%option nounput

/* header block */
%{

#include <stdbool.h>
#include <stdio.h>
#include <string.h>

#include "genbind-parser.h"

%}

 /* other Unicode “space separator” */
USP (\xe1\x9a\x80)|(\xe1\xa0\x8e)|(\xe2\x80[\x80-\x8a])|(\xe2\x80\xaf)|(\xe2\x81\x9f)|(\xe3\x80\x80)

/* non breaking space \u00A0 */
NBSP (\xc2\xa0)

whitespace              ([ \t\v\f\n]|{NBSP}|{USP})

multicomment            \/\*(([^*])|(\*[^/]))*\*\/

quotedstring            [^\"\\\n\r]

other                   [^\t\n\r 0-9A-Z_a-z]

%%

{whitespace}            /* nothing */

webidlfile              return TOK_IDLFILE;

\"{quotedstring}*\"     yylval->text = strndup(yytext + 1,strlen(yytext+1) - 1 ); return TOK_STRING_LITERAL;

{multicomment}          /* nothing */

{other}                 return (int) yytext[0];

.                       /* nothing */

%%