本文整理汇总了C#中ICSharpCode.NRefactory.Ast.PrimitiveExpression类的典型用法代码示例。如果您正苦于以下问题:C# PrimitiveExpression类的具体用法?C# PrimitiveExpression怎么用?C# PrimitiveExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrimitiveExpression类属于ICSharpCode.NRefactory.Ast命名空间,在下文中一共展示了PrimitiveExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VisitPrimitiveExpression
public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
{
if (primitiveExpression.Value is bool)
return (bool)primitiveExpression.Value ? SymbolDefined : null;
else
return null;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:ConditionalCompilation.cs
示例2: VisitPrimitiveExpression
public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
{
if (primitiveExpression.Value == null) {
return NullReturnType.Instance;
} else {
return resolver.ProjectContent.SystemTypes.CreatePrimitive(primitiveExpression.Value.GetType());
}
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:8,代码来源:TypeVisitor.cs
示例3: VisitPrimitiveExpression
public object VisitPrimitiveExpression(PrimitiveExpression pe, object data)
{
object val = pe.Value;
if (val == null) {
return new B.NullLiteralExpression(GetLexicalInfo(pe));
}
if (val is string) {
return new B.StringLiteralExpression(GetLexicalInfo(pe), (string)val);
}
if (val is char) {
return new B.CharLiteralExpression(GetLexicalInfo(pe), ((char)val).ToString());
}
if (val is bool) {
return new B.BoolLiteralExpression(GetLexicalInfo(pe), (bool)val);
}
if (val is byte) {
AddWarning(pe, "Converting byte literal to int literal");
return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (byte)val, false);
}
if (val is short) {
AddWarning(pe, "Converting short literal to int literal");
return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (short)val, false);
}
if (val is int) {
return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (int)val, false);
}
if (val is long) {
return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (long)val, true);
}
if (val is sbyte) {
AddWarning(pe, "Converting sbyte literal to int literal");
return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (sbyte)val, false);
}
if (val is ushort) {
AddWarning(pe, "Converting ushort literal to int literal");
return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (ushort)val, false);
}
if (val is uint) {
AddWarning(pe, "Converting uint literal to int/long literal");
return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (uint)val);
}
if (val is ulong) {
AddWarning(pe, "Converting ulong literal to long literal");
return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (long)((ulong)val), true);
}
if (val is float) {
return new B.DoubleLiteralExpression(GetLexicalInfo(pe), (float)val, true);
}
if (val is double) {
return new B.DoubleLiteralExpression(GetLexicalInfo(pe), (double)val, false);
}
if (val is decimal) {
AddWarning(pe, "Converting decimal literal to double literal");
return new B.DoubleLiteralExpression(GetLexicalInfo(pe), (double)(decimal)val);
}
AddError(pe, "Unknown primitive literal of type " + val.GetType().FullName);
return null;
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:58,代码来源:ConvertVisitorExpressions.cs
示例4: IsMatch
private bool IsMatch(PrimitiveExpression l, PrimitiveExpression r)
{
if (l.Value == null && r.Value == null)
{
// both null counts as a match
}
else if (l.Value == null || r.Value == null || !l.Value.Equals(r.Value))
{
// Fail if one or the other is null, or the values don't match.
return false;
}
return true;
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:13,代码来源:AstComparisonVisitor.cs
示例5: add_Return
public static BlockStatement add_Return(this BlockStatement blockStatement, object returnData)
{
if (returnData.notNull())
{
Expression returnStatement;
//if (returnData is ExpressionStatement)
//returnStatement = returnData as ExpressionStatement;
if (returnData is Expression)
returnStatement = (returnData as Expression);
else
returnStatement = new PrimitiveExpression(returnData, returnData.str());
blockStatement.append(new ReturnStatement(returnStatement));
}
return blockStatement;
}
开发者ID:pusp,项目名称:o2platform,代码行数:15,代码来源:BlockStatement_ExtensionMethod.cs
示例6: CompleteInternal
protected void CompleteInternal(CompletionContext context, string key)
{
string insertString;
if (this.outputVisitor != null) {
PrimitiveExpression pre = new PrimitiveExpression(key, key);
pre.AcceptVisitor(this.outputVisitor, null);
insertString = this.outputVisitor.Text;
} else {
insertString = key;
}
context.Editor.Document.Replace(context.StartOffset, context.Length, insertString);
context.EndOffset = context.StartOffset + insertString.Length;
}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:15,代码来源:ResourceCodeCompletionItem.cs
示例7: GenerateCode
protected override string GenerateCode(LanguageProperties language, IClass currentClass)
{
string[] fields = listBox.SelectedItems.OfType<PropertyOrFieldWrapper>().Select(f2 => f2.MemberName).ToArray();
Ast.PrimitiveExpression formatString = new Ast.PrimitiveExpression(GenerateFormatString(currentClass, language.CodeGenerator, fields));
List<Ast.Expression> param = new List<Ast.Expression>() { formatString };
Ast.ReturnStatement ret = new Ast.ReturnStatement(new Ast.InvocationExpression(
new Ast.MemberReferenceExpression(new Ast.TypeReferenceExpression(new Ast.TypeReference("System.String", true)), "Format"),
param.Concat(fields.Select(f => new Ast.IdentifierExpression(f))).ToList()
));
insertedCode = language.CodeGenerator.GenerateCode(ret, "").Trim();
return insertedCode;
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:16,代码来源:OverrideToStringMethodDialog.xaml.cs
示例8: add_Return
public static BlockStatement add_Return(this BlockStatement blockStatement, object returnData)
{
Expression returnStatement;
if (returnData.isNull())
returnStatement = new PrimitiveExpression(null);
else
{
if (returnData is Expression)
returnStatement = (returnData as Expression);
else
returnStatement = new PrimitiveExpression(returnData, returnData.str());
}
blockStatement.append(new ReturnStatement(returnStatement));
return blockStatement;
}
开发者ID:SiGhTfOrbACQ,项目名称:O2.Platform.Projects,代码行数:16,代码来源:BlockStatement_ExtensionMethod.cs
示例9: InsertAction
/// <summary>
/// Insert the element represented by the completion data into the text
/// editor.
/// </summary>
/// <param name="textArea">TextArea to insert the completion data in.</param>
/// <param name="ch">Character that should be inserted after the completion data.
/// \0 when no character should be inserted.</param>
/// <returns>Returns true when the insert action has processed the character
/// <paramref name="ch"/>; false when the character was not processed.</returns>
public override bool InsertAction(TextArea textArea, char ch)
{
string insertString;
if (this.outputVisitor != null) {
PrimitiveExpression pre = new PrimitiveExpression(this.Text, this.Text);
pre.AcceptVisitor(this.outputVisitor, null);
insertString = this.outputVisitor.Text;
} else {
insertString = this.Text;
}
textArea.InsertString(insertString);
if (ch == insertString[insertString.Length - 1]) {
return true;
}
return false;
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:27,代码来源:ResourceCodeCompletionData.cs
示例10: SimpleNonInvocationExpression
void SimpleNonInvocationExpression(
#line 1593 "VBNET.ATG"
out Expression pexpr) {
#line 1595 "VBNET.ATG"
Expression expr;
TypeReference type = null;
string name = String.Empty;
pexpr = null;
if (StartOf(29)) {
switch (la.kind) {
case 3: {
lexer.NextToken();
#line 1603 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val);
break;
}
case 4: {
lexer.NextToken();
#line 1604 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val);
break;
}
case 7: {
lexer.NextToken();
#line 1605 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val);
break;
}
case 6: {
lexer.NextToken();
#line 1606 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val);
break;
}
case 5: {
lexer.NextToken();
#line 1607 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val);
break;
}
case 9: {
lexer.NextToken();
#line 1608 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val);
break;
}
case 8: {
lexer.NextToken();
#line 1609 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val);
break;
}
case 173: {
lexer.NextToken();
#line 1611 "VBNET.ATG"
pexpr = new PrimitiveExpression(true, "true");
break;
}
case 96: {
lexer.NextToken();
#line 1612 "VBNET.ATG"
pexpr = new PrimitiveExpression(false, "false");
break;
}
case 130: {
lexer.NextToken();
#line 1613 "VBNET.ATG"
pexpr = new PrimitiveExpression(null, "null");
break;
}
case 24: {
lexer.NextToken();
Expr(
#line 1614 "VBNET.ATG"
out expr);
Expect(25);
#line 1614 "VBNET.ATG"
pexpr = new ParenthesizedExpression(expr);
break;
}
case 2: case 47: case 49: case 50: case 51: case 70: case 95: case 134: case 144: case 169: case 176: case 177: case 205: {
Identifier();
#line 1616 "VBNET.ATG"
pexpr = new IdentifierExpression(t.val);
#line 1617 "VBNET.ATG"
//.........这里部分代码省略.........
开发者ID:almazik,项目名称:ILSpy,代码行数:101,代码来源:Parser.cs
示例11: VisitPrimitiveExpression
public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
{
if (primitiveExpression.Value == null)
return CreateResult ("");
Type type = primitiveExpression.Value.GetType();
return CreateResult (type.FullName);
}
开发者ID:Ein,项目名称:monodevelop,代码行数:7,代码来源:ResolveVisitor.cs
示例12: VisitPrimitiveExpression
public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
{
return new CodePrimitiveExpression(primitiveExpression.Value);
}
开发者ID:almazik,项目名称:ILSpy,代码行数:4,代码来源:CodeDOMOutputVisitor.cs
示例13: VisitPrimitiveExpression
public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
{
foreach (var r in Replacements)
{
if (ReferenceEquals(primitiveExpression, r.Target))
{
ReplaceCurrentNode(r.Replacement);
}
}
return base.VisitPrimitiveExpression(primitiveExpression, data);
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:11,代码来源:LiteralToParameterExpansion.cs
示例14: SimpleNonInvocationExpression
void SimpleNonInvocationExpression(
#line 1730 "VBNET.ATG"
out Expression pexpr) {
#line 1732 "VBNET.ATG"
Expression expr;
CollectionInitializerExpression cie;
TypeReference type = null;
string name = String.Empty;
Location startLocation = la.Location;
pexpr = null;
if (StartOf(35)) {
switch (la.kind) {
case 3: {
lexer.NextToken();
#line 1742 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 4: {
lexer.NextToken();
#line 1743 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 7: {
lexer.NextToken();
#line 1744 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 6: {
lexer.NextToken();
#line 1745 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 5: {
lexer.NextToken();
#line 1746 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 9: {
lexer.NextToken();
#line 1747 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 8: {
lexer.NextToken();
#line 1748 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 220: {
lexer.NextToken();
#line 1750 "VBNET.ATG"
pexpr = new PrimitiveExpression(true, "true");
break;
}
case 124: {
lexer.NextToken();
#line 1751 "VBNET.ATG"
pexpr = new PrimitiveExpression(false, "false");
break;
}
case 168: {
lexer.NextToken();
#line 1752 "VBNET.ATG"
pexpr = new PrimitiveExpression(null, "null");
break;
}
case 37: {
lexer.NextToken();
Expr(
#line 1753 "VBNET.ATG"
out expr);
Expect(38);
#line 1753 "VBNET.ATG"
pexpr = new ParenthesizedExpression(expr);
break;
}
case 2: case 58: case 62: case 64: case 65: case 66: case 67: case 68: case 69: case 72: case 89: case 100: case 106: case 109: case 118: case 123: case 128: case 135: case 141: case 145: case 148: case 149: case 150: case 173: case 179: case 181: case 187: case 206: case 215: case 216: case 226: case 227: case 233: case 240: {
Identifier();
#line 1755 "VBNET.ATG"
pexpr = new IdentifierExpression(t.val);
//.........这里部分代码省略.........
开发者ID:BooMWax,项目名称:SharpDevelop,代码行数:101,代码来源:Parser.cs
示例15: VisitPrimitiveExpression
public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
{
if (primitiveExpression.Value == null) {
return CreateResolveResult(NullReturnType.Instance);
} else if (primitiveExpression.Value is int) {
return new IntegerLiteralResolveResult(resolver.CallingClass, resolver.CallingMember, resolver.ProjectContent.SystemTypes.Int32);
} else {
return CreateResolveResult(resolver.ProjectContent.SystemTypes.CreatePrimitive(primitiveExpression.Value.GetType()));
}
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:10,代码来源:ResolveVisitor.cs
示例16: TrackedVisitPrimitiveExpression
public override object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
{
if (primitiveExpression.Value == null)
{
this.Append("None");
}
else if (!(primitiveExpression.Value is bool))
{
this.Append(primitiveExpression.StringValue);
}
else
{
this.Append(primitiveExpression.Value.ToString());
}
return null;
}
开发者ID:L3tum,项目名称:BesiegeScriptingMod,代码行数:16,代码来源:NRefactoryToPythonConverter.cs
示例17: TrackedVisitPrimitiveExpression
public virtual object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
return base.VisitPrimitiveExpression(primitiveExpression, data);
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:3,代码来源:NodeTrackingAstVisitor.cs
示例18: SimpleNonInvocationExpression
void SimpleNonInvocationExpression(
#line 1645 "VBNET.ATG"
out Expression pexpr) {
#line 1647 "VBNET.ATG"
Expression expr;
TypeReference type = null;
string name = String.Empty;
pexpr = null;
if (StartOf(32)) {
switch (la.kind) {
case 3: {
lexer.NextToken();
#line 1655 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 4: {
lexer.NextToken();
#line 1656 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 7: {
lexer.NextToken();
#line 1657 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 6: {
lexer.NextToken();
#line 1658 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 5: {
lexer.NextToken();
#line 1659 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 9: {
lexer.NextToken();
#line 1660 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 8: {
lexer.NextToken();
#line 1661 "VBNET.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
break;
}
case 202: {
lexer.NextToken();
#line 1663 "VBNET.ATG"
pexpr = new PrimitiveExpression(true, "true");
break;
}
case 109: {
lexer.NextToken();
#line 1664 "VBNET.ATG"
pexpr = new PrimitiveExpression(false, "false");
break;
}
case 151: {
lexer.NextToken();
#line 1665 "VBNET.ATG"
pexpr = new PrimitiveExpression(null, "null");
break;
}
case 25: {
lexer.NextToken();
Expr(
#line 1666 "VBNET.ATG"
out expr);
Expect(26);
#line 1666 "VBNET.ATG"
pexpr = new ParenthesizedExpression(expr);
break;
}
case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 85: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: {
Identifier();
#line 1668 "VBNET.ATG"
pexpr = new IdentifierExpression(t.val);
pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
//.........这里部分代码省略.........
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:101,代码来源:Parser.cs
示例19: PrimaryExpr
void PrimaryExpr(
#line 1849 "cs.ATG"
out Expression pexpr) {
#line 1851 "cs.ATG"
TypeReference type = null;
Expression expr;
pexpr = null;
#line 1856 "cs.ATG"
Location startLocation = la.Location;
if (la.kind == 113) {
lexer.NextToken();
#line 1858 "cs.ATG"
pexpr = new PrimitiveExpression(true, "true");
} else if (la.kind == 72) {
lexer.NextToken();
#line 1859 "cs.ATG"
pexpr = new PrimitiveExpression(false, "false");
} else if (la.kind == 90) {
lexer.NextToken();
#line 1860 "cs.ATG"
pexpr = new PrimitiveExpression(null, "null");
} else if (la.kind == 2) {
lexer.NextToken();
#line 1861 "cs.ATG"
PrimitiveExpression primitiveExpression = new PrimitiveExpression(t.literalValue, t.val);
primitiveExpression.LiteralFormat = t.literalFormat;
pexpr = primitiveExpression;
} else if (
#line 1862 "cs.ATG"
StartOfQueryExpression()) {
QueryExpression(
#line 1863 "cs.ATG"
out pexpr);
} else if (
#line 1864 "cs.ATG"
IdentAndDoubleColon()) {
Identifier();
#line 1865 "cs.ATG"
type = new TypeReference(t.val);
Expect(10);
#line 1866 "cs.ATG"
pexpr = new TypeReferenceExpression(type);
Identifier();
#line 1867 "cs.ATG"
if (type.Type == "global") { type.IsGlobal = true; type.Type = t.val ?? "?"; } else type.Type += "." + (t.val ?? "?");
} else if (StartOf(19)) {
Identifier();
#line 1871 "cs.ATG"
pexpr = new IdentifierExpression(t.val);
if (la.kind == 48 ||
#line 1874 "cs.ATG"
IsGenericInSimpleNameOrMemberAccess()) {
if (la.kind == 48) {
ShortedLambdaExpression(
#line 1873 "cs.ATG"
(IdentifierExpression)pexpr, out pexpr);
} else {
#line 1875 "cs.ATG"
List<TypeReference> typeList;
TypeArgumentList(
#line 1876 "cs.ATG"
out typeList, false);
#line 1877 "cs.ATG"
((IdentifierExpression)pexpr).TypeArguments = typeList;
}
}
} else if (
#line 1879 "cs.ATG"
IsLambdaExpression()) {
LambdaExpression(
#line 1880 "cs.ATG"
out pexpr);
} else if (la.kind == 20) {
lexer.NextToken();
Expr(
#line 1883 "cs.ATG"
out expr);
Expect(21);
#line 1883 "cs.ATG"
pexpr = new ParenthesizedExpression(expr);
} else if (StartOf(35)) {
#line 1886 "cs.ATG"
string val = null;
switch (la.kind) {
//.........这里部分代码省略.........
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:101,代码来源:Parser.cs
示例20: ConvertXmlContentExpression
Expression ConvertXmlContentExpression(XmlContentExpression xmlContentExpression)
{
Expression newNode = null;
switch (xmlContentExpression.Type) {
case XmlContentType.Comment:
newNode = new ObjectCreateExpression(new TypeReference("XComment"), Expressions(xmlContentExpression.Content));
break;
case XmlContentType.Text:
newNode = new PrimitiveExpression(ConvertEntities(xmlContentExpression.Content));
break;
case XmlContentType.CData:
newNode = new ObjectCreateExpression(new TypeReference("XCData"), Expressions(xmlContentExpression.Content));
break;
case XmlContentType.ProcessingInstruction:
string content = xmlContentExpression.Content.Trim();
if (content.StartsWith("xml", StringComparison.OrdinalIgnoreCase)) {
XDeclaration decl;
try {
decl = XDocument.Parse("<?" + content + "?><Dummy />").Declaration;
} catch (XmlException) {
decl = new XDeclaration(null, null, null);
}
newNode = new ObjectCreateExpression(new TypeReference("XDeclaration"), Expressions(decl.Version, decl.Encoding, decl.Standalone));
} else {
string target = content.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault() ?? "";
string piData = content.IndexOf(' ') > -1 ? content.Substring(content.IndexOf(' ')) : "";
newNode = new ObjectCreateExpression(new TypeReference("XProcessingInstruction"), Expressions(target, piData));
}
break;
default:
throw new Exception("Invalid value for XmlContentType");
}
return newNode;
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:34,代码来源:VBNetConstructsConvertVisitor.cs
注:本文中的ICSharpCode.NRefactory.Ast.PrimitiveExpression类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论