Custom Language grammar problem

Hi There,

Probably this is will be for most of you obvious and you can point me the right direction and I think I must do some elementary mistake but still struggling with some solution that would work .

Here is the problem:

1. I have put together my .bnf gramer
2. When I run a rule this against my file it has issue with white spaces e.g.

operation=(edit, create, search){
    layout { editing:true;}
    class { editing:true;}
    field { editing:true;}
    action { editing:true;}

The parser does not ignore white spaces and then the rule is broken both in the bnf and .flex. But when I change the code above into this without whitespaces  - 'the space between  the comma  an the create and so on then the rules is correctly recognized.

    layout { editing:true;}
    class { editing:true;}
    field { editing:true;}
    action { editing:true;}

My Question is is this responsibility of the parser or the actual token  how it is defined ?

I have following tokens:



        IDENTIFIER='regexp:[a-z ,A-Z,_]([a-z,A-Z,_,0-9])*'
        FLT_LITERAL='regexp:(([0-9])+\.([0-9])*|\.([0-9])+(e,E]([+,-])?([0-9])+)?([d,D,f,F,b,B])?|([0-9])+[e,E]([+,-])?([0-9])+([d,D,f,F,b,B])?|([0-9])+[d,D,f,F,b,B] )'

Please see the screenshots how the space breaks my rules. and the case when the rules works correctly.

Please all if you can help to put some light into this problem I will really appreciate.

Thanks allot,

Screen Shot 2013-12-02 at 12.31.15 PM.png
Screen Shot 2013-12-02 at 12.28.04 PM.png
Comment actions Permalink

Some extra info :

I just found that it has something to do with the syntax I have here.

valueOrList ::=  listValue (','  listValue)*

But it looks like this expression above does not work when there are spaces
operation=(create, xx, xxx)

What is the best way to write this construction ? where I have this after equals should match this:

selectorValue ::= '=' (simpleValue | '(' valueOrList ')' )
valueOrList ::=  listValue (','  listValue)*

and when its valueOrList inside parenths: ' ,' OR ', ' does not work ..


Comment actions Permalink

I had bad Regexp that included also into my keywords also the ',' and it messed everything.



Please sign in to leave a comment.