Skip to content

Commit

Permalink
Rename TokenList to Expression
Browse files Browse the repository at this point in the history
  • Loading branch information
FourteenBrush committed Feb 27, 2024
1 parent f54d2c5 commit 545c9f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import me.fourteendoggo.mathexpressionparser.utils.Assert;

/**
* Represents a parsed expression in a solvable form. <br>
* @see TokenList#solve()
* Represents a solvable expression being constructed.
* @see Expression#solve()
*/
public class TokenList {
public class Expression {
private LinkedCalculation head, tail;
private TokenType lastType = TokenType.OPERATOR; // need to assure incoming type is different from the current one
private int numCalculations;
Expand Down Expand Up @@ -163,8 +163,8 @@ public String toString() {
/**
* A linked list of calculations, dynamically constructed as tokens are added.<br/>
* Tokens are added linearly, so the list is always in the order of the input.<br/>
* Each calculation added to the {@link TokenList} is supposed to have valid tokens,
* only {@link TokenList#tail} may be incomplete, meaning it is still being constructed
* Each calculation added to the {@link Expression} is supposed to have valid tokens,
* only {@link Expression#tail} may be incomplete, meaning it is still being constructed
*/
private static class LinkedCalculation {
private LinkedCalculation prev, next;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class Tokenizer {
private final char[] source;
private final ExecutionEnv env;
private final TokenList tokens;
private final Expression tokens;
private final IntPredicate loopCondition;
private int pos;

Expand All @@ -27,10 +27,10 @@ public Tokenizer(char[] source, ExecutionEnv env, IntPredicate loopCondition) {
this.source = source;
this.env = env;
this.loopCondition = loopCondition;
this.tokens = new TokenList();
this.tokens = new Expression();
}

public TokenList readTokens() {
public Expression readTokens() {
while (hasRemaining()) {
char current = advance();
switch (current) {
Expand Down

0 comments on commit 545c9f7

Please sign in to comment.