/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Development/parsers/test/parser.fl

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%{
 
2
#include "parser.tab.h"
 
3
%}
 
4
 
 
5
stdnum          [[:digit:]]+(\.[[:digit:]]*)?
 
6
scinum          [[:digit:]]\.[[:digit:]]+[eE][+\-][[:digit:]]+
 
7
num             ({stdnum}|{scinum})
 
8
var             [[:alpha:]][[:alnum:]]*
 
9
minus_op        [\-]
 
10
plus_op         [+]
 
11
mult_op         [*]
 
12
div_op          [/]
 
13
eq_op           [=]
 
14
open_prnt       [\({\[]
 
15
close_prnt      [\)}\]]
 
16
operator        ({minus_op}|{plus_op}|{mult_op}|{div_op})
 
17
 
 
18
endline         [\n]
 
19
 
 
20
%%
 
21
 
 
22
{num}           { 
 
23
                    yylval.val = atof(yytext); 
 
24
                    return NUM; 
 
25
                }
 
26
{var}           {
 
27
                    yylval.var = strdup(yytext);
 
28
                    return VAR;
 
29
                }
 
30
{minus_op}      return '-';
 
31
{plus_op}       return '+';
 
32
{mult_op}       return '*';
 
33
{div_op}        return '/';
 
34
{open_prnt}     return '(';
 
35
{close_prnt}    return ')';
 
36
{eq_op}         return '=';
 
37
{endline}       return END;
 
38
.               /* ignoring */