public ScriptLineView CreateLineView(string scriptLineText, int lineIndex, bool @default = false) { var lineType = Script.ResolveLineType(scriptLineText); var lineView = default(ScriptLineView); switch (lineType.Name) { case nameof(CommentScriptLine): var commentScriptLine = new CommentScriptLine(null, lineIndex, scriptLineText, null, true); lineView = new CommentLineView(commentScriptLine, linesContainer); break; case nameof(LabelScriptLine): var labelScriptLine = new LabelScriptLine(null, lineIndex, scriptLineText, null, true); lineView = new LabelLineView(labelScriptLine, linesContainer); break; case nameof(DefineScriptLine): var defineScriptLine = new DefineScriptLine(null, lineIndex, scriptLineText, null, true); lineView = new DefineLineView(defineScriptLine, linesContainer); break; case nameof(CommandScriptLine): var commandScriptLine = new CommandScriptLine(null, lineIndex, scriptLineText, null, true); lineView = CommandLineView.CreateOrError(commandScriptLine, linesContainer, config.HideUnusedParameters, @default); break; case nameof(GenericTextScriptLine): var genericTextScriptLine = new GenericTextScriptLine(null, lineIndex, scriptLineText, null, true); lineView = new GenericTextLineView(genericTextScriptLine, linesContainer); break; } return(lineView); }
public ScriptLineView CreateLineView(int lineIndex, string lineText) { tokens.Clear(); var lineType = lexer.TokenizeLine(lineText, tokens); var lineView = default(ScriptLineView); switch (lineType) { case LineType.Comment: lineView = new CommentLineView(lineIndex, lineText, linesContainer); break; case LineType.Label: lineView = new LabelLineView(lineIndex, lineText, linesContainer); break; case LineType.Command: lineView = CommandLineView.CreateOrError(lineIndex, lineText, tokens, linesContainer, config.HideUnusedParameters); break; default: lineView = new GenericTextLineView(lineIndex, lineText, linesContainer); break; } return(lineView); }
public ScriptLineView CreateLineView(int lineIndex, string lineText) { var lineView = default(ScriptLineView); switch (Script.ResolveLineType(lineText?.TrimFull()).Name) { case nameof(CommentScriptLine): lineView = new CommentLineView(lineIndex, lineText, linesContainer); break; case nameof(LabelScriptLine): lineView = new LabelLineView(lineIndex, lineText, linesContainer); break; case nameof(CommandScriptLine): lineView = CommandLineView.CreateOrError(lineIndex, lineText, linesContainer, config.HideUnusedParameters); break; case nameof(GenericTextScriptLine): lineView = new GenericTextLineView(lineIndex, lineText, linesContainer); break; } return(lineView); }