public JDebugProcessReplEvaluator(JProcess process) { _process = process; _threadId = process.GetThreads()[0].Id; _languageVersion = process.LanguageVersion; EnsureConnected(); }
private JRemoteProcess(string hostName, ushort portNumber, string secret, bool useSsl, JLanguageVersion langVer) : base(langVer) { _hostName = hostName; _portNumber = portNumber; _secret = secret; _useSsl = useSsl; }
private string _tokenWhiteSpace, _lookaheadWhiteSpace; // the whitespace for the current and lookahead tokens as provided from the parser #endregion Fields #region Constructors private Parser(Tokenizer tokenizer, ErrorSink errorSink, JLanguageVersion langVersion, bool verbatim, bool bindRefs, string privatePrefix) { Contract.Assert(tokenizer != null); Contract.Assert(errorSink != null); tokenizer.ErrorSink = new TokenizerErrorSink(this); _tokenizer = tokenizer; _errors = errorSink; _langVersion = langVersion; _verbatim = verbatim; _bindReferences = bindRefs; if (langVersion.Is7x()) { // 3.x always does true division _languageFeatures |= FutureOptions.TrueDivision; } Reset(FutureOptions.None); _privatePrefix = privatePrefix; }
/// <summary> /// Creates a new parser from a seekable stream including scanning the BOM or looking for a # coding: comment to detect the appropriate coding. /// </summary> public static Parser CreateParser(Stream stream, JLanguageVersion version, ParserOptions parserOptions = null) { var options = parserOptions ?? ParserOptions.Default; var reader = GetStreamReaderWithEncoding(stream, JAsciiEncoding.Instance, options.ErrorSink); return CreateParser(reader, version, options); }
public static Parser CreateParser(Stream stream, JLanguageVersion version) { if (stream == null) { throw new ArgumentNullException("stream"); } return CreateParser(stream, version, null); }
public static Parser CreateParser(TextReader reader, JLanguageVersion version, ParserOptions parserOptions) { if (reader == null) { throw new ArgumentNullException("reader"); } var options = parserOptions ?? ParserOptions.Default; Tokenizer tokenizer = new Tokenizer(version, options.ErrorSink, (options.Verbatim ? TokenizerOptions.Verbatim : TokenizerOptions.None) | TokenizerOptions.GroupingRecovery); tokenizer.Initialize(null, reader, SourceLocation.MinValue); tokenizer.IndentationInconsistencySeverity = options.IndentationInconsistencySeverity; Parser result = new Parser(tokenizer, options.ErrorSink ?? ErrorSink.Null, version, options.Verbatim, options.BindReferences, options.PrivatePrefix ); result._sourceReader = reader; return result; }
public static Parser CreateParser(TextReader reader, JLanguageVersion version) { return CreateParser(reader, version, null); }
private JLibAnalyzer(List<string> dirs, string indir, JLanguageVersion version) { _dirs = dirs.ToArray(); _indir = indir; _version = version; }
public JProcess(JLanguageVersion languageVersion, string exe, string args, string dir, string env, string interpreterOptions, JDebugOptions options = JDebugOptions.None, List<string[]> dirMapping = null) : this(languageVersion) { ListenForConnection(); if (dir.EndsWith("\\")) { dir = dir.Substring(0, dir.Length - 1); } _dirMapping = dirMapping; var processInfo = new ProcessStartInfo(exe); processInfo.CreateNoWindow = (options & JDebugOptions.CreateNoWindow) != 0; processInfo.UseShellExecute = false; processInfo.RedirectStandardOutput = false; processInfo.RedirectStandardInput = (options & JDebugOptions.RedirectInput) != 0; processInfo.Arguments = (String.IsNullOrWhiteSpace(interpreterOptions) ? "" : (interpreterOptions + " ")) + "\"" + Path.Combine(GetJToolsInstallPath(), "visualstudio_py_launcher.py") + "\" " + "\"" + dir + "\" " + " " + DebugConnectionListener.ListenerPort + " " + " " + _processGuid + " " + (((options & JDebugOptions.WaitOnAbnormalExit) != 0) ? " --wait-on-exception " : "") + (((options & JDebugOptions.WaitOnNormalExit) != 0) ? " --wait-on-exit " : "") + (((options & JDebugOptions.RedirectOutput) != 0) ? " --redirect-output " : "") + (((options & JDebugOptions.BreakOnSystemExitZero) != 0) ? " --break-on-systemexit-zero " : "") + (((options & JDebugOptions.DebugStdLib) != 0) ? " --debug-stdlib " : "") + (((options & JDebugOptions.DjangoDebugging) != 0) ? " --django-debugging " : "") + args; if (env != null) { string[] envValues = env.Split('\0'); foreach (var curValue in envValues) { string[] nameValue = curValue.Split(new[] { '=' }, 2); if (nameValue.Length == 2 && !String.IsNullOrWhiteSpace(nameValue[0])) { processInfo.EnvironmentVariables[nameValue[0]] = nameValue[1]; } } } Debug.WriteLine(String.Format("Launching: {0} {1}", processInfo.FileName, processInfo.Arguments)); _process = new Process(); _process.StartInfo = processInfo; _process.EnableRaisingEvents = true; _process.Exited += new EventHandler(_process_Exited); }
public static JProcess AttachRepl(Stream stream, int pid, JLanguageVersion version) { return new JProcess(stream, pid, version); }
private JProcess(Stream stream, int pid, JLanguageVersion version) { _process = Process.GetProcessById(pid); _process.EnableRaisingEvents = true; _process.Exited += new EventHandler(_process_Exited); _delayUnregister = true; ListenForConnection(); stream.WriteInt32(DebugConnectionListener.ListenerPort); stream.WriteString(_processGuid.ToString()); }
private JProcess(int pid) { _process = Process.GetProcessById(pid); _process.EnableRaisingEvents = true; _process.Exited += new EventHandler(_process_Exited); ListenForConnection(); using (var result = DebugAttach.Attach(pid, DebugConnectionListener.ListenerPort, _processGuid)) { if (result.Error != ConnErrorMessages.None) { throw new AttachException(result.Error); } _langVersion = (JLanguageVersion)result.LanguageVersion; if (!result.AttachDone.WaitOne(20000)) { throw new AttachException(ConnErrorMessages.TimeOut); } } }
protected JProcess(JLanguageVersion languageVersion) { _langVersion = languageVersion; }
/// <summary> /// Creates a new JProcess object for debugging. The process does not start until Start is called /// on the returned JProcess object. /// </summary> public JProcess CreateProcess(JLanguageVersion langVersion, string exe, string args, string dir, string env, string interpreterOptions = null, JDebugOptions debugOptions = JDebugOptions.None) { return new JProcess(langVersion, exe, args, dir, env, interpreterOptions, debugOptions); }