mirror of
https://github.com/prometheus/prometheus
synced 2024-12-26 16:43:21 +00:00
384 lines
6.4 KiB
Go
384 lines
6.4 KiB
Go
// CAUTION: Generated file - DO NOT EDIT.
|
|
|
|
package textparse
|
|
|
|
import (
|
|
"fmt"
|
|
"math"
|
|
"strconv"
|
|
)
|
|
|
|
// 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 *lexer) Lex() int {
|
|
const (
|
|
lstateInit = iota
|
|
lstateValue
|
|
lstateLabels
|
|
lstateLName
|
|
lstateLValue
|
|
)
|
|
s := lstateInit
|
|
|
|
if l.i >= len(l.b) {
|
|
return eof
|
|
}
|
|
c := l.b[l.i]
|
|
|
|
l.offsets = l.offsets[:0]
|
|
|
|
yystate0:
|
|
|
|
switch yyt := s; yyt {
|
|
default:
|
|
panic(fmt.Errorf(`invalid start condition %d`, yyt))
|
|
case 0: // start condition: INITIAL
|
|
goto yystart1
|
|
case 1: // start condition: lstateValue
|
|
goto yystart8
|
|
case 2: // start condition: lstateLabels
|
|
goto yystart14
|
|
case 3: // start condition: lstateLName
|
|
goto yystart18
|
|
case 4: // start condition: lstateLValue
|
|
goto yystart21
|
|
}
|
|
|
|
goto yystate0 // silence unused label error
|
|
goto yystate1 // silence unused label error
|
|
yystate1:
|
|
c = l.next()
|
|
yystart1:
|
|
switch {
|
|
default:
|
|
goto yyabort
|
|
case c == '#':
|
|
goto yystate4
|
|
case c == '\t' || c == '\n' || c == '\r' || c == ' ':
|
|
goto yystate3
|
|
case c == '\x00':
|
|
goto yystate2
|
|
case c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
|
|
goto yystate6
|
|
}
|
|
|
|
yystate2:
|
|
c = l.next()
|
|
goto yyrule1
|
|
|
|
yystate3:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyrule3
|
|
case c == '\t' || c == '\n' || c == '\r' || c == ' ':
|
|
goto yystate3
|
|
}
|
|
|
|
yystate4:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyabort
|
|
case c == '\n':
|
|
goto yystate5
|
|
case c >= '\x01' && c <= '\t' || c == '\v' || c == '\f' || c >= '\x0e' && c <= 'ÿ':
|
|
goto yystate4
|
|
}
|
|
|
|
yystate5:
|
|
c = l.next()
|
|
goto yyrule2
|
|
|
|
yystate6:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyrule5
|
|
case c == '{':
|
|
goto yystate7
|
|
case c >= '0' && c <= '9' || c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
|
|
goto yystate6
|
|
}
|
|
|
|
yystate7:
|
|
c = l.next()
|
|
goto yyrule4
|
|
|
|
goto yystate8 // silence unused label error
|
|
yystate8:
|
|
c = l.next()
|
|
yystart8:
|
|
switch {
|
|
default:
|
|
goto yyabort
|
|
case c == 'N':
|
|
goto yystate11
|
|
case c == '\t' || c == ' ':
|
|
goto yystate10
|
|
case c >= '\x01' && c <= '\b' || c == '\v' || c == '\f' || c >= '\x0e' && c <= '\x1f' || c >= '!' && c <= 'M' || c >= 'O' && c <= 'ÿ':
|
|
goto yystate9
|
|
}
|
|
|
|
yystate9:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyrule14
|
|
case c >= '\x01' && c <= '\b' || c == '\v' || c == '\f' || c >= '\x0e' && c <= '\x1f' || c >= '!' && c <= 'ÿ':
|
|
goto yystate9
|
|
}
|
|
|
|
yystate10:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyrule12
|
|
case c == '\t' || c == ' ':
|
|
goto yystate10
|
|
}
|
|
|
|
yystate11:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyrule14
|
|
case c == 'a':
|
|
goto yystate12
|
|
case c >= '\x01' && c <= '\b' || c == '\v' || c == '\f' || c >= '\x0e' && c <= '\x1f' || c >= '!' && c <= '`' || c >= 'b' && c <= 'ÿ':
|
|
goto yystate9
|
|
}
|
|
|
|
yystate12:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyrule14
|
|
case c == 'N':
|
|
goto yystate13
|
|
case c >= '\x01' && c <= '\b' || c == '\v' || c == '\f' || c >= '\x0e' && c <= '\x1f' || c >= '!' && c <= 'M' || c >= 'O' && c <= 'ÿ':
|
|
goto yystate9
|
|
}
|
|
|
|
yystate13:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyrule13
|
|
case c >= '\x01' && c <= '\b' || c == '\v' || c == '\f' || c >= '\x0e' && c <= '\x1f' || c >= '!' && c <= 'ÿ':
|
|
goto yystate9
|
|
}
|
|
|
|
goto yystate14 // silence unused label error
|
|
yystate14:
|
|
c = l.next()
|
|
yystart14:
|
|
switch {
|
|
default:
|
|
goto yyrule8
|
|
case c == ',':
|
|
goto yystate16
|
|
case c == '\t' || c == ' ':
|
|
goto yystate15
|
|
case c == '}':
|
|
goto yystate17
|
|
}
|
|
|
|
yystate15:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyrule6
|
|
case c == '\t' || c == ' ':
|
|
goto yystate15
|
|
}
|
|
|
|
yystate16:
|
|
c = l.next()
|
|
goto yyrule8
|
|
|
|
yystate17:
|
|
c = l.next()
|
|
goto yyrule7
|
|
|
|
goto yystate18 // silence unused label error
|
|
yystate18:
|
|
c = l.next()
|
|
yystart18:
|
|
switch {
|
|
default:
|
|
goto yyabort
|
|
case c == ':' || c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
|
|
goto yystate19
|
|
}
|
|
|
|
yystate19:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyabort
|
|
case c == '=':
|
|
goto yystate20
|
|
case c >= '0' && c <= ':' || c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z':
|
|
goto yystate19
|
|
}
|
|
|
|
yystate20:
|
|
c = l.next()
|
|
goto yyrule9
|
|
|
|
goto yystate21 // silence unused label error
|
|
yystate21:
|
|
c = l.next()
|
|
yystart21:
|
|
switch {
|
|
default:
|
|
goto yyabort
|
|
case c == '"':
|
|
goto yystate22
|
|
case c == '\'':
|
|
goto yystate25
|
|
}
|
|
|
|
yystate22:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyabort
|
|
case c == '"':
|
|
goto yystate23
|
|
case c == '\\':
|
|
goto yystate24
|
|
case c >= '\x01' && c <= '!' || c >= '#' && c <= '[' || c >= ']' && c <= 'ÿ':
|
|
goto yystate22
|
|
}
|
|
|
|
yystate23:
|
|
c = l.next()
|
|
goto yyrule10
|
|
|
|
yystate24:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyabort
|
|
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= 'ÿ':
|
|
goto yystate22
|
|
}
|
|
|
|
yystate25:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyabort
|
|
case c == '\'':
|
|
goto yystate26
|
|
case c == '\\':
|
|
goto yystate27
|
|
case c >= '\x01' && c <= '&' || c >= '(' && c <= '[' || c >= ']' && c <= 'ÿ':
|
|
goto yystate25
|
|
}
|
|
|
|
yystate26:
|
|
c = l.next()
|
|
goto yyrule11
|
|
|
|
yystate27:
|
|
c = l.next()
|
|
switch {
|
|
default:
|
|
goto yyabort
|
|
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= 'ÿ':
|
|
goto yystate25
|
|
}
|
|
|
|
yyrule1: // \0
|
|
{
|
|
return eof
|
|
}
|
|
yyrule2: // #[^\r\n]*\n
|
|
{
|
|
l.mstart = l.i
|
|
goto yystate0
|
|
}
|
|
yyrule3: // [\r\n \t]+
|
|
{
|
|
l.mstart = l.i
|
|
goto yystate0
|
|
}
|
|
yyrule4: // {L}({L}|{D})*\{
|
|
{
|
|
s = lstateLabels
|
|
l.offsets = append(l.offsets, l.i-1)
|
|
goto yystate0
|
|
}
|
|
yyrule5: // {L}({L}|{D})*
|
|
{
|
|
s = lstateValue
|
|
l.mend = l.i
|
|
l.offsets = append(l.offsets, l.i)
|
|
goto yystate0
|
|
}
|
|
yyrule6: // [ \t]+
|
|
|
|
goto yystate0
|
|
yyrule7: // \}
|
|
{
|
|
s = lstateValue
|
|
l.mend = l.i
|
|
goto yystate0
|
|
}
|
|
yyrule8: // ,?
|
|
{
|
|
s = lstateLName
|
|
l.offsets = append(l.offsets, l.i)
|
|
goto yystate0
|
|
}
|
|
yyrule9: // {M}({M}|{D})*=
|
|
{
|
|
s = lstateLValue
|
|
l.offsets = append(l.offsets, l.i-1)
|
|
goto yystate0
|
|
}
|
|
yyrule10: // \"(\\.|[^\\"])*\"
|
|
{
|
|
s = lstateLabels
|
|
l.offsets = append(l.offsets, l.i-1)
|
|
goto yystate0
|
|
}
|
|
yyrule11: // \'(\\.|[^\\'])*\'
|
|
{
|
|
s = lstateLabels
|
|
l.offsets = append(l.offsets, l.i-1)
|
|
goto yystate0
|
|
}
|
|
yyrule12: // [ \t]+
|
|
{
|
|
l.vstart = l.i
|
|
goto yystate0
|
|
}
|
|
yyrule13: // (NaN)
|
|
{
|
|
l.val = math.NaN()
|
|
return 1
|
|
}
|
|
yyrule14: // [^\n \t\r]+
|
|
{
|
|
// We don't parse strictly correct floats as the conversion
|
|
// repeats the effort anyway.
|
|
l.val, l.err = strconv.ParseFloat(yoloString(l.b[l.vstart:l.i]), 64)
|
|
if l.err != nil {
|
|
return -1
|
|
}
|
|
return 1
|
|
|
|
}
|
|
panic("unreachable")
|
|
|
|
goto yyabort // silence unused label error
|
|
|
|
yyabort: // no lexem recognized
|
|
return -1
|
|
}
|