Ejemplo n.º 1
0
        public override object VisitAssignment([NotNull] AssignmentContext context)
        {
            // checking if 'Sylvre' is being declared and assigned to. Sylvre is a builtin library so disallowed
            if (context.variable_complex_reference_left().variable_reference().GetText() == "Sylvre")
            {
                _transpileErrors.Add(new SylvreTranspileError
                {
                    CharPositionInLine = context.variable_complex_reference_left().Start.Column + 1, // Column number 1 behind, zero based index?
                    Line    = context.variable_complex_reference_left().Start.Line,
                    Symbol  = context.variable_complex_reference_left().Start.Text,
                    Message = _sylvreAssignmentDisallowedMessage
                });
            }

            VisitVariable_complex_reference_left(context.variable_complex_reference_left());
            VisitAssignment_operator(context.assignment_operator());

            if (context.conditional_expression() != null)
            {
                VisitConditional_expression(context.conditional_expression());
            }
            else
            {
                VisitArray_assignment(context.array_assignment());
            }

            return(null);
        }