예제 #1
0
 public static void Rule(List lhs, OpenBracket openBracket, OptionalListBody optionalListBody, CloseBracket closeBracket)
 {
     if (optionalListBody.CodeList == null)
     {
         lhs.CodeList = new CodeList();
     }
     else
     {
         lhs.CodeList = optionalListBody.CodeList;
     }
 }
예제 #2
0
 protected virtual CloseBracket VisitCloseBracket(CloseBracket node)
 {
     return(VisitSyntaxNode(node) as CloseBracket);
 }
예제 #3
0
 protected override CloseBracket VisitCloseBracket(CloseBracket node)
 {
     visitedCloseBracket = true;
     Assert.IsTrue(node.Value == "]");
     return(base.VisitCloseBracket(node));
 }
예제 #4
0
 public static void Rule(List lhs, OpenBracket openBracket, OptionalListBody optionalListBody, CloseBracket closeBracket)
 {
     lhs.CodeList = optionalListBody.CodeList ?? new CodeList();
 }
예제 #5
0
파일: List.cs 프로젝트: russlank/Prolog.NET
 public static void Rule(List lhs, OpenBracket openBracket, OptionalListBody optionalListBody, CloseBracket closeBracket)
 {
     if (optionalListBody.CodeList == null)
     {
         lhs.CodeList = new CodeList();
     }
     else
     {
         lhs.CodeList = optionalListBody.CodeList;
     }
 }
        private bool ReadToken(out Token token)
        {
            var currentState = InputState.Start;
            var tokenStr     = new StringBuilder();

            for (; _pos < _expression.Length; _pos++)
            {
                var symbol = _expression[_pos];
                var pair   = _table.Get(new KeyValuePair <InputState, char>(currentState, symbol));

                if (pair.Key == InputState.Start)
                {
                    continue;
                }

                if (pair.Key == InputState.Finish)
                {
                    switch (pair.Value)
                    {
                    case OutputState.Add:
                        token = new Add();
                        Step();
                        return(true);

                    case OutputState.Sub:
                        token = new Substract();
                        Step();
                        return(true);

                    case OutputState.Mul:
                        token = new Multiply();
                        return(true);

                    case OutputState.Div:
                        token = new Divide();
                        Step();
                        return(true);

                    case OutputState.Pow:
                        token = new Power();
                        Step();
                        return(true);

                    case OutputState.LBr:
                        token = new OpenBracket();
                        Step();
                        return(true);

                    case OutputState.RBr:
                        token = new CloseBracket();
                        Step();
                        return(true);

                    case OutputState.LPart:
                        token = new Digit(tokenStr.ToString());
                        return(true);

                    case OutputState.RPart:
                        token = new Digit(tokenStr.ToString());
                        return(true);
                    }
                }
                currentState = pair.Key;
                tokenStr.Append(symbol);
            }
            token = null;
            return(false);
        }
예제 #7
0
 public static void Rule(List lhs, OpenBracket openBracket, OptionalListBody optionalListBody, CloseBracket closeBracket)
 {
     lhs.CodeList = optionalListBody.CodeList ?? new CodeList();
 }