Exemplo n.º 1
0
        public static void start(string inputString)
        {
            List <Token>     tokens           = null;
            Lexer            lexer            = new Lexer();
            Parser           parser           = new Parser();
            Synthesizer      synthesizer      = new Synthesizer();
            Calculator       calculator       = new Calculator();
            LexemTypeEnum    lexemTypeEnum    = new LexemTypeEnum();
            TerminalTypeEnum terminalTypeEnum = new TerminalTypeEnum();

            try
            {
                tokens = lexer.start(inputString);
                Console.WriteLine("\nTokens:");
                foreach (Token token in tokens)
                {
                    Console.WriteLine("{ " + token.getValue() + " : " + token.getLexemType().getType() + " }");
                }
            }
            catch (NoSuchLexemException e)
            {
                Console.WriteLine("NoSuchLexemException: ", e.getValue());
            }

            bool check = parser.start(tokens);

            if (check)
            {
                Console.WriteLine("\nNo syntax errors found!");
            }
            else
            {
                Console.WriteLine("\nNo syntax errors found!");
            }

            tokens.Add(new Token("$", terminalTypeEnum.types["END"]));
            List <Token> postfixNotation = synthesizer.start(tokens);

            Console.WriteLine();
            for (int i = 0; i < postfixNotation.Count; i++)
            {
                Console.Write(postfixNotation[i].getValue() + " ");
            }

            Console.WriteLine("\n\nProgram output:");
            try
            {
                calculator.start(postfixNotation);
            }
            catch (NoSuchVariableException e)
            {
                Console.WriteLine("NoSuchVariableException: " + e.getValue());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: ", e.Message);
            }

            Console.ReadKey();
        }
Exemplo n.º 2
0
        private void InitStrings(string cardDataInputCapability, string cardholderAuthenticationCapability, string cardCaptureCapability, string operatingEnvironment, string cardholderPresent, string cardPresent, string cardDataInputMode, string cardholderAuthenticationMethod, string cardholderAuthenticationEntity, string cardDataOutputCapability, string terminalOutputCapability, string pINCaptureCapability, string terminalOperator, string terminalType)
        {
            this.CardDataInputCapability = EFTProperties <CardDataInputCapabilityEnum> .Enum(cardDataInputCapability);

            this.CardholderAuthenticationCapability = EFTProperties <CardholderAuthenticationCapabilityEnum> .Enum(cardholderAuthenticationCapability);

            this.CardCaptureCapability = EFTProperties <CardCaptureCapabilityEnum> .Enum(cardCaptureCapability);

            this.OperatingEnvironment = EFTProperties <OperatingEnvironmentEnum> .Enum(operatingEnvironment);

            this.CardholderPresent = EFTProperties <CardholderPresentEnum> .Enum(cardholderPresent);

            this.CardPresent = EFTProperties <CardPresentEnum> .Enum(cardPresent);

            this.CardDataInputMode = EFTProperties <CardDataInputModeEnum> .Enum(cardDataInputMode);

            this.CardholderAuthenticationMethod = EFTProperties <CardholderAuthenticationMethodEnum> .Enum(cardholderAuthenticationMethod);

            this.CardholderAuthenticationEntity = EFTProperties <CardholderAuthenticationEntityEnum> .Enum(cardholderAuthenticationEntity);

            this.CardDataOutputCapability = EFTProperties <CardDataOutputCapabilityEnum> .Enum(cardDataOutputCapability);

            this.TerminalOutputCapability = EFTProperties <TerminalOutputCapabilityEnum> .Enum(terminalOutputCapability);

            this.PINCaptureCapability = EFTProperties <PINCaptureCapabilityEnum> .Enum(pINCaptureCapability);

            this.TerminalOperator = EFTProperties <TerminalOperatorEnum> .Enum(terminalOperator);

            this.TerminalType = EFTProperties <TerminalTypeEnum> .Enum(terminalType);
        }
Exemplo n.º 3
0
 public POSDataCode(CardDataInputCapabilityEnum cardDataInputCapability, CardholderAuthenticationCapabilityEnum cardholderAuthenticationCapability, CardCaptureCapabilityEnum cardCaptureCapability, OperatingEnvironmentEnum operatingEnvironment, CardholderPresentEnum cardholderPresent, CardPresentEnum cardPresent, CardDataInputModeEnum cardDataInputMode, CardholderAuthenticationMethodEnum cardholderAuthenticationMethod, CardholderAuthenticationEntityEnum cardholderAuthenticationEntity, CardDataOutputCapabilityEnum cardDataOutputCapability, TerminalOutputCapabilityEnum terminalOutputCapability, PINCaptureCapabilityEnum pINCaptureCapability, TerminalOperatorEnum terminalOperator, TerminalTypeEnum terminalType)
 {
     this.CardDataInputCapability            = cardDataInputCapability;
     this.CardholderAuthenticationCapability = cardholderAuthenticationCapability;
     this.CardCaptureCapability          = cardCaptureCapability;
     this.OperatingEnvironment           = operatingEnvironment;
     this.CardholderPresent              = cardholderPresent;
     this.CardPresent                    = cardPresent;
     this.CardDataInputMode              = cardDataInputMode;
     this.CardholderAuthenticationMethod = cardholderAuthenticationMethod;
     this.CardholderAuthenticationEntity = cardholderAuthenticationEntity;
     this.CardDataOutputCapability       = cardDataOutputCapability;
     this.TerminalOutputCapability       = terminalOutputCapability;
     this.PINCaptureCapability           = pINCaptureCapability;
     this.TerminalOperator               = terminalOperator;
     this.TerminalType                   = terminalType;
 }