Exemplo n.º 1
0
        public RelinqScriptParser(String relinqScriptCode, IntegrationContext integration)
        {
            RelinqScriptCode = relinqScriptCode;
            Integration = integration;

            _rules.Add(t => t.Text == "PAREXPR", ParseParentheses);
            _rules.Add(t => t.Text == "CALL", ParseCall);
            _rules.Add(t => t.Text == "BYINDEX", ParseByIndex);
            _rules.Add(t => t.Text == "BYFIELD", ParseByField);
            _rules.Add(t => t.Text == "function", ParseFunctionDefinition);
            _rules.Add(t => EcmaScriptV3Syntax.IsObject(t.Token), ParseObjectInitializer);
            _rules.Add(t => EcmaScriptV3Syntax.IsArray(t.Token), ParseArrayInitializer);
            _rules.Add(t => OperatorsReference.IsOperator(t.Text), ParseOperator);

            _rules.Add(t => t.Children.Count == 0 && 
                !EcmaScriptV3Syntax.IsKeyword(t.Token) && integration.IsRegisteredJS(t.Text),
                t => new KeywordExpression(t.Text));

            _rules.Add(t => t.Children.Count == 0 && 
                !integration.IsRegisteredJS(t.Text) && EcmaScriptV3Syntax.IsIdentifier(t.Token),
                t => new VariableExpression(t.Text));

            _rules.Add(t => t.Children.Count == 0 && 
                !integration.IsRegisteredJS(t.Text) && EcmaScriptV3Syntax.IsLiteral(t.Token),
                t => new ConstantExpression(t.Token));
        }
Exemplo n.º 2
0
        public TypeInferenceContext(RelinqScriptExpression root, 
            TypeInferenceCache inferences, IntegrationContext integration)
        {
            Root = root;

            // ctx.Root might only be one of the following:
            // * Invoke expression (for both cases of compile-time and late-bound invocation)
            // * Indexer or Operator expression
            // * Root of an entire AST
            if (Root.Parent != null && !Root.IsCall())
            {
                throw new NotSupportedException(root.ToString());
            }

            Inferences = inferences;
            Integration = integration;
        }
Exemplo n.º 3
0
 protected IntegrationException(IntegrationExceptionType type, IntegrationContext ctx, Exception innerException)
     : base(innerException)
 {
     Type = type;
     Context = ctx;
 }
Exemplo n.º 4
0
 public TypeInferenceEngine(RelinqScriptExpression ast, IntegrationContext integration)
 {
     Ctx = new TypeInferenceContext(ast, new TypeInferenceCache(), integration);
 }
Exemplo n.º 5
0
 public RelinqScriptCompiler(IntegrationContext integration)
 {
     Integration = integration;
 }
Exemplo n.º 6
0
 public TransformationFramework()
 {
     Integration = new IntegrationContext();
 }
 public JSToCSharpIntegrationException(IntegrationExceptionType type, IntegrationContext ctx, String jsVariable, Exception innerException)
     : base(type, ctx, innerException)
 {
     JSVariable = jsVariable;
 }
 public JSToCSharpIntegrationException(IntegrationExceptionType type, IntegrationContext ctx, String jsVariable)
     : this(type, ctx, jsVariable, null)
 {
 }
 public CSharpToJSIntegrationException(IntegrationExceptionType type, IntegrationContext ctx, Object csharpObject, Exception innerException) 
     : base(type, ctx, innerException)
 {
     CSharpObject = csharpObject;
 }
 public CSharpToJSIntegrationException(IntegrationExceptionType type, IntegrationContext ctx, Object csharpObject)
     : this(type, ctx, csharpObject, null)
 {
 }
Exemplo n.º 11
0
 public CSharpExpressionTreeBuilder(RelinqScriptExpression ast, IntegrationContext integration)
 {
     Ast = ast;
     Integration = integration;
 }