os-cmpi-xen

view src/Xen_SettingDataLexer.l @ 121:4868ace2726b

Add initial consistence checks in test suite for Xen_MemoryPool, Xen_ProcessorPool and Xen_VirtualSystemManagementService.

Signed-off-by: Luke Szymanski <Lukasz.Szymanski@Unisys.com>
author Jim Fehlig <jfehlig@novell.com>
date Fri Jun 08 10:22:05 2007 -0600 (2007-06-08)
parents 1faa76de765e
children
line source
1 /*** WARNING - COMMENTS IN LEX MUST BE TAB INDENTED ***/
3 /* DEFINITIONS SECTION */
4 /* Everything between %{ ... %} is copied verbatim to the start of the lex generated C code. */
6 %{
7 #include "cmpidt.h"
8 #include <string.h>
9 #include "Xen_SettingDataParser.h"
10 #ifndef YY_FLEX_LEX_COMPAT
11 int yylineno = 1;
12 #endif
13 %}
15 /* Some useful regular expressions to use in the RULES section */
16 DIGIT ([0-9])
17 ALPHA ([A-Za-z])
18 ALPHANUMERIC ([A-Za-z0-9])
19 PUNCTUATION ([\,\.\:\(\)\-\!\"\'\`\^])
20 ARITHMETIC ([\+\-\*\/\<\>\=])
21 WHITESPACE ([\t ]+)
22 EOLN (\n)
23 NUMBER ([0-9]+)
24 INTEGER (-?[0-9]+)
25 REAL (-?[0-9]+\.[0-9]+)
26 WORD ([A-Za-z]+)
27 QUOTEDTEXT (\"[^"\n]*["\n])
28 SINGLEQUOTEDTEXT (\'[^'\n]*['\n])
29 FILENAME ([A-Za-z0-9\.][A-Za-z0-9\.\-\+\_]*)
30 PATHNAME (\/?[A-Za-z0-9\.][A-Za-z0-9\.\-\+\_]*(\/[A-Za-z0-9\.][A-Za-z0-9\.\-\+\_]*)*\/?)
31 HOSTNAME ([A-Za-z][A-Za-z0-9\-\_]*(\.[A-Za-z][A-Za-z0-9\-\_]*)*)
32 IPADDR ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)
34 /* Special mode to read CLASSNAME after reading INSTANCE OF, otherwise cannot distinguish this token from a PROPERTYNAME */
35 %x READCLASSNAME
37 /* Use the default yywrap() behavior */
38 %option noyywrap
40 /* END OF DEFINITIONS SECTION */
41 %%
42 /* RULES SECTION */
43 /* DESCRIBE EVERY LEXICAL TOKEN/PATTERN FOLLOWED BY THE APPROPRIATE ACTION.
44 TYPICALLY THE ACTION RETURNS THE TOKEN IDENTIFIER AND ITS VALUE (IN YYLVAL) */
46 /* The following simple lexical tokens only return the token identifier */
48 instance |
49 Instance |
50 INSTANCE {
51 return(INSTANCE);
52 }
54 of |
55 Of |
56 OF {
57 BEGIN READCLASSNAME; /* Read in classname as next token */
58 return(OF);
59 }
61 /* The following lexical tokens return the token identifier and the value of the token (in yylval) */
63 true |
64 True |
65 TRUE {
66 yylval.boolean = 1;
67 return(BOOLEAN);
68 }
70 false |
71 False |
72 FALSE {
73 yylval.boolean = 0;
74 return(BOOLEAN);
75 }
77 {INTEGER} {
78 yylval.sint64 = atoi(yytext);
79 return(INTEGER);
80 }
82 {QUOTEDTEXT} |
83 {SINGLEQUOTEDTEXT} {
84 yylval.string = (char *)strdup(yytext+1);
85 yylval.string[strlen(yylval.string)-1] = '\0';
86 return(STRING);
87 }
89 /* Classname */
90 /* NOTE - this rule only applies after a 'INSTANCE OF' has been read in */
91 <READCLASSNAME>[A-Za-z][A-Za-z0-9_]* {
92 BEGIN INITIAL; /* Go back to normal parsing rules now */
93 yylval.string = (char *)strdup(yytext);
94 return(CLASSNAME);
95 }
97 /* Propertyname */
98 [A-Za-z][A-Za-z0-9_]* {
99 yylval.string = (char *)strdup(yytext);
100 return(PROPERTYNAME);
101 }
103 /* Ignore end-of-line */
104 {EOLN} {
105 yylineno++;
106 }
108 <<EOF>> {
109 return(ENDOFFILE);
110 }
112 /* Ignore whitespace */
113 {WHITESPACE} ;
115 /* Return single character punctuation characters as-is */
116 . {
117 return(yytext[0]);
118 }
120 /* END OF RULES SECTION */
121 %%
122 /* USER SUBROUTINE SECTION */
123 /* Everything below is copied verbatim to the end of the lex generated C code. */
125 void yyerror(char *errmsg)
126 {
127 fprintf(stderr, "error line %d: %s in '%s'\n", yylineno, errmsg, yytext);
128 }