m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/interpreter/query/Yylex
blob: 4dd8029fae59001ba814612bd4cd6bf9b24894f4 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// This JLex file was machine-generated by the BNF converter
package pl.edu.mimuw.mmws.cloudatlas.query;

import java_cup.runtime.*;
%%
%cup
%unicode
%line
%public
%{
  String pstring = new String();
  public int line_num() { return (yyline+1); }
  public String buff() { return new String(yy_buffer,yy_buffer_index,10).trim(); }
%}
LETTER = ({CAPITAL}|{SMALL})
CAPITAL = [A-Z\xC0-\xD6\xD8-\xDE]
SMALL = [a-z\xDF-\xF6\xF8-\xFF]
DIGIT = [0-9]
IDENT = ({LETTER}|{DIGIT}|['_])
%state COMMENT
%state CHAR
%state CHARESC
%state CHAREND
%state STRING
%state ESCAPED
%%
<YYINITIAL>; { return new Symbol(sym._SYMB_0); }
<YYINITIAL>, { return new Symbol(sym._SYMB_1); }
<YYINITIAL>\+ { return new Symbol(sym._SYMB_2); }
<YYINITIAL>- { return new Symbol(sym._SYMB_3); }
<YYINITIAL>\* { return new Symbol(sym._SYMB_4); }
<YYINITIAL>/ { return new Symbol(sym._SYMB_5); }
<YYINITIAL>% { return new Symbol(sym._SYMB_6); }
<YYINITIAL>\( { return new Symbol(sym._SYMB_7); }
<YYINITIAL>\) { return new Symbol(sym._SYMB_8); }
<YYINITIAL>> { return new Symbol(sym._SYMB_9); }
<YYINITIAL>= { return new Symbol(sym._SYMB_10); }
<YYINITIAL><> { return new Symbol(sym._SYMB_11); }
<YYINITIAL>< { return new Symbol(sym._SYMB_12); }
<YYINITIAL><= { return new Symbol(sym._SYMB_13); }
<YYINITIAL>>= { return new Symbol(sym._SYMB_14); }
<YYINITIAL>AND { return new Symbol(sym._SYMB_15); }
<YYINITIAL>AS { return new Symbol(sym._SYMB_16); }
<YYINITIAL>ASC { return new Symbol(sym._SYMB_17); }
<YYINITIAL>BY { return new Symbol(sym._SYMB_18); }
<YYINITIAL>DESC { return new Symbol(sym._SYMB_19); }
<YYINITIAL>FIRST { return new Symbol(sym._SYMB_20); }
<YYINITIAL>LAST { return new Symbol(sym._SYMB_21); }
<YYINITIAL>NOT { return new Symbol(sym._SYMB_22); }
<YYINITIAL>NULLS { return new Symbol(sym._SYMB_23); }
<YYINITIAL>OR { return new Symbol(sym._SYMB_24); }
<YYINITIAL>ORDER { return new Symbol(sym._SYMB_25); }
<YYINITIAL>REGEXP { return new Symbol(sym._SYMB_26); }
<YYINITIAL>SELECT { return new Symbol(sym._SYMB_27); }
<YYINITIAL>WHERE { return new Symbol(sym._SYMB_28); }

<YYINITIAL>true|false { return new Symbol(sym.QBool, yytext().intern()); }
<YYINITIAL>({LETTER}|&)({LETTER}|{DIGIT}|_)* { return new Symbol(sym.QIdent, yytext().intern()); }
<YYINITIAL>{DIGIT}*\.{DIGIT}+([eE]-?{DIGIT}+)?|{DIGIT}+([eE]-?{DIGIT}+) { return new Symbol(sym.QDouble, yytext().intern()); }
<YYINITIAL>0|[123456789]{DIGIT}* { return new Symbol(sym.QInteger, yytext().intern()); }

<YYINITIAL>"\"" { yybegin(STRING); }
<STRING>\\ { yybegin(ESCAPED); }
<STRING>\" { String foo = pstring; pstring = new String(); yybegin(YYINITIAL); return new Symbol(sym._STRING_, foo.intern()); }
<STRING>.  { pstring += yytext(); }
<ESCAPED>n { pstring +=  "\n"; yybegin(STRING); }
<ESCAPED>\" { pstring += "\""; yybegin(STRING); }
<ESCAPED>\\ { pstring += "\\"; yybegin(STRING); }
<ESCAPED>t  { pstring += "\t"; yybegin(STRING); }
<ESCAPED>.  { pstring += yytext(); yybegin(STRING); }





<YYINITIAL>[ \t\r\n\f] { /* ignore white space. */ }