本文整理汇总了C#中Tools.SYMBOL类的典型用法代码示例。如果您正苦于以下问题:C# SYMBOL类的具体用法?C# SYMBOL怎么用?C# SYMBOL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SYMBOL类属于Tools命名空间,在下文中一共展示了SYMBOL类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TransformNode
/// <summary>
/// Recursively called to transform each type of node. Will transform this
/// node, then all it's children.
/// </summary>
/// <param name="s">The current node to transform.</param>
private void TransformNode(SYMBOL s)
{
// make sure to put type lower in the inheritance hierarchy first
// ie: since IdentConstant and StringConstant inherit from Constant,
// put IdentConstant and StringConstant before Constant
if (s is Declaration)
((Declaration) s).Datatype = m_datatypeLSL2OpenSim[((Declaration) s).Datatype];
else if (s is Constant)
((Constant) s).Type = m_datatypeLSL2OpenSim[((Constant) s).Type];
else if (s is TypecastExpression)
((TypecastExpression) s).TypecastType = m_datatypeLSL2OpenSim[((TypecastExpression) s).TypecastType];
else if (s is GlobalFunctionDefinition && "void" != ((GlobalFunctionDefinition) s).ReturnType) // we don't need to translate "void"
((GlobalFunctionDefinition) s).ReturnType = m_datatypeLSL2OpenSim[((GlobalFunctionDefinition) s).ReturnType];
for (int i = 0; i < s.kids.Count; i++)
{
// It's possible that a child is null, for instance when the
// assignment part in a for-loop is left out, ie:
//
// for (; i < 10; i++)
// {
// ...
// }
//
// We need to check for that here.
if (null != s.kids[i])
{
if (!(s is Assignment || s is ArgumentDeclarationList) && s.kids[i] is Declaration)
AddImplicitInitialization(s, i);
TransformNode((SYMBOL) s.kids[i]);
}
}
}
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:39,代码来源:LSL2CSCodeTransformer.cs
示例2: printThisTree
public static void printThisTree(SYMBOL ast)
{
for (int i = 0; i < m_indent; i++)
Console.Write(" ");
Console.WriteLine(ast.ToString());
m_indent++;
foreach (SYMBOL s in ast.kids)
printThisTree(s);
m_indent--;
}
开发者ID:aurora-sim,项目名称:Aurora-Libs,代码行数:11,代码来源:output.cs
示例3: TransformNode
/// <summary>
/// Recursively called to transform each type of node. Will transform this
/// node, then all it's children.
/// </summary>
/// <param name="s">The current node to transform.</param>
private void TransformNode(SYMBOL s, Dictionary<string, string> GlobalMethods, Dictionary<string, ObjectList> MethodArguements)
{
// make sure to put type lower in the inheritance hierarchy first
// ie: since IdentConstant and StringConstant inherit from Constant,
// put IdentConstant and StringConstant before Constant
if (s is Declaration)
((Declaration)s).Datatype = m_datatypeLSL2OpenSim[((Declaration)s).Datatype];
else if (s is Constant)
((Constant)s).Type = m_datatypeLSL2OpenSim[((Constant)s).Type];
else if (s is TypecastExpression)
((TypecastExpression)s).TypecastType = m_datatypeLSL2OpenSim[((TypecastExpression)s).TypecastType];
else if (s is GlobalFunctionDefinition)
{
if ("void" == ((GlobalFunctionDefinition)s).ReturnType) // we don't need to translate "void"
{
if (GlobalMethods != null && !GlobalMethods.ContainsKey(((GlobalFunctionDefinition)s).Name))
GlobalMethods.Add(((GlobalFunctionDefinition)s).Name, "void");
}
else
{
((GlobalFunctionDefinition)s).ReturnType = m_datatypeLSL2OpenSim[((GlobalFunctionDefinition)s).ReturnType];
if (GlobalMethods != null && !GlobalMethods.ContainsKey(((GlobalFunctionDefinition)s).Name))
{
GlobalMethods.Add(((GlobalFunctionDefinition)s).Name, ((GlobalFunctionDefinition)s).ReturnType);
MethodArguements.Add(((GlobalFunctionDefinition)s).Name, ((GlobalFunctionDefinition)s).kids);
}
}
}
for (int i = 0; i < s.kids.Count; i++)
{
// It's possible that a child is null, for instance when the
// assignment part in a for-loop is left out, ie:
//
// for (; i < 10; i++)
// {
// ...
// }
//
// We need to check for that here.
if (null != s.kids[i])
{
if (!(s is Assignment || s is ArgumentDeclarationList) && s.kids[i] is Declaration)
AddImplicitInitialization(s, i);
TransformNode((SYMBOL)s.kids[i], null, null);
}
}
}
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:55,代码来源:LSL2CSCodeTransformer.cs
示例4: LSL2CSCodeTransformer
/// <summary>
/// Pass the new CodeTranformer an abstract syntax tree.
/// </summary>
/// <param name="astRoot">The root node of the AST.</param>
public LSL2CSCodeTransformer(SYMBOL astRoot)
{
m_astRoot = astRoot;
m_datatypeLSL2CS = new Dictionary<string, string>()
{
{ "integer", "lsl_integer" },
{ "float", "lsl_float" },
{ "key", "lsl_string" },
{ "string", "lsl_string" },
{ "vector", "lsl_vector" },
{ "rotation", "lsl_rotation" },
{ "list", "lsl_list" }
};
}
开发者ID:osgrid,项目名称:openmetaverse,代码行数:19,代码来源:LSL2CSCodeTransformer.cs
示例5: LSL2CSCodeTransformer
/// <summary>
/// Pass the new CodeTranformer an abstract syntax tree.
/// </summary>
/// <param name="astRoot">The root node of the AST.</param>
public LSL2CSCodeTransformer(SYMBOL astRoot)
{
m_astRoot = astRoot;
// let's populate the dictionary
if (null == m_datatypeLSL2OpenSim)
{
m_datatypeLSL2OpenSim = new Dictionary<string, string>();
m_datatypeLSL2OpenSim.Add("integer", "LSL_Types.LSLInteger");
m_datatypeLSL2OpenSim.Add("float", "LSL_Types.LSLFloat");
m_datatypeLSL2OpenSim.Add("key", "LSL_Types.LSLString");
m_datatypeLSL2OpenSim.Add("string", "LSL_Types.LSLString");
m_datatypeLSL2OpenSim.Add("vector", "LSL_Types.Vector3");
m_datatypeLSL2OpenSim.Add("rotation", "LSL_Types.Quaternion");
m_datatypeLSL2OpenSim.Add("list", "LSL_Types.list");
}
}
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:21,代码来源:LSL2CSCodeTransformer.cs
示例6: LSL2CSCodeTransformer
/// <summary>
/// Pass the new CodeTransformer an abstract syntax tree.
/// </summary>
/// <param name="astRoot">The root node of the AST.</param>
/// <param name="originalScript">The original script that we are converting</param>
public LSL2CSCodeTransformer(SYMBOL astRoot, string originalScript)
{
m_astRoot = astRoot;
m_originalScript = originalScript;
// let's populate the dictionary
if (null == m_datatypeLSL2OpenSim)
{
m_datatypeLSL2OpenSim = new Dictionary<string, string>
{
{"integer", "LSL_Types.LSLInteger"},
{"float", "LSL_Types.LSLFloat"},
{"key", "LSL_Types.LSLString"},
{"string", "LSL_Types.LSLString"},
{"vector", "LSL_Types.Vector3"},
{"rotation", "LSL_Types.Quaternion"},
{"list", "LSL_Types.list"}
};
}
}
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:25,代码来源:LSL2CSCodeTransformer.cs
示例7: TransformNode
/// <summary>
/// Recursively called to transform each type of node. Will transform this
/// node, then all it's children.
/// </summary>
/// <param name="s">The current node to transform.</param>
private void TransformNode(SYMBOL s)
{
// make sure to put type lower in the inheritance hierarchy first
// ie: since IdentConstant and StringConstant inherit from Constant,
// put IdentConstant and StringConstant before Constant
if (s is Declaration)
((Declaration) s).Datatype = m_datatypeLSL2OpenSim[((Declaration) s).Datatype];
else if (s is Constant)
((Constant) s).Type = m_datatypeLSL2OpenSim[((Constant) s).Type];
else if (s is TypecastExpression)
((TypecastExpression) s).TypecastType = m_datatypeLSL2OpenSim[((TypecastExpression) s).TypecastType];
else if (s is GlobalFunctionDefinition && "void" != ((GlobalFunctionDefinition) s).ReturnType) // we don't need to translate "void"
((GlobalFunctionDefinition) s).ReturnType = m_datatypeLSL2OpenSim[((GlobalFunctionDefinition) s).ReturnType];
for (int i = 0; i < s.kids.Count; i++)
{
if (!(s is Assignment || s is ArgumentDeclarationList) && s.kids[i] is Declaration)
AddImplicitInitialization(s, i);
TransformNode((SYMBOL) s.kids[i]);
}
}
开发者ID:VirtualReality,项目名称:Libs,代码行数:27,代码来源:LSL2CSCodeTransformer.cs
示例8: GenerateCompoundStatement
/// <summary>
/// Generates the code for a CompoundStatement node.
/// </summary>
/// <param name="cs">The CompoundStatement node.</param>
/// <returns>String containing C# code for CompoundStatement cs.</returns>
private string GenerateCompoundStatement(SYMBOL previousSymbol, CompoundStatement cs)
{
string retstr = String.Empty;
// opening brace
retstr += GenerateIndentedLine("{");
m_braceCount++;
if (m_insertCoopTerminationChecks)
{
// We have to check in event functions as well because the user can manually call these.
if (previousSymbol is GlobalFunctionDefinition
|| previousSymbol is WhileStatement
|| previousSymbol is DoWhileStatement
|| previousSymbol is ForLoop
|| previousSymbol is StateEvent)
retstr += GenerateIndentedLine(m_coopTerminationCheck);
}
foreach (SYMBOL kid in cs.kids)
retstr += GenerateNode(cs, kid);
// closing brace
m_braceCount--;
retstr += GenerateIndentedLine("}");
return retstr;
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:33,代码来源:CSCodeGenerator.cs
示例9: GenerateIndented
/// <summary>
/// Prints text correctly indented.
/// </summary>
/// <param name="s">String of text to print.</param>
/// <returns>Properly indented string s.</returns>
//private string GenerateIndented(string s)
//{
// return GenerateIndented(s, null);
//}
// THIS FUNCTION IS COMMENTED OUT TO SUPPRESS WARNINGS
/// <summary>
/// Prints text correctly indented.
/// </summary>
/// <param name="s">String of text to print.</param>
/// <param name="sym">Symbol being generated to extract original line
/// number and column from.</param>
/// <returns>Properly indented string s.</returns>
private string GenerateIndented(string s, SYMBOL sym)
{
string retstr = Indent() + s;
if (null != sym)
m_positionMap.Add(new KeyValuePair<int, int>(m_CSharpLine, m_CSharpCol), new KeyValuePair<int, int>(sym.Line, sym.Position));
m_CSharpCol += s.Length;
return retstr;
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:29,代码来源:CSCodeGenerator.cs
示例10: GenerateNode
/// <summary>
/// Recursively called to generate each type of node. Will generate this
/// node, then all it's children.
/// </summary>
/// <param name="previousSymbol">The parent node.</param>
/// <param name="s">The current node to generate code for.</param>
/// <returns>String containing C# code for SYMBOL s.</returns>
private string GenerateNode(SYMBOL previousSymbol, SYMBOL s)
{
string retstr = String.Empty;
// make sure to put type lower in the inheritance hierarchy first
// ie: since IdentArgument and ExpressionArgument inherit from
// Argument, put IdentArgument and ExpressionArgument before Argument
if (s is GlobalFunctionDefinition)
retstr += GenerateGlobalFunctionDefinition((GlobalFunctionDefinition) s);
else if (s is GlobalVariableDeclaration)
retstr += GenerateGlobalVariableDeclaration((GlobalVariableDeclaration) s);
else if (s is State)
retstr += GenerateState((State) s);
else if (s is CompoundStatement)
retstr += GenerateCompoundStatement(previousSymbol, (CompoundStatement) s);
else if (s is Declaration)
retstr += GenerateDeclaration((Declaration) s);
else if (s is Statement)
retstr += GenerateStatement(previousSymbol, (Statement) s);
else if (s is ReturnStatement)
retstr += GenerateReturnStatement((ReturnStatement) s);
else if (s is JumpLabel)
retstr += GenerateJumpLabel((JumpLabel) s);
else if (s is JumpStatement)
retstr += GenerateJumpStatement((JumpStatement) s);
else if (s is StateChange)
retstr += GenerateStateChange((StateChange) s);
else if (s is IfStatement)
retstr += GenerateIfStatement((IfStatement) s);
else if (s is WhileStatement)
retstr += GenerateWhileStatement((WhileStatement) s);
else if (s is DoWhileStatement)
retstr += GenerateDoWhileStatement((DoWhileStatement) s);
else if (s is ForLoop)
retstr += GenerateForLoop((ForLoop) s);
else if (s is ArgumentList)
retstr += GenerateArgumentList((ArgumentList) s);
else if (s is Assignment)
retstr += GenerateAssignment((Assignment) s);
else if (s is BinaryExpression)
retstr += GenerateBinaryExpression((BinaryExpression) s);
else if (s is ParenthesisExpression)
retstr += GenerateParenthesisExpression((ParenthesisExpression) s);
else if (s is UnaryExpression)
retstr += GenerateUnaryExpression((UnaryExpression) s);
else if (s is IncrementDecrementExpression)
retstr += GenerateIncrementDecrementExpression((IncrementDecrementExpression) s);
else if (s is TypecastExpression)
retstr += GenerateTypecastExpression((TypecastExpression) s);
else if (s is FunctionCall)
retstr += GenerateFunctionCall((FunctionCall) s);
else if (s is VectorConstant)
retstr += GenerateVectorConstant((VectorConstant) s);
else if (s is RotationConstant)
retstr += GenerateRotationConstant((RotationConstant) s);
else if (s is ListConstant)
retstr += GenerateListConstant((ListConstant) s);
else if (s is Constant)
retstr += GenerateConstant((Constant) s);
else if (s is IdentDotExpression)
retstr += Generate(CheckName(((IdentDotExpression) s).Name) + "." + ((IdentDotExpression) s).Member, s);
else if (s is IdentExpression)
retstr += GenerateIdentifier(((IdentExpression) s).Name, s);
else if (s is IDENT)
retstr += Generate(CheckName(((TOKEN) s).yytext), s);
else
{
foreach (SYMBOL kid in s.kids)
retstr += GenerateNode(s, kid);
}
return retstr;
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:80,代码来源:CSCodeGenerator.cs
示例11: GenerateLine
/// <summary>
/// Prints text, followed by a newline.
/// </summary>
/// <param name="s">String of text to print.</param>
/// <param name="sym">
/// Symbol being generated to extract original line
/// number and column from.
/// </param>
/// <returns>String s followed by newline.</returns>
string GenerateLine(string s, SYMBOL sym)
{
string retstr = Generate(s, sym) + "\n";
m_CSharpLine++;
m_CSharpCol = 1;
return retstr;
}
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:18,代码来源:CSCodeGenerator.cs
示例12: GenerateIndentedLine
/// <summary>
/// Prints text correctly indented, followed by a newline.
/// </summary>
/// <param name="s">String of text to print.</param>
/// <param name="sym">Symbol being generated to extract original line
/// number and column from.</param>
/// <returns>Properly indented string s followed by newline.</returns>
private string GenerateIndentedLine(string s, SYMBOL sym)
{
string retstr = GenerateIndented(s, sym) + "\n";
m_CSharpLine++;
m_CSharpCol = 1;
return retstr;
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:16,代码来源:CSCodeGenerator.cs
示例13: GenerateIdentifier
/// <summary>
/// Generates the code for an identifier
/// </summary>
/// <param name="id">The symbol name</param>
/// <param name="s">The Symbol node.</param>
/// <returns>String containing C# code for identifier reference.</returns>
private string GenerateIdentifier(string id, SYMBOL s)
{
if (m_comms != null)
{
object value = m_comms.LookupModConstant(id);
if (value != null)
{
string retval = null;
if (value is int)
retval = String.Format("new LSL_Types.LSLInteger({0})",((int)value).ToString());
else if (value is float)
retval = String.Format("new LSL_Types.LSLFloat({0})",((float)value).ToString());
else if (value is string)
retval = String.Format("new LSL_Types.LSLString(\"{0}\")",((string)value));
else if (value is OpenMetaverse.UUID)
retval = String.Format("new LSL_Types.key(\"{0}\")",((OpenMetaverse.UUID)value).ToString());
else if (value is OpenMetaverse.Vector3)
retval = String.Format("new LSL_Types.Vector3(\"{0}\")",((OpenMetaverse.Vector3)value).ToString());
else if (value is OpenMetaverse.Quaternion)
retval = String.Format("new LSL_Types.Quaternion(\"{0}\")",((OpenMetaverse.Quaternion)value).ToString());
else retval = id;
return Generate(retval, s);
}
}
return Generate(CheckName(id), s);
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:34,代码来源:CSCodeGenerator.cs
示例14: TypecastExpression
public TypecastExpression (Parser yyp, string typecastType , SYMBOL rhs ):base(((LSLSyntax
)yyp)){ m_typecastType = typecastType ;
kids . Add ( rhs );
}
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:4,代码来源:lsl.parser.cs
示例15: ParenthesisExpression
public ParenthesisExpression (Parser yyp, SYMBOL s ):base(((LSLSyntax
)yyp)){ kids . Add ( s );
}
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:3,代码来源:lsl.parser.cs
示例16: Action
// support for actions
public virtual object Action(Parser yyp,SYMBOL yysym, int yyact) { return null; } // will be generated for the generated parser
开发者ID:Belxjander,项目名称:Asuna,代码行数:2,代码来源:parser.cs
示例17: NextSym
public SYMBOL NextSym()
{ // like lexer.Next but allows a one-token pushback for reduce
SYMBOL ret = m_ungot;
if (ret != null)
{
m_ungot = null;
return ret;
}
ret = (SYMBOL)m_lexer.Next();
if (ret==null)
ret = m_symbols.EOFSymbol;
return ret;
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:13,代码来源:parser.cs
示例18: Error
public void Error(int n,SYMBOL sym, string s)
{
if (sym!=null)
m_symbols.erh.Error(new CSToolsException(n,sym.yylx,sym.pos,"",s)); // 4.5b
else
m_symbols.erh.Error(new CSToolsException(n,s));
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:7,代码来源:parser.cs
示例19: Pop
internal void Pop(ref ParseStackEntry elt, int depth, SYMBOL ns)
{
for (;m_stack.Count>0 && depth>0;depth--)
{
elt = (ParseStackEntry)m_stack.Pop();
if (m_symbols.m_concrete) // building the concrete syntax tree
ns.kids.Push(elt.m_value); // else will be garbage collected
}
if (depth!=0)
m_symbols.erh.Error(new CSToolsException(14,m_lexer,"Pop failed"));
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:11,代码来源:parser.cs
示例20: GenerateNode
/// <summary>
/// Recursively called to generate each type of node. Will generate this
/// node, then all it's children.
/// </summary>
/// <param name="s">The current node to generate code for.</param>
/// <returns>String containing C# code for SYMBOL s.</returns>
string GenerateNode(SYMBOL s)
{
// make sure to put type lower in the inheritance hierarchy first
// ie: since IdentArgument and ExpressionArgument inherit from
// Argument, put IdentArgument and ExpressionArgument before Argument
if (s is GlobalFunctionDefinition)
{
return GenerateGlobalFunctionDefinition((GlobalFunctionDefinition) s);
}
else if (s is GlobalVariableDeclaration)
{
return GenerateGlobalVariableDeclaration((GlobalVariableDeclaration) s);
}
else if (s is State)
{
return GenerateState((State) s);
}
else if (s is CompoundStatement)
{
return GenerateCompoundStatement((CompoundStatement) s);
}
else if (s is Declaration)
{
return GenerateDeclaration((Declaration) s);
}
else if (s is Statement)
{
return GenerateStatement((Statement) s);
}
else if (s is ReturnStatement)
{
return GenerateReturnStatement((ReturnStatement) s);
}
else if (s is JumpLabel)
{
return GenerateJumpLabel((JumpLabel) s);
}
else if (s is JumpStatement)
{
return GenerateJumpStatement((JumpStatement) s);
}
else if (s is StateChange)
{
return GenerateStateChange((StateChange) s);
}
else if (s is IfStatement)
{
return GenerateIfStatement((IfStatement) s);
}
else if (s is WhileStatement)
{
return GenerateWhileStatement((WhileStatement) s);
}
else if (s is DoWhileStatement)
{
return GenerateDoWhileStatement((DoWhileStatement) s);
}
else if (s is ForLoop)
{
return GenerateForLoop((ForLoop) s);
}
else if (s is ArgumentList)
{
return GenerateArgumentList((ArgumentList) s);
}
else if (s is Assignment)
{
return GenerateAssignment((Assignment) s);
}
else if (s is BinaryExpression)
{
return GenerateBinaryExpression((BinaryExpression) s, false, "");
}
else if (s is ParenthesisExpression)
{
return GenerateParenthesisExpression((ParenthesisExpression) s);
}
else if (s is UnaryExpression)
{
return GenerateUnaryExpression((UnaryExpression) s);
}
else if (s is IncrementDecrementExpression)
{
return GenerateIncrementDecrementExpression((IncrementDecrementExpression) s);
}
else if (s is TypecastExpression)
{
return GenerateTypecastExpression((TypecastExpression) s);
}
else if (s is FunctionCall)
{
return GenerateFunctionCall((FunctionCall) s, true);
}
else if (s is VectorConstant)
//.........这里部分代码省略.........
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:101,代码来源:CSCodeGenerator.cs
注:本文中的Tools.SYMBOL类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论