public override void EnterAssignment([NotNull] CSharpParser.AssignmentContext context) { if (commandVar == null) { return; } foreach (var command in commandVar) { string partern = command + ".CommandText"; if (context.GetText().Contains(partern)) { if (!listExpressLine.Contains(context.Start.Line)) { listExpressLine.Add(context.Start.Line); if (!context.GetChild(2).GetText().StartsWith("\"")) { ParseTreeWalker methodWalker = new ParseTreeWalker(); FindCommandText commandListener = new FindCommandText(parser, context.GetChild(2).GetText()); methodWalker.Walk(commandListener, treeContext); if (commandListener.getListLine().Count > 0) { foreach (var item in commandListener.getListLine()) { if (!listExpressLine.Contains(item)) { listExpressLine.Add(item); } } } } } } } }
public override void EnterAssignment([NotNull] CSharpParser.AssignmentContext context) { if (context.GetChild(0).GetText().Equals(commandVar)) { if (!listLine.Contains(context.Start.Line)) { listLine.Add(context.Start.Line); } } //Console.WriteLine(context.GetChild(0).GetText()); }