本文整理汇总了C#中XSpect.Yacq.Symbols.SymbolTable类的典型用法代码示例。如果您正苦于以下问题:C# SymbolTable类的具体用法?C# SymbolTable怎么用?C# SymbolTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SymbolTable类属于XSpect.Yacq.Symbols命名空间,在下文中一共展示了SymbolTable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ReplWindow
public ReplWindow()
{
this.Width = 450;
this.Height = 350;
this.Title = "YACQ Console";
this.Content = this.textBox;
this.textBox.AcceptsReturn = true;
this.textBox.BorderThickness = new Thickness(0);
this.textBox.FontFamily = new FontFamily("Consolas");
this.textBox.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
this.textBox.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
this.textBox.TextWrapping = TextWrapping.Wrap;
this.textBox.Text = string.Format("YACQ {0} on Krile {1}\r\n", YacqServices.Version, typeof(App).Assembly.GetName().Version);
this.textBox.Select(this.textBox.Text.Length, 0);
this.textBox.PreviewKeyDown += this.textBox_PreviewKeyDown;
this.symbolTable = new SymbolTable(YacqFilter.FilterSymbols, typeof(Symbols))
{
{"*textbox*", YacqExpression.Constant(textBox)},
};
var rcPath = Path.Combine(
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
"yacq_lib\\rc.yacq"
);
if(File.Exists(rcPath))
{
YacqServices.ParseAll(this.symbolTable, File.ReadAllText(rcPath))
.ForEach(e => YacqExpression.Lambda(e).Compile().DynamicInvoke());
this.textBox.AppendText("rc.yacq was loaded.\r\n");
}
this.textBox.AppendText(">>> ");
}
开发者ID:takeshik,项目名称:YacqPlugin,代码行数:31,代码来源:ReplWindow.cs
示例2: VectorExpression
internal VectorExpression(
SymbolTable symbols,
YacqList elements
)
: base(symbols, elements)
{
}
开发者ID:takeshik,项目名称:yacq,代码行数:7,代码来源:VectorExpression.cs
示例3: LambdaListExpression
internal LambdaListExpression(
SymbolTable symbols,
YacqList elements
)
: base(symbols, elements)
{
}
开发者ID:takeshik,项目名称:yacq,代码行数:7,代码来源:LambdaListExpression.cs
示例4: IdentifierExpression
internal IdentifierExpression(
SymbolTable symbols,
String name
)
: base(symbols)
{
this.Name = name;
}
开发者ID:takeshik,项目名称:yacq,代码行数:8,代码来源:IdentifierExpression.cs
示例5: TypeCandidateExpression
internal TypeCandidateExpression(
SymbolTable symbols,
IList<Type> candidates
)
: base(symbols)
{
this.Candidates = new ReadOnlyCollection<Type>(candidates ?? Type.EmptyTypes);
}
开发者ID:takeshik,项目名称:yacq,代码行数:8,代码来源:TypeCandidateExpression.cs
示例6: SerializedExpression
internal SerializedExpression(
SymbolTable symbols,
Node node
)
: base(symbols)
{
this.Node = node;
}
开发者ID:takeshik,项目名称:yacq,代码行数:8,代码来源:SerializedExpression.cs
示例7: Clear
public static Expression Clear(DispatchExpression e, SymbolTable s, Type t)
{
return YacqExpression.Dispatch(
s,
DispatchTypes.Method,
s.Resolve("*textbox*"),
"Clear"
);
}
开发者ID:takeshik,项目名称:YacqPlugin,代码行数:9,代码来源:Symbols.cs
示例8: NumberExpression
internal NumberExpression(
SymbolTable symbols,
String text
)
: base(symbols)
{
this.SourceText = text;
this.Value = this.Parse();
}
开发者ID:takeshik,项目名称:yacq,代码行数:9,代码来源:NumberExpression.cs
示例9: AmbiguousParameterExpression
internal AmbiguousParameterExpression(
SymbolTable symbols,
Type type,
String name
)
: base(symbols)
{
this._type = type;
this.Name = name;
}
开发者ID:takeshik,项目名称:yacq,代码行数:10,代码来源:AmbiguousParameterExpression.cs
示例10: QuotedExpression
internal QuotedExpression(
SymbolTable symbols,
QuoteType quoteType,
Expression expression
)
: base(symbols)
{
this.QuoteType = quoteType;
this.Expression = expression ?? Empty();
this.SetPosition(this.Expression);
}
开发者ID:takeshik,项目名称:yacq,代码行数:11,代码来源:QuotedExpression.cs
示例11: ContextfulExpression
internal ContextfulExpression(
SymbolTable symbols,
Expression expression,
ContextType contextType
)
: base(symbols)
{
this.Expression = expression;
this.ContextType = contextType;
this.SetPosition(expression);
}
开发者ID:takeshik,项目名称:yacq,代码行数:11,代码来源:ContextfulExpression.cs
示例12: MacroExpression
internal MacroExpression(SymbolTable symbols, Expression body, IList<AmbiguousParameterExpression> parameters)
: base(symbols)
{
if (parameters.Any(p => p.Type(symbols) != null && !typeof(Expression).IsAppropriate(p.Type)))
{
throw new ArgumentException("All parameters of macro must be Expression", "parameters");
}
this.Parameters = new ReadOnlyCollection<AmbiguousParameterExpression>(parameters ?? Arrays.Empty<AmbiguousParameterExpression>());
this.Body = body ?? Empty();
this.SetPosition(this.Parameters.EndWith(this.Body));
}
开发者ID:takeshik,项目名称:yacq,代码行数:11,代码来源:MacroExpression.cs
示例13: TextExpression
internal TextExpression(
SymbolTable symbols,
Char quoteChar,
String sourceText
)
: base(symbols)
{
this._codes = new List<String>();
this.QuoteChar = quoteChar;
this.SourceText = sourceText ?? "";
this.Value = this.Parse();
}
开发者ID:takeshik,项目名称:yacq,代码行数:12,代码来源:TextExpression.cs
示例14: ReduceImpl
/// <summary>
/// Reduces this node to a simpler expression with additional symbol tables.
/// </summary>
/// <param name="symbols">The additional symbol table for reducing.</param>
/// <param name="expectedType">The type which is expected as the type of reduced expression.</param>
/// <returns>The reduced expression.</returns>
protected override Expression ReduceImpl(SymbolTable symbols, Type expectedType)
{
if (symbols.ResolveMatch(DispatchTypes.Member, this.Name) != null
|| symbols.Missing != DispatchExpression.DefaultMissing
)
{
return Variable(symbols, this.Name)
.ReduceOnce(symbols, expectedType)
.Let(e => (e as MacroExpression).Null(m => m.Evaluate(symbols)) ?? e);
}
else
{
throw new ParseException("Identifier evaluation failed: " + this, this);
}
}
开发者ID:takeshik,项目名称:yacq,代码行数:21,代码来源:IdentifierExpression.cs
示例15: Write
public static Expression Write(DispatchExpression e, SymbolTable s, Type t)
{
return YacqExpression.Dispatch(
s,
DispatchTypes.Method,
s.Resolve("*textbox*"),
"AppendText",
YacqExpression.Dispatch(
s,
DispatchTypes.Method,
e.Left,
"ToString"
)
);
}
开发者ID:takeshik,项目名称:YacqPlugin,代码行数:15,代码来源:Symbols.cs
示例16: ReduceImpl
/// <summary>
/// Reduces this node to a simpler expression with additional symbol tables.
/// </summary>
/// <param name="symbols">The additional symbol table for reducing.</param>
/// <param name="expectedType">The type which is expected as the type of reduced expression.</param>
/// <returns>The reduced expression.</returns>
protected override Expression ReduceImpl(SymbolTable symbols, Type expectedType)
{
Expression value = null;
if (this.Elements.IsEmpty())
{
return Empty();
}
if (!(this[0] is IdentifierExpression)
|| symbols.ResolveMatch(DispatchTypes.Member, this[0].Id()) != null
)
{
value = this[0].TryReduce(symbols);
if (value is MacroExpression)
{
return ((MacroExpression) value).Evaluate(symbols, this.Elements.Skip(1));
}
if (value != null && value.Type(symbols).GetDelegateSignature() != null)
{
return Invoke(value, this.Elements.Skip(1).ReduceAll(symbols));
}
if (value is TypeCandidateExpression)
{
return Dispatch(
symbols,
DispatchTypes.Constructor,
value,
null,
this.Elements.Skip(1)
);
}
}
if (this[0] is IdentifierExpression
&& symbols.ResolveMatch(DispatchTypes.Method, this[0].Id()) != null
|| symbols.Missing != DispatchExpression.DefaultMissing
)
{
return Function(
symbols,
this[0].Id(),
this.Elements.Skip(1)
);
}
if (value != null && this.Length == 1)
{
return value;
}
throw new ParseException("List evaluation failed: " + this, this);
}
开发者ID:takeshik,项目名称:yacq,代码行数:54,代码来源:ListExpression.cs
示例17: Missing
public static Expression Missing(DispatchExpression e, SymbolTable s, Type t)
{
Type type;
if (e.DispatchType == DispatchTypes.Method
&& !s.ExistsKey(DispatchTypes.Method, e.Name)
&& (type = FilterRegistrant.GetFilter(e.Name).FirstOrDefault()) != null
)
{
return YacqExpression.Dispatch(
s,
DispatchTypes.Constructor,
YacqExpression.TypeCandidate(type),
null,
e.Arguments
)
.Method(s, "Filter", YacqExpression.Identifier(s, "it"));
}
return DispatchExpression.DefaultMissing(e, s, t);
}
开发者ID:takeshik,项目名称:YacqPlugin,代码行数:19,代码来源:YacqFilter.Symbols.cs
示例18: ReduceImpl
/// <summary>
/// Reduces this node to a simpler expression with additional symbol tables.
/// </summary>
/// <param name="symbols">The additional symbol table for reducing.</param>
/// <param name="expectedType">The type which is expected as the type of reduced expression.</param>
/// <returns>The reduced expression.</returns>
protected override Expression ReduceImpl(SymbolTable symbols, Type expectedType)
{
return Enumerable.Range(0, Math.Max(
this.Elements
.SelectMany(YacqExpressionVisitor.Traverse)
.Max(e =>
{
Int32 value = -1;
return e.Id().Null(s =>
s.StartsWithInvariant("$") && Int32.TryParse(s.Substring(1), out value)
)
? value
: -1;
}) + 1,
expectedType.GetDelegateSignature().Null(m => m.GetParameters().Length, 0)
))
.Select(i => AmbiguousParameter(symbols, "$" + i))
.ToArray()
.Let(ps => AmbiguousLambda(symbols, List(symbols, this.Elements), ps));
}
开发者ID:takeshik,项目名称:yacq,代码行数:26,代码来源:LambdaListExpression.cs
示例19: WriteLine
public static Expression WriteLine(DispatchExpression e, SymbolTable s, Type t)
{
return YacqExpression.Dispatch(
s,
DispatchTypes.Method,
YacqExpression.Dispatch(
s,
DispatchTypes.Method,
"+",
YacqExpression.Dispatch(
s,
DispatchTypes.Method,
e.Left,
"ToString"
),
Expression.Constant("\n")
),
"printn"
);
}
开发者ID:takeshik,项目名称:YacqPlugin,代码行数:20,代码来源:Symbols.cs
示例20: Tab
public static Expression Tab(DispatchExpression e, SymbolTable s, Type t)
{
return YacqExpression.TypeCandidate(typeof(Setting))
.Member(s, "Instance")
.Member(s, "StateProperty")
.Member(s, "TabInformations")
.Method(s, "SelectMany",
YacqExpression.Function(s, "\\",
YacqExpression.Vector(s, YacqExpression.Identifier(s, "e")),
YacqExpression.Identifier(s, "e")
)
)
.Method(s, "First",
YacqExpression.LambdaList(s,
YacqExpression.Identifier(s, "=="),
YacqExpression.Identifier(s, "$0").Member(s, "Name"),
e.Arguments[0]
)
)
.Member(s, "TweetSources")
.Method(s, "Single");
}
开发者ID:takeshik,项目名称:YacqPlugin,代码行数:22,代码来源:YacqFilter.Symbols.cs
注:本文中的XSpect.Yacq.Symbols.SymbolTable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论