Hello,
I'm planning to write three parsers, and googling, I found some entries talking about lexical parsers.
After that, I did a 'find in files' in FPC sources, and I found many parsers (eg: jsonparser (jsonscanner), JSParser (JSScanner), fpsqlparser (fpsqlscanner), PParser (PScanner), fpexprpars etc.) that use lexical scanner.
Below, three possible string that I need to parse:
1)
${someVariable} -- 4 tokens
or
${a + b} -- 8 tokens - 1 expression
or
${fn:lenght('abc') * 3} -- 11 tokens - 1 function - 1 expression
2)
<c:forEach var="contact" items="${contactDao.list}"> ${contato.name}, ${contato.email}
</c:forEach>
3)
contacts[0].name=abc
contacts[0].email=abc at def
contacts[1].name=def
contacts[2].email=def at ghi
So my parser will allow to register dynamic variables, functions (to be called via script) and plugins (to extend the parser).
However, I have a question: is there any article about 'how to write lexical parsers' using Object Pascal?
I need any material about this subject, and I'm very grateful for any tip.
Thanks in advance!
