evaluate arguments

master
xieguigang 5 years ago
parent d266876212
commit f1d3948dcc

@ -43,6 +43,43 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Debug\</OutputPath>
<DocumentationFile>NetCDF.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Release\</OutputPath>
<DocumentationFile>NetCDF.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Publish|AnyCPU'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Publish\</OutputPath>
<DocumentationFile>NetCDF.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Publish|x64'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Publish\</OutputPath>
<DocumentationFile>NetCDF.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />

@ -1593,8 +1593,8 @@ Global
{A7145B06-EB92-4A95-8F85-F2BBE4226D5C}.ProteoWizard.d|x86.Build.0 = Debug|Any CPU
{A7145B06-EB92-4A95-8F85-F2BBE4226D5C}.Publish|Any CPU.ActiveCfg = Debug|Any CPU
{A7145B06-EB92-4A95-8F85-F2BBE4226D5C}.Publish|Any CPU.Build.0 = Debug|Any CPU
{A7145B06-EB92-4A95-8F85-F2BBE4226D5C}.Publish|x64.ActiveCfg = Debug|Any CPU
{A7145B06-EB92-4A95-8F85-F2BBE4226D5C}.Publish|x64.Build.0 = Debug|Any CPU
{A7145B06-EB92-4A95-8F85-F2BBE4226D5C}.Publish|x64.ActiveCfg = Publish|x64
{A7145B06-EB92-4A95-8F85-F2BBE4226D5C}.Publish|x64.Build.0 = Publish|x64
{A7145B06-EB92-4A95-8F85-F2BBE4226D5C}.Publish|x86.ActiveCfg = Debug|Any CPU
{A7145B06-EB92-4A95-8F85-F2BBE4226D5C}.Publish|x86.Build.0 = Debug|Any CPU
{A7145B06-EB92-4A95-8F85-F2BBE4226D5C}.R-dotnet|Any CPU.ActiveCfg = Release|Any CPU

@ -56,5 +56,11 @@ Namespace Interpreter
Public Property env As Environment
Public Property throwError As Boolean = True
Public ReadOnly Property GlobalEnvir As GlobalEnvironment
Get
Return env.GlobalEnvir
End Get
End Property
End Class
End Namespace

@ -53,7 +53,7 @@ Namespace Interpreter.Expressions
Public Property symbolName As String
Public Property type As String
Public Property arguments As String()
Public Property arguments As Expression()
Public Overrides ReadOnly Property keyword As String
Get

@ -1,49 +1,51 @@
#Region "Microsoft.VisualBasic::60bcd17ad4a2f4d16c0a950a86be8c6b, LINQ\LINQ\Interpreter\Query\DataSoruce\URIIteratorDriver.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' /********************************************************************************/
' Summaries:
' Summaries:
' Class URIIteratorDriver
'
' Constructor: (+1 Overloads) Sub New
' Function: PopulatesData
'
'
' /********************************************************************************/
' Class URIIteratorDriver
'
' Constructor: (+1 Overloads) Sub New
' Function: PopulatesData
'
'
' /********************************************************************************/
#End Region
Imports LINQ.Interpreter.Expressions
Imports LINQ.Runtime
Imports LINQ.Runtime.Drivers
Imports Microsoft.VisualBasic.Linq
Imports any = Microsoft.VisualBasic.Scripting
Namespace Interpreter.Query
@ -57,9 +59,14 @@ Namespace Interpreter.Query
End Sub
Public Overrides Iterator Function PopulatesData() As IEnumerable(Of Object)
Dim env As New ExecutableContext() With {.env = Me.env, .throwError = True}
Dim argumentStr As String() = symbolDeclare.arguments _
.SafeQuery _
.Select(Function(a) any.ToString(a.Exec(env))) _
.ToArray
Dim driver As DataSourceDriver = env.GlobalEnvir.GetDriverByCode(
code:=symbolDeclare.type,
arguments:=symbolDeclare.arguments
arguments:=argumentStr
)
For Each item As Object In driver.ReadFromUri(uri)

@ -224,24 +224,22 @@ Namespace Script
' declare new symbol
Dim name As String = tokenList(1).text
Dim type As String = "any"
Dim arguments As String() = Nothing
Dim arguments As Expression() = Nothing
If tokenList.Length > 2 Then
type = tokenList(3).text
If tokenList.Length > 4 Then
arguments = tokenList _
.Skip(4) _
.Where(Function(r) r.name <> Tokens.Comma) _
.Select(Function(r) r.text) _
tokenList = tokenList.Skip(4).ToArray
tokenList = tokenList.Take(tokenList.Length - 1).ToArray
Dim values As Token()() = tokenList _
.SplitByTopLevelStack _
.ToArray
If arguments(Scan0) = "(" AndAlso arguments.Last = ")" Then
arguments = arguments _
.Skip(1) _
.Take(arguments.Length - 2) _
.ToArray
End If
arguments = values _
.Select(AddressOf ParseExpression) _
.ToArray
End If
End If

Loading…
Cancel
Save