Add grammar

Signed-off-by: Levi Harrison <git@leviharrison.dev>
This commit is contained in:
Levi Harrison 2021-08-29 13:33:39 -04:00
parent 4ac4e2ca4b
commit ed220c1ae7
4 changed files with 226 additions and 1 deletions

View File

@ -64,6 +64,42 @@ export const functionIdentifierTerms = [
info: 'Determine whether input range vector is empty',
type: 'function',
},
{
label: 'acos',
detail: 'function',
info: 'Calculate the arccosine, in radians, for input series',
type: 'function',
},
{
label: 'acosh',
detail: 'function',
info: 'Calculate the inverse hyperbolic cosine, in radians, for input series',
type: 'function',
},
{
label: 'asin',
detail: 'function',
info: 'Calculate the arcsine, in radians, for input series',
type: 'function',
},
{
label: 'asinh',
detail: 'function',
info: 'Calculate the inverse hyperbolic sine, in radians, for input series',
type: 'function',
},
{
label: 'atan',
detail: 'function',
info: 'Calculate the arctangent, in radians, for input series',
type: 'function',
},
{
label: 'atanh',
detail: 'function',
info: 'Calculate the inverse hyperbolic tangent, in radians, for input series',
type: 'function',
},
{
label: 'avg_over_time',
detail: 'function',
@ -100,6 +136,18 @@ export const functionIdentifierTerms = [
info: 'Limit the value of input series to a minimum',
type: 'function',
},
{
label: 'cos',
detail: 'function',
info: 'Calculate the cosine, in radians, for input series',
type: 'function',
},
{
label: 'cosh',
detail: 'function',
info: 'Calculate the hyperbolic cosine, in radians, for input series',
type: 'function',
},
{
label: 'count_over_time',
detail: 'function',
@ -124,6 +172,12 @@ export const functionIdentifierTerms = [
info: 'Return the day of the week for provided timestamps',
type: 'function',
},
{
label: 'deg',
detail: 'function',
info: 'Convert radians to degrees for input series',
type: 'function',
},
{
label: 'delta',
detail: 'function',
@ -244,6 +298,12 @@ export const functionIdentifierTerms = [
info: 'Return the month for provided timestamps',
type: 'function',
},
{
label: 'pi',
detail: 'function',
info: 'Return pi',
type: 'function',
},
{
label: 'predict_linear',
detail: 'function',
@ -262,6 +322,12 @@ export const functionIdentifierTerms = [
info: 'Calculate value quantiles over time for input series',
type: 'function',
},
{
label: 'rad',
detail: 'function',
info: 'Convert degrees to radians for input series',
type: 'function',
},
{
label: 'rate',
detail: 'function',
@ -292,6 +358,18 @@ export const functionIdentifierTerms = [
info: 'Returns the sign of the instant vector',
type: 'function',
},
{
label: 'sin',
detail: 'function',
info: 'Calculate the sine, in radians, for input series',
type: 'function',
},
{
label: 'sinh',
detail: 'function',
info: 'Calculate the hyperbolic sine, in radians, for input series',
type: 'function',
},
{
label: 'sort',
detail: 'function',
@ -328,6 +406,18 @@ export const functionIdentifierTerms = [
info: 'Calculate the sum over the values of input series over time',
type: 'function',
},
{
label: 'tan',
detail: 'function',
info: 'Calculate the tangent, in radians, for input series',
type: 'function',
},
{
label: 'tanh',
detail: 'function',
info: 'Calculate the hyperbolic tangent, in radians, for input series',
type: 'function',
},
{
label: 'time',
detail: 'function',

View File

@ -121,16 +121,25 @@ FunctionIdentifier {
AbsentOverTime |
Absent |
Abs |
Acos |
Acosh |
Asin |
Asinh |
Atan |
Atanh |
AvgOverTime |
Ceil |
Changes |
Clamp |
ClampMax |
ClampMin |
Cos |
Cosh |
CountOverTime |
DaysInMonth |
DayOfMonth |
DayOfWeek |
Deg |
Delta |
Deriv |
Exp |
@ -151,20 +160,26 @@ FunctionIdentifier {
MinOverTime |
Minute |
Month |
Pi |
PredictLinear |
PresentOverTime |
QuantileOverTime |
Rad |
Rate |
Resets |
Round |
Scalar |
Sgn |
Sin |
Sinh |
Sort |
SortDesc |
Sqrt |
StddevOverTime |
StdvarOverTime |
SumOverTime |
Tan |
Tanh |
Timestamp |
Time |
Vector |
@ -343,16 +358,25 @@ NumberLiteral {
Abs { condFn<"abs"> }
Absent { condFn<"absent"> }
AbsentOverTime { condFn<"absent_over_time"> }
Acos { condFn<"acos"> }
Acosh { condFn<"acosh"> }
Asin { condFn<"asin"> }
Asinh { condFn<"asinh">}
Atan { condFn<"atan"> }
Atanh { condFn<"atanh">}
AvgOverTime { condFn<"avg_over_time"> }
Ceil { condFn<"ceil"> }
Changes { condFn<"changes"> }
Clamp { condFn<"clamp"> }
ClampMax { condFn<"clamp_max"> }
ClampMin { condFn<"clamp_min"> }
Cos { condFn<"cos">}
Cosh { condFn<"cosh">}
CountOverTime { condFn<"count_over_time"> }
DaysInMonth { condFn<"days_in_month"> }
DayOfMonth { condFn<"day_of_month"> }
DayOfWeek { condFn<"day_of_week"> }
Deg { condFn<"deg"> }
Delta { condFn<"delta"> }
Deriv { condFn<"deriv"> }
Exp { condFn<"exp"> }
@ -373,20 +397,26 @@ NumberLiteral {
MinOverTime { condFn<"min_over_time"> }
Minute { condFn<"minute"> }
Month { condFn<"month"> }
Pi { condFn<"pi">}
PredictLinear { condFn<"predict_linear"> }
PresentOverTime { condFn<"present_over_time"> }
QuantileOverTime { condFn<"quantile_over_time"> }
Rad { condFn<"rad"> }
Rate { condFn<"rate"> }
Resets { condFn<"resets"> }
Round { condFn<"round"> }
Scalar { condFn<"scalar"> }
Sgn { condFn<"sgn"> }
Sin { condFn<"sin">}
Sinh { condFn<"sinh"> }
Sort { condFn<"sort"> }
SortDesc { condFn<"sort_desc"> }
Sqrt { condFn<"sqrt"> }
StddevOverTime { condFn<"stddev_over_time"> }
StdvarOverTime { condFn<"stdvar_over_time"> }
SumOverTime { condFn<"sum_over_time"> }
Tan { condFn<"tan"> }
Tanh { condFn<"tanh">}
Time { condFn<"time"> }
Timestamp { condFn<"timestamp"> }
Vector { condFn<"vector"> }

View File

@ -35,7 +35,7 @@ export function promQLLanguage(top: LanguageType) {
StringLiteral: tags.string,
NumberLiteral: tags.number,
Duration: tags.number,
'Abs Absent AbsentOverTime AvgOverTime Ceil Changes Clamp ClampMax ClampMin CountOverTime DaysInMonth DayOfMonth DayOfWeek Delta Deriv Exp Floor HistogramQuantile HoltWinters Hour Idelta Increase Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MaxOverTime MinOverTime Minute Month PredictLinear PresentOverTime QuantileOverTime Rate Resets Round Scalar Sgn Sort SortDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Time Timestamp Vector Year':
'Abs Absent AbsentOverTime Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek Deg Delta Deriv Exp Floor HistogramQuantile HoltWinters Hour Idelta Increase Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MaxOverTime MinOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Time Timestamp Vector Year':
tags.function(tags.variableName),
'Avg Bottomk Count Count_values Group Max Min Quantile Stddev Stdvar Sum Topk': tags.operatorKeyword,
'By Without Bool On Ignoring GroupLeft GroupRight Offset Start End': tags.modifier,

View File

@ -15,16 +15,25 @@ import {
Abs,
Absent,
AbsentOverTime,
Acos,
Acosh,
Asin,
Asinh,
Atan,
Atanh,
AvgOverTime,
Ceil,
Changes,
Clamp,
ClampMax,
ClampMin,
Cos,
Cosh,
CountOverTime,
DayOfMonth,
DayOfWeek,
DaysInMonth,
Deg,
Delta,
Deriv,
Exp,
@ -45,20 +54,26 @@ import {
MinOverTime,
Minute,
Month,
Pi,
PredictLinear,
PresentOverTime,
QuantileOverTime,
Rad,
Rate,
Resets,
Round,
Scalar,
Sgn,
Sin,
Sinh,
Sort,
SortDesc,
Sqrt,
StddevOverTime,
StdvarOverTime,
SumOverTime,
Tan,
Tanh,
Time,
Timestamp,
Vector,
@ -101,6 +116,42 @@ const promqlFunctions: { [key: number]: PromQLFunction } = {
variadic: 0,
returnType: ValueType.vector,
},
[Acos]: {
name: 'acos',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Acosh]: {
name: 'acosh',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Asin]: {
name: 'asin',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Asinh]: {
name: 'asinh',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Atan]: {
name: 'atan',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Atanh]: {
name: 'atanh',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[AvgOverTime]: {
name: 'avg_over_time',
argTypes: [ValueType.matrix],
@ -137,6 +188,18 @@ const promqlFunctions: { [key: number]: PromQLFunction } = {
variadic: 0,
returnType: ValueType.vector,
},
[Cos]: {
name: 'cos',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Cosh]: {
name: 'Cosh',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[CountOverTime]: {
name: 'count_over_time',
argTypes: [ValueType.matrix],
@ -161,6 +224,12 @@ const promqlFunctions: { [key: number]: PromQLFunction } = {
variadic: 1,
returnType: ValueType.vector,
},
[Deg]: {
name: 'deg',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Delta]: {
name: 'delta',
argTypes: [ValueType.matrix],
@ -281,6 +350,12 @@ const promqlFunctions: { [key: number]: PromQLFunction } = {
variadic: 1,
returnType: ValueType.vector,
},
[Pi]: {
name: 'pi',
argTypes: [],
variadic: 0,
returnType: ValueType.vector,
},
[PredictLinear]: {
name: 'predict_linear',
argTypes: [ValueType.matrix, ValueType.scalar],
@ -299,6 +374,12 @@ const promqlFunctions: { [key: number]: PromQLFunction } = {
variadic: 0,
returnType: ValueType.vector,
},
[Rad]: {
name: 'rad',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Rate]: {
name: 'rate',
argTypes: [ValueType.matrix],
@ -329,6 +410,18 @@ const promqlFunctions: { [key: number]: PromQLFunction } = {
variadic: 0,
returnType: ValueType.vector,
},
[Sin]: {
name: 'sin',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Sinh]: {
name: 'Sinh',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Sort]: {
name: 'sort',
argTypes: [ValueType.vector],
@ -365,6 +458,18 @@ const promqlFunctions: { [key: number]: PromQLFunction } = {
variadic: 0,
returnType: ValueType.vector,
},
[Tan]: {
name: 'tan',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Tanh]: {
name: 'tanh',
argTypes: [ValueType.vector],
variadic: 0,
returnType: ValueType.vector,
},
[Time]: {
name: 'time',
argTypes: [],