mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-23 07:50:09 -08:00
Correctly handle invalid strings.
This commit is contained in:
parent
7c4ecdc1db
commit
9ce35aad54
|
@ -129,7 +129,9 @@ public abstract class TreeNode {
|
||||||
* @return the resulting tree.
|
* @return the resulting tree.
|
||||||
*/
|
*/
|
||||||
public static TreeNode fromString(String string){
|
public static TreeNode fromString(String string){
|
||||||
ArrayList<Match<TokenType>> matches = intoPostfix(string, tokenize(string));
|
ArrayList<Match<TokenType>> matches = tokenize(string);
|
||||||
|
if(matches == null) return null;
|
||||||
|
matches = intoPostfix(string, matches);
|
||||||
if(matches == null) return null;
|
if(matches == null) return null;
|
||||||
|
|
||||||
Collections.reverse(matches);
|
Collections.reverse(matches);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user