File: r7hl.ll

package info (click to toggle)
tinymux 2.12.0.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,000 kB
  • sloc: cpp: 132,440; sh: 3,225; lex: 1,264; makefile: 238; ansic: 141
file content (94 lines) | stat: -rw-r--r-- 2,438 bytes parent folder | download | duplicates (2)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
%{
#include "omega.h"
#include "r7hgame.h"
#include "r7hl.tab.hpp"
%}

%option 8bit
%option noyywrap
%option prefix="r7hl"

%%

\#-?[0-9]+     {
                   R7H_LOCKEXP *ple = new R7H_LOCKEXP;
                   ple->SetRef(atoi(r7hltext+1));
                   r7hllval.ple = ple;
                   return DBREF;
               }
[^:/&|()]+\/[^&|()]+ {
                   char *p = strchr(r7hltext, '/');
                   R7H_LOCKEXP *ple1 = new R7H_LOCKEXP;
                   ple1->SetText(StringCloneLen(r7hltext, p-r7hltext));
                   R7H_LOCKEXP *ple2 = new R7H_LOCKEXP;
                   ple2->SetText(StringClone(p+1));
                   R7H_LOCKEXP *ple3 = new R7H_LOCKEXP;
                   ple3->SetEval(ple1, ple2);
                   r7hllval.ple = ple3;
                   return EVALLIT;
               }
[^:/&|()]+:[^&|()]+ {
                   char *p = strchr(r7hltext, ':');
                   R7H_LOCKEXP *ple1 = new R7H_LOCKEXP;
                   ple1->SetText(StringCloneLen(r7hltext, p-r7hltext));
                   R7H_LOCKEXP *ple2 = new R7H_LOCKEXP;
                   ple2->SetText(StringClone(p+1));
                   R7H_LOCKEXP *ple3 = new R7H_LOCKEXP;
                   ple3->SetAttr(ple1, ple2);
                   r7hllval.ple = ple3;
                   return ATTRLIT;
               }
\=             {
                   return '=';
               }
\+             {
                   return '+';
               }
\@             {
                   return '@';
               }
\$             {
                   return '$';
               }
\&             {
                   return '&';
               }
\|             {
                   return '|';
               }
\!             {
                   return '!';
               }
\(             {
                   return '(';
               }
\)             {
                   return ')';
               }
[\n\t ]+       /* ignore whitespace */ ;
.              { return EOF; }
%%

extern R7H_LOCKEXP *g_r7hKeyExp;
int r7hlparse();

R7H_LOCKEXP *r7hl_ParseKey(char *pKey)
{
    delete g_r7hKeyExp;
    g_r7hKeyExp = NULL;

    YY_BUFFER_STATE bp = r7hl_scan_string(pKey);
    r7hl_switch_to_buffer(bp);
    R7H_LOCKEXP *ple = NULL;
    if (r7hlparse())
    {
        delete g_r7hKeyExp;
    }
    else
    {
        ple = g_r7hKeyExp;
    }
    r7hl_delete_buffer(bp);
    g_r7hKeyExp = NULL;
    return ple;
}