mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 07:20:09 -08:00
Remove Abacus dependency from ShuntingYardParser.
This commit is contained in:
parent
beb583a231
commit
50ede6460c
|
@ -53,7 +53,7 @@ public class Abacus {
|
|||
numberReducer = new NumberReducer(this);
|
||||
this.configuration = new Configuration(configuration);
|
||||
LexerTokenizer lexerTokenizer = new LexerTokenizer();
|
||||
ShuntingYardParser shuntingYardParser = new ShuntingYardParser(this);
|
||||
ShuntingYardParser shuntingYardParser = new ShuntingYardParser();
|
||||
treeBuilder = new TreeBuilder<>(lexerTokenizer, shuntingYardParser);
|
||||
|
||||
pluginManager.addListener(shuntingYardParser);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.nwapw.abacus.parsing;
|
||||
|
||||
import org.nwapw.abacus.Abacus;
|
||||
import org.nwapw.abacus.function.Operator;
|
||||
import org.nwapw.abacus.function.OperatorAssociativity;
|
||||
import org.nwapw.abacus.function.OperatorType;
|
||||
|
@ -17,10 +16,6 @@ import java.util.*;
|
|||
*/
|
||||
public class ShuntingYardParser implements Parser<Match<TokenType>>, PluginListener {
|
||||
|
||||
/**
|
||||
* The Abacus instance used to create number instances.
|
||||
*/
|
||||
private Abacus abacus;
|
||||
/**
|
||||
* Map of operator precedences, loaded from the plugin operators.
|
||||
*/
|
||||
|
@ -35,12 +30,9 @@ public class ShuntingYardParser implements Parser<Match<TokenType>>, PluginListe
|
|||
private Map<String, OperatorType> typeMap;
|
||||
|
||||
/**
|
||||
* Creates a new Shunting Yard parser with the given Abacus instance.
|
||||
*
|
||||
* @param abacus the abacus instance.
|
||||
* Creates a new Shunting Yard parser.
|
||||
*/
|
||||
public ShuntingYardParser(Abacus abacus) {
|
||||
this.abacus = abacus;
|
||||
public ShuntingYardParser() {
|
||||
precedenceMap = new HashMap<>();
|
||||
associativityMap = new HashMap<>();
|
||||
typeMap = new HashMap<>();
|
||||
|
|
Loading…
Reference in New Issue
Block a user