<div dir="ltr">Hello,<div><br></div><div>I'm planning to write three parsers, and googling, I found some entries talking about lexical parsers.</div><div><br></div><div>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.</div><div><div><br></div><div>Below, three possible string that I need to parse:</div><div><br></div><div>1)</div><div><br></div><div>${someVariable} -- 4 tokens</div><div><br></div><div>or</div><div><br></div><div>${a + b} -- 8 tokens - 1 expression<br></div><div><br></div><div>or</div><div><br></div><div>${fn:lenght('abc') * 3} -- 11 tokens - 1 function - 1 expression<br></div><div><br></div><div>2)</div><div><br></div><div><div><c:forEach var="contact" items="${contactDao.list}"></div><div>    ${<a href="http://contato.name" target="_blank">contato.name</a>}, ${contato.email}</div><div></c:forEach></div></div><div><br></div><div>3)</div><div><br></div><div>contacts[0].name=abc</div><div>contacts[0].email=abc@def<br></div><div><div>contacts[1].name=def</div><div>contacts[2].email=def@ghi</div></div><div><br></div><div>So my parser will allow to register dynamic variables, functions (to be called via script) and plugins (to extend the parser).</div><div><br></div><div>However, I have a question: is there any article about 'how to write lexical parsers' using Object Pascal?</div><div><br></div><div>I need any material about this subject, and I'm very grateful for any tip.</div><div><br></div><div>Thanks in advance!</div><div><br></div>-- <br><div>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a></div>
</div></div>