File: CifScanner.l

package info (click to toggle)
librcsb-core-wrapper 1.005-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 16,432 kB
  • ctags: 3,504
  • sloc: xml: 122,915; cpp: 25,250; ansic: 3,737; makefile: 1,033; sh: 784; lex: 294; yacc: 235; perl: 213; python: 121; csh: 30
file content (135 lines) | stat: -rw-r--r-- 2,459 bytes parent folder | download | duplicates (6)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
%{ 
/* 
  PURPOSE:    DDL 2.1 compliant CIF file lexer ...
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "CifScannerInt.h"
#include "CifParser.h"

/*
#undef  YY_DECL
#define YY_DECL int CifParser::yylex()
#undef   FLEX_LEXER_INCLUDED
#define  FLEX_LEXER_INCLUDED
#include "CifParser.h"
#include "CifScanner.h"

*/

%}

/* %option noyywrap c++ yyclass="CifScanner" prefix="Cif" */
%option noinput
%option nounput

CR      \r
LF      \n
EOL     (({CR}{LF})|{LF})

%%

^;[^\n\r]*{EOL} { 
    int ret;

    ret = ProcessNoneFromScanner();
    if (ret == LSITEMVALUE_CIF)
        return ret;
       }

([ \t]|{EOL})+      {                                    /* white space */ 
    ProcessWhiteSpaceFromScanner();

    }

[Dd][Aa][Tt][Aa][_][^\n\r\t ]*   {                 /* data_ */ 
    int ret;

    ret = ProcessDataFromScanner();
    if (ret == DATABLOCK_CIF)
        return ret;
    }

[Ll][Oo][Oo][Pp][_]      {                        /* loop_ */
    int ret;

    ret = ProcessLoopFromScanner();
    if (ret == LOOP_CIF)
        return ret;
    }

[Ss][Tt][Oo][Pp][_]      {                        /* stop_ */
    ProcessStopFromScanner();
    }

[.]  {                                        /* Unknown */
    int ret;

    ret = ProcessDotFromScanner();
    if (ret == UNKNOWN_CIF)
        return ret;
     }

[?]  {                                        /* Missing */
    int ret;

    ret = ProcessQuestionFromScanner();
    if (ret == MISSING_CIF)
        return ret;
    }

[#][^\n\r]*   {                             /* COMMENT */
    ProcessCommentFromScanner();
    }

[_][^\n\r \t]+  {                /* Item names start with _ end with spaces*/
    int ret;

    ret = ProcessUnderscoreFromScanner();
    if (ret == ITEMNAME_CIF)
        return ret;
   }

[^\n\r \t]+   {  /* unquoted or mixed quote strings strings */
    int ret;

    ret = ProcessBadStringsFromScanner();
    if (ret == ITEMVALUE_CIF)
        return ret;
   }

[\'](.)*[\']([ \t]|{EOL})  { /*  Single Quoted Strings */
    int ret;

    ret = ProcessSQuotedStringsFromScanner();
    if (ret == ITEMVALUE_CIF)
        return ret;
   }


[\"](.)*[\"]([ \t]|{EOL})  {  /* Double Quoted Strings */
    int ret;

    ret = ProcessDQuotedStringsFromScanner();
    if (ret == ITEMVALUE_CIF)
        return ret;
   }


<<EOF>> {
    return (ProcessEofFromScanner());
}

%%

void cif_yy_less(int i)
{
    yyless(i);
}

int yywrap(void)
{
    return (1);
}