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); } } } }
void Assoc_FunctionDecl(out Node node) { codeSegmentStarted = true; DesignScript.Parser.Associative.FunctionDefinitionNode f = null; f = new DesignScript.Parser.Associative.FunctionDefinitionNode() { Line = la.line, Col = la.col }; if (la.kind == 26) { Get(); if (t.val == "external") f.Kwexternal.SetValue(t.val, t.line, t.col); if (la.kind == 22) { Get(); if (t.val == "native") f.Kwnative.SetValue(t.val, t.line, t.col); } Assoc_ExternalLibraryReference(ref f); } Expect(25); if (t.val == "def") f.Kwdef.SetValue(t.val, t.line, t.col); else Get(); DesignScript.Parser.Associative.IDEHelpNode IdentName = f.name; DesignScript.Parser.Associative.TypeNode IDEType = new DesignScript.Parser.Associative.TypeNode(); DesignScript.Parser.Associative.ArgumentSignatureNode argumentSignature = null; DesignScript.Parser.Associative.Pattern pattern = null; Assoc_MethodSignature(out argumentSignature, out pattern, ref IdentName, ref IDEType); f.IDEReturnType = IDEType; f.name = IdentName; f.Pattern = pattern; f.Singnature = argumentSignature; while (!(StartOf(3))) {SynErr(76); Get();} Node functionBody = null; if (la.kind == 20) { Get(); f.endLine.SetValue(t.val, t.line, t.col); } else if (la.kind == 53) { Get(); DesignScript.Parser.Associative.CodeBlockNode func = new DesignScript.Parser.Associative.CodeBlockNode(); DesignScript.Parser.Associative.BinaryExpressionNode binaryExpr = new DesignScript.Parser.Associative.BinaryExpressionNode(); binaryExpr.op.SetValue(t.val, t.line, t.col); Node expr; Assoc_Expression(out expr); binaryExpr.RightNode = expr; List<Node> body = new List<Node>(); body.Add(binaryExpr); func.Body = body; f.FunctionBody = func as DesignScript.Parser.Associative.CodeBlockNode; Expect(20); f.endLine.SetValue(t.val, t.line, t.col); } else if (la.kind == 50) { Assoc_FunctionalMethodBodyMultiLine(out functionBody); f.FunctionBody = functionBody as DesignScript.Parser.Associative.CodeBlockNode; } else SynErr(77); node = f; }
void Assoc_ComparisonExpression(out Node node) { Assoc_RangeExpr(out node); while (StartOf(14)) { DesignScript.Parser.Associative.BinaryExpressionNode binaryNode = new DesignScript.Parser.Associative.BinaryExpressionNode(); DesignScript.Parser.Associative.IDEHelpNode IDEop = binaryNode.op; Assoc_ComparisonOp(ref IDEop); binaryNode.op = IDEop; Node expr2 = null; Assoc_RangeExpr(out expr2); binaryNode.LeftNode = node; binaryNode.RightNode = expr2; node = binaryNode; } }
void Assoc_ArithmeticExpression(out Node node) { Assoc_Term(out node); while (la.kind == 12 || la.kind == 57) { DesignScript.Parser.Associative.BinaryExpressionNode binaryNode = new DesignScript.Parser.Associative.BinaryExpressionNode(); DesignScript.Parser.Associative.IDEHelpNode IDEop = binaryNode.op; Assoc_AddOp(ref IDEop); binaryNode.op = IDEop; binaryNode.LeftNode = node; node = null; Assoc_Term(out node); binaryNode.RightNode = node; node = binaryNode; } }
void Assoc_Term(out Node node) { Assoc_interimfactor(out node); while (la.kind == 58 || la.kind == 59 || la.kind == 60) { DesignScript.Parser.Associative.BinaryExpressionNode binaryNode = new DesignScript.Parser.Associative.BinaryExpressionNode(); DesignScript.Parser.Associative.IDEHelpNode IDEop = binaryNode.op; binaryNode.LeftNode = node; Assoc_MulOp(ref IDEop); binaryNode.op = IDEop; node = null; Assoc_interimfactor(out node); binaryNode.RightNode = node; node = binaryNode; } }
void Assoc_LogicalExpression(out Node node) { node = null; Assoc_ComparisonExpression(out node); while (la.kind == 63 || la.kind == 64) { DesignScript.Parser.Associative.BinaryExpressionNode binaryNode = new DesignScript.Parser.Associative.BinaryExpressionNode(); DesignScript.Parser.Associative.IDEHelpNode IDEop = binaryNode.op; binaryNode.LeftNode = node; Assoc_LogicalOp(ref IDEop); binaryNode.op = IDEop; node = null; Assoc_ComparisonExpression(out node); binaryNode.RightNode = node; node = binaryNode; } }
void Assoc_interimfactor(out Node node) { Assoc_Factor(out node); while (la.kind == 13 || la.kind == 61 || la.kind == 62) { DesignScript.Parser.Associative.BinaryExpressionNode binaryNode = new DesignScript.Parser.Associative.BinaryExpressionNode(); DesignScript.Parser.Associative.IDEHelpNode IDEop = binaryNode.op; Assoc_BitOp(ref IDEop); binaryNode.op = IDEop; node = null; Assoc_Factor(out node); binaryNode.RightNode = node; node = binaryNode; } }