prometheus/model/textparse/openmetricslex.l.go

905 lines
13 KiB
Go
Raw Permalink Normal View History

// Code generated by golex. DO NOT EDIT.
// Copyright 2018 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package textparse
import (
"fmt"
)
// Lex is called by the parser generated by "go tool yacc" to obtain each
// token. The method is opened before the matching rules block and closed at
// the end of the file.
func (l *openMetricsLexer) Lex() token {
if l.i >= len(l.b) {
return tEOF
}
c := l.b[l.i]
l.start = l.i
yystate0:
switch yyt := l.state; yyt {
default:
panic(fmt.Errorf(`invalid start condition %d`, yyt))
case 0: // start condition: INITIAL
goto yystart1
case 1: // start condition: sComment
goto yystart6
case 2: // start condition: sMeta1
goto yystart26
case 3: // start condition: sMeta2
goto yystart31
case 4: // start condition: sLabels
goto yystart34
case 5: // start condition: sLValue
goto yystart42
case 6: // start condition: sValue
goto yystart46
case 7: // start condition: sTimestamp
goto yystart50
case 8: // start condition: sExemplar
goto yystart57
case 9: // start condition: sEValue
goto yystart65
case 10: // start condition: sETimestamp
goto yystart71
}
yystate1:
c = l.next()
yystart1:
switch {
default:
goto yyabort
case c == '#':
goto yystate2
case c == ':' || c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
goto yystate4
case c == '{':
goto yystate5
}
yystate2:
c = l.next()
switch {
default:
goto yyabort
case c == ' ':
goto yystate3
}
yystate3:
c = l.next()
goto yyrule1
yystate4:
c = l.next()
switch {
default:
goto yyrule9
case c >= '0' && c <= ':' || c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
goto yystate4
}
yystate5:
c = l.next()
goto yyrule11
yystate6:
c = l.next()
yystart6:
switch {
default:
goto yyabort
case c == 'E':
goto yystate7
case c == 'H':
goto yystate11
case c == 'T':
goto yystate16
case c == 'U':
goto yystate21
}
yystate7:
c = l.next()
switch {
default:
goto yyabort
case c == 'O':
goto yystate8
}
yystate8:
c = l.next()
switch {
default:
goto yyabort
case c == 'F':
goto yystate9
}
yystate9:
c = l.next()
switch {
default:
goto yyrule5
case c == '\n':
goto yystate10
}
yystate10:
c = l.next()
goto yyrule5
yystate11:
c = l.next()
switch {
default:
goto yyabort
case c == 'E':
goto yystate12
}
yystate12:
c = l.next()
switch {
default:
goto yyabort
case c == 'L':
goto yystate13
}
yystate13:
c = l.next()
switch {
default:
goto yyabort
case c == 'P':
goto yystate14
}
yystate14:
c = l.next()
switch {
default:
goto yyabort
case c == ' ':
goto yystate15
}
yystate15:
c = l.next()
goto yyrule2
yystate16:
c = l.next()
switch {
default:
goto yyabort
case c == 'Y':
goto yystate17
}
yystate17:
c = l.next()
switch {
default:
goto yyabort
case c == 'P':
goto yystate18
}
yystate18:
c = l.next()
switch {
default:
goto yyabort
case c == 'E':
goto yystate19
}
yystate19:
c = l.next()
switch {
default:
goto yyabort
case c == ' ':
goto yystate20
}
yystate20:
c = l.next()
goto yyrule3
yystate21:
c = l.next()
switch {
default:
goto yyabort
case c == 'N':
goto yystate22
}
yystate22:
c = l.next()
switch {
default:
goto yyabort
case c == 'I':
goto yystate23
}
yystate23:
c = l.next()
switch {
default:
goto yyabort
case c == 'T':
goto yystate24
}
yystate24:
c = l.next()
switch {
default:
goto yyabort
case c == ' ':
goto yystate25
}
yystate25:
c = l.next()
goto yyrule4
yystate26:
c = l.next()
yystart26:
switch {
default:
goto yyabort
case c == '"':
goto yystate27
case c == ':' || c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
goto yystate30
}
yystate27:
c = l.next()
switch {
default:
goto yyabort
case c == '"':
goto yystate28
case c == '\\':
goto yystate29
case c >= '\x01' && c <= '!' || c >= '#' && c <= '[' || c >= ']' && c <= 'ÿ':
goto yystate27
}
yystate28:
c = l.next()
goto yyrule6
yystate29:
c = l.next()
switch {
default:
goto yyabort
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= 'ÿ':
goto yystate27
}
yystate30:
c = l.next()
switch {
default:
goto yyrule7
case c >= '0' && c <= ':' || c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
goto yystate30
}
yystate31:
c = l.next()
yystart31:
switch {
default:
goto yyabort
case c == ' ':
goto yystate32
}
yystate32:
c = l.next()
switch {
default:
goto yyabort
case c == '\n':
goto yystate33
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= 'ÿ':
goto yystate32
}
yystate33:
c = l.next()
goto yyrule8
yystate34:
c = l.next()
yystart34:
switch {
default:
goto yyabort
case c == '"':
goto yystate35
case c == ',':
goto yystate38
case c == '=':
goto yystate39
case c == '}':
goto yystate41
case c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
goto yystate40
}
yystate35:
c = l.next()
switch {
default:
goto yyabort
case c == '"':
goto yystate36
case c == '\\':
goto yystate37
case c >= '\x01' && c <= '!' || c >= '#' && c <= '[' || c >= ']' && c <= 'ÿ':
goto yystate35
}
yystate36:
c = l.next()
goto yyrule13
yystate37:
c = l.next()
switch {
default:
goto yyabort
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= 'ÿ':
goto yystate35
}
yystate38:
c = l.next()
goto yyrule16
yystate39:
c = l.next()
goto yyrule15
yystate40:
c = l.next()
switch {
default:
goto yyrule12
case c >= '0' && c <= '9' || c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
goto yystate40
}
yystate41:
c = l.next()
goto yyrule14
yystate42:
c = l.next()
yystart42:
switch {
default:
goto yyabort
case c == '"':
goto yystate43
}
yystate43:
c = l.next()
switch {
default:
goto yyabort
case c == '"':
goto yystate44
case c == '\\':
goto yystate45
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '!' || c >= '#' && c <= '[' || c >= ']' && c <= 'ÿ':
goto yystate43
}
yystate44:
c = l.next()
goto yyrule17
yystate45:
c = l.next()
switch {
default:
goto yyabort
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= 'ÿ':
goto yystate43
}
yystate46:
c = l.next()
yystart46:
switch {
default:
goto yyabort
case c == ' ':
goto yystate47
case c == '{':
goto yystate49
}
yystate47:
c = l.next()
switch {
default:
goto yyabort
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '\x1f' || c >= '!' && c <= 'ÿ':
goto yystate48
}
yystate48:
c = l.next()
switch {
default:
goto yyrule18
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '\x1f' || c >= '!' && c <= 'ÿ':
goto yystate48
}
yystate49:
c = l.next()
goto yyrule10
yystate50:
c = l.next()
yystart50:
switch {
default:
goto yyabort
case c == ' ':
goto yystate52
case c == '\n':
goto yystate51
}
yystate51:
c = l.next()
goto yyrule20
yystate52:
c = l.next()
switch {
default:
goto yyabort
case c == '#':
goto yystate54
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '\x1f' || c == '!' || c == '"' || c >= '$' && c <= 'ÿ':
goto yystate53
}
yystate53:
c = l.next()
switch {
default:
goto yyrule19
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '\x1f' || c >= '!' && c <= 'ÿ':
goto yystate53
}
yystate54:
c = l.next()
switch {
default:
goto yyrule19
case c == ' ':
goto yystate55
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '\x1f' || c >= '!' && c <= 'ÿ':
goto yystate53
}
yystate55:
c = l.next()
switch {
default:
goto yyabort
case c == '{':
goto yystate56
}
yystate56:
c = l.next()
goto yyrule21
yystate57:
c = l.next()
yystart57:
switch {
default:
goto yyabort
case c == '"':
goto yystate58
case c == ',':
goto yystate61
case c == '=':
goto yystate62
case c == '}':
goto yystate64
case c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
goto yystate63
}
yystate58:
c = l.next()
switch {
default:
goto yyabort
case c == '"':
goto yystate59
case c == '\\':
goto yystate60
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '!' || c >= '#' && c <= '[' || c >= ']' && c <= 'ÿ':
goto yystate58
}
yystate59:
c = l.next()
goto yyrule23
yystate60:
c = l.next()
switch {
default:
goto yyabort
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= 'ÿ':
goto yystate58
}
yystate61:
c = l.next()
goto yyrule27
yystate62:
c = l.next()
goto yyrule25
yystate63:
c = l.next()
switch {
default:
goto yyrule22
case c >= '0' && c <= '9' || c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
goto yystate63
}
yystate64:
c = l.next()
goto yyrule24
yystate65:
c = l.next()
yystart65:
switch {
default:
goto yyabort
case c == ' ':
goto yystate66
case c == '"':
goto yystate68
}
yystate66:
c = l.next()
switch {
default:
goto yyabort
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '\x1f' || c >= '!' && c <= 'ÿ':
goto yystate67
}
yystate67:
c = l.next()
switch {
default:
goto yyrule28
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '\x1f' || c >= '!' && c <= 'ÿ':
goto yystate67
}
yystate68:
c = l.next()
switch {
default:
goto yyabort
case c == '"':
goto yystate69
case c == '\\':
goto yystate70
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '!' || c >= '#' && c <= '[' || c >= ']' && c <= 'ÿ':
goto yystate68
}
yystate69:
c = l.next()
goto yyrule26
yystate70:
c = l.next()
switch {
default:
goto yyabort
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= 'ÿ':
goto yystate68
}
yystate71:
c = l.next()
yystart71:
switch {
default:
goto yyabort
case c == ' ':
goto yystate73
case c == '\n':
goto yystate72
}
yystate72:
c = l.next()
goto yyrule30
yystate73:
c = l.next()
switch {
default:
goto yyabort
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '\x1f' || c >= '!' && c <= 'ÿ':
goto yystate74
}
yystate74:
c = l.next()
switch {
default:
goto yyrule29
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '\x1f' || c >= '!' && c <= 'ÿ':
goto yystate74
}
yyrule1: // #{S}
{
l.state = sComment
goto yystate0
}
yyrule2: // HELP{S}
{
l.state = sMeta1
return tHelp
goto yystate0
}
yyrule3: // TYPE{S}
{
l.state = sMeta1
return tType
goto yystate0
}
yyrule4: // UNIT{S}
{
l.state = sMeta1
return tUnit
goto yystate0
}
yyrule5: // "EOF"\n?
{
l.state = sInit
return tEOFWord
goto yystate0
}
yyrule6: // \"(\\.|[^\\"])*\"
{
l.state = sMeta2
return tMName
goto yystate0
}
yyrule7: // {M}({M}|{D})*
{
l.state = sMeta2
return tMName
goto yystate0
}
yyrule8: // {S}{C}*\n
{
l.state = sInit
return tText
goto yystate0
}
yyrule9: // {M}({M}|{D})*
{
l.state = sValue
return tMName
goto yystate0
}
yyrule10: // \{
{
l.state = sLabels
return tBraceOpen
goto yystate0
}
yyrule11: // \{
{
l.state = sLabels
return tBraceOpen
goto yystate0
}
yyrule12: // {L}({L}|{D})*
{
return tLName
}
yyrule13: // \"(\\.|[^\\"])*\"
{
l.state = sLabels
return tQString
goto yystate0
}
yyrule14: // \}
{
l.state = sValue
return tBraceClose
goto yystate0
}
yyrule15: // =
{
l.state = sLValue
return tEqual
goto yystate0
}
yyrule16: // ,
{
return tComma
}
yyrule17: // \"(\\.|[^\\"\n])*\"
{
l.state = sLabels
return tLValue
goto yystate0
}
yyrule18: // {S}[^ \n]+
{
l.state = sTimestamp
return tValue
goto yystate0
}
yyrule19: // {S}[^ \n]+
{
return tTimestamp
}
yyrule20: // \n
{
l.state = sInit
return tLinebreak
goto yystate0
}
yyrule21: // {S}#{S}\{
{
l.state = sExemplar
return tComment
goto yystate0
}
yyrule22: // {L}({L}|{D})*
{
return tLName
}
yyrule23: // \"(\\.|[^\\"\n])*\"
{
l.state = sExemplar
return tQString
goto yystate0
}
yyrule24: // \}
{
l.state = sEValue
return tBraceClose
goto yystate0
}
yyrule25: // =
{
l.state = sEValue
return tEqual
goto yystate0
}
yyrule26: // \"(\\.|[^\\"\n])*\"
{
l.state = sExemplar
return tLValue
goto yystate0
}
yyrule27: // ,
{
return tComma
}
yyrule28: // {S}[^ \n]+
{
l.state = sETimestamp
return tValue
goto yystate0
}
yyrule29: // {S}[^ \n]+
{
return tTimestamp
}
yyrule30: // \n
if true { // avoid go vet determining the below panic will not be reached
l.state = sInit
return tLinebreak
goto yystate0
}
panic("unreachable")
yyabort: // no lexem recognized
// silence unused label errors for build and satisfy go vet reachability analysis
{
if false {
goto yyabort
}
if false {
goto yystate0
}
if false {
goto yystate1
}
if false {
goto yystate6
}
if false {
goto yystate26
}
if false {
goto yystate31
}
if false {
goto yystate34
}
if false {
goto yystate42
}
if false {
goto yystate46
}
if false {
goto yystate50
}
if false {
goto yystate57
}
if false {
goto yystate65
}
if false {
goto yystate71
}
}
return tInvalid
}