parse method
void
parse(
- String sourceCode, {
- bool replMode = false,
})
Implementation
void parse(String sourceCode, {bool replMode = false}) {
if (replMode) {
// Check for an incomplete final line by finding the last (non-comment) token.
final bool isPartial = endsWithLineContinuation(sourceCode);
if (isPartial) {
partialInput = '${partialInput ?? ""}${Lexer.trimComment(sourceCode)} ';
return;
}
}
final Lexer tokens = Lexer('${partialInput ?? ''}$sourceCode');
partialInput = null;
_parseMultipleLines(tokens);
if (!replMode && needMoreInput()) {
// Whoops, we need more input but we don't have any. This is an error.
tokens
.lineNum++; // (so we report PAST the last line, making it clear this is an EOF problem)
if (outputStack!.length > 1) {
throw CompilerException.withLocation(
errorContext,
tokens.lineNum,
"'function' without matching 'end function'",
);
}
_checkForOpenBackpatches(tokens.lineNum);
}
}