algorithm - Are unescaped user names incompatible with BNF? -


I have got a (proprietary) output from software that I have to parse. Sadly, there are unknown usernames and I want to know my hair whether I can explain the files to use a BNF (or EBNF or ABNF), can tell what I do Can i

The problem, exaggerated (this is actually just an example), can look like this:

(data) :: = & lt; Username & gt;
& lt; Username & gt; : = (Other types of data)

And in some cases, instead of looking at the left or right side, the user name can also appear in the middle of a line.

The problem is that the username is unexpected and there is not enough restriction on the user names (they are printable ASCII, maximum 20 characters and they can not contain line breaks). Therefore "=" will be a fully valid username, for example. And therefore "= 1 = John = 2" (because the user, in sign-on, where they were allowed to choose any user name and they appear unnecessary in my output).

I 'm asking because my parser succumbed to some very creative usernames (once again, under my control, they are "weird" and I need to deal with it) And I can not find an easy way to deal with it. Also keep in mind that I do not already know the name of the user (for example, I do not have access to such databases in which all users will be included in the username).

So is the name of the Incapathibles with the UNFREE and unnecessary user BNF?

PS: If I make a mistake, then keep it calm with me, this is my first post on stackoverflow :)

The BNF user name does not "care" for per-call, it works at the token level. If you set a username token, you can describe a grammar using BNF based on it.

Your problem should be resolved at the lixar level. The laser should be smart enough to recognize the names of the users, even if they do not survive, and passcode to username Pass the token.

In principle, you have all the types of users named after a grammar, but this is very much dependent on other things in your language. Is = a valid token on your rights? If it is, how can you tell a user name in addition to = ? I think you have to describe the rest of the rules and valid tokens in your language to get a complete answer in your answer.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -