mirror of
https://github.com/DanilaFe/abacus
synced 2024-11-17 08:03: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);
|
numberReducer = new NumberReducer(this);
|
||||||
this.configuration = new Configuration(configuration);
|
this.configuration = new Configuration(configuration);
|
||||||
LexerTokenizer lexerTokenizer = new LexerTokenizer();
|
LexerTokenizer lexerTokenizer = new LexerTokenizer();
|
||||||
ShuntingYardParser shuntingYardParser = new ShuntingYardParser(this);
|
ShuntingYardParser shuntingYardParser = new ShuntingYardParser();
|
||||||
treeBuilder = new TreeBuilder<>(lexerTokenizer, shuntingYardParser);
|
treeBuilder = new TreeBuilder<>(lexerTokenizer, shuntingYardParser);
|
||||||
|
|
||||||
pluginManager.addListener(shuntingYardParser);
|
pluginManager.addListener(shuntingYardParser);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.nwapw.abacus.parsing;
|
package org.nwapw.abacus.parsing;
|
||||||
|
|
||||||
import org.nwapw.abacus.Abacus;
|
|
||||||
import org.nwapw.abacus.function.Operator;
|
import org.nwapw.abacus.function.Operator;
|
||||||
import org.nwapw.abacus.function.OperatorAssociativity;
|
import org.nwapw.abacus.function.OperatorAssociativity;
|
||||||
import org.nwapw.abacus.function.OperatorType;
|
import org.nwapw.abacus.function.OperatorType;
|
||||||
|
@ -17,10 +16,6 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
public class ShuntingYardParser implements Parser<Match<TokenType>>, PluginListener {
|
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.
|
* 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;
|
private Map<String, OperatorType> typeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Shunting Yard parser with the given Abacus instance.
|
* Creates a new Shunting Yard parser.
|
||||||
*
|
|
||||||
* @param abacus the abacus instance.
|
|
||||||
*/
|
*/
|
||||||
public ShuntingYardParser(Abacus abacus) {
|
public ShuntingYardParser() {
|
||||||
this.abacus = abacus;
|
|
||||||
precedenceMap = new HashMap<>();
|
precedenceMap = new HashMap<>();
|
||||||
associativityMap = new HashMap<>();
|
associativityMap = new HashMap<>();
|
||||||
typeMap = new HashMap<>();
|
typeMap = new HashMap<>();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user