// 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 promql 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 string string duration time.Duration } %token ASSIGN 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 EQL EQL_REGEX GTE GTR LAND LOR LSS LTE LUNLESS MOD MUL NEQ NEQ_REGEX POW SUB %token operatorsEnd // Aggregators. %token aggregatorsStart %token AVG BOTTOMK COUNT COUNT_VALUES 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 // 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 label_matchers %type label_matcher %type aggregate_op grouping_label match_op maybe_label metric_identifier unary_op %type label_set label_set_list metric %type