本文整理汇总了C#中PExp类的典型用法代码示例。如果您正苦于以下问题:C# PExp类的具体用法?C# PExp怎么用?C# PExp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PExp类属于命名空间,在下文中一共展示了PExp类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FoldInt
private int FoldInt(PExp exp, ref bool valid)
{
if (!valid) return -1;
if (exp is AIntConstExp)
{
return int.Parse(((AIntConstExp) exp).GetIntegerLiteral().Text);
}
if (exp is ABinopExp)
{
ABinopExp aExp = (ABinopExp)exp;
int left = FoldInt(aExp.GetLeft(), ref valid);
int right = FoldInt(aExp.GetLeft(), ref valid);
if (!valid) return -1;
PBinop binop = aExp.GetBinop();
if (binop is APlusBinop)
return left + right;
if (binop is AMinusBinop)
return left - right;
if (binop is ATimesBinop)
return left * right;
if ((binop is AModuloBinop || binop is ADivideBinop) && right == 0)
{
Token token = binop is AModuloBinop
? (Token)((AModuloBinop) binop).GetToken()
: ((ADivideBinop) binop).GetToken();
errors.Add(new ErrorCollection.Error(token, LocRM.GetString("ErrorText57")));
throw new ParserException(null, null);
}
if (binop is AModuloBinop)
return left % right;
if (binop is ADivideBinop)
return left / right;
if (binop is AAndBinop)
return left & right;
if (binop is AOrBinop)
return left | right;
if (binop is AXorBinop)
return left ^ right;
if (binop is ALBitShiftBinop)
return left << right;
if (binop is ARBitShiftBinop)
return left >> right;
}
if (exp is ALvalueExp)
return FoldInt(((ALvalueExp) exp).GetLvalue(), ref valid);
valid = false;
return -1;
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:49,代码来源:MakeEnrichmentLinks.cs
示例2: IsConst
static bool IsConst(PExp exp, out bool value)
{
if (exp is ABooleanConstExp)
{
value = ((ABooleanConstExp)exp).GetBool() is ATrueBool;
return true;
}
if (exp is AIntConstExp)
{
value = ((AIntConstExp)exp).GetIntegerLiteral().Text != "0";
return true;
}
if (exp is ANullExp)
{
value = false;
return true;
}
value = false;
return false;
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:20,代码来源:StatementRemover.cs
示例3: SetInit
public void SetInit(PExp node)
{
if (_init_ != null)
{
_init_.Parent(null);
}
if (node != null)
{
if (node.Parent() != null)
{
node.Parent().RemoveChild(node);
}
node.Parent(this);
}
_init_ = node;
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:19,代码来源:prods.cs
示例4: SetCondition
public void SetCondition(PExp node)
{
if (_condition_ != null)
{
_condition_.Parent(null);
}
if (node != null)
{
if (node.Parent() != null)
{
node.Parent().RemoveChild(node);
}
node.Parent(this);
}
_condition_ = node;
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:19,代码来源:prods.cs
示例5: AIfThenStm
public AIfThenStm(
TLParen _token_,
PExp _condition_,
PStm _body_
)
{
SetToken(_token_);
SetCondition(_condition_);
SetBody(_body_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:10,代码来源:prods.cs
示例6: SetElse
public void SetElse(PExp node)
{
if (_else_ != null)
{
_else_.Parent(null);
}
if (node != null)
{
if (node.Parent() != null)
{
node.Parent().RemoveChild(node);
}
node.Parent(this);
}
_else_ = node;
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:19,代码来源:prods.cs
示例7: SetReceiver
public void SetReceiver(PExp node)
{
if (_receiver_ != null)
{
_receiver_.Parent(null);
}
if (node != null)
{
if (node.Parent() != null)
{
node.Parent().RemoveChild(node);
}
node.Parent(this);
}
_receiver_ = node;
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:19,代码来源:prods.cs
示例8: ADelegateInvokeExp
public ADelegateInvokeExp(
TIdentifier _token_,
PExp _receiver_,
IList _args_
)
{
SetToken(_token_);
SetReceiver(_receiver_);
this._args_ = new TypedList(new Args_Cast(this));
this._args_.Clear();
this._args_.AddAll(_args_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:12,代码来源:prods.cs
示例9: AALocalDecl
public AALocalDecl(
PVisibilityModifier _visibility_modifier_,
TStatic _static_,
TRef _ref_,
TOut _out_,
TConst _const_,
PType _type_,
TIdentifier _name_,
PExp _init_
)
{
SetVisibilityModifier(_visibility_modifier_);
SetStatic(_static_);
SetRef(_ref_);
SetOut(_out_);
SetConst(_const_);
SetType(_type_);
SetName(_name_);
SetInit(_init_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:20,代码来源:prods.cs
示例10: ACastExp
public ACastExp(
TLParen _token_,
PType _type_,
PExp _exp_
)
{
SetToken(_token_);
SetType(_type_);
SetExp(_exp_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:10,代码来源:prods.cs
示例11: AForStm
public AForStm(
TLParen _token_,
PStm _init_,
PExp _cond_,
PStm _update_,
PStm _body_
)
{
SetToken(_token_);
SetInit(_init_);
SetCond(_cond_);
SetUpdate(_update_);
SetBody(_body_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:14,代码来源:prods.cs
示例12: AIfExp
public AIfExp(
TQuestionmark _token_,
PExp _cond_,
PExp _then_,
PExp _else_
)
{
SetToken(_token_);
SetCond(_cond_);
SetThen(_then_);
SetElse(_else_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:12,代码来源:prods.cs
示例13: ADeleteStm
public ADeleteStm(
TDelete _token_,
PExp _exp_
)
{
SetToken(_token_);
SetExp(_exp_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:8,代码来源:prods.cs
示例14: SetThen
public void SetThen(PExp node)
{
if (_then_ != null)
{
_then_.Parent(null);
}
if (node != null)
{
if (node.Parent() != null)
{
node.Parent().RemoveChild(node);
}
node.Parent(this);
}
_then_ = node;
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:19,代码来源:prods.cs
示例15: AEnrichmentDecl
public AEnrichmentDecl(
TEnrichment _token_,
PExp _dimention_,
TIntegerLiteral _int_dim_,
TRBrace _end_token_,
PType _type_,
IList _decl_
)
{
SetToken(_token_);
SetDimention(_dimention_);
SetIntDim(_int_dim_);
SetEndToken(_end_token_);
SetType(_type_);
this._decl_ = new TypedList(new Decl_Cast(this));
this._decl_.Clear();
this._decl_.AddAll(_decl_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:18,代码来源:prods.cs
示例16: AIfThenElseStm
public AIfThenElseStm(
TLParen _token_,
PExp _condition_,
PStm _then_body_,
PStm _else_body_
)
{
SetToken(_token_);
SetCondition(_condition_);
SetThenBody(_then_body_);
SetElseBody(_else_body_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:12,代码来源:prods.cs
示例17: AALocalDeclRight
public AALocalDeclRight(
TIdentifier _name_,
PAssignop _assignop_,
PExp _init_
)
{
SetName(_name_);
SetAssignop(_assignop_);
SetInit(_init_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:10,代码来源:prods.cs
示例18: AExpStm
public AExpStm(
TSemicolon _token_,
PExp _exp_
)
{
SetToken(_token_);
SetExp(_exp_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:8,代码来源:prods.cs
示例19: MoveOut
private void MoveOut(PExp exp, PType type)
{
PStm pStm = Util.GetAncestor<PStm>(exp);
AABlock pBlock = (AABlock)pStm.Parent();
ALocalLvalue lvalue = new ALocalLvalue(new TIdentifier("gppVar"));
ALvalueExp lvalueExp = new ALvalueExp(lvalue);
exp.ReplaceBy(lvalueExp);
AALocalDecl decl = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, Util.MakeClone(type, data), new TIdentifier("gppVar"), exp);
pBlock.GetStatements().Insert(pBlock.GetStatements().IndexOf(pStm), new ALocalDeclStm(new TSemicolon(";"), decl));
data.LvalueTypes[lvalue] =
data.ExpTypes[lvalueExp] = decl.GetType();
data.LocalLinks[lvalue] = decl;
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:15,代码来源:PointerNullFixes.cs
示例20: AFieldDecl
public AFieldDecl(
PVisibilityModifier _visibility_modifier_,
TStatic _static_,
TConst _const_,
PType _type_,
TIdentifier _name_,
PExp _init_
)
{
SetVisibilityModifier(_visibility_modifier_);
SetStatic(_static_);
SetConst(_const_);
SetType(_type_);
SetName(_name_);
SetInit(_init_);
}
开发者ID:Whimsyduke,项目名称:GalaxyEditorPlusPlus,代码行数:16,代码来源:prods.cs
注:本文中的PExp类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论