コード例 #1
0
ファイル: CompilerError.cs プロジェクト: hlizard/boo
		public CompilerError(string code, LexicalInfo lexicalInfo, string message, Exception cause) : base(message, cause)
		{
			if (null == lexicalInfo)
				throw new ArgumentNullException("lexicalInfo");
			_code = code;
			_lexicalInfo = lexicalInfo;
		}
コード例 #2
0
ファイル: CompilerError.cs プロジェクト: hlizard/boo
		public CompilerError(string code, LexicalInfo lexicalInfo, params object[] args) : base(ResourceManager.Format(code, args))
		{
			if (null == lexicalInfo)
				throw new ArgumentNullException("lexicalInfo");
			_code = code;
			_lexicalInfo = lexicalInfo;
		}
コード例 #3
0
ファイル: IfStatement.cs プロジェクト: w4x/boolangstudio
 public IfStatement(LexicalInfo token, Expression condition, Block trueBlock, Block falseBlock)
     : base(token)
 {
     this.Condition = condition;
     this.TrueBlock = trueBlock;
     this.FalseBlock = falseBlock;
 }
コード例 #4
0
ファイル: MappedNode.cs プロジェクト: pshiryaev/Boo-Plugin
 protected MappedNode(CompileResults results, LexicalInfo lexicalInfo, int length)
     : this(results, null,
         results.LocationToPoint(lexicalInfo),
         results.LocationToPoint(lexicalInfo.Line, lexicalInfo.Column + length))
 {
     LexicalInfo = lexicalInfo;
 }
コード例 #5
0
ファイル: Slice.cs プロジェクト: w4x/boolangstudio
 public Slice(LexicalInfo lexicalInfo, Expression begin, Expression end, Expression step)
     : base(lexicalInfo)
 {
     this.Begin = begin;
     this.End = end;
     this.Step = step;
 }
コード例 #6
0
ファイル: BinaryExpression.cs プロジェクト: w4x/boolangstudio
 public BinaryExpression(LexicalInfo lexicalInfoProvider, BinaryOperatorType operator_, Expression left, Expression right)
     : base(lexicalInfoProvider)
 {
     this.Operator = operator_;
     this.Left = left;
     this.Right = right;
 }
コード例 #7
0
ファイル: CompilerMessage.cs プロジェクト: Rfvgyhn/Boo-Plugin
 public CompilerMessage(LexicalInfo lexicalInfo, string code, string message, TaskErrorCategory errorCategory)
 {
     LexicalInfo = lexicalInfo;
     Code = code;
     Message = message;
     ErrorCategory = errorCategory;
 }
コード例 #8
0
ファイル: AstUtil.cs プロジェクト: w4x/boolangstudio
 public static MethodInvocationExpression CreateMethodInvocationExpression(LexicalInfo li, Expression target, Expression arg)
 {
     MethodInvocationExpression mie = new MethodInvocationExpression(li);
     mie.Target = (Expression)target.Clone();
     mie.Arguments.Add((Expression)arg.Clone());
     mie.IsSynthetic = true;
     return mie;
 }
コード例 #9
0
ファイル: CompilerWarning.cs プロジェクト: 0xb1dd1e/boo
		public CompilerWarning(LexicalInfo lexicalInfo, string message, string code)
		{
			if (null == message) throw new ArgumentNullException("message");
			if (null == code) throw new ArgumentNullException("code");
			_lexicalInfo = lexicalInfo;
			_message = message;
			_code = code;
		}
コード例 #10
0
 void OnParserError(antlr.RecognitionException error)
 {
     var location = new LexicalInfo(error.getFilename(), error.getLine(), error.getColumn());
     var nvae = error as antlr.NoViableAltException;
     if (null != nvae)
         ParserError(location, nvae);
     else
         GenericParserError(location, error);
 }
コード例 #11
0
ファイル: CompilerWarning.cs プロジェクト: w4x/boolangstudio
        public CompilerWarning(LexicalInfo lexicalInfo, string message)
        {
            if (null == message)
            {
                throw new ArgumentNullException("message");
            }

            _code = "BCW0000";
            _lexicalInfo = lexicalInfo;
            _message = Boo.Lang.ResourceManager.Format(_code, message);
        }
コード例 #12
0
ファイル: CompilerWarning.cs プロジェクト: w4x/boolangstudio
 public CompilerWarning(string code, LexicalInfo lexicalInfo,  params object[] args)
 {
     if (null == code)
     {
         throw new ArgumentNullException("code");
     }
     if (null == lexicalInfo)
     {
         throw new ArgumentNullException("lexicalInfo");
     }
     _code = code;
     _lexicalInfo = lexicalInfo;
     _message = Boo.Lang.ResourceManager.Format(code, args);
 }
コード例 #13
0
ファイル: TypeMemberImpl.cs プロジェクト: codehaus/boo
 protected TypeMemberImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
     _attributes = new AttributeCollection(this);
 }
コード例 #14
0
 protected SelfLiteralExpressionImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
 }
コード例 #15
0
 /// <summary>
 /// Initializes a new instance of the CompilerError class.
 /// </summary>
 /// <param name="lexicalInfo">Location of the source code that caused the error.</param>
 /// <param name="message">Description of the error.</param>
 /// <param name="cause"><see cref="Exception"/> that caused the error.</param>
 /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception>
 public CompilerError(LexicalInfo lexicalInfo, string message, Exception cause) : this("SCE0000", lexicalInfo, message, cause)
 {
 }
コード例 #16
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
        public Method CreateAbstractMethod(LexicalInfo lexicalInfo, IMethod baseMethod)
        {
            TypeMemberModifiers visibility = VisibilityFrom(baseMethod);

            return(CreateMethodFromPrototype(lexicalInfo, baseMethod, visibility | TypeMemberModifiers.Abstract));
        }
コード例 #17
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
 public MethodInvocationExpression CreateEvalInvocation(LexicalInfo li)
 {
     return(CreateBuiltinInvocation(li, BuiltinFunction.Eval));
 }
コード例 #18
0
ファイル: ExpressionPairImpl.cs プロジェクト: codehaus/boo
 protected ExpressionPairImpl(LexicalInfo lexicalInfo, Expression first, Expression second) : base(lexicalInfo)
 {
     First  = first;
     Second = second;
 }
コード例 #19
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public TypeReference CreateTypeReference(LexicalInfo li, Type type)
 {
     return CreateTypeReference(li, TypeSystemServices.Map(type));
 }
コード例 #20
0
 protected MethodImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
     _parameters           = new ParameterDeclarationCollection(this);
     _returnTypeAttributes = new AttributeCollection(this);
     Body = new Block();
 }
コード例 #21
0
 protected InterfaceDefinitionImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
 }
コード例 #22
0
 /// <summary>
 /// Initializes a new instance of the CompilerError class.
 /// </summary>
 /// <param name="lexicalInfo">Location of the source code that caused the error.</param>
 /// <param name="cause"><see cref="Exception"/> that caused the error.</param>
 /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception>
 public CompilerError(LexicalInfo lexicalInfo, Exception cause) : this(lexicalInfo, cause.Message, cause)
 {
 }
コード例 #23
0
ファイル: YieldStatementImpl.cs プロジェクト: codehaus/boo
 protected YieldStatementImpl(LexicalInfo lexicalInfo, Expression expression) : base(lexicalInfo)
 {
     Expression = expression;
 }
コード例 #24
0
ファイル: BooParsingStep.cs プロジェクト: codehaus/boo
        void ParserError(LexicalInfo data, antlr.NoViableAltException error)
        {
            string msg = Boo.ResourceManager.Format("NoViableAltException", error.token.getText());

            _context.Errors.Add(new Error(data, msg, error));
        }
コード例 #25
0
 /// <summary>
 /// Initializes a new instance of the CompilerError class.
 /// </summary>
 /// <param name="code">String id of the error.</param>
 /// <param name="lexicalInfo">Location of the source code that caused the error.</param>
 /// <param name="isParserError">True if error was found by <see cref="Parser"/>.</param>
 /// <param name="args">Formatting items used to create an error message.</param>
 /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception>
 public CompilerError(string code, LexicalInfo lexicalInfo, bool isParserError, params object[] args) : base(ErrorCodes.Format(code, args))
 {
     _lexicalInfo  = lexicalInfo ?? throw new ArgumentNullException(nameof(lexicalInfo));
     IsParserError = isParserError;
     _code         = code;
 }
コード例 #26
0
ファイル: ExpressionPairImpl.cs プロジェクト: codehaus/boo
 protected ExpressionPairImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
 }
コード例 #27
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public SelfLiteralExpression CreateSelfReference(LexicalInfo location, IType expressionType)
 {
     var reference = CreateSelfReference(expressionType);
     reference.LexicalInfo = location;
     return reference;
 }
コード例 #28
0
 protected IfStatementImpl(LexicalInfo lexicalInfo, Expression expression, Block trueBlock, Block falseBlock) : base(lexicalInfo)
 {
     Expression = expression;
     TrueBlock  = trueBlock;
     FalseBlock = falseBlock;
 }
コード例 #29
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public RaiseStatement RaiseException(LexicalInfo lexicalInfo, IConstructor exceptionConstructor, params Expression[] args)
 {
     Debug.Assert(TypeSystemServices.IsValidException(exceptionConstructor.DeclaringType));
     return new RaiseStatement(lexicalInfo, CreateConstructorInvocation(lexicalInfo, exceptionConstructor, args));
 }
コード例 #30
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public Expression CreateInitValueType(LexicalInfo li, ReferenceExpression target)
 {
     var mie = CreateBuiltinInvocation(li, BuiltinFunction.InitValueType);
     mie.Arguments.Add(target);
     return mie;
 }
コード例 #31
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
 public ReferenceExpression CreateReference(LexicalInfo li, System.Type type)
 {
     return(CreateReference(li, TypeSystemServices.Map(type)));
 }
コード例 #32
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public MemberReferenceExpression CreateMemberReference(LexicalInfo li, Expression target, IMember member)
 {
     MemberReferenceExpression expression = CreateMemberReference(target, member);
     expression.LexicalInfo = li;
     return expression;
 }
コード例 #33
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
 public Statement CreateFieldAssignment(LexicalInfo lexicalInfo, IField fieldEntity, Expression initializer)
 {
     return(new ExpressionStatement(lexicalInfo,
                                    CreateFieldAssignmentExpression(fieldEntity, initializer)));
 }
コード例 #34
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
        public Method CreateMethodFromPrototype(LexicalInfo location, IMethod baseMethod, TypeMemberModifiers newModifiers, string newMethodName)
        {
            var method = new Method(location);
            method.Name = newMethodName;
            method.Modifiers = newModifiers;
            method.IsSynthetic = true;

            var optionalTypeMappings = DeclareGenericParametersFromPrototype(method, baseMethod);
            var typeReferenceFactory = optionalTypeMappings != null
                                       	? new MappedTypeReferenceFactory(TypeReferenceFactory, optionalTypeMappings)
                                       	: TypeReferenceFactory;
            _typeReferenceFactory.With(typeReferenceFactory, ()=>
            {
                DeclareParameters(method, baseMethod.GetParameters(), baseMethod.IsStatic ? 0 : 1);
                method.ReturnType = CreateTypeReference(baseMethod.ReturnType);
            });
            EnsureEntityFor(method);
            return method;
        }
コード例 #35
0
 /// <summary>
 /// Initializes a new instance of the CompilerError class.
 /// </summary>
 /// <param name="lexicalInfo">Location of the source code that caused the error.</param>
 /// <param name="message">Description of the error.</param>
 /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception>
 public CompilerError(LexicalInfo lexicalInfo, string message) : this(lexicalInfo, message, null)
 {
 }
コード例 #36
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public MethodInvocationExpression CreateMethodInvocation(LexicalInfo li, IMethod staticMethod, Expression arg0, Expression arg1, Expression arg2)
 {
     MethodInvocationExpression expression = CreateMethodInvocation(staticMethod, arg0, arg1, arg2);
     expression.LexicalInfo = li;
     return expression;
 }
コード例 #37
0
 /// <summary>
 /// Initializes a new instance of the CompilerError class.
 /// </summary>
 /// <param name="code">String id of the error.</param>
 /// <param name="lexicalInfo">Location of the source code that caused the error.</param>
 /// <param name="message">Description of the error.</param>
 /// <param name="cause"><see cref="Exception"/> that caused the error.</param>
 /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception>
 public CompilerError(string code, LexicalInfo lexicalInfo, string message, Exception cause) : base(message, cause)
 {
     _lexicalInfo = lexicalInfo ?? throw new ArgumentNullException(nameof(lexicalInfo));
     _code        = code;
 }
コード例 #38
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public Expression CreateMethodReference(LexicalInfo lexicalInfo, IMethod method)
 {
     var e = CreateMethodReference(method);
     e.LexicalInfo = lexicalInfo;
     return e;
 }
コード例 #39
0
        protected void EmitRunProcess(CompileContext context, TypeInfo procType, bool setGuidOnProc, LexicalInfo lexInfo, bool loadVariables)
        {
            if (context.Type == null || context.ILGenerator == null)
            {
                return; //Are at top level and so can't run the process
            }
            ILGenerator il = context.ILGenerator;


            if (loadVariables)
            {
                foreach (string paramName in procType.ConstructorParameters)
                {
                    il.Emit(OpCodes.Ldloc, context.Type.GetLocal(paramName));
                }
            }
            LocalBuilder loc = il.DeclareLocal(typeof(ProcessBase));

            il.Emit(OpCodes.Newobj, procType.Constructor);
            il.Emit(OpCodes.Stloc, loc);
            il.Emit(OpCodes.Ldloc, loc);
            il.Emit(OpCodes.Ldarg_0); //load the "this" pointer

            //The current process doesn't have a restrict or relabel method, no reason for it
            //to continue living, set the parent process of the new proc as our own parent process
            if (!context.Type.IsPreProcessed && !context.Type.IsRestricted && !context.Type.MustLiveOn)
            {
                il.Emit(OpCodes.Call, MethodResolver.GetMethod(typeof(ProcessBase), "get_Parent"));
            }
            il.Emit(OpCodes.Call, MethodResolver.GetMethod(typeof(ProcessBase), "set_Parent"));

            if (setGuidOnProc)
            {
                il.Emit(OpCodes.Ldloc, loc);
                il.Emit(OpCodes.Ldarg_0);
                il.Emit(OpCodes.Call, typeof(ProcessBase).GetMethod("get_SetID"));
                il.Emit(OpCodes.Call, typeof(ProcessBase).GetMethod("set_SetID"));
            }

            il.Emit(OpCodes.Ldloc, loc);
            if (context.Options.Debug && lexInfo != null)
            {
                //context.MarkSequencePoint(lexInfo);
            }
            il.Emit(OpCodes.Call, MethodResolver.GetMethod(typeof(ProcessBase), "Run"));
        }
コード例 #40
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public ReferenceExpression CreateReference(LexicalInfo info, IType type)
 {
     var expression = CreateReference(type);
     expression.LexicalInfo = info;
     return expression;
 }
コード例 #41
0
 protected IfStatementImpl(LexicalInfo lexicalInfo) : base(lexicalInfo)
 {
 }
コード例 #42
0
 /// <summary>
 /// Initializes a new instance of the CompilerError class.
 /// </summary>
 /// <param name="code">String id of the error.</param>
 /// <param name="lexicalInfo">Location of the source code that caused the error.</param>
 /// <param name="cause"><see cref="Exception"/> that caused the error.</param>
 /// <param name="args">Formatting items used to create an error message.</param>
 /// <exception cref="ArgumentNullException">If parameter lexicalInfo is null.</exception>
 public CompilerError(string code, LexicalInfo lexicalInfo, Exception cause, params object[] args) : base(ErrorCodes.Format(code, args), cause)
 {
     _code        = code;
     _lexicalInfo = lexicalInfo ?? throw new ArgumentNullException(nameof(lexicalInfo));
 }
コード例 #43
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public Expression CreateInitValueType(LexicalInfo li, InternalLocal local)
 {
     return CreateInitValueType(li, CreateReference(local));
 }
コード例 #44
0
 private static MethodInvocationExpression NewAddInvocation(LexicalInfo location, ReferenceExpression target, params Expression[] args)
 {
     return(new MethodInvocationExpression(location, new MemberReferenceExpression(target.CloneNode(), "Add"), args));
 }
コード例 #45
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public Method CreateMethodFromPrototype(LexicalInfo lexicalInfo, IMethod baseMethod, TypeMemberModifiers newModifiers)
 {
     return CreateMethodFromPrototype(lexicalInfo, baseMethod, newModifiers, baseMethod.Name);
 }
コード例 #46
0
 protected void AddCompilerError(LexicalInfo lexicalInfo, string msg)
 {
     Errors.Add(CompilerErrorFactory.CustomError(lexicalInfo, msg));
 }
コード例 #47
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public MethodInvocationExpression CreateMethodInvocation(LexicalInfo li, Expression target, IMethod tag, Expression arg)
 {
     MethodInvocationExpression mie = CreateMethodInvocation(target, tag, arg);
     mie.LexicalInfo = li;
     return mie;
 }
コード例 #48
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
 public Method CreateMethodFromPrototype(LexicalInfo lexicalInfo, IMethod baseMethod, TypeMemberModifiers newModifiers)
 {
     return(CreateMethodFromPrototype(lexicalInfo, baseMethod, newModifiers, baseMethod.Name));
 }
コード例 #49
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public MethodInvocationExpression CreateMethodInvocation(LexicalInfo li, Expression target, IMethod entity)
 {
     MethodInvocationExpression expression = CreateMethodInvocation(target, entity);
     expression.LexicalInfo = li;
     return expression;
 }
コード例 #50
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
 public RaiseStatement RaiseException(LexicalInfo lexicalInfo, IConstructor exceptionConstructor, params Expression[] args)
 {
     Debug.Assert(TypeSystemServices.IsValidException(exceptionConstructor.DeclaringType));
     return(new RaiseStatement(lexicalInfo, CreateConstructorInvocation(lexicalInfo, exceptionConstructor, args)));
 }
コード例 #51
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public MemberReferenceExpression CreateReference(LexicalInfo li, Field field)
 {
     MemberReferenceExpression e = CreateReference(field);
     e.LexicalInfo = li;
     return e;
 }
コード例 #52
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
 public Expression CreateDefaultInitializer(LexicalInfo li, ReferenceExpression target, IType type)
 {
     return(type.IsValueType
                         ? CreateInitValueType(li, target)
                         : CreateAssignment(li, target, CreateNullLiteral()));
 }
コード例 #53
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public ReferenceExpression CreateReference(LexicalInfo li, System.Type type)
 {
     return CreateReference(li, TypeSystemServices.Map(type));
 }
コード例 #54
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
 public Expression CreateDefaultInitializer(LexicalInfo li, InternalLocal local)
 {
     return(CreateDefaultInitializer(li, CreateReference(local), local.Type));
 }
コード例 #55
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public Statement CreateSwitch(LexicalInfo li, Expression offset, IEnumerable<LabelStatement> labels)
 {
     offset.LexicalInfo = li;
     return CreateSwitch(offset, labels);
 }
コード例 #56
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
 public Expression CreateInitValueType(LexicalInfo li, InternalLocal local)
 {
     return(CreateInitValueType(li, CreateReference(local)));
 }
コード例 #57
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 public TypeReference CreateTypeReference(LexicalInfo li, IType type)
 {
     TypeReference reference = CreateTypeReference(type);
     reference.LexicalInfo = li;
     return reference;
 }
コード例 #58
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
 public Statement CreateSwitch(LexicalInfo li, Expression offset, IEnumerable <LabelStatement> labels)
 {
     offset.LexicalInfo = li;
     return(CreateSwitch(offset, labels));
 }
コード例 #59
0
ファイル: BooCodeBuilder.cs プロジェクト: 0xb1dd1e/boo
 private static MethodInvocationExpression CreateBuiltinInvocation(LexicalInfo li, BuiltinFunction builtin)
 {
     return new MethodInvocationExpression(li) { Target = CreateBuiltinReference(builtin) };
 }
コード例 #60
0
ファイル: BooCodeBuilder.cs プロジェクト: sixteentons/boo
 public TypeReference CreateTypeReference(LexicalInfo li, Type type)
 {
     return(CreateTypeReference(li, TypeSystemServices.Map(type)));
 }