GetSymbolDocumentName() private method

private GetSymbolDocumentName ( ) : string
return string
Esempio n. 1
0
        internal static void ThrowSyntaxErrorException(Microsoft.Scripting.SyntaxErrorException e,
                                                       string defaultVirtualPath, int defaultLine)
        {
            // Try to get a virtual path
            string virtualPath = Misc.GetVirtualPathFromPhysicalPath(e.GetSymbolDocumentName());
            int    line;

            // If we couldn't get one, use the passed in path
            if (virtualPath == null)
            {
                virtualPath = defaultVirtualPath;
                line        = defaultLine;
            }
            else
            {
                line = e.Line;
            }

            Misc.ThrowException(null /*message*/, e, virtualPath, line);
        }
Esempio n. 2
0
        /// <summary>
        /// Converts the DLR SyntaxErrorException into a Python new-style SyntaxError instance.
        /// </summary>
        private static BaseException/*!*/ SyntaxErrorToPython(SyntaxErrorException/*!*/ e) {
            PythonExceptions._SyntaxError se;
            if (e.GetType() == typeof(IndentationException)) {
                se = new _SyntaxError(IndentationError);
            } else if (e.GetType() == typeof(TabException)) {
                se = new _SyntaxError(TabError);
            } else {
                se = new _SyntaxError();
            }

            string sourceLine = PythonContext.GetSourceLine(e);
            string fileName = e.GetSymbolDocumentName();
            object column = (e.Column == 0 || e.Data.Contains(PythonContext._syntaxErrorNoCaret)) ? null : (object)e.Column;
            
            se.args = PythonTuple.MakeTuple(e.Message, PythonTuple.MakeTuple(fileName, e.Line, column, sourceLine));

            se.filename = fileName;
            se.lineno = e.Line;
            se.offset = column;
            se.text = sourceLine;
            se.msg = e.Message;

            AssociateException(e, se);

            return se;
        }