Esempio n. 1
0
        ASTNode READ()
        {
            var node = new ReadNode();

            node.lexeme           = Consume("read", TokenType.KEYWORD);
            node.identifierToRead = IDENT();
            return(node);
        }
Esempio n. 2
0
        public void VisitRead(ReadNode rn)
        {
            int    temp   = this.depth;
            string spaces = IncreaseDepth();

            this.io.WriteLine($"{spaces}Read: (");
            this.io.WriteLine($"{spaces}  Identifier: {rn.Identifier},\n{spaces}  Value: {rn.Value},\n{spaces}  Token: {rn.Token}");
            this.io.WriteLine($"{spaces})");
            this.depth = temp;
        }
Esempio n. 3
0
        public void VisitRead(ReadNode rn)
        {
            SymbolType type  = CheckThatIdentifierIsDeclaredAndGetEntry(rn.Identifier, rn.Token).Type;
            string     input = this.io.ReadLine();

            if (type == SymbolType.IntegerValue)
            {
                input = ConvertStringToInteger(input, rn.Token).ToString();
            }
            this.symbolTable.ModifyEntry(rn.Identifier, input);
        }