public DiagnoseParser(Parser parser, int firstToken, int start, int end, int[] intervalStartToSkip, int[] intervalEndToSkip, int[] intervalFlagsToSkip, CompilerOptions options) { this.parser = parser; this.options = options; this.lexStream = new LexStream(BUFF_SIZE, parser.scanner, intervalStartToSkip, intervalEndToSkip, intervalFlagsToSkip, firstToken, start, end); this.recoveryScanner = parser.recoveryScanner; }
public int getToken() { return this.currentIndex = next(this.currentIndex); }
this.buffer[1] = this.lexStream.previous(this.buffer[2]); this.buffer[0] = this.lexStream.previous(this.buffer[1]); this.buffer[k] = this.lexStream.next(this.buffer[k - 1]); this.buffer[BUFF_UBOUND] = this.lexStream.badtoken();// elmt not available this.lexStream.kind(this.buffer[next_last_index]) == EOFT_SYMBOL; int save_location_start = this.locationStartStack[this.nextStackTop]; this.locationStack[this.nextStackTop] = this.buffer[2]; this.locationStartStack[this.nextStackTop] = this.lexStream.start(this.buffer[2]); misplaced.numDeletions = this.nextStackTop; misplaced = misplacementRecovery(this.nextStack, this.nextStackTop, this.buffer[2] = this.lexStream.previous(this.buffer[3]); this.buffer[1] = this.lexStream.previous(this.buffer[2]); this.buffer[0] = this.lexStream.previous(this.buffer[1]); this.buffer[k] = this.lexStream.next(this.buffer[k - 1]); last_index >= 1 && this.lexStream.kind(this.buffer[last_index]) == EOFT_SYMBOL; this.buffer[1] = this.lexStream.previous(this.buffer[2]); this.buffer[0] = this.lexStream.previous(this.buffer[1]); this.buffer[k] = this.lexStream.next(this.buffer[k - 1]); this.buffer[BUFF_UBOUND] = this.lexStream.badtoken();// elmt not available
this.lexStream.reset(); this.currentToken = this.lexStream.getToken(); this.stack[this.stateStackTop] = act; int tok = this.lexStream.kind(this.currentToken); this.locationStack[this.stateStackTop] = this.currentToken; this.locationStartStack[this.stateStackTop] = this.lexStream.start(this.currentToken); this.currentToken = this.lexStream.getToken(); tok = this.lexStream.kind(this.currentToken); act = Parser.tAction(act, tok); while(act <= NUM_RULES) { this.stack[i] = this.nextStack[i]; this.locationStack[this.stateStackTop] = this.currentToken; this.locationStartStack[this.stateStackTop] = this.lexStream.start(this.currentToken); pos = next_pos; this.currentToken = this.lexStream.getToken(); tok = this.lexStream.kind(this.currentToken); this.locationStack[this.stateStackTop] = this.currentToken; this.locationStartStack[this.stateStackTop] = this.lexStream.start(this.currentToken); } else { tok = candidate.symbol; this.locationStack[this.stateStackTop] = candidate.location; this.locationStartStack[this.stateStackTop] = this.lexStream.start(candidate.location);
if(this.lexStream.isInsideStream(leftToken)) { if(leftToken == 0) { errorStart = this.lexStream.start(leftToken + 1); } else { errorStart = this.lexStream.start(leftToken); errorStart = this.lexStream.start(rightToken); int errorEnd = this.lexStream.end(rightToken); case SCOPE_CODE: errorStart = this.lexStream.start(rightToken);
stck, stack_top, this.lexStream.kind(this.buffer[repair.bufferPosition + 1]), repair.bufferPosition + 2); if (this.lexStream.kind(this.buffer[repair.bufferPosition]) == EOLT_SYMBOL && this.lexStream.afterEol(this.buffer[repair.bufferPosition+1])) { k = 10; } else { this.tempStackTop = stack_top - 1; tok = this.lexStream.kind(this.buffer[repair.bufferPosition]); this.lexStream.reset(this.buffer[repair.bufferPosition + 1]); act = Parser.tAction(next_state, tok); while(act <= NUM_RULES) { if (symbol == EOLT_SYMBOL && this.lexStream.afterEol(this.buffer[repair.bufferPosition])) { k = 10; } else { if (symbol == EOLT_SYMBOL && this.lexStream.afterEol(this.buffer[repair.bufferPosition+1])) { k = 10; } else {
int errorStart = this.lexStream.start(token); int errorEnd = this.lexStream.end(token); int currentKind = this.lexStream.kind(token); String errorTokenName = Parser.name[Parser.terminal_index[this.lexStream.kind(token)]]; char[] errorTokenSource = this.lexStream.name(token); if (currentKind == TerminalTokens.TokenNameStringLiteral) { errorTokenSource = displayEscapeCharacters(errorTokenSource, 1, errorTokenSource.length - 1);
private int mergeCandidate(int state, int buffer_position) { char[] name1 = this.lexStream.name(this.buffer[buffer_position]); char[] name2 = this.lexStream.name(this.buffer[buffer_position + 1]); int len = name1.length + name2.length; char[] str = CharOperation.concat(name1, name2); for (int k = Parser.asi(state); Parser.asr[k] != 0; k++) { int l = Parser.terminal_index[Parser.asr[k]]; if (len == Parser.name[l].length()) { char[] name = Parser.name[l].toCharArray(); if (CharOperation.equals(str, name, false)) { return Parser.asr[k]; } } } return 0; }
private boolean secondaryCheck(int stck[], int stack_top, int buffer_position, int distance) { int top, j; for (top = stack_top - 1; top >= 0; top--) { j = parseCheck(stck, top, this.lexStream.kind(this.buffer[buffer_position]), buffer_position + 1); if (((j - buffer_position + 1) > MIN_DISTANCE) && (j > distance)) return true; } PrimaryRepairInfo repair = new PrimaryRepairInfo(); repair.bufferPosition = buffer_position + 1; repair.distance = distance; repair = scopeTrial(stck, stack_top, repair); if ((repair.distance - buffer_position) > MIN_DISTANCE && repair.distance > distance) return true; return false; }
this.buffer[1] = this.lexStream.previous(this.buffer[2]); this.buffer[0] = this.lexStream.previous(this.buffer[1]); this.buffer[k] = this.lexStream.next(this.buffer[k - 1]); this.buffer[BUFF_UBOUND] = this.lexStream.badtoken();// elmt not available this.lexStream.kind(this.buffer[next_last_index]) == EOFT_SYMBOL; int save_location_start = this.locationStartStack[this.nextStackTop]; this.locationStack[this.nextStackTop] = this.buffer[2]; this.locationStartStack[this.nextStackTop] = this.lexStream.start(this.buffer[2]); misplaced.numDeletions = this.nextStackTop; misplaced = misplacementRecovery(this.nextStack, this.nextStackTop, this.buffer[2] = this.lexStream.previous(this.buffer[3]); this.buffer[1] = this.lexStream.previous(this.buffer[2]); this.buffer[0] = this.lexStream.previous(this.buffer[1]); this.buffer[k] = this.lexStream.next(this.buffer[k - 1]); last_index >= 1 && this.lexStream.kind(this.buffer[last_index]) == EOFT_SYMBOL; this.buffer[1] = this.lexStream.previous(this.buffer[2]); this.buffer[0] = this.lexStream.previous(this.buffer[1]); this.buffer[k] = this.lexStream.next(this.buffer[k - 1]); this.buffer[BUFF_UBOUND] = this.lexStream.badtoken();// elmt not available
this.lexStream.reset(); this.currentToken = this.lexStream.getToken(); this.stack[this.stateStackTop] = act; int tok = this.lexStream.kind(this.currentToken); this.locationStack[this.stateStackTop] = this.currentToken; this.locationStartStack[this.stateStackTop] = this.lexStream.start(this.currentToken); this.currentToken = this.lexStream.getToken(); tok = this.lexStream.kind(this.currentToken); act = Parser.tAction(act, tok); while(act <= NUM_RULES) { this.stack[i] = this.nextStack[i]; this.locationStack[this.stateStackTop] = this.currentToken; this.locationStartStack[this.stateStackTop] = this.lexStream.start(this.currentToken); pos = next_pos; this.currentToken = this.lexStream.getToken(); tok = this.lexStream.kind(this.currentToken); this.locationStack[this.stateStackTop] = this.currentToken; this.locationStartStack[this.stateStackTop] = this.lexStream.start(this.currentToken); } else { tok = candidate.symbol; this.locationStack[this.stateStackTop] = candidate.location; this.locationStartStack[this.stateStackTop] = this.lexStream.start(candidate.location);
if(this.lexStream.isInsideStream(leftToken)) { if(leftToken == 0) { errorStart = this.lexStream.start(leftToken + 1); } else { errorStart = this.lexStream.start(leftToken); errorStart = this.lexStream.start(rightToken); int errorEnd = this.lexStream.end(rightToken); case SCOPE_CODE: errorStart = this.lexStream.start(rightToken);
stck, stack_top, this.lexStream.kind(this.buffer[repair.bufferPosition + 1]), repair.bufferPosition + 2); if (this.lexStream.kind(this.buffer[repair.bufferPosition]) == EOLT_SYMBOL && this.lexStream.afterEol(this.buffer[repair.bufferPosition+1])) { k = 10; } else { this.tempStackTop = stack_top - 1; tok = this.lexStream.kind(this.buffer[repair.bufferPosition]); this.lexStream.reset(this.buffer[repair.bufferPosition + 1]); act = Parser.tAction(next_state, tok); while(act <= NUM_RULES) { if (symbol == EOLT_SYMBOL && this.lexStream.afterEol(this.buffer[repair.bufferPosition])) { k = 10; } else { if (symbol == EOLT_SYMBOL && this.lexStream.afterEol(this.buffer[repair.bufferPosition+1])) { k = 10; } else {
private int mergeCandidate(int state, int buffer_position) { char[] name1 = this.lexStream.name(this.buffer[buffer_position]); char[] name2 = this.lexStream.name(this.buffer[buffer_position + 1]); int len = name1.length + name2.length; char[] str = CharOperation.concat(name1, name2); for (int k = Parser.asi(state); Parser.asr[k] != 0; k++) { int l = Parser.terminal_index[Parser.asr[k]]; if (len == Parser.name[l].length()) { char[] name = Parser.name[l].toCharArray(); if (CharOperation.equals(str, name, false)) { return Parser.asr[k]; } } } return 0; }
private boolean secondaryCheck(int stck[], int stack_top, int buffer_position, int distance) { int top, j; for (top = stack_top - 1; top >= 0; top--) { j = parseCheck(stck, top, this.lexStream.kind(this.buffer[buffer_position]), buffer_position + 1); if (((j - buffer_position + 1) > MIN_DISTANCE) && (j > distance)) return true; } PrimaryRepairInfo repair = new PrimaryRepairInfo(); repair.bufferPosition = buffer_position + 1; repair.distance = distance; repair = scopeTrial(stck, stack_top, repair); if ((repair.distance - buffer_position) > MIN_DISTANCE && repair.distance > distance) return true; return false; }
this.buffer[1] = this.lexStream.previous(this.buffer[2]); this.buffer[0] = this.lexStream.previous(this.buffer[1]); this.buffer[k] = this.lexStream.next(this.buffer[k - 1]); this.buffer[BUFF_UBOUND] = this.lexStream.badtoken();// elmt not available this.lexStream.kind(this.buffer[next_last_index]) == EOFT_SYMBOL; int save_location_start = this.locationStartStack[this.nextStackTop]; this.locationStack[this.nextStackTop] = this.buffer[2]; this.locationStartStack[this.nextStackTop] = this.lexStream.start(this.buffer[2]); misplaced.numDeletions = this.nextStackTop; misplaced = misplacementRecovery(this.nextStack, this.nextStackTop, this.buffer[2] = this.lexStream.previous(this.buffer[3]); this.buffer[1] = this.lexStream.previous(this.buffer[2]); this.buffer[0] = this.lexStream.previous(this.buffer[1]); this.buffer[k] = this.lexStream.next(this.buffer[k - 1]); last_index >= 1 && this.lexStream.kind(this.buffer[last_index]) == EOFT_SYMBOL; this.buffer[1] = this.lexStream.previous(this.buffer[2]); this.buffer[0] = this.lexStream.previous(this.buffer[1]); this.buffer[k] = this.lexStream.next(this.buffer[k - 1]); this.buffer[BUFF_UBOUND] = this.lexStream.badtoken();// elmt not available
this.lexStream.reset(); this.currentToken = this.lexStream.getToken(); this.stack[this.stateStackTop] = act; int tok = this.lexStream.kind(this.currentToken); this.locationStack[this.stateStackTop] = this.currentToken; this.locationStartStack[this.stateStackTop] = this.lexStream.start(this.currentToken); this.currentToken = this.lexStream.getToken(); tok = this.lexStream.kind(this.currentToken); act = Parser.tAction(act, tok); while(act <= NUM_RULES) { this.stack[i] = this.nextStack[i]; this.locationStack[this.stateStackTop] = this.currentToken; this.locationStartStack[this.stateStackTop] = this.lexStream.start(this.currentToken); pos = next_pos; this.currentToken = this.lexStream.getToken(); tok = this.lexStream.kind(this.currentToken); this.locationStack[this.stateStackTop] = this.currentToken; this.locationStartStack[this.stateStackTop] = this.lexStream.start(this.currentToken); } else { tok = candidate.symbol; this.locationStack[this.stateStackTop] = candidate.location; this.locationStartStack[this.stateStackTop] = this.lexStream.start(candidate.location);
if(this.lexStream.isInsideStream(leftToken)) { if(leftToken == 0) { errorStart = this.lexStream.start(leftToken + 1); } else { errorStart = this.lexStream.start(leftToken); errorStart = this.lexStream.start(rightToken); int errorEnd = this.lexStream.end(rightToken); case SCOPE_CODE: errorStart = this.lexStream.start(rightToken);
stck, stack_top, this.lexStream.kind(this.buffer[repair.bufferPosition + 1]), repair.bufferPosition + 2); if (this.lexStream.kind(this.buffer[repair.bufferPosition]) == EOLT_SYMBOL && this.lexStream.afterEol(this.buffer[repair.bufferPosition+1])) { k = 10; } else { this.tempStackTop = stack_top - 1; tok = this.lexStream.kind(this.buffer[repair.bufferPosition]); this.lexStream.reset(this.buffer[repair.bufferPosition + 1]); act = Parser.tAction(next_state, tok); while(act <= NUM_RULES) { if (symbol == EOLT_SYMBOL && this.lexStream.afterEol(this.buffer[repair.bufferPosition])) { k = 10; } else { if (symbol == EOLT_SYMBOL && this.lexStream.afterEol(this.buffer[repair.bufferPosition+1])) { k = 10; } else {