Exemple #1
0
 public MatrixSetNode(MatrixGetNode node)
 {
     ExpressionPrefix = node.ExpressionPrefix;
       Index1 = node.Index1;
       Index2 = node.Index2;
 }
Exemple #2
0
        /// <summary>
        /// index = "[", expr, [ ",", expr ], "]"
        /// </summary>
        /// <param name="parent">Parent node get index from</param>
        /// <returns></returns>
        public IdentifierNode ParseIndex()
        {
            // "["
              var lexem = GetLexem();
              SkipLexem();
              var index1 = ParseExpr();

              if (PeekLexem(LexemType.Comma))
              {
            SkipLexem();
            // ? ","
            // double index!
            var index2 = ParseExpr();

            // "]"
            if (!PeekLexem(LexemType.SquareClose)) Error(Resources.errSquareBracketExpected);
            SkipLexem(true);

            // look ahead: if "=" then assignment and break loop
            var node = new MatrixGetNode();
            node.Index1 = index1;
            node.Index2 = index2;
            node.Lexem = lexem;
            return node;
              }
              else
              {
            // "]"
            if (!PeekLexem(LexemType.SquareClose)) Error(Resources.errSquareBracketExpected);
            SkipLexem(true);

            var node = new ArrayGetNode();
            node.Index = index1;
            node.Lexem = lexem;
            return node;
              }
        }