| 504 | | public void parseString(String inStr) { |
|---|
| 505 | | |
|---|
| 506 | | try { |
|---|
| 507 | | byte currentBytes[] = inStr.getBytes(); |
|---|
| 508 | | |
|---|
| 509 | | ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(currentBytes); |
|---|
| 510 | | |
|---|
| 511 | | |
|---|
| 512 | | AdministrationService adminService = Context.getAdministrationService(); |
|---|
| 513 | | |
|---|
| 514 | | // Create a scanner that reads from the input stream passed to us |
|---|
| 515 | | ArdenBaseLexer lexer = new ArdenBaseLexer(byteArrayInputStream); |
|---|
| 516 | | |
|---|
| 517 | | // Create a parser that reads from the scanner |
|---|
| 518 | | ArdenBaseParser parser = new ArdenBaseParser(lexer); |
|---|
| 519 | | |
|---|
| 520 | | // start parsing at the compilationUnit rule |
|---|
| 521 | | parser.start_test(); |
|---|
| 522 | | |
|---|
| 523 | | BaseAST t = (BaseAST) parser.getAST(); |
|---|
| 524 | | |
|---|
| 525 | | //System.out.println(t.toStringTree()); // prints Abstract Syntax Tree |
|---|
| 526 | | |
|---|
| 527 | | ArdenBaseTreeParser treeParser = new ArdenBaseTreeParser(); |
|---|
| 528 | | |
|---|
| 529 | | LogicCriteria lc = new LogicCriteria(null); |
|---|
| 530 | | lc = treeParser.start_test(t, lc); |
|---|
| 531 | | System.out.println(lc.toString()); |
|---|
| 532 | | |
|---|
| 533 | | } |
|---|
| 534 | | catch(Exception e) { |
|---|
| 535 | | log.error(e.getStackTrace()); |
|---|
| 536 | | } |
|---|
| 537 | | } |
|---|
| | 504 | |
|---|