Can any one suggest how to parse TEXT using ABNF grammar?
Installed abnf module. I have grammar in abc.abnf file. I have text content in abc.txt file. I am successful in validating the grammar. I want content in abc.txt need to validated against abc.abnf grammar.
I just want to convert below text message into Json after parsing/validating...
Input Text
DMS/6
Dinesh-Sr.Anlayst/12345678
DBMS/PLSQL/JOINS
DATASTRUCTURE/TRESS/GRAPHS
{
"message": "DMS",
"version": "6"
"employee": {
"name":"dinesh",
"designation": "Sr,Analyst",
"contact": "12345678"
}
"skills": {
"dbms": {
"PLSQL",
"Joins"
},
"datastructure": {
"Trees",
"Graphs"
}
}
}
====
Grammar i tried
DMS =
MessageInfo
Employe
e
Skills;
MessageInfo = MessageIdentifier
Slant
Version
CRLF;
Employee =
name
Hyphen
Designation
Slant
contact;
Skils =
5skill;
skill =
subject
expert1
expert2;
name=10Alpha
Designation=20Alpha
contact=10Numeric
subject=10Alpha
expert1=10Alpha
expert2=10Alpha;
MessageIdentifier ="DMS";
Slant = "/";
CRLF = %x0D;
Version = "5";
Alpha = %x41-5A;
Hyphen = "-";
Numeric= %x30-39;