private static IExpressionNode BuildExpression(
     ISyntaxNode node,
     IFunctionDictionary functions,
     VariableDictionary variables,
     TypeInferenceResults typeInferenceResults,
     TicTypesConverter typesConverter) =>
 node.Accept(new ExpressionBuilderVisitor(functions, variables, typeInferenceResults, typesConverter));
        public static bool ComeOver(this ISyntaxNode root, ISyntaxNodeVisitor <VisitorEnterResult> enterVisitor,
                                    ISyntaxNodeVisitor <bool> exitVisitor)
        {
            var enterResult = root.Accept(enterVisitor);

            if (enterResult == VisitorEnterResult.Failed)
            {
                return(false);
            }
            if (enterResult == VisitorEnterResult.Skip)
            {
                return(true);
            }

            foreach (var child in root.Children)
            {
                if (!child.ComeOver(enterVisitor, exitVisitor))
                {
                    return(false);
                }
            }
            return(root.Accept(exitVisitor));
        }
        public static IExpressionNode BuildExpression(
            ISyntaxNode node,
            IFunctionDictionary functions,
            FunnyType outputType,
            VariableDictionary variables,
            TypeInferenceResults typeInferenceResults,
            TicTypesConverter typesConverter)
        {
            var result = node.Accept(
                new ExpressionBuilderVisitor(functions, variables, typeInferenceResults, typesConverter));

            if (result.Type == outputType)
            {
                return(result);
            }
            var converter = VarTypeConverter.GetConverterOrThrow(result.Type, outputType, node.Interval);

            return(new CastExpressionNode(result, outputType, converter, node.Interval));
        }
 private IExpressionNode ReadNode(ISyntaxNode node)
 => node.Accept(this);
Exemple #5
0
 public static string ToShortText(ISyntaxNode node) => node.Accept(new ShortDescritpionVisitor());