예제 #1
0
 public override void ExitFromClause(MySqlParser.FromClauseContext context)
 {
     if (_tmpDepth == _depth)
     {
         _isOtherListener = false;
     }
 }
예제 #2
0
        public FromClause(Interval ruleInterval, MySqlParser.FromClauseContext context, string text) : base(ruleInterval, context, text)
        {
            ParseTreeWalker walker = new ParseTreeWalker();

            walker.Walk(_listener, context);
            _text      = text;
            Rules      = _listener.Rules;
            _whereRule = new BaseRule(new Interval(0, 0), context, "ERROR");
            foreach (var rule in Rules)
            {
                switch (rule.Text)
                {
                case "FROM":
                    rule.Text = rule.Text + Environment.NewLine; break;

                case "WHERE": rule.Text = Environment.NewLine + rule.Text + Environment.NewLine;
                    _whereRule          = rule;
                    _whereInterval      = rule.SourceInterval;
                    break;

                case "GROUP": rule.Text = Environment.NewLine + rule.Text;
                    _groupInterval      = rule.SourceInterval;
                    break;

                case "BY": rule.Text += Environment.NewLine; break;

                default: break;
                }
            }
        }
예제 #3
0
 public override void EnterFromClause(MySqlParser.FromClauseContext context)
 {
     if (_isOtherListener == 1 && Rules.Count > 0 && _isFirst)
     {
         Rules.Remove(Rules[Rules.Count - 1]);
         _isFirst = false;
     }
 }
예제 #4
0
 public override void EnterFromClause(MySqlParser.FromClauseContext context)
 {
     if (_tmpDepth == _depth)
     {
         FromClause fromClause = new FromClause(context.SourceInterval, context, Environment.NewLine + context.GetText() + Environment.NewLine);
         AllRules.Remove(AllRules[AllRules.Count - 1]);
         AllRules.Add(fromClause);
         _isOtherListener = true;
     }
 }
 public override void EnterFromClause(MySqlParser.FromClauseContext context)
 {
     if (_tmpDepth == _depth)
     {
         FromClause fromClause = new FromClause(context.SourceInterval, context, Environment.NewLine + "FROM-----" + context.GetText() + "----FROM " + Environment.NewLine);
         Rules.Remove(Rules[Rules.Count - 1]);
         Rules.Add(fromClause);
         _isOtherListener++;
     }
 }