diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-11-05 16:49:20 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-11-05 16:49:20 +0100 |
commit | 63a6651c9d3e74218f3eec1458b7c7f46de0471d (patch) | |
tree | 171ca0f280727cf76587c561c07bb37a7b111092 /config-model/src/main/javacc/SDParser.jj | |
parent | 7e6517d5a039f1f3bc6551ec7baff9616cefa24a (diff) |
- Move blob to LargeRankExpressions and prepare som simplifying DistributableResource and make members final.
Diffstat (limited to 'config-model/src/main/javacc/SDParser.jj')
-rw-r--r-- | config-model/src/main/javacc/SDParser.jj | 57 |
1 files changed, 22 insertions, 35 deletions
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj index fe522494baf..5bcc033fa37 100644 --- a/config-model/src/main/javacc/SDParser.jj +++ b/config-model/src/main/javacc/SDParser.jj @@ -29,6 +29,7 @@ import com.yahoo.documentmodel.*; import com.yahoo.compress.Compressor; import com.yahoo.compress.CompressionType; import com.yahoo.searchdefinition.Application; +import com.yahoo.searchdefinition.DistributableResource; import com.yahoo.searchdefinition.document.*; import com.yahoo.searchdefinition.document.annotation.SDAnnotationType; import com.yahoo.searchdefinition.document.annotation.TemporaryAnnotationReferenceDataType; @@ -1945,8 +1946,8 @@ Object onnxModelItem(OnnxModel onnxModel) : } { ( - (<FILE> <COLON> path = filePath() { } (<NL>)*) { onnxModel.setFileName(path); } | - (<URI> <COLON> path = uriPath() { } (<NL>)*) { onnxModel.setUri(path); } | + (path = fileItem()) { onnxModel.setFileName(path); } | + (path = uriItem()) { onnxModel.setUri(path); } | (<ONNX_INPUT_SL>) { String name = token.image.substring(5, token.image.lastIndexOf(":")).trim(); if (name.startsWith("\"")) { name = name.substring(1, name.length() - 1); } @@ -1973,56 +1974,42 @@ Object onnxModelItem(OnnxModel onnxModel) : void rankingConstant(Schema schema) : { String name; - RankingConstant constant; + String path = null; + DistributableResource.PathType pathType = DistributableResource.PathType.FILE; + TensorType type = null; } { - ( <CONSTANT> name = identifier() - { - constant = new RankingConstant(name); - } - lbrace() (rankingConstantItem(constant) (<NL>)*)+ <RBRACE> ) + ( <CONSTANT> name = identifier() lbrace() + (path = fileItem() { pathType = DistributableResource.PathType.FILE; } + | path = uriItem() { pathType = DistributableResource.PathType.URI; } + | type = tensorTypeWithPrefix(rankingConstantErrorMessage(name)) (<NL>)* + )+ + <RBRACE> + ) { if (documentsOnly) return; - schema.rankingConstants().add(constant); + schema.rankingConstants().add(new RankingConstant(name, type, path, pathType)); } } -/** - * This rule consumes a constant block. - * - * @param constant The constant to modify. - * @return Null. - */ -Object rankingConstantItem(RankingConstant constant) : +String fileItem() : { - String path = null; - TensorType type = null; + String path; } { - ( (<FILE> <COLON> path = filePath() { } (<NL>)*) { constant.setFileName(path); } - | (<URI> <COLON> path = uriPath() { } (<NL>)*) { constant.setUri(path); } - | type = tensorTypeWithPrefix(rankingConstantErrorMessage(constant.getName())) (<NL>)* { constant.setType(type); } - ) - { - return null; - } + (<FILE> <COLON> ( <FILE_PATH> | <STRING> | <IDENTIFIER>) { path = token.image; } { } (<NL>)*) { return path; } } - -String rankingConstantErrorMessage(String name) : {} +String uriItem() : { - { return "For ranking constant ' " + name + "'"; } + String path; } - -String filePath() : { } { - ( <FILE_PATH> | <STRING> | <IDENTIFIER>) - { return token.image; } + (<URI> <COLON> ( <URI_PATH> ) { path = token.image; } (<NL>)*) { return path; } } -String uriPath() : { } +String rankingConstantErrorMessage(String name) : {} { - ( <URI_PATH> ) - { return token.image; } + { return "For ranking constant ' " + name + "'"; } } /** |