예제 #1
0
		internal XpidlAttribute(String name, String type, Boolean isReadOnly, XpidlModifiers<XpidlMethodModifier> modifiers)
		{
			m_Name = name;
			m_Type = type;
			m_IsReadOnly = isReadOnly;
			m_Modifiers = (modifiers ?? new XpidlModifiers<XpidlMethodModifier>()).AsReadOnly();
		}
예제 #2
0
		internal XpidlMethodParameter(String name, String type, XpidlParameterDirection direction, XpidlModifiers<XpidlParamModifier> modifiers)
		{
			m_Name = name;
			m_Type = type;
			m_Direction = direction;
			m_Modifiers = (modifiers ?? new XpidlModifiers<XpidlParamModifier>()).AsReadOnly();
		}
예제 #3
0
		internal XpidlInterface(String name, String baseName, Guid uuid, XpidlModifiers<XpidlInterfaceModifier> modifiers)
		{
			m_Name = name;
			m_BaseName = baseName;
			m_Uuid = uuid;
			m_Modifiers = (modifiers ?? new XpidlModifiers<XpidlInterfaceModifier>()).AsReadOnly();
		}
예제 #4
0
		internal XpidlMethod(String name, String type, XpidlModifiers<XpidlMethodModifier> modifiers, IEnumerable<XpidlMethodParameter> parameters, IEnumerable<String> exceptions)
		{
			m_Name = name;
			m_Type = type;
			m_Modifiers = (modifiers ?? new XpidlModifiers<XpidlMethodModifier>()).AsReadOnly();
			m_ReadOnlyParameters = (parameters != null ? new List<XpidlMethodParameter>(parameters) : new List<XpidlMethodParameter>(0)).AsReadOnly();
			m_Exceptions = (exceptions != null ? new List<String>(exceptions) : new List<String>(0)).AsReadOnly();
		}
		private static void BuildXpidlMethodParamModifiers(XpidlModifiers<XpidlParamModifier> paramModifiers, ComplexSyntaxNode paramModifiersSyntaxNode)
		{
			switch ((RuleConstants) paramModifiersSyntaxNode.Rule.Index)
			{
				case RuleConstants.XpidlMethodParamModifiersDecl:
				case RuleConstants.XpidlMethodParamModifiersList1:
				case RuleConstants.XpidlMethodParamModifiersList2:
					foreach (SyntaxNode syntaxNode in paramModifiersSyntaxNode)
					{
						if (syntaxNode is ComplexSyntaxNode)
						{
							BuildXpidlMethodParamModifiers(paramModifiers, (ComplexSyntaxNode)syntaxNode);
						}
					}
					break;

				case RuleConstants.XpidlParamModifierArray:
					paramModifiers.Add(XpidlParamModifier.Array);
					break;

				case RuleConstants.XpidlParamModifierSizeIs:
					var paramNameSyntaxNode = (ComplexSyntaxNode) paramModifiersSyntaxNode[2];
					paramModifiers.Add(XpidlParamModifier.SizeIs, ((SimpleSyntaxNode) paramNameSyntaxNode[0]).Text);
					break;

				case RuleConstants.XpidlParamModifierIidIs:
					paramNameSyntaxNode = (ComplexSyntaxNode) paramModifiersSyntaxNode[2];
					paramModifiers.Add(XpidlParamModifier.IidIs, ((SimpleSyntaxNode) paramNameSyntaxNode[0]).Text);
					break;

				case RuleConstants.XpidlParamModifierRetVal:
					paramModifiers.Add(XpidlParamModifier.RetVal);
					break;

				case RuleConstants.XpidlParamModifierConst:
					paramModifiers.Add(XpidlParamModifier.Const);
					break;

				case RuleConstants.XpidlParamModifierShared:
					paramModifiers.Add(XpidlParamModifier.Shared);
					break;

				case RuleConstants.XpidlParamModifierOptional:
					paramModifiers.Add(XpidlParamModifier.Optional);
					break;

				default:
					throw new ArgumentException(mc_InvalidSyntaxNode, "paramModifiersSyntaxNode");
			}
		}
		private static XpidlModifiers<XpidlParamModifier> CreateXpidlMethodParamModifiers(ComplexSyntaxNode paramModifiersSyntaxNode)
		{
			ValidateSyntaxNode(paramModifiersSyntaxNode, RuleConstants.XpidlMethodParamModifiersDecl);

			var paramModifiers = new XpidlModifiers<XpidlParamModifier>();
			BuildXpidlMethodParamModifiers(paramModifiers, paramModifiersSyntaxNode);
			return paramModifiers;
		}
		private static void BuildXpidlMethodModifiers(XpidlModifiers<XpidlMethodModifier> methodModifiers, ComplexSyntaxNode methodModifiersSyntaxNode)
		{
			switch ((RuleConstants) methodModifiersSyntaxNode.Rule.Index)
			{
				case RuleConstants.XpidlMethodModifiersDecl:
				case RuleConstants.XpidlMethodModifiersList1:
				case RuleConstants.XpidlMethodModifiersList2:
					foreach (SyntaxNode syntaxNode in methodModifiersSyntaxNode)
					{
						if (syntaxNode is ComplexSyntaxNode)
						{
							BuildXpidlMethodModifiers(methodModifiers, (ComplexSyntaxNode) syntaxNode);
						}
					}
					break;
				case RuleConstants.XpidlMethodModifier1:
					methodModifiers.Add(XpidlMethodModifier.NoScript);
					break;
				case RuleConstants.XpidlMethodModifier2:
					methodModifiers.Add(XpidlMethodModifier.NotXpcom);
					break;
				case RuleConstants.XpidlMethodModifier3:
					var simpleSyntaxNode = (SimpleSyntaxNode) methodModifiersSyntaxNode[2];
					methodModifiers.Add(XpidlMethodModifier.BinaryName, simpleSyntaxNode.Text);
					break;
				default:
					throw new ArgumentException(mc_InvalidSyntaxNode, "methodModifiersSyntaxNode");
			}
		}
		private static XpidlModifiers<XpidlMethodModifier> CreateXpidlMethodModifiers(ComplexSyntaxNode methodModifiersSyntaxNode)
		{
			ValidateSyntaxNode(methodModifiersSyntaxNode, RuleConstants.XpidlMethodModifiersDecl);

			var methodModifiers = new XpidlModifiers<XpidlMethodModifier>();
			BuildXpidlMethodModifiers(methodModifiers, methodModifiersSyntaxNode);
			return methodModifiers;
		}
		private static void BuildXpidlInterfaceModifiers(XpidlModifiers<XpidlInterfaceModifier> interfaceModifiers, ComplexSyntaxNode interfaceModifiersSyntaxNode)
		{
			switch ((RuleConstants) interfaceModifiersSyntaxNode.Rule.Index)
			{
				case RuleConstants.XpidlInterfaceModifiersDecl1:
				case RuleConstants.XpidlInterfaceModifiersDecl2:
				case RuleConstants.XpidlInterfaceModifiersList1:
				case RuleConstants.XpidlInterfaceModifiersList2:
					foreach (SyntaxNode syntaxNode in interfaceModifiersSyntaxNode)
					{
						if (syntaxNode is ComplexSyntaxNode)
						{
							BuildXpidlInterfaceModifiers(interfaceModifiers, (ComplexSyntaxNode) syntaxNode);
						}
					}
					break;
				case RuleConstants.XpidlInterfaceModifierScriptable:
					interfaceModifiers.Add(XpidlInterfaceModifier.Scriptable);
					break;
				case RuleConstants.XpidlInterfaceModifierFunction:
					interfaceModifiers.Add(XpidlInterfaceModifier.Function);
					break;
				case RuleConstants.XpidlInterfaceModifierObject:
					interfaceModifiers.Add(XpidlInterfaceModifier.Object);
					break;
				case RuleConstants.XpidlInterfaceModifierNotXpcom:
					interfaceModifiers.Add(XpidlInterfaceModifier.NotXpcom);
					break;
				case RuleConstants.XpidlInterfaceModifierNoScript:
					interfaceModifiers.Add(XpidlInterfaceModifier.NoScript);
					break;
				case RuleConstants.XpidlInterfaceUuid:
					break;
				default:
					throw new ArgumentException(mc_InvalidSyntaxNode, "interfaceModifiersSyntaxNode");
			}
		}
		private static XpidlModifiers<XpidlInterfaceModifier> CreateXpidlInterfaceModifiers(ComplexSyntaxNode interfaceModifiersSyntaxNode)
		{
			ValidateSyntaxNode(interfaceModifiersSyntaxNode);

			var interfaceModifiers = new XpidlModifiers<XpidlInterfaceModifier>();
			BuildXpidlInterfaceModifiers(interfaceModifiers, interfaceModifiersSyntaxNode);
			return interfaceModifiers;
		}
		private static void BuildXpidlNativeTypeModifiers(XpidlModifiers<XpidlNativeTypeModifier> nativeTypeModifiers, ComplexSyntaxNode nativeTypeModifiersSyntaxNode)
		{
			switch ((RuleConstants) nativeTypeModifiersSyntaxNode.Rule.Index)
			{
				case RuleConstants.XpidlNativeTypeModifiersDecl:
				case RuleConstants.XpidlNativeTypeModifiersList1:
				case RuleConstants.XpidlNativeTypeModifiersList2:
					foreach (SyntaxNode syntaxNode in nativeTypeModifiersSyntaxNode)
					{
						if (syntaxNode is ComplexSyntaxNode)
						{
							BuildXpidlNativeTypeModifiers(nativeTypeModifiers, (ComplexSyntaxNode) syntaxNode);
						}
					}
					break;
				case RuleConstants.XpidlNativeTypeModifierRef:
					nativeTypeModifiers.Add(XpidlNativeTypeModifier.Ref);
					break;
				case RuleConstants.XpidlNativeTypeModifierPtr:
					nativeTypeModifiers.Add(XpidlNativeTypeModifier.Ptr);
					break;
				case RuleConstants.XpidlNativeTypeModifierNsId:
					nativeTypeModifiers.Add(XpidlNativeTypeModifier.NsId);
					break;
				case RuleConstants.XpidlNativeTypeModifierDomString:
					nativeTypeModifiers.Add(XpidlNativeTypeModifier.DomString);
					break;
				case RuleConstants.XpidlNativeTypeModifierUtf8String:
					nativeTypeModifiers.Add(XpidlNativeTypeModifier.Utf8String);
					break;
				case RuleConstants.XpidlNativeTypeModifierCString:
					nativeTypeModifiers.Add(XpidlNativeTypeModifier.CString);
					break;
				case RuleConstants.XpidlNativeTypeModifierAString:
					nativeTypeModifiers.Add(XpidlNativeTypeModifier.AString);
					break;
				default:
					throw new ArgumentException(mc_InvalidSyntaxNode, "nativeTypeModifiersSyntaxNode");
			}
		}
		private static XpidlModifiers<XpidlNativeTypeModifier> CreateNativeTypeModifiers(ComplexSyntaxNode nativeTypeModifiersSyntaxNode)
		{
			ValidateSyntaxNode(nativeTypeModifiersSyntaxNode, RuleConstants.XpidlNativeTypeModifiersDecl);

			var nativeTypeModifiers = new XpidlModifiers<XpidlNativeTypeModifier>();
			BuildXpidlNativeTypeModifiers(nativeTypeModifiers, nativeTypeModifiersSyntaxNode);
			return nativeTypeModifiers;
		}
예제 #13
0
		internal XpidlNativeType(String name, String definition, XpidlModifiers<XpidlNativeTypeModifier> modifiers)
		{
			m_Name = name;
			m_Definition = definition;
			m_Modifiers = (modifiers ?? new XpidlModifiers<XpidlNativeTypeModifier>()).AsReadOnly();
		}