public void ScanForLabels() { while (!Input.IsEnd()) { if (Input.Peek().ASTType == AST.Classification.Label) { InterpreteLabel(); } else { Input.Read(); } } Input.RecoverPosition(Input.Beginning); LabelScanned = true; }
private AST Maybe(params Parse[] parsers) { AST result = null; int BackedUpPosition = Input.BackupPosition(); foreach (Parse parser in parsers) { result = parser(); if (result == null) { Input.RecoverPosition(BackedUpPosition); continue; } else { return(result); } } throw new UnexpectedTokenException("Unknown error happened. Please check the input array."); }