private ITreeNode CreateExpression(string format, string name) { var node = CreateParser(name + "\n" + ":" + name + "\n" + ";").ParsePsiFile(false) as IPsiFile; if (node == null) { throw new ElementFactoryException(string.Format("Cannot create expression '{0}'", format)); } SandBox.CreateSandBoxFor(node, myModule); var ruleDeclaration = node.FirstChild as IRuleDeclaration; if (ruleDeclaration != null) { IRuleBody ruleBody = ruleDeclaration.Body; ITreeNode child = ruleBody.FirstChild; while (child != null && !(child is IPsiExpression)) { child = child.NextSibling; } while (child != null && !(child is IRuleName)) { child = child.FirstChild; } if (child != null) { return(child); } } throw new ElementFactoryException(string.Format("Cannot create expression '{0}'" + name, format)); }
private ICgFile CreateContent(IPsiModule module, string text) { var generatedLexer = new CgLexerGenerated(new StringBuffer(text)); var file = new CgParser(generatedLexer.ToCachingLexer(), myIntern).ParseFile(); if (file == null) { throw new ElementFactoryException("Cannot create IFile"); } SandBox.CreateSandBoxFor(file, module); return(file.Children().OfType <ICgFile>().First()); }
private INTriplesFile CreateNTriplesFile(string text, bool restoreWhitespaces = false) { var node = this.CreateParser(text).ParseNTriplesFile(false, restoreWhitespaces) as INTriplesFile; if (node == null) { throw new ElementFactoryException(string.Format("Cannot create file '{0}'", text)); } SandBox.CreateSandBoxFor(node, this.myModule); return(node); }
public IJsonNewLiteralExpression CreateStringLiteral(string literal) { var parser = CreateParser($"\"{literal}\""); var node = parser.ParseLiteral(); if (node == null) { throw new ElementFactoryException(string.Format("Cannot create expression '{0}'", literal)); } SandBox.CreateSandBoxFor(node, myModule, myLanguageService.LanguageType); return(node); }
private static ICSharpFile ParseFile(IPsiSourceFile psiSourceFile, IPsiModule primaryPsiModule) { var languageService = CSharpLanguage.Instance.LanguageService().NotNull("CSharp language service not available"); ILexer lexer = languageService.CreateCachingLexer(psiSourceFile.Document.Buffer); var csharpParser = (ICSharpParser)languageService.CreateParser(lexer, primaryPsiModule, psiSourceFile); csharpParser.SetChameleonExpansionMode(true); var psiFile = (ICSharpFile)csharpParser.ParseFile(); SandBox.CreateSandBoxFor(psiFile, primaryPsiModule); return(psiFile); }
private void TestSandboxDistributionFunction() { var name = "Песочница"; var obj = new SandBox(); chart5.Series[0].IsVisibleInLegend = false; chart5.Series.Add(name); chart5.Series[name].ChartType = SeriesChartType.Line; chart5.Series[name].Color = Color.Red; for (double i = 1; i < 17; i += 0.001) { chart5.Series[name].Points.AddXY(i, obj.DistributionFunction(i)); } }
static void MonitorVSshits() { while (true) { try { if (SandBox.Check() == true) { Environment.Exit(0); } Thread.Sleep(500); } catch { } } }
public override IRuleDeclaration CreateRuleDeclaration(string name, bool hasBraceParameters = false) { string braceParameters = ""; if (hasBraceParameters) { braceParameters = " {ROLE, getter} "; } var node = CreateParser(name + braceParameters + "\n" + ":" + "\n" + ";").ParsePsiFile(false) as IPsiFile; if (node == null) { throw new ElementFactoryException(string.Format("Cannot create expression '{0}'", name + braceParameters + "\n" + ":" + "\n" + ";")); } SandBox.CreateSandBoxFor(node, myModule); var ruleDeclaration = node.FirstChild as IRuleDeclaration; if (ruleDeclaration != null) { return(ruleDeclaration); } throw new ElementFactoryException(string.Format("Cannot create expression '{0}'", name)); }
public override IRuleDeclaration CreateRuleDeclaration(string name, bool hasBraceParameters, IList <Pair <string, string> > variableParameters) { if (variableParameters.Count == 0) { return(CreateRuleDeclaration(name, hasBraceParameters)); } string braceParameters = ""; if (hasBraceParameters) { braceParameters = " {ROLE, getter} "; } string variableParametersString = " ["; foreach (var variableParameter in variableParameters) { variableParametersString = variableParametersString + variableParameter.Second + " " + variableParameter.First + ","; } variableParametersString = variableParametersString.Substring(0, variableParametersString.Length - 1) + "]"; var node = CreateParser(name + braceParameters + variableParametersString + "\n" + ":" + "\n" + ";").ParsePsiFile(false) as IPsiFile; if (node == null) { throw new ElementFactoryException(string.Format("Cannot create expression '{0}'", name + braceParameters + variableParametersString + "\n" + ":" + "\n" + ";")); } SandBox.CreateSandBoxFor(node, myModule); var ruleDeclaration = node.FirstChild as IRuleDeclaration; if (ruleDeclaration != null) { return(ruleDeclaration); } throw new ElementFactoryException(string.Format("Cannot create expression '{0}'", name)); }
private ITreeNode CreateExpression(string format, string name) { ITreeNode node = CreateParser(name).ParseLexFile(false) as ILexFile; if (node == null) { throw new ElementFactoryException(string.Format("Cannot create expression '{0}'", format)); } SandBox.CreateSandBoxFor(node, myModule); var child = node; while (child.FirstChild != null) { child = child.FirstChild; } if (child is IIdentifier) { return(child); } throw new ElementFactoryException(string.Format("Cannot create expression '{0}'" + name, format)); }
public void OnSandBoxCreated(SandBox sandBox) { }
void ICache.OnSandBoxCreated(SandBox sandBox) { }
public void TestMethod1() { SandBox s = new SandBox(); }