[#78] netmap: Add new keywords NOT and UNIQUE

* Add the rule for NOT operation to the policy parser grammar
* Regenerate query parse
* Implement NOT in filter
* Add unit-tests

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
Airat Arifullin 2023-05-24 12:50:13 +03:00
parent ec59ebfd88
commit 4f48f6c9e0
17 changed files with 383 additions and 300 deletions

3
.gitignore vendored
View file

@ -21,3 +21,6 @@ vendor/
# coverage
coverage.txt
coverage.html
# antlr tool jar
antlr-*.jar

7
go.mod
View file

@ -3,7 +3,7 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go
go 1.19
require (
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230519114017-0c67b8fefa41
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb
git.frostfs.info/TrueCloudLab/hrw v1.2.1
git.frostfs.info/TrueCloudLab/tzhash v1.8.0
@ -20,14 +20,10 @@ require (
require (
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 // indirect
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
github.com/hashicorp/golang-lru v0.6.0 // indirect
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 // indirect
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20221202075445-cb5c18dc73eb // indirect
@ -43,6 +39,7 @@ require (
go.opentelemetry.io/otel/trace v1.15.1 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/goleak v1.2.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect

48
go.sum
View file

@ -31,8 +31,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230519114017-0c67b8fefa41 h1:xtGsOUX8Rz0hwWIFa148URysWuD4nRHspPNbYAUc1tg=
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230519114017-0c67b8fefa41/go.mod h1:6wEpMfSwD5xNtQYYVHWWTHwpYuvyumyntZEzILBIXUo=
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac h1:a6/Zc5BejflmguShwbllgJdEehnM9gshkLrLbKQHCU0=
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230531114046-62edd68f47ac/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI=
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M=
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o=
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=
@ -49,7 +49,6 @@ github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1
github.com/CityOfZion/neo-go v0.70.1-pre.0.20191209120015-fccb0085941e/go.mod h1:0enZl0az8xA6PVkwzEOwPWVJGqlt/GO4hA4kmQ5Xzig=
github.com/CityOfZion/neo-go v0.70.1-pre.0.20191212173117-32ac01130d4c/go.mod h1:JtlHfeqLywZLswKIKFnAp+yzezY4Dji9qlfQKB2OD/I=
github.com/CityOfZion/neo-go v0.71.1-pre.0.20200129171427-f773ec69fb84/go.mod h1:FLI526IrRWHmcsO+mHsCbj64pJZhwQFTLJZu+A4PGOA=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA=
github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg=
github.com/abiosoft/ishell/v2 v2.0.2/go.mod h1:E4oTCXfo6QjoCart0QYa5m9w4S+deXs/P/9jA77A9Bs=
@ -83,10 +82,7 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
@ -96,11 +92,7 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
@ -115,7 +107,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
@ -137,18 +128,11 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@ -217,9 +201,6 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
@ -390,29 +371,14 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opentelemetry.io/otel v1.15.1 h1:3Iwq3lfRByPaws0f6bU3naAqOR1n5IeDWd9390kWHa8=
go.opentelemetry.io/otel v1.15.1/go.mod h1:mHHGEHVDLal6YrKMmk9LqC4a3sF5g+fHfrttQIB1NTc=
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 h1:XYDQtNzdb2T4uM1pku2m76eSMDJgqhJ+6KzkqgQBALc=
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1/go.mod h1:uOTV75+LOzV+ODmL8ahRLWkFA3eQcSC2aAsbxIu4duk=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 h1:tyoeaUh8REKay72DVYsSEBYV18+fGONe+YYPaOxgLoE=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1/go.mod h1:HUSnrjQQ19KX9ECjpQxufsF+3ioD3zISPMlauTPZu2g=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 h1:pIfoG5IAZFzp9EUlJzdSkpUwpaUAAnD+Ru1nBLTACIQ=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1/go.mod h1:poNKBqF5+nR/6ke2oGTDjHfksrsHDOHXAl2g4+9ONsY=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 h1:2PunuO5SbkN5MhCbuHCd3tC6qrcaj+uDAkX/qBU5BAs=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1/go.mod h1:q8+Tha+5LThjeSU8BW93uUC5w5/+DnYHMKBMpRCsui0=
go.opentelemetry.io/otel/sdk v1.15.1 h1:5FKR+skgpzvhPQHIEfcwMYjCBr14LWzs3uSqKiQzETI=
go.opentelemetry.io/otel/sdk v1.15.1/go.mod h1:8rVtxQfrbmbHKfqzpQkT5EzZMcbMBwTzNAggbEAM0KA=
go.opentelemetry.io/otel/trace v1.15.1 h1:uXLo6iHJEzDfrNC0L0mNjItIp06SyaBQxu5t3xMlngY=
go.opentelemetry.io/otel/trace v1.15.1/go.mod h1:IWdQG/5N1x7f6YUlmdLeJvH9yxtuJAfc4VW5Agv9r/8=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw=
go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
@ -501,7 +467,6 @@ golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
@ -514,7 +479,6 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -577,9 +541,7 @@ golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@ -596,7 +558,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
@ -704,7 +665,6 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
@ -721,9 +681,7 @@ google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=

View file

@ -39,7 +39,7 @@ func (c *context) processFilter(f netmap.Filter, top bool) error {
inner := f.GetFilters()
switch op := f.GetOp(); op {
case netmap.AND, netmap.OR:
case netmap.AND, netmap.OR, netmap.NOT:
for i := range inner {
if err := c.processFilter(inner[i], false); err != nil {
return fmt.Errorf("process inner filter #%d: %w", i, err)
@ -79,6 +79,13 @@ func (c *context) processFilter(f netmap.Filter, top bool) error {
// and missing node properties are considered as a regular fail.
func (c *context) match(f *netmap.Filter, b NodeInfo) bool {
switch f.GetOp() {
case netmap.NOT:
inner := f.GetFilters()
fSub := &inner[0]
if name := inner[0].GetName(); name != "" {
fSub = c.processedFilters[name]
}
return !c.match(fSub, b)
case netmap.AND, netmap.OR:
inner := f.GetFilters()
for i := range inner {

View file

@ -22,7 +22,8 @@ selectStmt:
clause: CLAUSE_SAME | CLAUSE_DISTINCT; // nodes from distinct buckets
filterExpr:
F1 = filterExpr Op = AND_OP F2 = filterExpr
Op = NOT_OP '(' F1 = filterExpr ')'
| F1 = filterExpr Op = AND_OP F2 = filterExpr
| F1 = filterExpr Op = OR_OP F2 = filterExpr
| '(' Inner = filterExpr ')'
| expr

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,6 @@
lexer grammar QueryLexer;
NOT_OP : 'NOT';
AND_OP : 'AND';
OR_OP : 'OR';
SIMPLE_OP : 'EQ' | 'NE' | 'GE' | 'GT' | 'LT' | 'LE';

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,3 @@
// Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT.
package parser // Query
import "github.com/antlr4-go/antlr/v4"

View file

@ -1,12 +1,11 @@
// Code generated from /work/netmap/parser/QueryLexer.g4 by ANTLR 4.13.0. DO NOT EDIT.
package parser
import (
"fmt"
"github.com/antlr4-go/antlr/v4"
"sync"
"unicode"
"github.com/antlr4-go/antlr/v4"
)
// Suppress unused import error
@ -43,112 +42,114 @@ func querylexerLexerInit() {
"DEFAULT_MODE",
}
staticData.LiteralNames = []string{
"", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", "'SELECT'",
"'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", "')'", "'@'",
"", "", "'0'",
"", "'NOT'", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'",
"'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('",
"')'", "'@'", "", "", "'0'",
}
staticData.SymbolicNames = []string{
"", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT",
"FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN",
"R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS",
"", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF",
"SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT",
"L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS",
}
staticData.RuleNames = []string{
"AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT",
"FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN",
"R_PAREN", "AT", "IDENT", "Digit", "Nondigit", "NUMBER1", "ZERO", "STRING",
"ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE",
"NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF",
"SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT",
"L_PAREN", "R_PAREN", "AT", "IDENT", "Digit", "Nondigit", "NUMBER1",
"ZERO", "STRING", "ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE",
"WS",
}
staticData.PredictionContextCache = antlr.NewPredictionContextCache()
staticData.serializedATN = []int32{
4, 0, 21, 198, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2,
4, 0, 22, 204, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2,
4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2,
10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15,
7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7,
20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25,
2, 26, 7, 26, 2, 27, 7, 27, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1,
2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3,
2, 77, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5,
1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8,
1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10,
1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1,
12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15,
1, 16, 1, 16, 1, 16, 5, 16, 137, 8, 16, 10, 16, 12, 16, 140, 9, 16, 1,
17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 5, 19, 148, 8, 19, 10, 19, 12, 19,
151, 9, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 5, 21, 158, 8, 21, 10, 21,
12, 21, 161, 9, 21, 1, 21, 1, 21, 1, 21, 1, 21, 5, 21, 167, 8, 21, 10,
21, 12, 21, 170, 9, 21, 1, 21, 3, 21, 173, 8, 21, 1, 22, 1, 22, 1, 22,
3, 22, 178, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1,
24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 4, 27, 193, 8, 27, 11, 27, 12, 27,
194, 1, 27, 1, 27, 0, 0, 28, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7,
15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33,
17, 35, 0, 37, 0, 39, 18, 41, 19, 43, 20, 45, 0, 47, 0, 49, 0, 51, 0, 53,
0, 55, 21, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0,
49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110,
114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39,
92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 205,
0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0,
0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0,
0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0,
0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1,
0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43,
1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 1, 57, 1, 0, 0, 0, 3, 61, 1, 0, 0, 0, 5,
76, 1, 0, 0, 0, 7, 78, 1, 0, 0, 0, 9, 82, 1, 0, 0, 0, 11, 85, 1, 0, 0,
0, 13, 88, 1, 0, 0, 0, 15, 92, 1, 0, 0, 0, 17, 99, 1, 0, 0, 0, 19, 104,
1, 0, 0, 0, 21, 111, 1, 0, 0, 0, 23, 113, 1, 0, 0, 0, 25, 118, 1, 0, 0,
0, 27, 127, 1, 0, 0, 0, 29, 129, 1, 0, 0, 0, 31, 131, 1, 0, 0, 0, 33, 133,
1, 0, 0, 0, 35, 141, 1, 0, 0, 0, 37, 143, 1, 0, 0, 0, 39, 145, 1, 0, 0,
0, 41, 152, 1, 0, 0, 0, 43, 172, 1, 0, 0, 0, 45, 174, 1, 0, 0, 0, 47, 179,
1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 187, 1, 0, 0, 0, 53, 189, 1, 0, 0,
0, 55, 192, 1, 0, 0, 0, 57, 58, 5, 65, 0, 0, 58, 59, 5, 78, 0, 0, 59, 60,
5, 68, 0, 0, 60, 2, 1, 0, 0, 0, 61, 62, 5, 79, 0, 0, 62, 63, 5, 82, 0,
0, 63, 4, 1, 0, 0, 0, 64, 65, 5, 69, 0, 0, 65, 77, 5, 81, 0, 0, 66, 67,
5, 78, 0, 0, 67, 77, 5, 69, 0, 0, 68, 69, 5, 71, 0, 0, 69, 77, 5, 69, 0,
0, 70, 71, 5, 71, 0, 0, 71, 77, 5, 84, 0, 0, 72, 73, 5, 76, 0, 0, 73, 77,
5, 84, 0, 0, 74, 75, 5, 76, 0, 0, 75, 77, 5, 69, 0, 0, 76, 64, 1, 0, 0,
0, 76, 66, 1, 0, 0, 0, 76, 68, 1, 0, 0, 0, 76, 70, 1, 0, 0, 0, 76, 72,
1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 77, 6, 1, 0, 0, 0, 78, 79, 5, 82, 0, 0,
79, 80, 5, 69, 0, 0, 80, 81, 5, 80, 0, 0, 81, 8, 1, 0, 0, 0, 82, 83, 5,
73, 0, 0, 83, 84, 5, 78, 0, 0, 84, 10, 1, 0, 0, 0, 85, 86, 5, 65, 0, 0,
86, 87, 5, 83, 0, 0, 87, 12, 1, 0, 0, 0, 88, 89, 5, 67, 0, 0, 89, 90, 5,
66, 0, 0, 90, 91, 5, 70, 0, 0, 91, 14, 1, 0, 0, 0, 92, 93, 5, 83, 0, 0,
93, 94, 5, 69, 0, 0, 94, 95, 5, 76, 0, 0, 95, 96, 5, 69, 0, 0, 96, 97,
5, 67, 0, 0, 97, 98, 5, 84, 0, 0, 98, 16, 1, 0, 0, 0, 99, 100, 5, 70, 0,
0, 100, 101, 5, 82, 0, 0, 101, 102, 5, 79, 0, 0, 102, 103, 5, 77, 0, 0,
103, 18, 1, 0, 0, 0, 104, 105, 5, 70, 0, 0, 105, 106, 5, 73, 0, 0, 106,
107, 5, 76, 0, 0, 107, 108, 5, 84, 0, 0, 108, 109, 5, 69, 0, 0, 109, 110,
5, 82, 0, 0, 110, 20, 1, 0, 0, 0, 111, 112, 5, 42, 0, 0, 112, 22, 1, 0,
0, 0, 113, 114, 5, 83, 0, 0, 114, 115, 5, 65, 0, 0, 115, 116, 5, 77, 0,
0, 116, 117, 5, 69, 0, 0, 117, 24, 1, 0, 0, 0, 118, 119, 5, 68, 0, 0, 119,
120, 5, 73, 0, 0, 120, 121, 5, 83, 0, 0, 121, 122, 5, 84, 0, 0, 122, 123,
5, 73, 0, 0, 123, 124, 5, 78, 0, 0, 124, 125, 5, 67, 0, 0, 125, 126, 5,
84, 0, 0, 126, 26, 1, 0, 0, 0, 127, 128, 5, 40, 0, 0, 128, 28, 1, 0, 0,
0, 129, 130, 5, 41, 0, 0, 130, 30, 1, 0, 0, 0, 131, 132, 5, 64, 0, 0, 132,
32, 1, 0, 0, 0, 133, 138, 3, 37, 18, 0, 134, 137, 3, 35, 17, 0, 135, 137,
3, 37, 18, 0, 136, 134, 1, 0, 0, 0, 136, 135, 1, 0, 0, 0, 137, 140, 1,
0, 0, 0, 138, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 34, 1, 0, 0,
0, 140, 138, 1, 0, 0, 0, 141, 142, 7, 0, 0, 0, 142, 36, 1, 0, 0, 0, 143,
144, 7, 1, 0, 0, 144, 38, 1, 0, 0, 0, 145, 149, 7, 2, 0, 0, 146, 148, 3,
35, 17, 0, 147, 146, 1, 0, 0, 0, 148, 151, 1, 0, 0, 0, 149, 147, 1, 0,
0, 0, 149, 150, 1, 0, 0, 0, 150, 40, 1, 0, 0, 0, 151, 149, 1, 0, 0, 0,
152, 153, 5, 48, 0, 0, 153, 42, 1, 0, 0, 0, 154, 159, 5, 34, 0, 0, 155,
158, 3, 45, 22, 0, 156, 158, 3, 53, 26, 0, 157, 155, 1, 0, 0, 0, 157, 156,
1, 0, 0, 0, 158, 161, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 159, 160, 1, 0,
0, 0, 160, 162, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 162, 173, 5, 34, 0, 0,
163, 168, 5, 39, 0, 0, 164, 167, 3, 45, 22, 0, 165, 167, 3, 51, 25, 0,
166, 164, 1, 0, 0, 0, 166, 165, 1, 0, 0, 0, 167, 170, 1, 0, 0, 0, 168,
166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 171, 1, 0, 0, 0, 170, 168,
1, 0, 0, 0, 171, 173, 5, 39, 0, 0, 172, 154, 1, 0, 0, 0, 172, 163, 1, 0,
0, 0, 173, 44, 1, 0, 0, 0, 174, 177, 5, 92, 0, 0, 175, 178, 7, 3, 0, 0,
176, 178, 3, 47, 23, 0, 177, 175, 1, 0, 0, 0, 177, 176, 1, 0, 0, 0, 178,
46, 1, 0, 0, 0, 179, 180, 5, 117, 0, 0, 180, 181, 3, 49, 24, 0, 181, 182,
3, 49, 24, 0, 182, 183, 3, 49, 24, 0, 183, 184, 3, 49, 24, 0, 184, 48,
1, 0, 0, 0, 185, 186, 7, 4, 0, 0, 186, 50, 1, 0, 0, 0, 187, 188, 8, 5,
0, 0, 188, 52, 1, 0, 0, 0, 189, 190, 8, 6, 0, 0, 190, 54, 1, 0, 0, 0, 191,
193, 7, 7, 0, 0, 192, 191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 192,
1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 197, 6, 27,
0, 0, 197, 56, 1, 0, 0, 0, 12, 0, 76, 136, 138, 149, 157, 159, 166, 168,
172, 177, 194, 1, 6, 0, 0,
2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 83, 8, 3, 1, 4, 1, 4, 1, 4, 1,
4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1,
8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1,
10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12,
1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1,
13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 5, 17,
143, 8, 17, 10, 17, 12, 17, 146, 9, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1,
20, 1, 20, 5, 20, 154, 8, 20, 10, 20, 12, 20, 157, 9, 20, 1, 21, 1, 21,
1, 22, 1, 22, 1, 22, 5, 22, 164, 8, 22, 10, 22, 12, 22, 167, 9, 22, 1,
22, 1, 22, 1, 22, 1, 22, 5, 22, 173, 8, 22, 10, 22, 12, 22, 176, 9, 22,
1, 22, 3, 22, 179, 8, 22, 1, 23, 1, 23, 1, 23, 3, 23, 184, 8, 23, 1, 24,
1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1,
27, 1, 28, 4, 28, 199, 8, 28, 11, 28, 12, 28, 200, 1, 28, 1, 28, 0, 0,
29, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21,
11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 0, 39,
0, 41, 19, 43, 20, 45, 21, 47, 0, 49, 0, 51, 0, 53, 0, 55, 0, 57, 22, 1,
0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0,
34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116,
116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0,
0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 211, 0, 1, 1, 0, 0,
0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0,
0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0,
0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1,
0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33,
1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0,
45, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 1, 59, 1, 0, 0, 0, 3, 63, 1, 0, 0, 0,
5, 67, 1, 0, 0, 0, 7, 82, 1, 0, 0, 0, 9, 84, 1, 0, 0, 0, 11, 88, 1, 0,
0, 0, 13, 91, 1, 0, 0, 0, 15, 94, 1, 0, 0, 0, 17, 98, 1, 0, 0, 0, 19, 105,
1, 0, 0, 0, 21, 110, 1, 0, 0, 0, 23, 117, 1, 0, 0, 0, 25, 119, 1, 0, 0,
0, 27, 124, 1, 0, 0, 0, 29, 133, 1, 0, 0, 0, 31, 135, 1, 0, 0, 0, 33, 137,
1, 0, 0, 0, 35, 139, 1, 0, 0, 0, 37, 147, 1, 0, 0, 0, 39, 149, 1, 0, 0,
0, 41, 151, 1, 0, 0, 0, 43, 158, 1, 0, 0, 0, 45, 178, 1, 0, 0, 0, 47, 180,
1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 191, 1, 0, 0, 0, 53, 193, 1, 0, 0,
0, 55, 195, 1, 0, 0, 0, 57, 198, 1, 0, 0, 0, 59, 60, 5, 78, 0, 0, 60, 61,
5, 79, 0, 0, 61, 62, 5, 84, 0, 0, 62, 2, 1, 0, 0, 0, 63, 64, 5, 65, 0,
0, 64, 65, 5, 78, 0, 0, 65, 66, 5, 68, 0, 0, 66, 4, 1, 0, 0, 0, 67, 68,
5, 79, 0, 0, 68, 69, 5, 82, 0, 0, 69, 6, 1, 0, 0, 0, 70, 71, 5, 69, 0,
0, 71, 83, 5, 81, 0, 0, 72, 73, 5, 78, 0, 0, 73, 83, 5, 69, 0, 0, 74, 75,
5, 71, 0, 0, 75, 83, 5, 69, 0, 0, 76, 77, 5, 71, 0, 0, 77, 83, 5, 84, 0,
0, 78, 79, 5, 76, 0, 0, 79, 83, 5, 84, 0, 0, 80, 81, 5, 76, 0, 0, 81, 83,
5, 69, 0, 0, 82, 70, 1, 0, 0, 0, 82, 72, 1, 0, 0, 0, 82, 74, 1, 0, 0, 0,
82, 76, 1, 0, 0, 0, 82, 78, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 83, 8, 1, 0,
0, 0, 84, 85, 5, 82, 0, 0, 85, 86, 5, 69, 0, 0, 86, 87, 5, 80, 0, 0, 87,
10, 1, 0, 0, 0, 88, 89, 5, 73, 0, 0, 89, 90, 5, 78, 0, 0, 90, 12, 1, 0,
0, 0, 91, 92, 5, 65, 0, 0, 92, 93, 5, 83, 0, 0, 93, 14, 1, 0, 0, 0, 94,
95, 5, 67, 0, 0, 95, 96, 5, 66, 0, 0, 96, 97, 5, 70, 0, 0, 97, 16, 1, 0,
0, 0, 98, 99, 5, 83, 0, 0, 99, 100, 5, 69, 0, 0, 100, 101, 5, 76, 0, 0,
101, 102, 5, 69, 0, 0, 102, 103, 5, 67, 0, 0, 103, 104, 5, 84, 0, 0, 104,
18, 1, 0, 0, 0, 105, 106, 5, 70, 0, 0, 106, 107, 5, 82, 0, 0, 107, 108,
5, 79, 0, 0, 108, 109, 5, 77, 0, 0, 109, 20, 1, 0, 0, 0, 110, 111, 5, 70,
0, 0, 111, 112, 5, 73, 0, 0, 112, 113, 5, 76, 0, 0, 113, 114, 5, 84, 0,
0, 114, 115, 5, 69, 0, 0, 115, 116, 5, 82, 0, 0, 116, 22, 1, 0, 0, 0, 117,
118, 5, 42, 0, 0, 118, 24, 1, 0, 0, 0, 119, 120, 5, 83, 0, 0, 120, 121,
5, 65, 0, 0, 121, 122, 5, 77, 0, 0, 122, 123, 5, 69, 0, 0, 123, 26, 1,
0, 0, 0, 124, 125, 5, 68, 0, 0, 125, 126, 5, 73, 0, 0, 126, 127, 5, 83,
0, 0, 127, 128, 5, 84, 0, 0, 128, 129, 5, 73, 0, 0, 129, 130, 5, 78, 0,
0, 130, 131, 5, 67, 0, 0, 131, 132, 5, 84, 0, 0, 132, 28, 1, 0, 0, 0, 133,
134, 5, 40, 0, 0, 134, 30, 1, 0, 0, 0, 135, 136, 5, 41, 0, 0, 136, 32,
1, 0, 0, 0, 137, 138, 5, 64, 0, 0, 138, 34, 1, 0, 0, 0, 139, 144, 3, 39,
19, 0, 140, 143, 3, 37, 18, 0, 141, 143, 3, 39, 19, 0, 142, 140, 1, 0,
0, 0, 142, 141, 1, 0, 0, 0, 143, 146, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0,
144, 145, 1, 0, 0, 0, 145, 36, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 148,
7, 0, 0, 0, 148, 38, 1, 0, 0, 0, 149, 150, 7, 1, 0, 0, 150, 40, 1, 0, 0,
0, 151, 155, 7, 2, 0, 0, 152, 154, 3, 37, 18, 0, 153, 152, 1, 0, 0, 0,
154, 157, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156,
42, 1, 0, 0, 0, 157, 155, 1, 0, 0, 0, 158, 159, 5, 48, 0, 0, 159, 44, 1,
0, 0, 0, 160, 165, 5, 34, 0, 0, 161, 164, 3, 47, 23, 0, 162, 164, 3, 55,
27, 0, 163, 161, 1, 0, 0, 0, 163, 162, 1, 0, 0, 0, 164, 167, 1, 0, 0, 0,
165, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 168, 1, 0, 0, 0, 167,
165, 1, 0, 0, 0, 168, 179, 5, 34, 0, 0, 169, 174, 5, 39, 0, 0, 170, 173,
3, 47, 23, 0, 171, 173, 3, 53, 26, 0, 172, 170, 1, 0, 0, 0, 172, 171, 1,
0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 175, 1, 0, 0,
0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 177, 179, 5, 39, 0, 0, 178,
160, 1, 0, 0, 0, 178, 169, 1, 0, 0, 0, 179, 46, 1, 0, 0, 0, 180, 183, 5,
92, 0, 0, 181, 184, 7, 3, 0, 0, 182, 184, 3, 49, 24, 0, 183, 181, 1, 0,
0, 0, 183, 182, 1, 0, 0, 0, 184, 48, 1, 0, 0, 0, 185, 186, 5, 117, 0, 0,
186, 187, 3, 51, 25, 0, 187, 188, 3, 51, 25, 0, 188, 189, 3, 51, 25, 0,
189, 190, 3, 51, 25, 0, 190, 50, 1, 0, 0, 0, 191, 192, 7, 4, 0, 0, 192,
52, 1, 0, 0, 0, 193, 194, 8, 5, 0, 0, 194, 54, 1, 0, 0, 0, 195, 196, 8,
6, 0, 0, 196, 56, 1, 0, 0, 0, 197, 199, 7, 7, 0, 0, 198, 197, 1, 0, 0,
0, 199, 200, 1, 0, 0, 0, 200, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201,
202, 1, 0, 0, 0, 202, 203, 6, 28, 0, 0, 203, 58, 1, 0, 0, 0, 12, 0, 82,
142, 144, 155, 163, 165, 172, 174, 178, 183, 200, 1, 6, 0, 0,
}
deserializer := antlr.NewATNDeserializer(nil)
staticData.atn = deserializer.Deserialize(staticData.serializedATN)
@ -189,25 +190,26 @@ func NewQueryLexer(input antlr.CharStream) *QueryLexer {
// QueryLexer tokens.
const (
QueryLexerAND_OP = 1
QueryLexerOR_OP = 2
QueryLexerSIMPLE_OP = 3
QueryLexerREP = 4
QueryLexerIN = 5
QueryLexerAS = 6
QueryLexerCBF = 7
QueryLexerSELECT = 8
QueryLexerFROM = 9
QueryLexerFILTER = 10
QueryLexerWILDCARD = 11
QueryLexerCLAUSE_SAME = 12
QueryLexerCLAUSE_DISTINCT = 13
QueryLexerL_PAREN = 14
QueryLexerR_PAREN = 15
QueryLexerAT = 16
QueryLexerIDENT = 17
QueryLexerNUMBER1 = 18
QueryLexerZERO = 19
QueryLexerSTRING = 20
QueryLexerWS = 21
QueryLexerNOT_OP = 1
QueryLexerAND_OP = 2
QueryLexerOR_OP = 3
QueryLexerSIMPLE_OP = 4
QueryLexerREP = 5
QueryLexerIN = 6
QueryLexerAS = 7
QueryLexerCBF = 8
QueryLexerSELECT = 9
QueryLexerFROM = 10
QueryLexerFILTER = 11
QueryLexerWILDCARD = 12
QueryLexerCLAUSE_SAME = 13
QueryLexerCLAUSE_DISTINCT = 14
QueryLexerL_PAREN = 15
QueryLexerR_PAREN = 16
QueryLexerAT = 17
QueryLexerIDENT = 18
QueryLexerNUMBER1 = 19
QueryLexerZERO = 20
QueryLexerSTRING = 21
QueryLexerWS = 22
)

View file

@ -1,5 +1,3 @@
// Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT.
package parser // Query
import (
@ -33,14 +31,14 @@ var QueryParserStaticData struct {
func queryParserInit() {
staticData := &QueryParserStaticData
staticData.LiteralNames = []string{
"", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", "'SELECT'",
"'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", "')'", "'@'",
"", "", "'0'",
"", "'NOT'", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'",
"'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('",
"')'", "'@'", "", "", "'0'",
}
staticData.SymbolicNames = []string{
"", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT",
"FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN",
"R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS",
"", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF",
"SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT",
"L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS",
}
staticData.RuleNames = []string{
"policy", "repStmt", "cbfStmt", "selectStmt", "clause", "filterExpr",
@ -49,60 +47,62 @@ func queryParserInit() {
}
staticData.PredictionContextCache = antlr.NewPredictionContextCache()
staticData.serializedATN = []int32{
4, 1, 21, 130, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7,
4, 1, 22, 135, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7,
4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7,
10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 4, 0, 30, 8, 0, 11,
0, 12, 0, 31, 1, 0, 3, 0, 35, 8, 0, 1, 0, 5, 0, 38, 8, 0, 10, 0, 12, 0,
41, 9, 0, 1, 0, 5, 0, 44, 8, 0, 10, 0, 12, 0, 47, 9, 0, 1, 0, 1, 0, 1,
1, 1, 1, 1, 1, 1, 1, 3, 1, 55, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3,
1, 3, 3, 3, 64, 8, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3,
3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 83,
8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 91, 8, 5, 10, 5, 12, 5,
94, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1,
7, 3, 7, 107, 8, 7, 1, 8, 1, 8, 3, 8, 111, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9,
116, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 124, 8, 12,
1, 13, 1, 13, 3, 13, 128, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10,
12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, 12, 13, 1, 0, 18, 19, 2, 0,
4, 6, 8, 10, 132, 0, 29, 1, 0, 0, 0, 2, 50, 1, 0, 0, 0, 4, 56, 1, 0, 0,
0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, 82, 1, 0, 0, 0, 12, 95, 1,
0, 0, 0, 14, 106, 1, 0, 0, 0, 16, 110, 1, 0, 0, 0, 18, 115, 1, 0, 0, 0,
20, 117, 1, 0, 0, 0, 22, 119, 1, 0, 0, 0, 24, 123, 1, 0, 0, 0, 26, 127,
1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0,
31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3,
4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 39, 1, 0, 0, 0, 36,
38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0,
0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 42, 44,
3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0,
45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 48, 49, 5,
0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 4, 0, 0, 51, 54, 5, 18, 0, 0, 52,
53, 5, 5, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0,
0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 7, 0, 0, 57, 58, 5, 18, 0, 0, 58, 5,
1, 0, 0, 0, 59, 60, 5, 8, 0, 0, 60, 66, 5, 18, 0, 0, 61, 63, 5, 5, 0, 0,
62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 1,
0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0,
67, 68, 1, 0, 0, 0, 68, 69, 5, 9, 0, 0, 69, 72, 3, 26, 13, 0, 70, 71, 5,
6, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0,
73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, 9, 1, 0, 0, 0, 76, 77, 6, 5,
-1, 0, 77, 78, 5, 14, 0, 0, 78, 79, 3, 10, 5, 0, 79, 80, 5, 15, 0, 0, 80,
83, 1, 0, 0, 0, 81, 83, 3, 14, 7, 0, 82, 76, 1, 0, 0, 0, 82, 81, 1, 0,
0, 0, 83, 92, 1, 0, 0, 0, 84, 85, 10, 4, 0, 0, 85, 86, 5, 1, 0, 0, 86,
91, 3, 10, 5, 5, 87, 88, 10, 3, 0, 0, 88, 89, 5, 2, 0, 0, 89, 91, 3, 10,
5, 4, 90, 84, 1, 0, 0, 0, 90, 87, 1, 0, 0, 0, 91, 94, 1, 0, 0, 0, 92, 90,
1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 11, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0,
95, 96, 5, 10, 0, 0, 96, 97, 3, 10, 5, 0, 97, 98, 5, 6, 0, 0, 98, 99, 3,
24, 12, 0, 99, 13, 1, 0, 0, 0, 100, 101, 5, 16, 0, 0, 101, 107, 3, 24,
12, 0, 102, 103, 3, 16, 8, 0, 103, 104, 5, 3, 0, 0, 104, 105, 3, 18, 9,
0, 105, 107, 1, 0, 0, 0, 106, 100, 1, 0, 0, 0, 106, 102, 1, 0, 0, 0, 107,
15, 1, 0, 0, 0, 108, 111, 3, 24, 12, 0, 109, 111, 5, 20, 0, 0, 110, 108,
1, 0, 0, 0, 110, 109, 1, 0, 0, 0, 111, 17, 1, 0, 0, 0, 112, 116, 3, 24,
12, 0, 113, 116, 3, 20, 10, 0, 114, 116, 5, 20, 0, 0, 115, 112, 1, 0, 0,
0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 19, 1, 0, 0, 0, 117,
118, 7, 1, 0, 0, 118, 21, 1, 0, 0, 0, 119, 120, 7, 2, 0, 0, 120, 23, 1,
0, 0, 0, 121, 124, 3, 22, 11, 0, 122, 124, 5, 17, 0, 0, 123, 121, 1, 0,
0, 0, 123, 122, 1, 0, 0, 0, 124, 25, 1, 0, 0, 0, 125, 128, 3, 24, 12, 0,
126, 128, 5, 11, 0, 0, 127, 125, 1, 0, 0, 0, 127, 126, 1, 0, 0, 0, 128,
27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72, 82, 90, 92, 106, 110,
115, 123, 127,
3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5,
1, 5, 1, 5, 1, 5, 3, 5, 88, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5,
5, 96, 8, 5, 10, 5, 12, 5, 99, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7,
1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 112, 8, 7, 1, 8, 1, 8, 3, 8, 116, 8,
8, 1, 9, 1, 9, 1, 9, 3, 9, 121, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12,
1, 12, 3, 12, 129, 8, 12, 1, 13, 1, 13, 3, 13, 133, 8, 13, 1, 13, 0, 1,
10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0,
13, 14, 1, 0, 19, 20, 2, 0, 5, 7, 9, 11, 138, 0, 29, 1, 0, 0, 0, 2, 50,
1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10,
87, 1, 0, 0, 0, 12, 100, 1, 0, 0, 0, 14, 111, 1, 0, 0, 0, 16, 115, 1, 0,
0, 0, 18, 120, 1, 0, 0, 0, 20, 122, 1, 0, 0, 0, 22, 124, 1, 0, 0, 0, 24,
128, 1, 0, 0, 0, 26, 132, 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0,
0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34,
1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0,
35, 39, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1,
0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41,
39, 1, 0, 0, 0, 42, 44, 3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0,
0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45,
1, 0, 0, 0, 48, 49, 5, 0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 5, 0, 0,
51, 54, 5, 19, 0, 0, 52, 53, 5, 6, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52,
1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 8, 0, 0,
57, 58, 5, 19, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 5, 9, 0, 0, 60, 66, 5,
19, 0, 0, 61, 63, 5, 6, 0, 0, 62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63,
64, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0,
0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 69, 5, 10, 0, 0, 69,
72, 3, 26, 13, 0, 70, 71, 5, 7, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1,
0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75,
9, 1, 0, 0, 0, 76, 77, 6, 5, -1, 0, 77, 78, 5, 1, 0, 0, 78, 79, 5, 15,
0, 0, 79, 80, 3, 10, 5, 0, 80, 81, 5, 16, 0, 0, 81, 88, 1, 0, 0, 0, 82,
83, 5, 15, 0, 0, 83, 84, 3, 10, 5, 0, 84, 85, 5, 16, 0, 0, 85, 88, 1, 0,
0, 0, 86, 88, 3, 14, 7, 0, 87, 76, 1, 0, 0, 0, 87, 82, 1, 0, 0, 0, 87,
86, 1, 0, 0, 0, 88, 97, 1, 0, 0, 0, 89, 90, 10, 4, 0, 0, 90, 91, 5, 2,
0, 0, 91, 96, 3, 10, 5, 5, 92, 93, 10, 3, 0, 0, 93, 94, 5, 3, 0, 0, 94,
96, 3, 10, 5, 4, 95, 89, 1, 0, 0, 0, 95, 92, 1, 0, 0, 0, 96, 99, 1, 0,
0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 11, 1, 0, 0, 0, 99, 97,
1, 0, 0, 0, 100, 101, 5, 11, 0, 0, 101, 102, 3, 10, 5, 0, 102, 103, 5,
7, 0, 0, 103, 104, 3, 24, 12, 0, 104, 13, 1, 0, 0, 0, 105, 106, 5, 17,
0, 0, 106, 112, 3, 24, 12, 0, 107, 108, 3, 16, 8, 0, 108, 109, 5, 4, 0,
0, 109, 110, 3, 18, 9, 0, 110, 112, 1, 0, 0, 0, 111, 105, 1, 0, 0, 0, 111,
107, 1, 0, 0, 0, 112, 15, 1, 0, 0, 0, 113, 116, 3, 24, 12, 0, 114, 116,
5, 21, 0, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 17, 1, 0,
0, 0, 117, 121, 3, 24, 12, 0, 118, 121, 3, 20, 10, 0, 119, 121, 5, 21,
0, 0, 120, 117, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 119, 1, 0, 0, 0,
121, 19, 1, 0, 0, 0, 122, 123, 7, 1, 0, 0, 123, 21, 1, 0, 0, 0, 124, 125,
7, 2, 0, 0, 125, 23, 1, 0, 0, 0, 126, 129, 3, 22, 11, 0, 127, 129, 5, 18,
0, 0, 128, 126, 1, 0, 0, 0, 128, 127, 1, 0, 0, 0, 129, 25, 1, 0, 0, 0,
130, 133, 3, 24, 12, 0, 131, 133, 5, 12, 0, 0, 132, 130, 1, 0, 0, 0, 132,
131, 1, 0, 0, 0, 133, 27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72,
87, 95, 97, 111, 115, 120, 128, 132,
}
deserializer := antlr.NewATNDeserializer(nil)
staticData.atn = deserializer.Deserialize(staticData.serializedATN)
@ -141,27 +141,28 @@ func NewQuery(input antlr.TokenStream) *Query {
// Query tokens.
const (
QueryEOF = antlr.TokenEOF
QueryAND_OP = 1
QueryOR_OP = 2
QuerySIMPLE_OP = 3
QueryREP = 4
QueryIN = 5
QueryAS = 6
QueryCBF = 7
QuerySELECT = 8
QueryFROM = 9
QueryFILTER = 10
QueryWILDCARD = 11
QueryCLAUSE_SAME = 12
QueryCLAUSE_DISTINCT = 13
QueryL_PAREN = 14
QueryR_PAREN = 15
QueryAT = 16
QueryIDENT = 17
QueryNUMBER1 = 18
QueryZERO = 19
QuerySTRING = 20
QueryWS = 21
QueryNOT_OP = 1
QueryAND_OP = 2
QueryOR_OP = 3
QuerySIMPLE_OP = 4
QueryREP = 5
QueryIN = 6
QueryAS = 7
QueryCBF = 8
QuerySELECT = 9
QueryFROM = 10
QueryFILTER = 11
QueryWILDCARD = 12
QueryCLAUSE_SAME = 13
QueryCLAUSE_DISTINCT = 14
QueryL_PAREN = 15
QueryR_PAREN = 16
QueryAT = 17
QueryIDENT = 18
QueryNUMBER1 = 19
QueryZERO = 20
QuerySTRING = 21
QueryWS = 22
)
// Query rules.
@ -1265,6 +1266,7 @@ type IFilterExprContext interface {
// Getter signatures
L_PAREN() antlr.TerminalNode
R_PAREN() antlr.TerminalNode
NOT_OP() antlr.TerminalNode
AllFilterExpr() []IFilterExprContext
FilterExpr(i int) IFilterExprContext
Expr() IExprContext
@ -1279,8 +1281,8 @@ type FilterExprContext struct {
antlr.BaseParserRuleContext
parser antlr.Parser
F1 IFilterExprContext
Inner IFilterExprContext
Op antlr.Token
Inner IFilterExprContext
F2 IFilterExprContext
}
@ -1335,6 +1337,10 @@ func (s *FilterExprContext) R_PAREN() antlr.TerminalNode {
return s.GetToken(QueryR_PAREN, 0)
}
func (s *FilterExprContext) NOT_OP() antlr.TerminalNode {
return s.GetToken(QueryNOT_OP, 0)
}
func (s *FilterExprContext) AllFilterExpr() []IFilterExprContext {
children := s.GetChildren()
len := 0
@ -1434,17 +1440,20 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
var _alt int
p.EnterOuterAlt(localctx, 1)
p.SetState(82)
p.SetState(87)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
}
switch p.GetTokenStream().LA(1) {
case QueryL_PAREN:
case QueryNOT_OP:
{
p.SetState(77)
p.Match(QueryL_PAREN)
var _m = p.Match(QueryNOT_OP)
localctx.(*FilterExprContext).Op = _m
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -1452,13 +1461,46 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
}
{
p.SetState(78)
p.Match(QueryL_PAREN)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(79)
var _x = p.filterExpr(0)
localctx.(*FilterExprContext).F1 = _x
}
{
p.SetState(80)
p.Match(QueryR_PAREN)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
case QueryL_PAREN:
{
p.SetState(82)
p.Match(QueryL_PAREN)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(83)
var _x = p.filterExpr(0)
localctx.(*FilterExprContext).Inner = _x
}
{
p.SetState(79)
p.SetState(84)
p.Match(QueryR_PAREN)
if p.HasError() {
// Recognition error - abort rule
@ -1468,7 +1510,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryAT, QueryIDENT, QuerySTRING:
{
p.SetState(81)
p.SetState(86)
p.Expr()
}
@ -1477,7 +1519,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
goto errorExit
}
p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1))
p.SetState(92)
p.SetState(97)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -1492,7 +1534,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
p.TriggerExitRuleEvent()
}
_prevctx = localctx
p.SetState(90)
p.SetState(95)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -1503,14 +1545,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
localctx = NewFilterExprContext(p, _parentctx, _parentState)
localctx.(*FilterExprContext).F1 = _prevctx
p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr)
p.SetState(84)
p.SetState(89)
if !(p.Precpred(p.GetParserRuleContext(), 4)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", ""))
goto errorExit
}
{
p.SetState(85)
p.SetState(90)
var _m = p.Match(QueryAND_OP)
@ -1521,7 +1563,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
}
}
{
p.SetState(86)
p.SetState(91)
var _x = p.filterExpr(5)
@ -1532,14 +1574,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
localctx = NewFilterExprContext(p, _parentctx, _parentState)
localctx.(*FilterExprContext).F1 = _prevctx
p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr)
p.SetState(87)
p.SetState(92)
if !(p.Precpred(p.GetParserRuleContext(), 3)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", ""))
goto errorExit
}
{
p.SetState(88)
p.SetState(93)
var _m = p.Match(QueryOR_OP)
@ -1550,7 +1592,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
}
}
{
p.SetState(89)
p.SetState(94)
var _x = p.filterExpr(4)
@ -1562,7 +1604,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
}
}
p.SetState(94)
p.SetState(99)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -1720,7 +1762,7 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) {
p.EnterRule(localctx, 12, QueryRULE_filterStmt)
p.EnterOuterAlt(localctx, 1)
{
p.SetState(95)
p.SetState(100)
p.Match(QueryFILTER)
if p.HasError() {
// Recognition error - abort rule
@ -1728,14 +1770,14 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) {
}
}
{
p.SetState(96)
p.SetState(101)
var _x = p.filterExpr(0)
localctx.(*FilterStmtContext).Expr = _x
}
{
p.SetState(97)
p.SetState(102)
p.Match(QueryAS)
if p.HasError() {
// Recognition error - abort rule
@ -1743,7 +1785,7 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) {
}
}
{
p.SetState(98)
p.SetState(103)
var _x = p.Ident()
@ -1923,7 +1965,7 @@ func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
func (p *Query) Expr() (localctx IExprContext) {
localctx = NewExprContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 14, QueryRULE_expr)
p.SetState(106)
p.SetState(111)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -1933,7 +1975,7 @@ func (p *Query) Expr() (localctx IExprContext) {
case QueryAT:
p.EnterOuterAlt(localctx, 1)
{
p.SetState(100)
p.SetState(105)
p.Match(QueryAT)
if p.HasError() {
// Recognition error - abort rule
@ -1941,7 +1983,7 @@ func (p *Query) Expr() (localctx IExprContext) {
}
}
{
p.SetState(101)
p.SetState(106)
var _x = p.Ident()
@ -1951,14 +1993,14 @@ func (p *Query) Expr() (localctx IExprContext) {
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT, QuerySTRING:
p.EnterOuterAlt(localctx, 2)
{
p.SetState(102)
p.SetState(107)
var _x = p.FilterKey()
localctx.(*ExprContext).Key = _x
}
{
p.SetState(103)
p.SetState(108)
p.Match(QuerySIMPLE_OP)
if p.HasError() {
// Recognition error - abort rule
@ -1966,7 +2008,7 @@ func (p *Query) Expr() (localctx IExprContext) {
}
}
{
p.SetState(104)
p.SetState(109)
var _x = p.FilterValue()
@ -2079,7 +2121,7 @@ func (s *FilterKeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
func (p *Query) FilterKey() (localctx IFilterKeyContext) {
localctx = NewFilterKeyContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 16, QueryRULE_filterKey)
p.SetState(110)
p.SetState(115)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -2089,14 +2131,14 @@ func (p *Query) FilterKey() (localctx IFilterKeyContext) {
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT:
p.EnterOuterAlt(localctx, 1)
{
p.SetState(108)
p.SetState(113)
p.Ident()
}
case QuerySTRING:
p.EnterOuterAlt(localctx, 2)
{
p.SetState(109)
p.SetState(114)
p.Match(QuerySTRING)
if p.HasError() {
// Recognition error - abort rule
@ -2227,7 +2269,7 @@ func (s *FilterValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{}
func (p *Query) FilterValue() (localctx IFilterValueContext) {
localctx = NewFilterValueContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 18, QueryRULE_filterValue)
p.SetState(115)
p.SetState(120)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -2237,21 +2279,21 @@ func (p *Query) FilterValue() (localctx IFilterValueContext) {
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT:
p.EnterOuterAlt(localctx, 1)
{
p.SetState(112)
p.SetState(117)
p.Ident()
}
case QueryNUMBER1, QueryZERO:
p.EnterOuterAlt(localctx, 2)
{
p.SetState(113)
p.SetState(118)
p.Number()
}
case QuerySTRING:
p.EnterOuterAlt(localctx, 3)
{
p.SetState(114)
p.SetState(119)
p.Match(QuerySTRING)
if p.HasError() {
// Recognition error - abort rule
@ -2357,7 +2399,7 @@ func (p *Query) Number() (localctx INumberContext) {
p.EnterOuterAlt(localctx, 1)
{
p.SetState(117)
p.SetState(122)
_la = p.GetTokenStream().LA(1)
if !(_la == QueryNUMBER1 || _la == QueryZERO) {
@ -2481,10 +2523,10 @@ func (p *Query) Keyword() (localctx IKeywordContext) {
p.EnterOuterAlt(localctx, 1)
{
p.SetState(119)
p.SetState(124)
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1904) != 0) {
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3808) != 0) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
@ -2593,7 +2635,7 @@ func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
func (p *Query) Ident() (localctx IIdentContext) {
localctx = NewIdentContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 24, QueryRULE_ident)
p.SetState(123)
p.SetState(128)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -2603,14 +2645,14 @@ func (p *Query) Ident() (localctx IIdentContext) {
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER:
p.EnterOuterAlt(localctx, 1)
{
p.SetState(121)
p.SetState(126)
p.Keyword()
}
case QueryIDENT:
p.EnterOuterAlt(localctx, 2)
{
p.SetState(122)
p.SetState(127)
p.Match(QueryIDENT)
if p.HasError() {
// Recognition error - abort rule
@ -2724,7 +2766,7 @@ func (s *IdentWCContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
func (p *Query) IdentWC() (localctx IIdentWCContext) {
localctx = NewIdentWCContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 26, QueryRULE_identWC)
p.SetState(127)
p.SetState(132)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -2734,14 +2776,14 @@ func (p *Query) IdentWC() (localctx IIdentWCContext) {
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT:
p.EnterOuterAlt(localctx, 1)
{
p.SetState(125)
p.SetState(130)
p.Ident()
}
case QueryWILDCARD:
p.EnterOuterAlt(localctx, 2)
{
p.SetState(126)
p.SetState(131)
p.Match(QueryWILDCARD)
if p.HasError() {
// Recognition error - abort rule

View file

@ -1,5 +1,3 @@
// Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT.
package parser // Query
import "github.com/antlr4-go/antlr/v4"

View file

@ -464,6 +464,21 @@ func writeFilterStringTo(w io.StringWriter, f netmap.Filter) error {
}
inner := f.GetFilters()
if op == netmap.NOT {
_, err = w.WriteString(op.String() + " (")
if err != nil {
return err
}
err = writeFilterStringTo(w, inner[0])
if err != nil {
return err
}
_, err = w.WriteString(")")
if err != nil {
return err
}
} else {
for i := range inner {
if i != 0 {
_, err = w.WriteString(" " + op.String() + " ")
@ -471,12 +486,12 @@ func writeFilterStringTo(w io.StringWriter, f netmap.Filter) error {
return err
}
}
err = writeFilterStringTo(w, inner[i])
if err != nil {
return err
}
}
}
if s = f.GetName(); s != "" && !unspecified {
_, err = w.WriteString(" AS " + s)
@ -671,6 +686,12 @@ func (p *policyVisitor) VisitFilterExpr(ctx *parser.FilterExprContext) any {
op := operationFromString(ctx.GetOp().GetText())
f.SetOp(op)
if op == netmap.NOT {
f1 := *ctx.GetF1().Accept(p).(*netmap.Filter)
f.SetFilters([]netmap.Filter{f1})
return f
}
f1 := *ctx.GetF1().Accept(p).(*netmap.Filter)
f2 := *ctx.GetF2().Accept(p).(*netmap.Filter)

View file

@ -23,6 +23,10 @@ FILTER @FromRU AND Rating GT 7 AS Good`,
`REP 7 IN SPB
SELECT 1 IN City FROM SPBSSD AS SPB
FILTER City EQ SPB AND SSD EQ true OR City EQ SPB AND Rating GE 5 AS SPBSSD`,
`REP 7 IN SPB
SELECT 1 IN City FROM SPBSSD AS SPB
FILTER NOT (NOT (City EQ SPB) AND SSD EQ true OR City EQ SPB AND Rating GE 5) AS SPBSSD`,
}
var p PlacementPolicy

View file

@ -244,6 +244,57 @@ func TestPlacementPolicy_ProcessSelectors(t *testing.T) {
}
}
func TestPlacementPolicy_ProcessSelectorsExceptForNodes(t *testing.T) {
p := newPlacementPolicy(1, nil,
[]Selector{
newSelector("ExceptRU", "City", 2, "ExceptRU", (*Selector).SelectSame),
},
[]Filter{
newFilter("ExceptRU", "", "", netmap.NOT,
newFilter("", "", "", netmap.AND,
newFilter("", "City", "Lyon", netmap.EQ),
newFilter("", "Rating", "10", netmap.LE),
),
),
})
nodes := []NodeInfo{
nodeInfoFromAttributes("Country", "Germany", "Rating", "1", "City", "Berlin"),
nodeInfoFromAttributes("Country", "Germany", "Rating", "5", "City", "Berlin"),
nodeInfoFromAttributes("Country", "Russia", "Rating", "6", "City", "Moscow"),
nodeInfoFromAttributes("Country", "France", "Rating", "4", "City", "Paris"),
nodeInfoFromAttributes("Country", "France", "Rating", "1", "City", "Lyon"),
nodeInfoFromAttributes("Country", "France", "Rating", "5", "City", "Lyon"),
nodeInfoFromAttributes("Country", "Russia", "Rating", "7", "City", "Moscow"),
nodeInfoFromAttributes("Country", "Germany", "Rating", "3", "City", "Darmstadt"),
nodeInfoFromAttributes("Country", "Germany", "Rating", "7", "City", "Frankfurt"),
nodeInfoFromAttributes("Country", "Russia", "Rating", "9", "City", "SPB"),
nodeInfoFromAttributes("Country", "Russia", "Rating", "9", "City", "SPB"),
}
var nm NetMap
nm.SetNodes(nodes)
c := newContext(nm)
c.setCBF(p.backupFactor)
require.NoError(t, c.processFilters(p))
require.NoError(t, c.processSelectors(p))
for _, s := range p.selectors {
sel := c.selections[s.GetName()]
s := c.processedSelectors[s.GetName()]
bucketCount, nodesInBucket := calcNodesCount(*s)
nodesInBucket *= int(c.cbf)
targ := fmt.Sprintf("selector '%s'", s.GetName())
require.Equal(t, bucketCount, len(sel), targ)
fName := s.GetFilter()
for _, res := range sel {
require.Equal(t, nodesInBucket, len(res), targ)
for j := range res {
require.True(t, fName == mainFilterName || c.match(c.processedFilters[fName], res[j]), targ)
}
}
}
}
func TestSelector_SetName(t *testing.T) {
const name = "some name"
var s Selector