Beispiel #1
0
        /**
         * Constructor of a string parser
         * @arg data The complete string that has to be parsed
         * @arg variable The offset of the provided string where the parser needs to start
         * @visibility private if you'd to intansiate a string parser, use  StringParser::create
         */
        private StringParser(string data, int offset, ArgumentsManager manager)
        {
            _argumentManager = manager;
            if (data.Length <= offset || offset < 0 || data[0] == '\0')
            {
                throw new ArgumentOutOfRangeException();
            }
            _data        = data;
            _startOffset = offset;
            _state       = ParserState.Unknown;

            StartParsing();
        }
Beispiel #2
0
        public IAsciiBasePropositionalOperator GetOperator(char symbol, ArgumentsManager manager)
        {
            switch (symbol)
            {
            case '>':
                return(new IfThenPropositionalOperator(manager));

            case '=':
                return(new SamePropositionalOperator(manager));

            case '&':
                return(new AndPropositionalOperator(manager));

            case '|':
                return(new OrPropositionalOperator(manager));

            case '~':
                return(new NotPropositionalOperator(manager));

            case '%':
                return(new NotAndPropositionalOperator(manager));

            case 'F':
                return(new FalsePropositionalOperator(manager));

            case 'T':
                return(new TruePropositionalOperator(manager));

            case '@':
                return(new UniversalQuantifierOperator(manager));

            case '!':
                return(new ExtensionalQuantifierOperator(manager));
            }
            return(null);
        }
Beispiel #3
0
        /**
         * Use this function to create an instance of StringParser.
         */
        public static StringParser Create(string data)
        {
            var manager = new ArgumentsManager();

            return(new StringParser(data, 0, manager));
        }