⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 future.java

📁 无线通信的主要编程软件,是无线通信工作人员的必备工具,关天相关教程我会在后续传上.
💻 JAVA
字号:
// (C) Copyright 2001 Samuele Pedronipackage org.python.compiler;import org.python.parser.*;import org.python.parser.ast.*;import org.python.parser.ast.Module;public class Future extends Object implements PythonGrammarTreeConstants {    private boolean division;    private boolean generators;    private static final String FUTURE = "__future__";    private boolean check(ImportFrom cand) throws Exception {        if (!cand.module.equals(FUTURE))            return false;        int n = cand.names.length;        if (n == 0) {            throw new ParseException(                    "future statement does not support import *",cand);        }        for (int i = 0; i < n; i++) {            String feature = cand.names[i].name;            // *known* features            if (feature.equals("nested_scopes")) {                continue;            }            if (feature.equals("division")) {                division = true;                continue;            }            if (feature.equals("generators")) {                generators = true;                continue;            }            throw new ParseException("future feature "+feature+                                     " is not defined",cand);        }        return true;    }    public void preprocessFutures(modType node,                                  org.python.core.CompilerFlags cflags)        throws Exception    {        if (cflags != null) {            division = cflags.division;        }        int beg = 0;        stmtType[] suite = null;        if (node instanceof Module) {            suite = ((Module) node).body;            if (suite.length > 0 && suite[0] instanceof Expr &&                            ((Expr) suite[0]).value instanceof Str) {                beg++;            }        } else if (node instanceof Interactive) {            suite = ((Interactive) node).body;        } else {            return;        }        for (int i = beg; i < suite.length; i++) {            stmtType stmt = suite[i];            if (!(stmt instanceof ImportFrom))                break;            stmt.from_future_checked = true;            if (!check((ImportFrom) stmt))                break;        }        if (cflags != null) {            cflags.division      = cflags.division      ||  division;        }        if (cflags != null) {            cflags.generator_allowed = cflags.generator_allowed || generators;        }    }    public static void checkFromFuture(ImportFrom node) throws Exception {        if (node.from_future_checked)            return;        if (node.module.equals(FUTURE)) {            throw new ParseException("from __future__ imports must occur " +                                     "at the beginning of the file",node);        }        node.from_future_checked = true;    }    public boolean areDivisionOn() {        return division;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -