2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// Copyright 2015 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.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-04 00:23:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								package parser
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									"testing"
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-10 08:06:53 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									"github.com/prometheus/prometheus/util/testutil"
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								type testCase struct {
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-11 20:04:53 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									input      string
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									expected   []Item
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-11 20:04:53 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									fail       bool
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									seriesDesc bool // Whether to lex a series description.
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var tests = []struct {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									name  string
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									tests []testCase
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "common",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    ",",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{COMMA, 0, ","}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "()",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{LEFT_PAREN, 0, `(`}, {RIGHT_PAREN, 1, `)`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "{}",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{LEFT_BRACE, 0, `{`}, {RIGHT_BRACE, 1, `}`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "[5m]",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 0, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 1, `5m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 3, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-11 16:56:24 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "[ 5m]",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 0, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 2, `5m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 4, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-11 16:56:24 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "[  5m]",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 0, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 3, `5m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 5, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-11 16:56:24 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "[  5m ]",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 0, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 3, `5m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 6, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-11 16:56:24 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "\r\n\r",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "numbers",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "1",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NUMBER, 0, "1"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "4.23",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NUMBER, 0, "4.23"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    ".3",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NUMBER, 0, ".3"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "5.",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NUMBER, 0, "5."}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "NaN",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NUMBER, 0, "NaN"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "nAN",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NUMBER, 0, "nAN"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "NaN 123",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NUMBER, 0, "NaN"}, {NUMBER, 4, "123"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "NaN123",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{IDENTIFIER, 0, "NaN123"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "iNf",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NUMBER, 0, "iNf"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "Inf",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NUMBER, 0, "Inf"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "+Inf",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{ADD, 0, "+"}, {NUMBER, 1, "Inf"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "+Inf 123",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{ADD, 0, "+"}, {NUMBER, 1, "Inf"}, {NUMBER, 5, "123"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "-Inf",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{SUB, 0, "-"}, {NUMBER, 1, "Inf"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "Infoo",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{IDENTIFIER, 0, "Infoo"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "-Infoo",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{SUB, 0, "-"}, {IDENTIFIER, 1, "Infoo"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "-Inf 123",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{SUB, 0, "-"}, {NUMBER, 1, "Inf"}, {NUMBER, 5, "123"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "0x123",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NUMBER, 0, "0x123"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-02 06:23:18 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "strings",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "\"test\\tsequence\"",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{STRING, 0, `"test\tsequence"`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "\"test\\\\.expression\"",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{STRING, 0, `"test\\.expression"`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "\"test\\.expression\"",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{ERROR, 0, "unknown escape sequence U+002E '.'"},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 0, `"test\.expression"`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "`test\\.expression`",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{STRING, 0, "`test\\.expression`"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												// See https://github.com/prometheus/prometheus/issues/939.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: ".٩",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												fail:  true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "durations",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "5s",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{DURATION, 0, "5s"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "123m",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{DURATION, 0, "123m"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "1h",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{DURATION, 0, "1h"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "3w",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{DURATION, 0, "3w"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "1y",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{DURATION, 0, "1y"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "identifiers",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "abc",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{IDENTIFIER, 0, "abc"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "a:bc",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{METRIC_IDENTIFIER, 0, "a:bc"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "abc d",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{IDENTIFIER, 0, "abc"}, {IDENTIFIER, 4, "d"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    ":bc",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{METRIC_IDENTIFIER, 0, ":bc"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "0a:bc",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												fail:  true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-08 22:43:02 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "comments",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "# some comment",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{COMMENT, 0, "# some comment"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "5 # 1+1\n5",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NUMBER, 0, "5"},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{COMMENT, 2, "# 1+1"},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NUMBER, 8, "5"},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "operators",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `=`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{ASSIGN, 0, `=`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												// Inside braces equality is a single '=' character.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `{=}`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{LEFT_BRACE, 0, `{`}, {EQL, 1, `=`}, {RIGHT_BRACE, 2, `}`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `==`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{EQL, 0, `==`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `!=`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{NEQ, 0, `!=`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `<`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{LSS, 0, `<`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `>`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{GTR, 0, `>`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `>=`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{GTE, 0, `>=`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `<=`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{LTE, 0, `<=`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `+`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{ADD, 0, `+`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `-`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{SUB, 0, `-`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `*`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{MUL, 0, `*`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `/`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{DIV, 0, `/`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `^`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{POW, 0, `^`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `%`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{MOD, 0, `%`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `AND`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{LAND, 0, `AND`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `or`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{LOR, 0, `or`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `unless`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{LUNLESS, 0, `unless`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-16 22:19:24 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "aggregators",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `sum`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{SUM, 0, `sum`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `AVG`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{AVG, 0, `AVG`}},
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-30 22:51:18 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `GROUP`,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{GROUP, 0, `GROUP`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `MAX`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{MAX, 0, `MAX`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `min`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{MIN, 0, `min`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `count`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{COUNT, 0, `count`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `stdvar`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{STDVAR, 0, `stdvar`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    `stddev`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{STDDEV, 0, `stddev`}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-16 22:19:24 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "keywords",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "offset",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{OFFSET, 0, "offset"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "by",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{BY, 0, "by"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "without",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{WITHOUT, 0, "without"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "on",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{ON, 0, "on"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "ignoring",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{IGNORING, 0, "ignoring"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "group_left",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{GROUP_LEFT, 0, "group_left"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "group_right",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{GROUP_RIGHT, 0, "group_right"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input:    "bool",
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{{BOOL, 0, "bool"}},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-16 22:19:24 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-12 16:39:10 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "selectors",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `台北`,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												fail:  true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{台北='a'}`,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												fail:  true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{0a='a'}`,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												fail:  true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{foo='bar'}`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 0, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 1, `foo`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{EQL, 4, `=`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 5, `'bar'`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 10, `}`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{foo="bar"}`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 0, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 1, `foo`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{EQL, 4, `=`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 5, `"bar"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 10, `}`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{foo="bar\"bar"}`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 0, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 1, `foo`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{EQL, 4, `=`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 5, `"bar\"bar"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 15, `}`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{NaN	!= "bar" }`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 0, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 1, `NaN`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NEQ, 5, `!=`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 8, `"bar"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 14, `}`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{alert=~"bar" }`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 0, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 1, `alert`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{EQL_REGEX, 6, `=~`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 8, `"bar"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 14, `}`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{on!~"bar"}`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 0, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 1, `on`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NEQ_REGEX, 3, `!~`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 5, `"bar"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 10, `}`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{alert!#"bar"}`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{foo:a="bar"}`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-12 16:39:10 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "common errors",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `=~`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `!~`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `!(`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "1a", fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-12 16:39:10 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "mismatched parentheses",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `(`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `())`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `(()`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `}`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "{{", fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "{{}}", fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `[`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `[[`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `[]]`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `[[]]`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `]`, fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-12 16:39:10 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 21:47:13 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "encoding issues",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "\"\xff\"", fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: "`\xff`", fail: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 21:47:13 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "series descriptions",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `{} _ 1 x .3`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 0, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 1, `}`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{SPACE, 2, ` `},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{BLANK, 3, `_`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{SPACE, 4, ` `},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NUMBER, 5, `1`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{SPACE, 6, ` `},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{TIMES, 7, `x`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{SPACE, 8, ` `},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NUMBER, 9, `.3`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												seriesDesc: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `metric +Inf Inf NaN`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 0, `metric`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{SPACE, 6, ` `},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{ADD, 7, `+`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NUMBER, 8, `Inf`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{SPACE, 11, ` `},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NUMBER, 12, `Inf`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{SPACE, 15, ` `},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NUMBER, 16, `NaN`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												seriesDesc: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `metric 1+1x4`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 0, `metric`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{SPACE, 6, ` `},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NUMBER, 7, `1`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{ADD, 8, `+`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NUMBER, 9, `1`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{TIMES, 10, `x`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NUMBER, 11, `4`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												seriesDesc: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 21:47:13 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name: "subqueries",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tests: []testCase{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test_name{on!~"bar"}[4m:4s]`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 0, `test_name`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 9, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 10, `on`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NEQ_REGEX, 12, `!~`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 14, `"bar"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 19, `}`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 20, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 21, `4m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{COLON, 23, `:`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 24, `4s`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 26, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test:name{on!~"bar"}[4m:4s]`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{METRIC_IDENTIFIER, 0, `test:name`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 9, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 10, `on`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NEQ_REGEX, 12, `!~`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 14, `"bar"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 19, `}`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 20, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 21, `4m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{COLON, 23, `:`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 24, `4s`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 26, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test:name{on!~"b:ar"}[4m:4s]`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{METRIC_IDENTIFIER, 0, `test:name`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 9, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 10, `on`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NEQ_REGEX, 12, `!~`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 14, `"b:ar"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 20, `}`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 21, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 22, `4m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{COLON, 24, `:`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 25, `4s`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 27, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test:name{on!~"b:ar"}[4m:]`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{METRIC_IDENTIFIER, 0, `test:name`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 9, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 10, `on`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NEQ_REGEX, 12, `!~`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 14, `"b:ar"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 20, `}`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 21, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 22, `4m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{COLON, 24, `:`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 25, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, { // Nested Subquery.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `min_over_time(rate(foo{bar="baz"}[2s])[5m:])[4m:3s]`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 0, `min_over_time`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_PAREN, 13, `(`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 14, `rate`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_PAREN, 18, `(`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 19, `foo`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 22, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 23, `bar`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{EQL, 26, `=`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 27, `"baz"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 32, `}`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 33, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 34, `2s`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 36, `]`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_PAREN, 37, `)`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 38, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 39, `5m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{COLON, 41, `:`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 42, `]`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_PAREN, 43, `)`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 44, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 45, `4m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{COLON, 47, `:`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 48, `3s`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 50, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											// Subquery with offset.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test:name{on!~"b:ar"}[4m:4s] offset 10m`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{METRIC_IDENTIFIER, 0, `test:name`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 9, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 10, `on`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{NEQ_REGEX, 12, `!~`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 14, `"b:ar"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 20, `}`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 21, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 22, `4m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{COLON, 24, `:`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 25, `4s`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 27, `]`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{OFFSET, 29, "offset"},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 36, "10m"},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}, {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `min_over_time(rate(foo{bar="baz"}[2s])[5m:] offset 6m)[4m:3s]`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 21:47:13 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 0, `min_over_time`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_PAREN, 13, `(`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 14, `rate`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_PAREN, 18, `(`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 19, `foo`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACE, 22, `{`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{IDENTIFIER, 23, `bar`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{EQL, 26, `=`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{STRING, 27, `"baz"`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACE, 32, `}`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 33, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 34, `2s`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 36, `]`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_PAREN, 37, `)`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 38, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 39, `5m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{COLON, 41, `:`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 42, `]`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{OFFSET, 44, `offset`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 51, `6m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_PAREN, 53, `)`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 54, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 55, `4m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{COLON, 57, `:`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 58, `3s`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 60, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-11 16:56:24 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test:name[ 5m]`,
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												expected: []Item{
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-26 21:29:42 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{METRIC_IDENTIFIER, 0, `test:name`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{LEFT_BRACKET, 9, `[`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{DURATION, 11, `5m`},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{RIGHT_BRACKET, 13, `]`},
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-11 16:56:24 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test:name{o:n!~"bar"}[4m:4s]`,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												fail:  true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test:name{on!~"bar"}[4m:4s:4h]`,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												fail:  true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test:name{on!~"bar"}[4m:4s:]`,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												fail:  true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test:name{on!~"bar"}[4m::]`,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												fail:  true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												input: `test:name{on!~"bar"}[:4s]`,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												fail:  true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-22 21:47:13 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									},
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// TestLexer tests basic functionality of the lexer. More elaborate tests are implemented
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// for the parser to avoid duplicated effort.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								func TestLexer(t *testing.T) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									for _, typ := range tests {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										t.Run(typ.name, func(t *testing.T) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											for i, test := range typ.tests {
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												l := &Lexer{
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													input:      test.input,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													seriesDesc: test.seriesDesc,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												}
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-29 15:20:43 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-09 19:26:58 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												var out []Item
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												for l.state = lexStatements; l.state != nil; {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													out = append(out, Item{})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													l.NextItem(&out[len(out)-1])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												}
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												lastItem := out[len(out)-1]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												if test.fail {
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-09 19:26:58 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													hasError := false
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													for _, item := range out {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
														if item.Typ == ERROR {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
															hasError = true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
														}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													if !hasError {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
														t.Logf("%d: input %q", i, test.input)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
														t.Fatalf("expected lexing error but did not fail")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													continue
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												}
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												if lastItem.Typ == ERROR {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													t.Logf("%d: input %q", i, test.input)
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													t.Fatalf("unexpected lexing error at position %d: %s", lastItem.Pos, lastItem)
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												}
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-10 03:03:31 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												eofItem := Item{EOF, Pos(len(test.input)), ""}
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-10 08:06:53 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												testutil.Equals(t, lastItem, eofItem, "%d: input %q", i, test.input)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												out = out[:len(out)-1]
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-27 20:21:59 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
												testutil.Equals(t, test.expected, out, "%d: input %q", i, test.input)
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-17 05:35:45 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										})
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-31 00:12:51 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |