示例#1
0
        /// WRITE keyword
        ParseNode KWrite()
        {
            WriteParseNode node = new WriteParseNode();

            InitFunctionNodes();

            ControlList cilist = ParseCIList(_writeFunctions.ParameterList);
            if (cilist == null) {
                SkipToEndOfLine();
                return null;
            }

            node.ArgList = ParseVarargList();
            node.ErrLabel = (SymbolParseNode)cilist["ERR"];

            // First column is special for F77 only
            node.FirstColumnSpecial = (_opts.F77);

            // If this is internal storage, create an expression that
            // assigns the result to the character string
            ParseNode unit = cilist["UNIT"];

            if (unit != null && unit.ID == ParseID.IDENT && Symbol.IsCharType(unit.Type)) {
                node.WriteParamsNode = _ioCoreFunctions.ParametersNode(cilist);
                node.WriteManagerParamsNode = _writeFunctionString.ParametersNode(cilist);

                AssignmentParseNode assignNode = new AssignmentParseNode();
                assignNode.Identifier = (IdentifierParseNode)unit;
                assignNode.ValueExpression = node;
                return assignNode;
            }

            if (unit == null) {
                cilist["UNIT"] = new NumberParseNode(new Variant(IOConstant.Stdout));
            }
            node.WriteParamsNode = _ioCoreFunctions.ParametersNode(cilist);
            node.WriteManagerParamsNode = _writeFunctions.ParametersNode(cilist);
            return node;
        }
示例#2
0
        /// PRINT keyword
        ParseNode KPrint()
        {
            WriteParseNode node = new WriteParseNode();

            InitFunctionNodes();

            ControlList cilist = new ControlList();
            cilist["FMT"] = ParseFormatSpecifier();
            cilist["UNIT"] = new NumberParseNode(new Variant(IOConstant.Stdout));

            // First column is special for F77 only
            node.FirstColumnSpecial = (_opts.F77);

            if (!IsAtEndOfLine()) {
                SimpleToken token;

                ExpectToken(TokenID.COMMA);
                VarArgParseNode varargs = new VarArgParseNode();
                do {
                    varargs.Add(ParseExpressionWithImpliedDo());
                    token = _ls.GetToken();
                } while (token.ID == TokenID.COMMA);
                _ls.BackToken();
                node.ArgList = varargs;
            }

            node.WriteParamsNode = _ioCoreFunctions.ParametersNode(cilist);
            node.WriteManagerParamsNode = _writeFunctions.ParametersNode(cilist);
            return node;
        }