1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-12-23 16:00:09 -08:00

Fix mismatched parentheses causing exceptions.

This commit is contained in:
Danila Fedorin 2017-08-05 15:59:49 -07:00
parent 55257f7274
commit 48e6e658d0

View File

@ -162,6 +162,7 @@ public class ShuntingYardParser implements Parser<Match<TokenType>>, PluginListe
@Override @Override
public TreeNode constructTree(List<Match<TokenType>> tokens) { public TreeNode constructTree(List<Match<TokenType>> tokens) {
tokens = intoPostfix(new ArrayList<>(tokens)); tokens = intoPostfix(new ArrayList<>(tokens));
if(tokens == null) return null;
Collections.reverse(tokens); Collections.reverse(tokens);
return constructRecursive(tokens); return constructRecursive(tokens);
} }