Skip to content
sanity edited this page Mar 25, 2013 · 2 revisions

LastCalc's parser is very sophisticated and has many components, but fortunately SequentialParser.java provides a very friendly high-level interface to it, which is used at various points through LastCalc's user-facing code.

Here is a simple usage example:

final SequentialParser sp = SequentialParser.create();
sp.parseNext("a=49+3");
final TokenList res = sp.parseNext("a+1");
System.out.println(res);

This will print "53".

You can see many other usage examples in SequentialParserTest.java - which also serves as a suite of integration tests for all of LastCalc's parsing code.

Clone this wiki locally