antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
16.68k stars 3.23k forks source link

Unexcept parse #4636

Open shxxd opened 4 weeks ago

shxxd commented 4 weeks ago

Parse.g4: dsl_stmt: (udf_stmt)* select_stmt hit_limit_clause record_config_clause ;

hit_limit_clause : max_hits_limit min_hit_interval ;

max_hits_limit : MAX_HITS_PER_HOUR NUMBER ;

min_hit_interval : MIN_HIT_INTERVAL_SECONDS NUMBER ;

record_config_clause : before_hit_time after_hit_time ;

before_hit_time : RECORD_SECONDS_BEFORE_HIT NUMBER ;

after_hit_time : RECORD_SECONDS_AFTER_HIT NUMBER ;

DSL: max_hits_per_hour 30 min_hit_interval_seconds 120 record_seconds_before_hit 60 record_seconds_after_hit 10 max_hits_per_hour 30 min_hit_interval_seconds 120 record_seconds_before_hit 60 record_seconds_after_hit 10

'hit_limit_clause' and 'record_config_clause' appear twice, why it can match successfully?(C++)