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.

operation=(edit,create,search){
    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:

tokens=[
       LINE_COMMENT='regexp://.*'
       BLOCK_COMMENT='regexp:/\*((?<!\*/)(.|\n))*'

        SEMI=";"
        COLON=":"
        OP_EQ="="
        AT="@"
        HASH="#"
        DOT="."
        LEFT_PARENTH="("
        RIGHT_PARENTH=")"
        LEFT_BRACE="{"
        RIGHT_BRACE="}"
        LEFT_BRACKET="["
        RIGHT_BRACKET="]"
        NEXT="=>"
        STAR="*"
        NEGATE="~"
        EXCL_MARK="!"
        EXPR_LITERAL='regexp:\${1,2}\{([^}]*)}'

        STRING_LITERAL='regexp:"[^"]*"'
        SQ_STRING_LITERAL="regexp:'[^']*'"
        IDENTIFIER='regexp:[a-z ,A-Z,_]([a-z,A-Z,_,0-9])*'
        KEY_PATH='regexp:[a-z,A-Z,_]([a-z,A-Z,_,0-9,.,\$])*'
        DYN_FIELDPATHBINDING='regexp:\$[a-z,A-Z,_]([a-z,A-Z,_,0-9,.])*'
        LOCALIZATION_KEY='regexp:\$\[[a-z,A-Z,_,0-9]*\]'
        INT_LITERAL='regexp:(0([0-7])*|[1-9]([0-9])*|0[x,X]([0-9,a-f,A-F])+)([l,L,h,H])?'
        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,
Frantisek



Attachment(s):
Screen Shot 2013-12-02 at 12.31.15 PM.png
Screen Shot 2013-12-02 at 12.28.04 PM.png
2 comments
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 ..

Thanks,
Frantisek  

0
Comment actions Permalink

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

FK

0

Please sign in to leave a comment.