本文整理汇总了C#中IronPython.Compiler.Ast.NameExpression类的典型用法代码示例。如果您正苦于以下问题:C# NameExpression类的具体用法?C# NameExpression怎么用?C# NameExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NameExpression类属于IronPython.Compiler.Ast命名空间,在下文中一共展示了NameExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Walk
public override bool Walk(NameExpression node) {
// Called for the sublist parameters. The elements of the tuple become regular
// local variables, therefore don't make the parameters (DefineParameter), but
// regular locals (DefineName)
_binder.DefineName(node.Name);
node.Reference = _binder.Reference(node.Name);
return false;
}
开发者ID:Hank923,项目名称:ironruby,代码行数:8,代码来源:PythonNameBinder.cs
示例2: Walk
public override bool Walk(NameExpression node)
{
if (currentAssignStatement != null) {
string nodeName = node.Name;
if (nodeName == variableName) {
foundVariableAssignment = true;
}
}
return base.Walk(node);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:10,代码来源:PythonVariableResolver.cs
示例3: Walk
public override bool Walk(NameExpression node)
{
binder.DefineParameter(node.Name);
return false;
}
开发者ID:FabioNascimento,项目名称:DICommander,代码行数:5,代码来源:Binder.cs
示例4: ParsePrimary
// primary: atom | attributeref | subscription | slicing | call
// atom: identifier | literal | enclosure
// enclosure:
// parenth_form |
// list_display |
// generator_expression |
// dict_display |
// string_conversion |
// yield_atom
private Expression ParsePrimary() {
Token t = PeekToken();
Expression ret;
switch (t.Kind) {
case TokenKind.LeftParenthesis: // parenth_form, generator_expression, yield_atom
NextToken();
return FinishTupleOrGenExp();
case TokenKind.LeftBracket: // list_display
NextToken();
return FinishListValue();
case TokenKind.LeftBrace: // dict_display
NextToken();
return FinishDictOrSetValue();
case TokenKind.BackQuote: // string_conversion
NextToken();
return FinishStringConversion();
case TokenKind.Name: // identifier
NextToken();
string name = (string)t.Value;
if (_sink != null) {
_sink.StartName(GetSourceSpan(), name);
}
ret = new NameExpression(FixName(name));
ret.SetLoc(_globalParent, GetStart(), GetEnd());
return ret;
case TokenKind.Constant: // literal
NextToken();
var start = GetStart();
object cv = t.Value;
string cvs = cv as string;
if (cvs != null) {
cv = FinishStringPlus(cvs);
} else {
Bytes bytes = cv as Bytes;
if (bytes != null) {
cv = FinishBytesPlus(bytes);
}
}
if (t is UnicodeStringToken) {
ret = ConstantExpression.MakeUnicode((string)cv);
} else {
ret = new ConstantExpression(cv);
}
ret.SetLoc(_globalParent, start, GetEnd());
return ret;
default:
ReportSyntaxError(_lookahead.Token, _lookahead.Span, ErrorCodes.SyntaxError, _allowIncomplete || _tokenizer.EndContinues);
// error node
ret = new ErrorExpression();
ret.SetLoc(_globalParent, _lookahead.Span.Start, _lookahead.Span.End);
return ret;
}
}
开发者ID:bdoot,项目名称:IronLanguages,代码行数:64,代码来源:Parser.cs
示例5: ParseDecorators
// decorators ::=
// decorator+
// decorator ::=
// "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE
private List<Expression> ParseDecorators() {
List<Expression> decorators = new List<Expression>();
while (MaybeEat(TokenKind.At)) {
var start = GetStart();
Expression decorator = new NameExpression(ReadName());
decorator.SetLoc(_globalParent, start, GetEnd());
while (MaybeEat(TokenKind.Dot)) {
string name = ReadNameMaybeNone();
decorator = new MemberExpression(decorator, name);
decorator.SetLoc(_globalParent, GetStart(), GetEnd());
}
decorator.SetLoc(_globalParent, start, GetEnd());
if (MaybeEat(TokenKind.LeftParenthesis)) {
if (_sink != null) {
_sink.StartParameters(GetSourceSpan());
}
Arg[] args = FinishArgumentList(null);
decorator = FinishCallExpr(decorator, args);
}
decorator.SetLoc(_globalParent, start, GetEnd());
EatNewLine();
decorators.Add(decorator);
}
return decorators;
}
开发者ID:bdoot,项目名称:IronLanguages,代码行数:33,代码来源:Parser.cs
示例6: Name
internal Name(NameExpression expr, expr_context ctx)
: this(expr.Name, ctx) {
}
开发者ID:rchandrashekara,项目名称:main,代码行数:3,代码来源:_ast.cs
示例7: Walk
public override bool Walk(NameExpression node)
{
node.Parent = _currentScope;
node.Reference = Reference(node.Name);
return true;
}
开发者ID:TerabyteX,项目名称:main,代码行数:6,代码来源:PythonNameBinder.cs
示例8: PostWalk
public override void PostWalk(NameExpression node)
{
}
开发者ID:valdisz,项目名称:PyToJs,代码行数:3,代码来源:JavascriptGenerator.cs
示例9: Walk
public override bool Walk(NameExpression node)
{
if (null == node) {
throw new ArgumentNullException("node");
}
Define(node.Name);
return false;
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:8,代码来源:Analyzer.cs
示例10: PostWalk
public override void PostWalk(NameExpression node)
{
base.PostWalk(node);
Console.WriteLine("NODE NAME: "+node.Name);
}
开发者ID:cadabloom,项目名称:RethinkDb.Driver,代码行数:5,代码来源:GeneratorForUnitTests.cs
示例11: SetPropertyValue
/// <summary>
/// Sets the property value that is referenced by this field expression.
/// </summary>
/// <remarks>
/// This method checks that the name expression matches a created instance before
/// converting the name expression as a string and setting the property value.
/// </remarks>
public bool SetPropertyValue(IComponentCreator componentCreator, NameExpression nameExpression)
{
object component = GetComponent(componentCreator);
PropertyDescriptor property = GetProperty(component, memberName);
if (property != null) {
string name = nameExpression.Name;
if (property.PropertyType != typeof(bool)) {
if ("self" == name) {
return SetPropertyValue(component, memberName, componentCreator.RootComponent);
} else {
object instance = componentCreator.GetInstance(name);
if (instance != null) {
return SetPropertyValue(component, memberName, instance);
}
}
}
return SetPropertyValue(component, memberName, name);
}
return false;
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:27,代码来源:PythonControlFieldExpression.cs
示例12: GetPropertyAccessors
private static bool GetPropertyAccessors(CallExpression rhsCall, ref NameExpression ne, ref string get, ref string set)
{
bool fCantEmit = false;
for (int i = 0; i < rhsCall.Args.Count; i++) {
// fget, fset, fdel, doc
if (rhsCall.Args[i].Name != SymbolTable.Empty) {
switch (rhsCall.Args[i].Name.GetString()) {
case "fget":
ne = rhsCall.Args[i].Expression as NameExpression;
if (ne == null) { fCantEmit = true; break; }
get = ne.Name.GetString();
break;
case "fset":
ne = rhsCall.Args[i].Expression as NameExpression;
if (ne == null) { fCantEmit = true; break; }
set = ne.Name.GetString();
break;
default:
fCantEmit = true;
break;
}
} else {
switch (i) {
case 0:
ne = rhsCall.Args[i].Expression as NameExpression;
if (ne == null) { fCantEmit = true; break; }
get = ne.Name.GetString();
break;
case 1:
ne = rhsCall.Args[i].Expression as NameExpression;
if (ne == null) { fCantEmit = true; break; }
set = ne.Name.GetString();
break;
default:
fCantEmit = true;
break;
}
}
}
return fCantEmit;
}
开发者ID:FabioNascimento,项目名称:DICommander,代码行数:45,代码来源:UserTypeGenerator.cs
示例13: PostWalk
public virtual void PostWalk(NameExpression node)
{
}
开发者ID:FabioNascimento,项目名称:DICommander,代码行数:3,代码来源:Walker.Generated.cs
示例14: Walk
// NameExpression
public virtual bool Walk(NameExpression node)
{
return true;
}
开发者ID:FabioNascimento,项目名称:DICommander,代码行数:5,代码来源:Walker.Generated.cs
示例15: Walk
// NameExpression
public bool Walk(NameExpression node)
{
return Process(node);
}
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:5,代码来源:Locator.cs
示例16: Walk
// NameExpr
public override bool Walk(NameExpression node)
{
Binding binding;
if (bindings.TryGetValue(node.Name, out binding)) {
int index = binding.Index * 2;
node.IsDefined = bits.Get(index);
if (!node.IsDefined) {
binding.UninitializedUse();
}
if (!bits.Get(index + 1)) {
// Found an unbound use of the name => need to initialize to Uninitialized.instance
binding.UnassignedUse();
}
}
return true;
}
开发者ID:FabioNascimento,项目名称:DICommander,代码行数:17,代码来源:FlowChecker.cs
示例17: Walk
public override bool Walk(NameExpression node) {
_fc.Delete(node.Name);
return false;
}
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:4,代码来源:FlowChecker.cs
示例18: Walk
public override bool Walk(NameExpression node)
{
if (!(Parent(0) is CallExpression) || !functionNameMapping.ContainsKey(node.Name))
{
CheckForIllegalWords(node, node.Name);
}
Content(node.Name);
return false;
}
开发者ID:valdisz,项目名称:PyToJs,代码行数:10,代码来源:JavascriptGenerator.cs
示例19: Walk
public override bool Walk(NameExpression node)
{
if (!FoundInitializeComponentMethod) {
return false;
}
fieldExpression.SetPropertyValue(componentCreator, node);
return false;
}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:9,代码来源:PythonComponentWalker.cs
示例20: Deserialize
/// <summary>
/// Deserializes expressions of the form:
///
/// 1) self
/// </summary>
object Deserialize(NameExpression nameExpression)
{
string name = nameExpression.Name;
if ("self" == name.ToLowerInvariant()) {
return componentCreator.RootComponent;
} else {
bool result;
if (Boolean.TryParse(name, out result)) {
return result;
}
}
return componentCreator.GetInstance(name);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:18,代码来源:PythonCodeDeserializer.cs
注:本文中的IronPython.Compiler.Ast.NameExpression类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论