internal CompletionHelpers(XSharpDialect dialect, IGlyphService glyphService, XFile file, bool ignoreCase) { _dialect = dialect; _glyphService = glyphService; _file = file; _settingIgnoreCase = ignoreCase; }
public static bool AllowGarbage(this XSharpDialect dialect) { switch (dialect) { case XSharpDialect.Core: return(false); default: return(true); } }
public XSharpCompletionSource(XSharpCompletionSourceProvider provider, ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregator, XFile file) { _provider = provider; _buffer = buffer; _file = file; var prj = _file.Project.ProjectNode; _dialect = _file.Project.Dialect; helpers = new CompletionHelpers(_dialect, provider.GlyphService, file, !prj.ParseOptions.CaseSensitive); this.aggregator = aggregator; }
public static bool SupportsMemvars(this XSharpDialect dialect) { switch (dialect) { case XSharpDialect.Core: case XSharpDialect.Vulcan: return(false); default: return(true); } }
public XSharpAsyncCompletionSource(XSharpAsyncCompletionSourceProvider provider, ITextView textView, IBufferTagAggregatorFactoryService aggregator, XFile file) { _provider = provider; _textView = textView; _buffer = textView.TextBuffer; _file = file; // Currently, set as default, but should be VS Settings Based // Retrieve from Project properties later: _file.Project.ProjectNode.ParseOptions. var prj = _file.Project.ProjectNode; _dialect = _file.Project.Dialect; this.aggregator = aggregator; }
private static bool TryParseDialect(string str, XSharpDialect defaultDialect, out XSharpDialect dialect) { if (str == null) { dialect = defaultDialect; return(true); } switch (str.ToLowerInvariant()) { case "core": dialect = XSharpDialect.Core; return(true); case "vo": dialect = XSharpDialect.VO; return(true); case "vulcan": case "vulcan.net": dialect = XSharpDialect.Vulcan; return(true); case "dbase": dialect = XSharpDialect.dBase; return(true); case "foxpro": case "foxbase": case "fox": case "vfp": dialect = XSharpDialect.FoxPro; return(true); case "harbour": case "xharbour": dialect = XSharpDialect.Harbour; return(true); case "xbase++": case "xbasepp": case "xpp": dialect = XSharpDialect.XPP; return(true); default: dialect = XSharpDialect.Core; return(false); } }
public static bool AllowFourLetterAbbreviations(this XSharpDialect dialect) { switch (dialect) { case XSharpDialect.VO: case XSharpDialect.Harbour: case XSharpDialect.FoxPro: return(true); case XSharpDialect.XPP: default: return(false); } }
// Allow && comments public static bool AllowOldStyleComments(this XSharpDialect dialect) { switch (dialect) { case XSharpDialect.VO: case XSharpDialect.Harbour: case XSharpDialect.XPP: case XSharpDialect.FoxPro: return(true); case XSharpDialect.Core: case XSharpDialect.Vulcan: default: return(false); } }
public static bool SupportsAddressOf(this XSharpDialect dialect) { switch (dialect) { case XSharpDialect.Core: case XSharpDialect.VO: case XSharpDialect.Vulcan: return(true); case XSharpDialect.Harbour: case XSharpDialect.XPP: case XSharpDialect.FoxPro: default: return(false); } }
public static bool AllowASend(this XSharpDialect dialect) { switch (dialect) { case XSharpDialect.Core: return(false); case XSharpDialect.VO: case XSharpDialect.Vulcan: case XSharpDialect.Harbour: case XSharpDialect.XPP: case XSharpDialect.FoxPro: default: return(true); } }
public static bool AllowStringsWithSingleQuotes(this XSharpDialect dialect) { switch (dialect) { case XSharpDialect.VO: case XSharpDialect.Harbour: case XSharpDialect.XPP: case XSharpDialect.FoxPro: return(true); case XSharpDialect.Core: case XSharpDialect.Vulcan: default: return(false); } }
public static MacroCompiler GetScriptCompiler(XSharpDialect dialect = XSharpDialect.Core) { MacroOptions options; switch (dialect) { case XSharpDialect.FoxPro: options = MacroOptions.FoxPro; break; case XSharpDialect.VO: options = MacroOptions.VisualObjects; break; default: options = MacroOptions.Default; break; } options.ParseMode = ParseMode.Statements; return(new MacroCompiler(options)); }
internal bool ParseXSharpArgument(ref string name, ref string value, string arg, List <Diagnostic> diagnostics) { if (options == null) { options = new XSharpSpecificCompilationOptions(); } bool handled = true; bool positive = !name.EndsWith("-"); bool encode = false; string oldname = name; if (name.EndsWith("+") || name.EndsWith("-")) { name = name.Substring(0, name.Length - 1); } switch (name) { case "az": options.ArrayZero = positive; encode = true; break; case "cf": OptionNotImplemented(diagnostics, oldname, "Compiling for Compact Framework"); break; case "dialect": XSharpDialect dialect = XSharpDialect.Core; if (string.IsNullOrEmpty(value)) { AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "/dialect:"); } else if (!TryParseDialect(value, XSharpDialect.Core, out dialect)) { AddDiagnostic(diagnostics, ErrorCode.ERR_InvalidDialect, value); } options.Dialect = dialect; break; case "clr": // CLR OptionNotImplemented(diagnostics, oldname, "Specify CLR version"); encode = true; break; case "cs": options.CaseSensitive = positive; XSharpString.CaseSensitive = positive; break; case "i": if (value == null) { AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "/i:"); } else { if (value.StartsWith("\"") && value.EndsWith("\"")) { value = value.Substring(1, value.Length - 2); } options.IncludePaths = string.IsNullOrEmpty(options.IncludePaths) ? value : options.IncludePaths + ';' + value; } break; case "initlocals": options.InitLocals = positive; encode = true; break; case "ins": options.ImplicitNameSpace = positive; encode = true; break; case "lb": options.LateBinding = positive; encode = true; break; case "namedarguments": options.AllowNamedArguments = positive; encode = true; break; case "noclipcall": options.NoClipCall = positive; break; case "norun": OptionNotImplemented(diagnostics, oldname, "NoRun compiler option. To achieve the same result in X# simply remove the references to the X# and/or Vulcan runtime DLLs."); break; case "nostddefs": options.NoStdDef = positive; break; case "ns": if (value == null) { AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "/ns:"); } else { options.NameSpace = value; } break; case "fovf": // synonym for checked case "ovf": // synonym for checked if (options.ExplicitOptions.HasFlag(CompilerOption.Overflow) && positive != options.Overflow) { AddDiagnostic(diagnostics, ErrorCode.ERR_ConflictingCommandLineOptions, arg, options.PreviousArgument); } options.PreviousArgument = arg; encode = true; options.Overflow = positive; if (positive) { name = "checked+"; } else { name = "checked-"; } handled = false; break; case "languageversion": handled = true; break; case "lexonly": options.ParseLevel = ParseLevel.Lex; break; case "memvar": options.MemVars = positive; encode = true; break; case "undeclared": options.UndeclaredMemVars = positive; encode = true; break; case "parseonly": options.ParseLevel = ParseLevel.Parse; break; case "out": if (!string.IsNullOrEmpty(value)) { value = value.Trim(); if (value.StartsWith("\"") && value.EndsWith("\"")) { value = value.Substring(1, value.Length - 2); } string fn = System.IO.Path.GetFileName(value).ToLower(); switch (fn) { case "xsharp.core.dll": options.TargetDLL = XSharpTargetDLL.Core; break; case "xsharp.data.dll": options.TargetDLL = XSharpTargetDLL.Data; break; case "xsharp.rt.dll": options.TargetDLL = XSharpTargetDLL.RT; break; case "xsharp.vo.dll": options.TargetDLL = XSharpTargetDLL.VO; break; case "xsharp.rdd.dll": options.TargetDLL = XSharpTargetDLL.RDD; break; case "xsharp.xpp.dll": options.TargetDLL = XSharpTargetDLL.XPP; break; case "xsharp.vfp.dll": options.TargetDLL = XSharpTargetDLL.VFP; break; case "vowin32apilibrary.dll": options.TargetDLL = XSharpTargetDLL.VOWin32Api; break; case "vosystemclasses.dll": options.TargetDLL = XSharpTargetDLL.VOSystemClasses; break; case "vorddclasses.dll": options.TargetDLL = XSharpTargetDLL.VORDDClasses; break; case "vosqlclasses.dll": options.TargetDLL = XSharpTargetDLL.VOSQLClasses; break; case "voguiclasses.dll": options.TargetDLL = XSharpTargetDLL.VOGuiClasses; break; case "vointernetclasses.dll": options.TargetDLL = XSharpTargetDLL.VOInternetClasses; break; case "voconsoleclasses.dll": options.TargetDLL = XSharpTargetDLL.VOConsoleClasses; break; default: options.TargetDLL = XSharpTargetDLL.Other; break; } } handled = false; break; case "ppo": options.PreProcessorOutput = positive; break; case "r": case "reference": if (!string.IsNullOrEmpty(value)) { // /r:"reference" // /r:alias=reference // /r:alias="reference" // /r:reference;reference // /r:"path;containing;semicolons" // /r:"unterminated_quotes // /r:"quotes"in"the"middle // /r:alias=reference;reference ... error 2034 // /r:nonidf=reference ... error 1679 var pos = value.IndexOf('='); if (pos >= 0 && value[pos] == '=') { value = value.Substring(pos + 1); } if (value.StartsWith("\"") && value.EndsWith("\"")) { value = value.Substring(1, value.Length - 2); } string filename = value; if (value.IndexOf(";") != -1) { foreach (var fname in ParseSeparatedPaths(value).Where((path) => !string.IsNullOrWhiteSpace(path))) { SetOptionFromReference(fname); } } else { SetOptionFromReference(filename); } } handled = false; break; case "s": options.ParseLevel = ParseLevel.SyntaxCheck; break; case "showdefs": case "showdefines": options.ShowDefs = positive; break; case "showincludes": options.ShowIncludes = positive; break; case "stddefs": if (value == null) { AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "/stddefs:"); } else { if (value.StartsWith("\"") && value.EndsWith("\"")) { value = value.Substring(1, value.Length - 2); } options.StdDefs = value; } break; case "tocs": options.SaveAsCSharp = positive; break; case "ast": options.DumpAST = positive; break; case "usenativeversion": options.UseNativeVersion = true; break; case "verbose": options.Verbose = true; options.ShowIncludes = true; break; case "vo1": // Init & Axit mapped to .ctor and .dtor options.Vo1 = positive; encode = true; break; case "vo2": // Initialize Strings to Empty string options.Vo2 = positive; encode = true; break; case "vo3": // All methods Virtual options.Vo3 = positive; encode = true; break; case "vo4": // Implicit signed/unsigned integer conversions options.Vo4 = positive; encode = true; break; case "vo5": // Implicit CLIPPER calling convention options.Vo5 = positive; encode = true; break; case "vo6": // Resolve typed function PTR to PTR options.Vo6 = positive; encode = true; break; case "vo7": // Compatible implicit cast & conversion options.Vo7 = positive; encode = true; break; case "vo8": // Compatible preprocessor options.Vo8 = positive; encode = true; break; case "vo9": // Allow missing RETURN options.Vo9 = positive; encode = true; break; case "vo10": // Compatible IIF options.Vo10 = positive; encode = true; break; case "vo11": // VO arithmetic conversions options.Vo11 = positive; encode = true; break; case "vo12": // Clipper integer divisions options.Vo12 = positive; encode = true; break; case "vo13": // VO String comparisons options.Vo13 = positive; encode = true; break; case "vo14": // VO FLoat Literals options.Vo14 = positive; encode = true; break; case "vo15": // VO Untyped allowed options.Vo15 = positive; encode = true; break; case "vo16": // VO Add Clipper CC Missing constructors options.Vo16 = positive; encode = true; break; case "wx": // disable warning name = "warnaserror+"; handled = false; break; case "xpp1": // classes inherit from XPP.Abstract options.Xpp1 = positive; encode = true; break; case "xpp2": // untyped main instead of Start options.Xpp2 = positive; encode = true; break; case "fox1": // Classes inherit from unknown options.Fox1 = positive; encode = true; break; case "unsafe": options.AllowUnsafe = positive; handled = false; // there is also an 'unsafe' option in Roslyn name = oldname; break; default: name = oldname; handled = false; break; } if (encode) { options.ExplicitOptions |= CompilerOptionDecoder.Decode(name); } return(handled); }
public static bool HasRuntime(this XSharpDialect dialect) { return(dialect != XSharpDialect.Core); }