clean up (#7)

This commit is contained in:
Kurt Hutten
2023-01-22 07:43:28 +11:00
committed by GitHub
parent e37f68424b
commit 9540c2fca5
2 changed files with 0 additions and 28 deletions

View File

@ -761,28 +761,6 @@ export interface BinaryExpression extends GeneralStatement {
right: BinaryPart right: BinaryPart
} }
function makeBinaryPart(
tokens: Token[],
index: number
): { part: Literal | Identifier; lastIndex: number } {
const currentToken = tokens[index]
if (currentToken.type === 'word') {
const identifier = makeIdentifier(tokens, index)
return {
part: identifier,
lastIndex: index,
}
}
if (currentToken.type === 'number' || currentToken.type === 'string') {
const literal = makeLiteral(tokens, index)
return {
part: literal,
lastIndex: index,
}
}
throw new Error('Expected a previous BinaryPart if statement to match')
}
export function findEndOfBinaryExpression( export function findEndOfBinaryExpression(
tokens: Token[], tokens: Token[],
index: number index: number

View File

@ -1,12 +1,6 @@
import { BinaryExpression, Literal, Identifier } from './abstractSyntaxTree' import { BinaryExpression, Literal, Identifier } from './abstractSyntaxTree'
import { Token } from './tokeniser' import { Token } from './tokeniser'
interface Tree {
value: string
left?: Tree
right?: Tree
}
export function reversePolishNotation( export function reversePolishNotation(
tokens: Token[], tokens: Token[],
previousPostfix: Token[] = [], previousPostfix: Token[] = [],