本文整理汇总了C#中ITreeAdaptor.GetToken方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeAdaptor.GetToken方法的具体用法?C# ITreeAdaptor.GetToken怎么用?C# ITreeAdaptor.GetToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITreeAdaptor
的用法示例。
在下文中一共展示了ITreeAdaptor.GetToken方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Walk_Enum_AST
private static CEnumRecord Walk_Enum_AST( object root_node, ITreeAdaptor tree_adapter, string file_name_with_path )
{
string name_space = String.Empty;
string extension_enum_name = String.Empty;
if ( tree_adapter.GetChildCount( root_node ) != 3 )
{
throw new Exception( "Parse Error: Enum parse tree root does not have three children" );
}
EEnumFlags flags = EEnumFlags.None;
object begin_settings_node = tree_adapter.GetChild( root_node, 0 );
for ( int i = 0; i < tree_adapter.GetChildCount( begin_settings_node ); i++ )
{
object setting_node = tree_adapter.GetChild( begin_settings_node, i );
switch ( tree_adapter.GetToken( setting_node ).Type )
{
case EnumReflectorParser.BITFIELD:
flags |= EEnumFlags.IsBitfield;
break;
case EnumReflectorParser.EXTENDS:
{
if ( tree_adapter.GetChildCount( setting_node ) != 1 )
{
throw new Exception( "Parse Error: extension clause does not have a single child qualified identifier node" );
}
object extension_name_node = tree_adapter.GetChild( setting_node, 0 );
extension_enum_name = Concatenate_Depth2_Subtree_Name( tree_adapter, extension_name_node );
break;
}
default:
break;
}
}
object enum_entry_point_node = tree_adapter.GetChild( root_node, 1 );
object enum_definition_node = enum_entry_point_node;
if ( tree_adapter.GetToken( enum_entry_point_node ).Type == EnumReflectorParser.NAMESPACE )
{
object namespace_name_node = tree_adapter.GetChild( enum_entry_point_node, 0 );
name_space = Concatenate_Depth2_Subtree_Name( tree_adapter, namespace_name_node );
enum_definition_node = tree_adapter.GetChild( enum_entry_point_node, 1 );
}
if ( tree_adapter.GetChildCount( enum_definition_node ) != 2 )
{
throw new Exception( "Parse Error: Enum definition node does not have two children" );
}
object enum_name_node = tree_adapter.GetChild( enum_definition_node, 0 );
if ( tree_adapter.GetToken( enum_name_node ).Type != EnumReflectorParser.ID )
{
throw new Exception( "Parse Error: Enum definition missing name" );
}
string enum_name = tree_adapter.GetText( enum_name_node );
CLogInterface.Write_Line( "Processing Enum " + name_space + "::" + enum_name + ", Flags = " + flags.ToString() );
CEnumRecord enum_record = new CEnumRecord( enum_name, file_name_with_path, name_space, extension_enum_name, flags );
enum_record.HeaderFileID = CEnumReflector.HeaderFileTracker.Get_Header_ID_By_File_Path( file_name_with_path ).ID;
int current_value = 0;
object enum_entry_list_node = tree_adapter.GetChild( enum_definition_node, 1 );
for ( int i = 0; i < tree_adapter.GetChildCount( enum_entry_list_node ); i++ )
{
object enum_entry_node = tree_adapter.GetChild( enum_entry_list_node, i );
string qualified_entry_name = tree_adapter.GetText( enum_entry_node );
if ( name_space.Length > 0 )
{
qualified_entry_name = name_space + "::" + qualified_entry_name;
}
string entry_conversion_name = "";
bool can_bind_value = extension_enum_name.Length == 0;
bool bound_value = false;
string bound_name = "";
for ( int j = 0; j < tree_adapter.GetChildCount( enum_entry_node ); j++ )
{
object enum_entry_sub_node = tree_adapter.GetChild( enum_entry_node, j );
int sub_node_token_type = tree_adapter.GetToken( enum_entry_sub_node ).Type;
if ( sub_node_token_type == EnumReflectorParser.ENUM_ENTRY )
{
if ( tree_adapter.GetChildCount( enum_entry_sub_node ) != 1 )
{
throw new Exception( "Enum entry conversion tag has invalid child count" );
}
string quoted_string = tree_adapter.GetText( tree_adapter.GetChild( enum_entry_sub_node, 0 ) );
entry_conversion_name = quoted_string.Substring( 1, quoted_string.Length - 2 );
}
else if ( sub_node_token_type == EnumReflectorParser.POSITIVE_INTEGER16 )
//.........这里部分代码省略.........