示例#1
0
 void Assoc_ComparisonOp(ref DesignScript.Parser.Associative.IDEHelpNode IDEop)
 {
     switch (la.kind) {
     case 15: {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     break;
     }
     case 17: {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     break;
     }
     case 14: {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     break;
     }
     case 16: {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     break;
     }
     case 18: {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     break;
     }
     case 19: {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     break;
     }
     default: SynErr(95); break;
     }
 }
示例#2
0
        void Assoc_FunctionalStatement(out Node node, ref DesignScript.Parser.Associative.IDEHelpNode Endline)
        {
            DesignScript.Parser.Associative.BinaryExpressionNode expressionNode = new DesignScript.Parser.Associative.BinaryExpressionNode();
            while (!(StartOf(5))) {SynErr(85); Get();}
            Node leftNode = null;
            isLeft = true;
            Assoc_DecoratedIdentifier(out leftNode);
            expressionNode.Line = leftNode.Line; expressionNode.Col = leftNode.Col; expressionNode.LeftNode = leftNode;
            isLeft = false;
            node = leftNode;
            if(!(leftNode is DesignScript.Parser.Associative.PostFixNode)) {
            Expect(53);
            Node rightNode = null;
            if (t.val == "=") { expressionNode.op.SetValue(t.val, t.line, t.col); }
            else { expressionNode.op.SetValue(null, 0, 0); }

            if (la.val == "[") {
            Assoc_LanguageBlock(out rightNode);
            Endline = null;
            } else if (HasMoreAssignmentStatements()) {
            Assoc_FunctionalStatement(out rightNode, ref Endline);
            } else if (!IsModifierStack()) {
            Assoc_Expression(out rightNode);
            while (!(la.kind == 0 || la.kind == 20)) {SynErr(86); Get();}
            Expect(20);
            if(t.val == ";") Endline.SetValue(t.val, t.line, t.col); else Endline.SetValue(null, -1, -1);
            } else if (IsModifierStack()) {
            DesignScript.Parser.Associative.ModifierStackNode mstack = new DesignScript.Parser.Associative.ModifierStackNode();
            if (la.val == "{") { mstack.openSharpBrace.SetValue(la.val, la.line, la.col); mstack.Line = la.line; mstack.Col = la.col; }
            else { 	mstack.openSharpBrace.SetValue(null, 0, 0); }

            Expect(50);
            string name = null;
            DesignScript.Parser.Associative.BinaryExpressionNode expression = new DesignScript.Parser.Associative.BinaryExpressionNode(); ; Node expression2 = null;
            Assoc_Expression(out expression2);
            if (la.kind == 55) {
                string _arr = null; int _line = 0; int _col = 0;
                Get();
                if (t.val == "=>") _arr = t.val; _line = t.line; _col = t.col;
                Expect(1);
                if (t.kind == _ident) { name = t.val; mstack.AddArrow(_arr, _line, _col, t.val, t.line, t.col); } else { name = null; mstack.AddArrow(_arr, _line, _col, null, 0, 0); }
            }
            expression.LeftNode = leftNode;
            expression.op = expressionNode.op;
            expression.RightNode = expression2;
            mstack.AddElementNode(expression, name);

            while (!(la.kind == 0 || la.kind == 20)) {SynErr(87); Get();}
            Expect(20);
            if (t.val == ";") mstack.AddEndLine(t.val, t.line, t.col); else mstack.AddEndLine(null, 0, 0);
            while (StartOf(6)) {
                name = null;
                bool bHasOperator = false; expression = new DesignScript.Parser.Associative.BinaryExpressionNode(); expression2 = null;
                bHasOperator = true; DesignScript.Parser.Associative.IDEHelpNode IDEop = expression.op;
                if (StartOf(7)) {
                    Assoc_BinaryOps(ref IDEop);
                }
                Assoc_Expression(out expression2);
                if (la.kind == 55) {
                    string _arr = null; int _line = 0; int _col = 0;
                    Get();
                    if (t.val == "=>") _arr = t.val; _line = t.line; _col = t.col;
                    Expect(1);
                    if (t.kind == _ident) { name = t.val; mstack.AddArrow(_arr, _line, _col, t.val, t.line, t.col); } else { name = null; mstack.AddArrow(_arr, _line, _col, null, 0, 0); }
                }
                if(!bHasOperator)
                {
                expression.RightNode = expression2;
                expression.LeftNode = leftNode;
                expression.op = expressionNode.op;
                mstack.AddElementNode(expression, name);
                }
                else
                {
                expression.LeftNode = leftNode;
                DesignScript.Parser.Associative.BinaryExpressionNode expression3 = new DesignScript.Parser.Associative.BinaryExpressionNode();
                expression3.LeftNode = leftNode;
                expression3.op = IDEop;
                expression3.RightNode = expression2;
                expression.LeftNode = leftNode;
                expression.RightNode = expression3;
                expression.op = expressionNode.op;
                mstack.AddElementNode(expression, name);
                }

                Expect(20);
                if (t.val == ";") mstack.AddEndLine(t.val, t.line, t.col); else mstack.AddEndLine(null, 0, 0);
            }
            if (la.val == "}" && mstack.openSharpBrace.Value != null) mstack.closeBrace.SetValue(la.val, la.line, la.col); else if (la.val != "}") mstack.openSharpBrace.SetValue(null, 0, 0); rightNode = mstack;
            Expect(51);
            } else SynErr(88);
            expressionNode.RightNode = rightNode; node = expressionNode;
                                      if (rightNode is DesignScript.Parser.Associative.ExprListNode) {
                                          DesignScript.Parser.Associative.IdentifierNode identNode =
                                              expressionNode.LeftNode as DesignScript.Parser.Associative.IdentifierNode;
                                          if (null != identNode) {
                                              DesignScript.Parser.Associative.IDEHelpNode identValue = identNode.IdentValue;
                                              rightNode.Name = ((null != identValue) ? identValue.Value : null);
                                          }
                                      }
                                  }
        }
示例#3
0
 void Assoc_AddOp(ref DesignScript.Parser.Associative.IDEHelpNode IDEop)
 {
     if (la.kind == 57) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else if (la.kind == 12) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else SynErr(93);
 }
示例#4
0
 void Assoc_BitOp(ref DesignScript.Parser.Associative.IDEHelpNode IDEop)
 {
     if (la.kind == 61) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else if (la.kind == 62) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else if (la.kind == 13) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else SynErr(103);
 }
示例#5
0
 void Associative_PostFixOp(ref DesignScript.Parser.Associative.IDEHelpNode IDEop)
 {
     if (la.kind == 66) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else if (la.kind == 67) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else SynErr(104);
 }
示例#6
0
 void Assoc_rangeStepOperator(ref DesignScript.Parser.Associative.IDEHelpNode stepOp2)
 {
     if (la.kind == 65 || la.kind == 68) {
     if (la.kind == 68) {
         Get();
         stepOp2.SetValue(t.val, t.line, t.col);
     } else {
         Get();
         stepOp2.SetValue(t.val, t.line, t.col);
     }
     }
 }
示例#7
0
 void Assoc_MulOp(ref DesignScript.Parser.Associative.IDEHelpNode IDEop)
 {
     if (la.kind == 58) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else if (la.kind == 59) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else if (la.kind == 60) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else SynErr(94);
 }
示例#8
0
 void Assoc_MethodSignature(out DesignScript.Parser.Associative.ArgumentSignatureNode argumentSign, out DesignScript.Parser.Associative.Pattern pattern, ref DesignScript.Parser.Associative.IDEHelpNode IDEName, ref DesignScript.Parser.Associative.TypeNode typeNode)
 {
     Expect(1);
     if (t.kind == _ident) IDEName.SetValue(t.val, t.line, t.col);
     if (la.kind == 54) {
     Assoc_TypeRestriction(out typeNode);
     }
     Assoc_ArgumentSignatureDefinition(out argumentSign);
     pattern = null;
     if (la.kind == 13) {
     Assoc_PatternExpression(out pattern);
     }
 }
示例#9
0
 void Assoc_LogicalOp(ref DesignScript.Parser.Associative.IDEHelpNode IDEop)
 {
     if (la.kind == 63) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else if (la.kind == 64) {
     Get();
     IDEop.SetValue(t.val, t.line, t.col);
     } else SynErr(96);
 }