Open corporateanon opened 7 years ago
Also PEG.js which is more beautiful:
ItemsList
= list:Item* {
return list;
}
Item
= Space
/ Nimi
/ CartoucheExpression
/ OpenCartoucheExpression
/ Raw
Nimi 'nimi'
= [aeiouptksmnlwj\-]+ {
return ['nimi', text()];
}
Space 'space'
= [ ]+ {
return ['space', text()]
}
OpenCartoucheExpression
= CartoucheStart items:ItemsList {
return ['openCartouche', items]
}
CartoucheExpression
= CartoucheStart items:ItemsList CartoucheEnd {
return ['cartouche', items]
}
CartoucheStart '['
= [\[]
CartoucheEnd ']'
= [\]]
Raw
= [^ ]+ { return ['raw', text()] }
Let's start with the following (not working, but a good starting point):