public void scan() { skipWhite(); if (Char.IsLetter(io.getNextChar())) { load_ident_or_keyword(); } else if (Char.IsDigit(io.getNextChar())) { load_digits(); } else if (is_op(io.getNextChar())) { load_op(); } else if (is_bracket(io.getNextChar())) { load_bracket(); } else if (io.EOF()) { load_eof(); } else { value = new StringBuilder(Io.MAXSTR); value.Append(io.getNextChar()); token_id = TOK_UNKNOWN; io.ReadChar(); } skipWhite(); }
void stmt(VarList curtree, String ilabel, String olabel) { Var e = new Var(); currenttree = curtree; if (io.EOF()) { io.Abort("PL0142: expected statement but end of file encountered"); } if ((tok.getId() != Tok.TOK_PROC) && (tok.getId() != Tok.TOK_PROCEDURE)) { if (last_label != null) { emit.Label("L@@" + last_label); last_label = null; } } switch (tok.getId()) { case Tok.TOK_RETURN: ret_stmt(ilabel, olabel); null_stmt(); break; case Tok.TOK_IDENT: ident_stmt(curtree); break; case Tok.TOK_CALL: call_stmt(curtree); null_stmt(); break; case Tok.TOK_DO: do_stmt(curtree); null_stmt(); break; case Tok.TOK_GO: case Tok.TOK_GOTO: goto_stmt(curtree); null_stmt(); break; case Tok.TOK_PROCEDURE: case Tok.TOK_PROC: proc_decl(curtree, last_label); null_stmt(); break; case Tok.TOK_IF: if_stmt(curtree, ilabel, olabel); break; case Tok.TOK_DCL: case Tok.TOK_DECLARE: io.Abort("PL0143: wild declaration found"); break; case Tok.TOK_UNKNOWN: io.Abort("PL0144: unknown construction"); break; case Tok.TOK_END: case Tok.TOK_ELSE: case Tok.TOK_THEN: break; default: io.Abort("PL0145: wild symbol found"); break; } }