Ejemplo n.º 1
0
 public static Exception OperatorIsUnknown(Tok token)
 => throw new FunParseException(213, $"operator '{ErrorsHelper.ToText(token)}' is unknown", token.Interval);
Ejemplo n.º 2
0
        public static Exception ArrayInitializeStepMissed(Tok openBracket, Tok lastToken, Tok missedVal)
        {
            int start  = openBracket.Start;
            int finish = lastToken.Finish;

            if (string.IsNullOrWhiteSpace(missedVal?.Value))
            {
                return(new FunParseException(234,
                                             $"'[x..y..???]. Array step expected but was nothing'{Nl} Example: a[1..5..2]", start,
                                             finish));
            }
            else
            {
                return(new FunParseException(237,
                                             $"'[x..y..???]. Array step expected but was {ErrorsHelper.ToText(missedVal)}'{Nl} Example: a[1..5..2]", start, finish));
            }
        }
Ejemplo n.º 3
0
 public static Exception FunctionAlreadyExist(UserFunctionDefinitionSyntaxNode userFun)
 => new FunParseException(545, $"Function  {ErrorsHelper.Signature(userFun.Id, userFun.Args)} already exist",
                          new Interval(userFun.Head.Interval.Start, userFun.Body.Interval.Finish));
Ejemplo n.º 4
0
 public static Exception FunctionArgumentDuplicates(UserFunctionDefinitionSyntaxNode lexFunction, TypedVarDefSyntaxNode lexFunctionArg)
 => new FunParseException(554, $"'Argument name '{lexFunctionArg.Id}' duplicates at  {ErrorsHelper.Signature(lexFunction.Id, lexFunction.Args)} ", lexFunction.Head.Interval);
Ejemplo n.º 5
0
 public static Exception LeftBinaryArgumentIsMissing(Tok token)
 => throw new FunParseException(207, $"expression is missed before '{ErrorsHelper.ToText(token)}'",
                                token.Interval);
Ejemplo n.º 6
0
 public static Exception RightBinaryArgumentIsMissing(ISyntaxNode leftNode, Tok @operator)
 => throw new FunParseException(210, $"{ErrorsHelper.ToShortText(leftNode)} {ErrorsHelper.ToText(@operator)} ???. Right expression is missed{Nl} Example: {ErrorsHelper.ToShortText(leftNode)} {ErrorsHelper.ToText(@operator)} e",
                                leftNode.Interval.Start, @operator.Finish);
Ejemplo n.º 7
0
 public static Exception UnaryArgumentIsMissing(Tok operatorTok)
 => throw new FunParseException(201, $"{ErrorsHelper.ToText(operatorTok)} ???{Nl} right expression is missed{Nl} Example: {ErrorsHelper.ToText(operatorTok)} a",
                                operatorTok.Interval);
Ejemplo n.º 8
0
 public static Exception InvalidArgTypeDefinition(ISyntaxNode argumentNode)
 => new FunParseException(509, ErrorsHelper.ToShortText(argumentNode) + " is  not valid fun arg", argumentNode.Interval);
Ejemplo n.º 9
0
 public static Exception UnknownValueAtStartOfExpression(int exprStart, Tok flowCurrent)
 => new FunParseException(315, $"Unexpected symbol {ErrorsHelper.ToText(flowCurrent)}. Equation, anonymous equation, function or type definition expected.", exprStart, flowCurrent.Finish);
Ejemplo n.º 10
0
 public static Exception ExpressionBeforeTheDefinition(int exprStart, ISyntaxNode expression, Tok flowCurrent)
 => new FunParseException(318, $"Unexpected expression {ErrorsHelper.ToShortText(expression)} before definition. Equation, anonymous equation, function or type definition expected.", exprStart, flowCurrent.Finish);
Ejemplo n.º 11
0
 public static Exception FunExpressionIsMissed(string funName, List <TypedVarDefSyntaxNode> arguments, Interval interval)
 => new FunParseException(312,
                          $"{ErrorsHelper.Signature(funName, arguments)} = ??? . Function body is missed {Nl}Example: {ErrorsHelper.Signature(funName, arguments)} = #place your body here",
                          interval);
Ejemplo n.º 12
0
 public static Exception FunDefTokenIsMissed(string funName, List <TypedVarDefSyntaxNode> arguments, Tok actual)
 {
     return(new FunParseException(309, $"{ErrorsHelper.Signature(funName, arguments)} ??? . '=' def symbol is skipped but was {ErrorsHelper.ToText(actual)}{Nl}Example: {ErrorsHelper.Signature(funName, arguments)} = ...",
                                  actual.Start, actual.Finish));
 }
Ejemplo n.º 13
0
 public static Exception UnexpectedExpression(ISyntaxNode lexNode)
 => new FunParseException(306, $"Unexpected expression {ErrorsHelper.ToShortText(lexNode)}", lexNode.Interval);
Ejemplo n.º 14
0
 public static Exception TypeExpectedButWas(Tok token)
 => new FunParseException(276, $"Expected: type, but was {ErrorsHelper.ToText(token)}", token.Interval);
Ejemplo n.º 15
0
        public static Exception FunctionCallObrMissed(int funStart, string name, int position, ISyntaxNode pipedVal)
        {
            if (pipedVal == null)
            {
                return(new FunParseException(270,
                                             $"{name}( ???. Close bracket ')' is missed{Nl} Example: {name}()",
                                             funStart,
                                             position));
            }

            return(new FunParseException(273,
                                         $"{ErrorsHelper.ToShortText(pipedVal)}.{name}( ???. Close bracket ')' is missed{Nl} Example: {ErrorsHelper.ToShortText(pipedVal)}.{name}() or {name}({ErrorsHelper.ToShortText(pipedVal)})",
                                         funStart,
                                         position));
        }