// Copyright 2019 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. %{ package parser import ( "math" "sort" "strconv" "time" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/pkg/value" ) %} %union { node Node item Item matchers []*labels.Matcher matcher *labels.Matcher label labels.Label labels labels.Labels strings []string series []SequenceValue uint uint64 float float64 duration time.Duration } %token EQL BLANK COLON COMMA COMMENT DURATION EOF ERROR IDENTIFIER LEFT_BRACE LEFT_BRACKET LEFT_PAREN METRIC_IDENTIFIER NUMBER RIGHT_BRACE RIGHT_BRACKET RIGHT_PAREN SEMICOLON SPACE STRING TIMES // Operators. %token operatorsStart %token ADD DIV EQLC EQL_REGEX GTE GTR LAND LOR LSS LTE LUNLESS MOD MUL NEQ NEQ_REGEX POW SUB AT ATAN2 %token operatorsEnd // Aggregators. %token aggregatorsStart %token AVG BOTTOMK COUNT COUNT_VALUES GROUP MAX MIN QUANTILE STDDEV STDVAR SUM TOPK %token aggregatorsEnd // Keywords. %token keywordsStart %token BOOL BY GROUP_LEFT GROUP_RIGHT IGNORING OFFSET ON WITHOUT %token keywordsEnd // Preprocessors. %token preprocessorStart %token START END %token preprocessorEnd // Start symbols for the generated parser. %token startSymbolsStart %token START_METRIC START_SERIES_DESCRIPTION START_EXPRESSION START_METRIC_SELECTOR %token startSymbolsEnd // Type definitions for grammar rules. %type label_match_list %type label_matcher %type aggregate_op grouping_label match_op maybe_label metric_identifier unary_op at_modifier_preprocessors %type label_set label_set_list metric %type