Skip to content

Commit

Permalink
Merge pull request #639 from Drincann/master
Browse files Browse the repository at this point in the history
refactor: replace typo lookhead with lookahead
  • Loading branch information
killme2008 authored Jul 30, 2024
2 parents f9d64dc + 312b86f commit 900adca
Show file tree
Hide file tree
Showing 11 changed files with 703 additions and 703 deletions.
18 changes: 9 additions & 9 deletions examples/calculator.av
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn expr(parser, tokens) {
term(parser, tokens);

while true {
let t = parser.lookhead;
let t = parser.lookahead;

if t.val == '+' {
parser.move();
Expand All @@ -89,7 +89,7 @@ fn term(parser, tokens) {
unary(parser, tokens);

while true {
let t = parser.lookhead;
let t = parser.lookahead;

if t.val == '*' {
parser.move();
Expand All @@ -106,7 +106,7 @@ fn term(parser, tokens) {
}

fn unary(parser, tokens) {
let t = parser.lookhead;
let t = parser.lookahead;
if t.val == '-' {
parser.move();
unary(parser, tokens);
Expand All @@ -117,12 +117,12 @@ fn unary(parser, tokens) {
}

fn factor(parser, tokens) {
let t = parser.lookhead;
let t = parser.lookahead;

if t.val == '(' {
parser.move();
expr(parser, tokens);
t = parser.lookhead;
t = parser.lookahead;
if t.val != ')'{
error(t);
}
Expand All @@ -137,10 +137,10 @@ fn factor(parser, tokens) {

fn parser(lexer) {
let parser = seq.map();
parser.lookhead = lexer();
parser.lookahead = lexer();

parser.move = fn() {
parser.lookhead = lexer();
parser.lookahead = lexer();
};

return parser;
Expand All @@ -153,8 +153,8 @@ fn parse(s) {

expr(parser, tokens);

if parser.lookhead.type != EOF {
error(parser.lookhead);
if parser.lookahead.type != EOF {
error(parser.lookahead);
}

return tokens;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1828,12 +1828,12 @@ public StringSegments compileStringSegments(final String lexeme, final String so
new ExpressionParser(this, lexer, newCodeGenerator(sourceFile, false));

Expression exp = parser.parse(false);
final Token<?> lookhead = parser.getLookhead();
if (lookhead == null || (lookhead.getType() != TokenType.Char
|| ((CharToken) lookhead).getCh() != '}')) {
final Token<?> lookahead = parser.getLookahead();
if (lookahead == null || (lookahead.getType() != TokenType.Char
|| ((CharToken) lookahead).getCh() != '}')) {
parser.reportSyntaxError("expect '}' to complete string interpolation");
}
int expStrLen = lookhead.getStartIndex() + 1;
int expStrLen = lookahead.getStartIndex() + 1;
while (expStrLen-- > 0) {
prev = ch;
ch = it.next();
Expand Down
80 changes: 40 additions & 40 deletions src/main/java/com/googlecode/aviator/code/CodeGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,118 +29,118 @@
*/
public interface CodeGenerator {

public void onAssignment(Token<?> lookhead);
public void onAssignment(Token<?> lookahead);

public void setParser(Parser parser);

public void onShiftRight(Token<?> lookhead);
public void onShiftRight(Token<?> lookahead);


public void onShiftLeft(Token<?> lookhead);
public void onShiftLeft(Token<?> lookahead);


public void onUnsignedShiftRight(Token<?> lookhead);
public void onUnsignedShiftRight(Token<?> lookahead);


public void onBitOr(Token<?> lookhead);
public void onBitOr(Token<?> lookahead);


public void onBitAnd(Token<?> lookhead);
public void onBitAnd(Token<?> lookahead);


public void onBitXor(Token<?> lookhead);
public void onBitXor(Token<?> lookahead);


public void onBitNot(Token<?> lookhead);
public void onBitNot(Token<?> lookahead);


public void onAdd(Token<?> lookhead);
public void onAdd(Token<?> lookahead);


public void onSub(Token<?> lookhead);
public void onSub(Token<?> lookahead);


public void onMult(Token<?> lookhead);
public void onMult(Token<?> lookahead);

public void onExponent(Token<?> loohead);


public void onDiv(Token<?> lookhead);
public void onDiv(Token<?> lookahead);


public void onAndLeft(Token<?> lookhead);
public void onAndLeft(Token<?> lookahead);


public void onAndRight(Token<?> lookhead);
public void onAndRight(Token<?> alookahead);


public void onTernaryBoolean(Token<?> lookhead);
public void onTernaryBoolean(Token<?> lookahead);


public void onTernaryLeft(Token<?> lookhead);
public void onTernaryLeft(Token<?> lookahead);


public void onTernaryRight(Token<?> lookhead);
public void onTernaryRight(Token<?> lookahead);

public void onTernaryEnd(Token<?> lookhead);
public void onTernaryEnd(Token<?> lookahead);


public void onJoinLeft(Token<?> lookhead);
public void onJoinLeft(Token<?> lookahead);


public void onJoinRight(Token<?> lookhead);
public void onJoinRight(Token<?> lookahead);


public void onEq(Token<?> lookhead);
public void onEq(Token<?> lookahead);


public void onMatch(Token<?> lookhead);
public void onMatch(Token<?> lookahead);


public void onNeq(Token<?> lookhead);
public void onNeq(Token<?> lookahead);


public void onLt(Token<?> lookhead);
public void onLt(Token<?> lookahead);


public void onLe(Token<?> lookhead);
public void onLe(Token<?> lookahead);


public void onGt(Token<?> lookhead);
public void onGt(Token<?> lookahead);


public void onGe(Token<?> lookhead);
public void onGe(Token<?> lookahead);


public void onMod(Token<?> lookhead);
public void onMod(Token<?> lookahead);


public void onNot(Token<?> lookhead);
public void onNot(Token<?> lookahead);


public void onNeg(Token<?> lookhead);
public void onNeg(Token<?> lookahead);

public Expression getResult(boolean unboxObject);

public void onConstant(Token<?> lookhead);
public void onConstant(Token<?> lookahead);

public void onMethodName(Token<?> lookhead);
public void onMethodName(Token<?> lookahead);

public void onMethodParameter(Token<?> lookhead);
public void onMethodParameter(Token<?> lookahead);

public void onMethodInvoke(Token<?> lookhead);
public void onMethodInvoke(Token<?> lookahead);

public void onLambdaDefineStart(Token<?> lookhead);
public void onLambdaDefineStart(Token<?> lookahead);

public void onLambdaArgument(Token<?> lookhead, FunctionParam param);
public void onLambdaArgument(Token<?> lookahead, FunctionParam param);

public void onLambdaBodyStart(Token<?> lookhead);
public void onLambdaBodyStart(Token<?> lookahead);

public void onLambdaBodyEnd(Token<?> lookhead);
public void onLambdaBodyEnd(Token<?> lookahead);

public void onArray(Token<?> lookhead);
public void onArray(Token<?> lookahead);

public void onArrayIndexStart(Token<?> token);

public void onArrayIndexEnd(Token<?> lookhead);
public void onArrayIndexEnd(Token<?> lookahead);
}
Loading

0 comments on commit 900adca

Please sign in to comment.