antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.

Home Page:http://antlr.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexcept parse

shxxd opened this issue · comments

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++)