示例#1
0
 //-----------------------------------------------------------------------------
 // Limits on 'As' operator
 //-----------------------------------------------------------------------------
 public static SymbolErrorException AsOpOnlyOnRefTypes(
     FileRange location
     )
 {
     return(new SymbolErrorException(Code.cAsOpOnlyOnRefTypes, location,
                                     "The 'as' operator can only be used on reference types, not value types."));
 }
示例#2
0
    public SymEntry EnsureSymbolType(SymEntry sym, System.Type tExpected, FileRange location)
    {
        if (sym == null)
            return null;
/*
        Type tSym = sym.GetType();
        if (tSym == tExpected)
            return sym;

        if (tSym.IsSubclassOf(tExpected))
            return sym;
*/
        bool fMatch = SymbolEngine.TypeEntry.IsAssignable(sym.GetType(), tExpected);
        if (fMatch)
            return sym;

        ThrowError(SymbolError.BadSymbolType(sym, tExpected, location));
/*
        this.ThrowError(Code.cBadSymbolType,
            location,
            "Symbol '" + sym.Name + "' must be of type '" + tExpected.ToString() + "', not '" +
            sym.GetType().ToString() + "'");
*/
        return sym;
    }
示例#3
0
        /// <summary>
        /// Constructs a web request to write a range of pages in a file from the source file.
        /// </summary>
        /// <param name="uri">The absolute URI to the file.</param>
        /// <param name="sourceUri">A <see cref="System.Uri"/> specifying the absolute URI to the source file.</param>
        /// <param name="sourceFileRange">The beginning and ending source offsets.</param>
        /// <param name="destFileRange">The beginning and ending destination offsets.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="sourceContentChecksum">The checksum calculated for the range of bytes of the source.</param>
        /// <param name="sourceAccessCondition">The source access condition to apply to the request</param>
        /// <param name="content">The HTTP entity body and content headers.</param>
        /// <param name="operationContext">An object that represents the context for the current operation.</param>
        /// <param name="canonicalizer">A canonicalizer that converts HTTP request data into a standard form appropriate for signing.</param>
        /// <param name="credentials">A <see cref="StorageCredentials"/> object providing credentials for the request.</param>
        /// <returns></returns>
        public static StorageRequestMessage PutRangeFromUrl(
            Uri uri,
            Uri sourceUri,
            FileRange sourceFileRange,
            FileRange destFileRange,
            int?timeout,
            Checksum sourceContentChecksum,
            AccessCondition sourceAccessCondition,
            HttpContent content,
            OperationContext operationContext,
            ICanonicalizer canonicalizer,
            StorageCredentials credentials)
        {
            UriQueryBuilder builder = new UriQueryBuilder();

            builder.Add(Constants.QueryConstants.Component, "range");

            StorageRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(
                HttpMethod.Put, uri, timeout, builder, content, operationContext, canonicalizer, credentials);

            request.Headers.Add(Constants.HeaderConstants.CopySourceHeader, sourceUri.AbsoluteUri);
            request.Headers.Add(Constants.HeaderConstants.FileRangeWrite, FileRangeWrite.Update.ToString());
            request.Headers.Add(Constants.HeaderConstants.RangeHeader, destFileRange.ToString());
            request.Headers.Add(Constants.HeaderConstants.SourceRangeHeader, sourceFileRange.ToString());
            request.ApplySourceContentChecksumHeaders(sourceContentChecksum);
            request.ApplyAccessConditionToSource(sourceAccessCondition);

            return(request);
        }
示例#4
0
    //-----------------------------------------------------------------------------
    // No acceptable indexer (matched by parameter types)
    //-----------------------------------------------------------------------------
    public static SymbolErrorException NoAcceptableIndexer(FileRange location, System.Type [] alTypes, bool fIsLeft)
    {
        StringBuilder sb = new StringBuilder();

        sb.Append("No acceptable '");
        sb.Append(fIsLeft ? "get" : "set");
        sb.Append("' indexer has signature: (");

        bool fComma = false;

        foreach (Type t in alTypes)
        {
            if (fComma)
            {
                sb.Append(",");
            }
            sb.Append(t.FullName);
            fComma = true;
        }
        sb.Append(").");

        return(new SymbolErrorException(
                   Code.cNoAcceptableIndexer,
                   location,
                   sb.ToString()));
    }
示例#5
0
 //-----------------------------------------------------------------------------
 // When doing 'base.X(.....)', X must not be static.
 // If it was, we should have done 'T.X(.....)'
 //-----------------------------------------------------------------------------
 public static SymbolErrorException BaseAccessCantBeStatic(FileRange location, MethodExpEntry m)
 {
     return(new SymbolErrorException(
                Code.cBaseAccessCantBeStatic,
                location,
                "Can't access static member '" + m.PrettyDecoratedName + "' via a 'base' accessor."));
 }
示例#6
0
 // No data (for practically everything else)
 public Token(Type type, FileRange pos)
 {   
     m_filepos = pos;
     
     m_type = type;
     m_text = "";
 }
 private bool TryParseComponentPosition(string s, FileRange range, out ComponentPosition componentPosition, out string remaining)
 {
     if (s.StartsWith("_Start", StringComparison.OrdinalIgnoreCase))
     {
         componentPosition = ComponentPosition.Start;
         remaining         = s.Substring("_Start".Length);
         return(true);
     }
     else if (s.StartsWith("_Middle", StringComparison.OrdinalIgnoreCase))
     {
         componentPosition = ComponentPosition.Middle;
         remaining         = s.Substring("_Middle".Length);
         return(true);
     }
     else if (s.StartsWith("_End", StringComparison.OrdinalIgnoreCase))
     {
         componentPosition = ComponentPosition.End;
         remaining         = s.Substring("_End".Length);
         return(true);
     }
     else
     {
         _logger.Log(LogLevel.Error, range, $"Invalid point '{s}' (expected a string beginning with '_Start', '_Middle' or '_End'", null);
         componentPosition = ComponentPosition.Absolute;
         remaining         = null;
         return(false);
     }
 }
        public bool TryParse(string x, string y, FileRange xRange, FileRange yRange, out XmlComponentPoint componentPoint)
        {
            if (!TryParseComponentPosition(x, xRange, out var relativeToX, out var remainingX))
            {
                componentPoint = null;
                return(false);
            }

            if (!TryParseOffsets(remainingX, OffsetAxis.X, xRange, out var xOffsets))
            {
                componentPoint = null;
                return(false);
            }

            if (!TryParseComponentPosition(y, yRange, out var relativeToY, out var remainingY))
            {
                componentPoint = null;
                return(false);
            }

            if (!TryParseOffsets(remainingY, OffsetAxis.Y, yRange, out var yOffsets))
            {
                componentPoint = null;
                return(false);
            }

            var offsets = xOffsets.Concat(yOffsets).ToList();

            componentPoint = new XmlComponentPoint(relativeToX, relativeToY, offsets);
            return(true);
        }
示例#9
0
 //-----------------------------------------------------------------------------
 // The specified feature is not yet implemented
 //-----------------------------------------------------------------------------
 public static SymbolErrorException NotYetImpl(FileRange location, string stHint)
 {
     return(new SymbolErrorException(
                Code.cNotYetImplemented,
                location,
                "'" + stHint + "' not implemented."
                ));
 }
示例#10
0
 //-----------------------------------------------------------------------------
 // This label is already defined
 //-----------------------------------------------------------------------------
 public static SymbolErrorException LabelAlreadyDefined(string stName, FileRange lNew, FileRange lOld)
 {
     return(new SymbolErrorException(
                Code.cLabelAlreadyDefined,
                lNew,
                "Label '" + stName + "' is already defined at '" +
                lOld + "' in the current scope"));
 }
示例#11
0
 // For chars
 public Token(Type type, char chValue, FileRange pos)
 {
     Debug.Assert(type == Type.cChar);
     m_filepos = pos;
     
     m_type = type;
     m_nValue = (int) chValue;
 }
示例#12
0
 // Int data (for integers)
 public Token(Type type, int nValue, FileRange pos)
 {   
     Debug.Assert(type == Type.cInt || type == Type.cLRSquare);
     m_filepos = pos;        
     
     m_type = type;
     m_nValue = nValue;
 }
示例#13
0
 // String data (for string literals & identifiers)
 public Token(Type type, string stText, FileRange pos)
 {   
     Debug.Assert(type == Type.cId || type == Type.cString);
     m_filepos = pos;
     
     m_type = type;
     m_text = stText;
 }
示例#14
0
 //-----------------------------------------------------------------------------
 // The expression is not valid on the lefthand side
 //-----------------------------------------------------------------------------
 public static SymbolErrorException NotValidLHS(FileRange location)
 {
     return(new SymbolErrorException(
                Code.cNotValidLHS,
                location,
                "This expression is not a valid Left-Hand-Side expression"
                ));
 }
示例#15
0
 // String data (for string literals & identifiers)
 public Token(Type type, bool fValue, FileRange pos)
 {   
     Debug.Assert(type == Type.cBool);
     m_filepos = pos;
     
     m_type = type;
     m_fValue = fValue;
     
 }
示例#16
0
 //-----------------------------------------------------------------------------
 // Shadow
 //-----------------------------------------------------------------------------
 public static SymbolErrorException ShadowCatchHandlers(
     FileRange location,
     System.Type tCatchType,
     System.Type tPrevCatchType)
 {
     return(new SymbolErrorException(
                Code.cShadowCatchHandlers, location,
                "Catch handler for type '" + tCatchType.ToString() +
                "' is inaccessible because of a previous handler of type '" +
                tPrevCatchType.ToString() + "'"));
 }
示例#17
0
 //-----------------------------------------------------------------------------
 // The method is not defined.
 //-----------------------------------------------------------------------------
 public static SymbolErrorException MethodNotDefined(
     FileRange location,
     string stFullyQualifiedName
     )
 {
     return(new SymbolErrorException(
                Code.cMethodNotDefined,
                location,
                "The method '" + stFullyQualifiedName + "' is not defined."
                ));
 }
示例#18
0
 //-----------------------------------------------------------------------------
 // There is no suitable overload
 //-----------------------------------------------------------------------------
 public static SymbolErrorException NoAcceptableOverload(
     FileRange location,
     string stFullyQualifiedName
     )
 {
     return(new SymbolErrorException(
                Code.cNoAcceptableOverload,
                location,
                "No acceptable overload for '" + stFullyQualifiedName + "' exists"
                ));
 }
示例#19
0
 public virtual void EnsureAssignable(
     System.Type tFrom, 
     System.Type tTo, 
     FileRange location
 )
 {
     bool fOk = TypeEntry.IsAssignable(tFrom, tTo);
     if (!fOk)
     {
         ThrowError(SymbolError.TypeMismatch(tFrom, tTo, location));        
     }
 }
示例#20
0
 protected FileRange CalcCurFileRange()
 {
     FileRange r = new FileRange();
     r.Filename = this.m_stFilenameHint;
     r.ColStart = m_StartPos.col;
     r.RowStart = m_StartPos.row;
     
     r.ColEnd = m_col;
     r.RowEnd = m_row;
     
     return r;        
 }
示例#21
0
        private bool ReportUndeclared(FileRange position, ISet <string> allUndeclared)
        {
            if (allUndeclared.Any())
            {
                foreach (var undeclared in allUndeclared)
                {
                    logger.Log(LogLevel.Error, position, $"Usage of variable not present in the enclosing 'whenDefined' attribute: ${undeclared}", null);
                }
                return(false);
            }

            return(true);
        }
示例#22
0
 //-----------------------------------------------------------------------------
 // Overload for binary & unary
 //-----------------------------------------------------------------------------
 public static SymbolErrorException NoAcceptableOperator(
     FileRange location,
     System.Type tLeft,
     System.Type tRight,
     BinaryExp.BinaryOp op
     )
 {
     return(new SymbolErrorException(
                Code.cNoAcceptableOperator,
                location,
                "No binary operator '" + op +
                "' that takes arguments '" + tLeft.ToString() + "' and '" + tRight.ToString() + "'."));
 }
        /// <summary>
        /// Constructs a web request to write or clear a range of pages in a file.
        /// </summary>
        /// <param name="uri">The absolute URI to the file.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="fileRange">The beginning and ending offsets.</param>
        /// <param name="fileRangeWrite">Action describing whether we are writing to a file or clearing a set of ranges.</param>
        /// <param name="accessCondition">The access condition to apply to the request.</param>
        /// <param name="content">The corresponding Http content.</param>
        /// <param name="operationContext">An object that represents the context for the current operation.</param>
        /// <returns>A web request to use to perform the operation.</returns>
        public static StorageRequestMessage PutRange(Uri uri, int?timeout, FileRange fileRange, FileRangeWrite fileRangeWrite, AccessCondition accessCondition, HttpContent content, OperationContext operationContext, ICanonicalizer canonicalizer, StorageCredentials credentials)
        {
            UriQueryBuilder builder = new UriQueryBuilder();

            builder.Add(Constants.QueryConstants.Component, "range");

            StorageRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(HttpMethod.Put, uri, timeout, builder, content, operationContext, canonicalizer, credentials);

            request.AddOptionalHeader(Constants.HeaderConstants.RangeHeader, fileRange.ToString());
            request.Headers.Add(Constants.HeaderConstants.FileRangeWrite, fileRangeWrite.ToString());

            request.ApplyAccessCondition(accessCondition);
            return(request);
        }
示例#24
0
 // For errors
 public Token(Type type, char ch1, int chPeek, FileRange pos)
 {   
     Debug.Assert(type == Type.cError);
     m_filepos = pos;
     
     m_type = type;
     if (chPeek == -1 || Lexer.IsWhitespace(chPeek))
     {
         m_text = "" + ch1;
     } else {
         m_text = "" + ch1 + (char) chPeek;
     }
     
     
 }
示例#25
0
    //-----------------------------------------------------------------------------
    // The methdo must be public because it is implementing an interface.
    //-----------------------------------------------------------------------------
    public static SymbolErrorException IMethodMustBePublic(
        FileRange location,
        MethodExpEntry mInterface,
        TypeEntry tClass

        )
    {
        string stClass     = tClass.FullName;
        string stMethod    = mInterface.PrettyDecoratedName;
        string stInterface = mInterface.SymbolClass.FullName;

        return(new SymbolErrorException(
                   Code.cIMethodMustBePublic,
                   location,
                   "The method '" + stMethod + "' must be public to implement interface '" + stInterface + "'"));
    }
示例#26
0
    //-----------------------------------------------------------------------------
    // Missing an method inherited from an interface
    //-----------------------------------------------------------------------------
    public static SymbolErrorException MissingInterfaceMethod(
        FileRange location,
        MethodExpEntry mInterface,
        TypeEntry tClass
        )
    {
        string stClass     = tClass.FullName;
        string stMethod    = mInterface.PrettyDecoratedName;
        string stInterface = mInterface.SymbolClass.FullName;

        return(new SymbolErrorException(
                   Code.cMissingInterfaceMethod,
                   location,
                   "The type '" + stClass + "' does not implement method '" +
                   stMethod + "' from interface '" + stInterface + "'"));
    }
        /// <summary>
        /// Constructs a web request to write or clear a range of pages in a file.
        /// </summary>
        /// <param name="uri">The absolute URI to the file.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="fileRange">The beginning and ending offsets.</param>
        /// <param name="fileRangeWrite">Action describing whether we are writing to a file or clearing a set of ranges.</param>
        /// <param name="accessCondition">The access condition to apply to the request.</param>
        /// <param name="useVersionHeader">A boolean value indicating whether to set the <i>x-ms-version</i> HTTP header.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
        /// <returns>A web request to use to perform the operation.</returns>
        public static HttpWebRequest PutRange(Uri uri, int?timeout, FileRange fileRange, FileRangeWrite fileRangeWrite, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)
        {
            CommonUtility.AssertNotNull("fileRange", fileRange);

            UriQueryBuilder builder = new UriQueryBuilder();

            builder.Add(Constants.QueryConstants.Component, "range");

            HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Put, uri, timeout, builder, useVersionHeader, operationContext);

            request.AddOptionalHeader(Constants.HeaderConstants.RangeHeader, fileRange.ToString());
            request.Headers.Add(Constants.HeaderConstants.FileRangeWrite, fileRangeWrite.ToString());

            request.ApplyAccessCondition(accessCondition);
            return(request);
        }
        private async Task <(Stream, string)> GetStreamAsync(FileRange info, CancellationToken token)
        {
            token.ThrowIfCancellationRequested();

            var request = new HttpRequestMessage {
                RequestUri = Target
            };

            request.Headers.ConnectionClose = false;
            request.Headers.Range           = info.Range;

            var response = await Client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, token);

            var stream = await response.Content.ReadAsStreamAsync(token);

            return(stream, info.FileName);
        }
示例#29
0
 public static bool Parse(this IConditionParser parser, XAttribute conditionsAttribute, ComponentDescription description, IXmlLoadLogger logger, out IConditionTreeItem value)
 {
     try
     {
         value = parser.Parse(description, conditionsAttribute.Value);
         return(true);
     }
     catch (ConditionFormatException ex)
     {
         IXmlLineInfo line     = conditionsAttribute;
         int          startCol = line.LinePosition + conditionsAttribute.Name.LocalName.Length + 2 + ex.PositionStart;
         var          position = new FileRange(line.LineNumber, startCol, line.LineNumber, startCol + ex.Length);
         logger.Log(LogLevel.Error, position, ex.Message, null);
         value = null;
         return(false);
     }
 }
        public bool TryParse(string point, FileRange range, out XmlComponentPoint componentPoint)
        {
            if (!TryParseComponentPosition(point, range, out var relativeTo, out var remaining))
            {
                componentPoint = null;
                return(false);
            }

            if (!TryParseOffsets(remaining, null, range, out var offsets))
            {
                componentPoint = null;
                return(false);
            }

            componentPoint = new XmlComponentPoint(relativeTo, relativeTo, offsets);
            return(true);
        }
示例#31
0
文件: ExpAST.cs 项目: chenzuo/blue
 // Resolve expression as a RHS value. The exp node can totally change on us
 // (operator overloading, constant folding, etc), so we must pass as a ref
 public static void ResolveExpAsRight(ref Exp e, ISemanticResolver s)
 {
     // Debugging helper. Useful when we want to break when resolving 
     // a particular symbol.
     
     #if false   
          
     // Set lTarget to a symbol that we want to see resolved.
     FileRange lTarget = new FileRange("SemanticChecker.cs", 143, 39, 143, 43);
     if (lTarget.Equals(e.Location))
     {
         System.Diagnostics.Debugger.Break();
     }
     
     #endif
     e = e.ResolveExpAsRight(s);
     Debug.Assert(e != null);
 }
示例#32
0
文件: Error.cs 项目: chenzuo/blue
 internal ErrorException(SymbolError.Code e, FileRange location, string stMessage) 
     : this(ERResolve(e), location, stMessage) { }
        /// <summary>
        /// Constructs a web request to write or clear a range of pages in a file.
        /// </summary>
        /// <param name="uri">The absolute URI to the file.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="fileRange">The beginning and ending offsets.</param>
        /// <param name="fileRangeWrite">Action describing whether we are writing to a file or clearing a set of ranges.</param>
        /// <param name="accessCondition">The access condition to apply to the request.</param>
        /// <param name="useVersionHeader">A boolean value indicating whether to set the <i>x-ms-version</i> HTTP header.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
        /// <returns>A web request to use to perform the operation.</returns>
        public static HttpWebRequest PutRange(Uri uri, int? timeout, FileRange fileRange, FileRangeWrite fileRangeWrite, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)
        {
            CommonUtility.AssertNotNull("fileRange", fileRange);

            UriQueryBuilder builder = new UriQueryBuilder();
            builder.Add(Constants.QueryConstants.Component, "range");

            HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Put, uri, timeout, builder, useVersionHeader, operationContext);

            request.AddOptionalHeader(Constants.HeaderConstants.RangeHeader, fileRange.ToString());
            request.Headers.Add(Constants.HeaderConstants.FileRangeWrite, fileRangeWrite.ToString());

            request.ApplyAccessCondition(accessCondition);
            return request;
        }
示例#34
0
文件: ExpAST.cs 项目: chenzuo/blue
 public DoubleExp(double d, FileRange location) 
 {
     m_filerange = location;
     m_dValue = d;        
 }
 public static void ContentRangeHeader(HttpWebResponse response, FileRange expectedValue)
 {
     Assert.IsNotNull(response);
     Assert.IsNotNull(response.Headers[HttpResponseHeader.ContentRange]);
     Assert.AreEqual(expectedValue.ToString(), response.Headers[HttpResponseHeader.ContentRange]);
 }
示例#36
0
 //-----------------------------------------------------------------------------
 // There is no suitable overload
 //-----------------------------------------------------------------------------
 public static SymbolErrorException NoAcceptableOverload(
     FileRange location,
     string stFullyQualifiedName
 )
 {
     return new SymbolErrorException(
         Code.cNoAcceptableOverload, 
         location,
         "No acceptable overload for '" + stFullyQualifiedName + "' exists"
     );                
 }
示例#37
0
文件: Error.cs 项目: chenzuo/blue
 private void PrettyPrintWarning(int iErrorNum, FileRange location, string stText)
 {
     PrettyPrint(iErrorNum, location, Severity.Warning, stText);
 }
示例#38
0
 //-----------------------------------------------------------------------------
 // No acceptable indexer (matched by parameter types)
 //-----------------------------------------------------------------------------
 public static SymbolErrorException NoAcceptableIndexer(FileRange location, System.Type [] alTypes, bool fIsLeft)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("No acceptable '");
     sb.Append(fIsLeft ? "get" : "set");
     sb.Append("' indexer has signature: (");
     
     bool fComma = false;
     foreach(Type t in alTypes)
     {
         if (fComma)
             sb.Append(",");
         sb.Append(t.FullName);   
         fComma = true;
     }
     sb.Append(").");
     
     return new SymbolErrorException(
         Code.cNoAcceptableIndexer, 
         location,
         sb.ToString());
 
 }
示例#39
0
 //-----------------------------------------------------------------------------
 // The symbol is of the wrong type.
 //-----------------------------------------------------------------------------
 public static SymbolErrorException BadSymbolType(SymEntry sym, System.Type tExpected, FileRange location)
 {    
     return new SymbolErrorException(
         Code.cBadSymbolType,
         location,
         "Symbol '" + sym.Name + "' must be of type '" + tExpected.ToString() + "', not '" +
         sym.GetType().ToString() + "'"
     );    
 }
示例#40
0
 //-----------------------------------------------------------------------------
 // Limits on 'As' operator
 //-----------------------------------------------------------------------------
 public static SymbolErrorException AsOpOnlyOnRefTypes(        
     FileRange location    
     )
 {
     return new SymbolErrorException(Code.cAsOpOnlyOnRefTypes, location,
         "The 'as' operator can only be used on reference types, not value types.");
 }
示例#41
0
 //-----------------------------------------------------------------------------
 // Shadow
 //-----------------------------------------------------------------------------
 public static SymbolErrorException ShadowCatchHandlers(        
     FileRange location,
     System.Type tCatchType,
     System.Type tPrevCatchType)
 {
     return new SymbolErrorException(
         Code.cShadowCatchHandlers, location, 
         "Catch handler for type '"+ tCatchType.ToString()+
         "' is inaccessible because of a previous handler of type '" +
         tPrevCatchType.ToString() + "'");
 }
示例#42
0
 //-----------------------------------------------------------------------------
 // Overload for binary & unary
 //-----------------------------------------------------------------------------
 public static SymbolErrorException NoAcceptableOperator(        
     FileRange location,
     System.Type tLeft, 
     System.Type tRight,
     BinaryExp.BinaryOp op
     )
 {
     return new SymbolErrorException(
         Code.cNoAcceptableOperator,
         location,
         "No binary operator '" + op +  
         "' that takes arguments '" + tLeft.ToString() + "' and '" + tRight.ToString() + "'.");
         
 }   
示例#43
0
文件: Error.cs 项目: chenzuo/blue
 internal ErrorException(Blue.CodeGen.EmitCodeGen.ErrorCodes e, FileRange location, string stMessage) 
     : this(ERCodeGen(e), location, stMessage) { }
示例#44
0
 //-----------------------------------------------------------------------------
 // This label is already defined
 //-----------------------------------------------------------------------------
 public static SymbolErrorException LabelAlreadyDefined(string stName, FileRange lNew, FileRange lOld)
 {
     return new SymbolErrorException(
         Code.cLabelAlreadyDefined, 
         lNew, 
         "Label '" + stName + "' is already defined at '"+ 
         lOld + "' in the current scope");
 }
示例#45
0
文件: Error.cs 项目: chenzuo/blue
 // Constructor used once we've translated an error-enum into
 // a raw integer
 private ErrorException(
     int iCode,
     FileRange location,
     string stMessage)
 {
     m_iCode     = iCode;
     m_location  = location;
     m_stMessage = stMessage;
     
     // Debugging facility
     #if false
     int iBreakOnErrorCode = 0;
     if (iCode == iBreakOnErrorCode)
     {
         Console.WriteLine("UserBreakpoint on error code {0}", iCode);
         System.Diagnostics.Debugger.Break();        
     }        
     #endif
 }
示例#46
0
文件: ExpAST.cs 项目: chenzuo/blue
 public NullExp(FileRange location) 
 {
     m_filerange = location;
 }
示例#47
0
文件: Error.cs 项目: chenzuo/blue
 private void PrettyPrint(int iErrorNum, FileRange location, Severity idxSeverity, string stText)
 {
     StringBuilder sb = new StringBuilder();
     if (location != null)
     {
         sb.AppendFormat("{0}({1},{2}): {5} B{3}:{4}", 
             location.Filename, location.RowStart, location.ColStart,
             iErrorNum, stText,
             s_arstSeverity[(int) idxSeverity]);
     } else {
         sb.AppendFormat("{0} B{1}:{2}",                
             s_arstSeverity[(int) idxSeverity],
             iErrorNum, stText);        
     }
     
     Console.WriteLine(sb.ToString());
     
     m_arcOccurences[(int) idxSeverity]++;
 }
示例#48
0
文件: ExpAST.cs 项目: chenzuo/blue
 public StringExp(string s, FileRange location) 
 {
     m_filerange = location;
     m_stValue = s;        
 }
示例#49
0
 //-----------------------------------------------------------------------------
 // The method is not defined.
 //-----------------------------------------------------------------------------
 public static SymbolErrorException MethodNotDefined(
     FileRange location,
     string stFullyQualifiedName
 )
 {
     return new SymbolErrorException(
         Code.cMethodNotDefined, 
         location,
         "The method '" + stFullyQualifiedName + "' is not defined."
     );    
 }
示例#50
0
 //-----------------------------------------------------------------------------
 // When doing 'base.X(.....)', X must not be static.
 // If it was, we should have done 'T.X(.....)'
 //-----------------------------------------------------------------------------
 public static SymbolErrorException BaseAccessCantBeStatic(FileRange location, MethodExpEntry m)
 {
     return new SymbolErrorException(
         Code.cBaseAccessCantBeStatic,
         location,
         "Can't access static member '"+m.PrettyDecoratedName+"' via a 'base' accessor.");
         
 
 }
示例#51
0
 public static HttpWebRequest WriteRangeRequest(FileContext context, string shareName, string fileName, FileRange range, int length, AccessCondition accessCondition)
 {
     bool valid = FileTests.ShareNameValidator(shareName) &&
         FileTests.FileNameValidator(fileName);
     Uri uri = FileTests.ConstructPutUri(context.Address, shareName, fileName);
     HttpWebRequest request = null;
     OperationContext opContext = new OperationContext();
     try
     {
         request = FileHttpWebRequestFactory.PutRange(uri, context.Timeout, range, FileRangeWrite.Update, accessCondition, true, opContext);
         request.ContentLength = length;
     }
     catch (InvalidOperationException)
     {
         if (valid)
         {
             Assert.Fail();
         }
     }
     if (valid)
     {
         Assert.IsNotNull(request);
         Assert.IsNotNull(request.Method);
         Assert.AreEqual("PUT", request.Method);
         FileTestUtils.RangeHeader(request, range.StartOffset, range.EndOffset);
     }
     return request;
 }
示例#52
0
 //-----------------------------------------------------------------------------
 // The methdo must be public because it is implementing an interface.
 //-----------------------------------------------------------------------------
 public static SymbolErrorException IMethodMustBePublic(        
     FileRange location,
     MethodExpEntry mInterface,
     TypeEntry tClass
     
     )
 {
     string stClass = tClass.FullName;
     string stMethod = mInterface.PrettyDecoratedName;
     string stInterface = mInterface.SymbolClass.FullName;
     
     return new SymbolErrorException(
         Code.cIMethodMustBePublic, 
         location,
         "The method '" + stMethod + "' must be public to implement interface '" + stInterface + "'");
 }
示例#53
0
文件: ExpAST.cs 项目: chenzuo/blue
 public IntExp(int i, FileRange location) 
 {
     m_filerange = location;
     m_value = i;        
 }
        /// <summary>
        /// Constructs a web request to write or clear a range of pages in a file.
        /// </summary>
        /// <param name="uri">The absolute URI to the file.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="fileRange">The beginning and ending offsets.</param>
        /// <param name="fileRangeWrite">Action describing whether we are writing to a file or clearing a set of ranges.</param>
        /// <param name="accessCondition">The access condition to apply to the request.</param>
        /// <param name="content">The corresponding Http content.</param>
        /// <param name="operationContext">An object that represents the context for the current operation.</param>
        /// <returns>A web request to use to perform the operation.</returns>
        public static StorageRequestMessage PutRange(Uri uri, int? timeout, FileRange fileRange, FileRangeWrite fileRangeWrite, AccessCondition accessCondition, HttpContent content, OperationContext operationContext, ICanonicalizer canonicalizer, StorageCredentials credentials)
        {
            UriQueryBuilder builder = new UriQueryBuilder();
            builder.Add(Constants.QueryConstants.Component, "range");

            StorageRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(HttpMethod.Put, uri, timeout, builder, content, operationContext, canonicalizer, credentials);

            request.AddOptionalHeader(Constants.HeaderConstants.RangeHeader, fileRange.ToString());
            request.Headers.Add(Constants.HeaderConstants.FileRangeWrite, fileRangeWrite.ToString());

            request.ApplyAccessCondition(accessCondition);
            return request;
        }
示例#55
0
文件: ExpAST.cs 项目: chenzuo/blue
 public BoolExp(bool f, FileRange location) 
 {
     m_filerange = location;
     m_fValue = f;        
 }
示例#56
0
文件: Error.cs 项目: chenzuo/blue
 // Have typesafe ctors for each error-subsystem
 internal ErrorException(Blue.Driver.ErrorCodes e, FileRange location, string stMessage) 
     : this(ERGeneral(e), location, stMessage) { }
示例#57
0
文件: ExpAST.cs 项目: chenzuo/blue
 public CharExp(char ch, FileRange location) 
 {
     m_filerange = location;
     m_chValue = ch;        
 }
示例#58
0
文件: Error.cs 项目: chenzuo/blue
 internal ErrorException(ManualParser.Parser.Code e, FileRange location, string stMessage) 
     : this(ERParser(e), location, stMessage) { }
示例#59
0
 //-----------------------------------------------------------------------------
 // Missing an method inherited from an interface
 //-----------------------------------------------------------------------------
 public static SymbolErrorException MissingInterfaceMethod(        
     FileRange location,
     MethodExpEntry mInterface,
     TypeEntry tClass        
     )
 {
     string stClass = tClass.FullName;
     string stMethod = mInterface.PrettyDecoratedName;
     string stInterface = mInterface.SymbolClass.FullName;
     
     return new SymbolErrorException(
         Code.cMissingInterfaceMethod, 
         location,
         "The type '"+stClass+"' does not implement method '"+
         stMethod + "' from interface '" + stInterface + "'");
 }
示例#60
0
 // @dogfood - if a parameter is of type 'code', then that gets confused with
 // the ErrorException get_Code Property from our base class.
 // For now, use a fully-qualified name. But we should fix this.
 //internal SymbolErrorException(Code c, FileRange location, string s) : 
 internal SymbolErrorException(SymbolError.Code c, FileRange location, string s) : 
     base (c, location, s)
 {
     // All Symbol errors will come through this body.
 }