File: GAFFCESParserLexer.l

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 239,888 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; makefile: 95
file content (87 lines) | stat: -rw-r--r-- 2,109 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
%{

#include <BALL/MOLMEC/AMBER/GAFFCESParser.h>
#include "GAFFCESParserParser.h"
#include <BALL/COMMON/parserDefinitions.h>

using namespace BALL;


#include <string.h>

#define YY_INPUT(buf,result,max_size) \
{ \
	result = GAFFCESParser::state.current_parser->read(buf, max_size);\
}


%}

%option noyywrap
%option nounput

%x APS

/*definition */
INTEGER 			[1-4]
SYMBOL  			[A-Z]+[A-Za-z]?
START_PROPERTY "["
END_PROPERTY   "]"

/*rules*/
%%
{INTEGER} {GAFFCESParserlval.number = atoi(yytext); return OPTIONAL_NUMBER;}
{SYMBOL} 	{GAFFCESParserlval.text = yytext; return ATOMSTRING;}

{START_PROPERTY} {BEGIN(APS); return TK_APS_START;}

<APS>","  {return TK_APS_AND_TERM;}
<APS>"."  {return TK_APS_OR_TERM;}

<APS>"DL" {return TK_APS_DELOCALIZED;}
<APS>"SB" {return TK_APS_PURE_SINGLE_BOND;}
<APS>"DB" {return TK_APS_PURE_DOUBLE_BOND;}
<APS>"TB" {return TK_APS_TRIPLE_BOND;}
<APS>"AB" {return TK_APS_AROMATIC_BOND;}
<APS>"sb" {return TK_APS_ALL_SINGLE_BONDS;}
<APS>"db" {return TK_APS_ALL_DOUBLE_BONDS;}
<APS>"tb" {return TK_APS_TRIPLE_BOND;}
<APS>"''" {return TK_APS_NOT_BOUND_TO_PARENT;}
<APS>"'"  {return TK_APS_BOUND_TO_PARENT;}

<APS>"AR1" {return TK_APS_PURE_AROMATIC_RING;}
<APS>"AR2" {return TK_APS_PLANAR_RING;}
<APS>"AR3" {return TK_APS_PLANAR_RING_WITH_DB;}
<APS>"AR4" {return TK_APS_OTHER_RING_ATOM;}
<APS>"AR5" {return TK_APS_PURE_ALIPHATIC_RING;}

<APS>"RG3" {return TK_APS_THREE_RING;}
<APS>"RG4" {return TK_APS_FOUR_RING;}
<APS>"RG5" {return TK_APS_FIVE_RING;}
<APS>"RG6" {return TK_APS_SIX_RING;}
<APS>"RG7" {return TK_APS_SEVEN_RING;}
<APS>"RG8" {return TK_APS_EIGHT_RING;}
<APS>"RG9" {return TK_APS_NINE_RING;}
<APS>"RG"	 {return TK_APS_RING;}
<APS>"NR"	 {return TK_APS_NON_RING;}
<APS>"*"	 {return TK_APS_TRUE;}

<APS>[0-9]+ {GAFFCESParserlval.number = atoi(yytext); return TK_APS_NUMBER;}

<APS>{END_PROPERTY}	 {BEGIN(INITIAL); return TK_APS_END;}

"("				{return TK_OPEN;}
")"				{return TK_END;}
","				{return TK_AND;}
"*"				{return TK_MATCH_TRUE;}


%%
/*user defined routines*/

void GAFFCESParser_destroy()
{
#ifdef BALL_HAS_YYLEX_DESTROY
	GAFFCESParserlex_destroy();
#endif
}