Comments (3)
This would be a fairly significant change. The Hyperscan compiler can return a lot of different error messages -- consider everything that can be produced by the parser, for example!
It may also require an ABI change, and we try to limit those as much as possible to allow for easy library upgrades.
We view pretty much any error result from compilation as fatal, and generally the only code we see that needs to retry compilation under any circumstances tends to be prefiltering code that tries for full Hyperscan support first, then switches on HS_FLAG_PREFILTER
for a second attempt if that fails.
Can you describe your application and what you are trying to do as a result of "Pattern too large"? If you're able to share the patterns that you are seeing issues with, we would love to see them with a view to improving pattern support in general.
from hyperscan.
We view pretty much any error result from compilation as fatal, and generally the only code we see that needs to retry compilation under any circumstances tends to be prefiltering code that tries for full Hyperscan support first, then switches on
HS_FLAG_PREFILTER
for a second attempt if that fails.
I want to distinguish two cases:
- pattern is incorrect. Print error message and abort the program.
- Pattern is correct, but too large for Hyperscan. Pass it to other regex library which is slower but accepts the pattern.
Can you describe your application and what you are trying to do as a result of "Pattern too large"? If you're able to share the patterns that you are seeing issues with, we would love to see them with a view to improving pattern support in general.
I uploaded the pattern and the testing tool to gist. The pattern matches post address in Russia. Original pattern (written for other library) is stored in file original-pattern.txt
. Then I applied pattern preprocessor which takes patterns written for that library and produces patterns for hyperscan. I saved the result to processed-pattern.txt
. Hyperscan accepts first pattern, but it fails with "Pattern is too large" on preprocessed pattern. I have to preprocess regexps to achieve compatibility with other regexp library. Syntax and meaning of some character sets in that library differ from ones of Hyperscan, so the only reliable way to use hyperscan in place of that library is to preprocess a pattern. Results of preprocessing reproduce original behaviour precisely, but are sometimes too large for Hyperscan.
from hyperscan.
Thanks for the extra detail. (We will also take a look at this pattern and see what we can do to improve support for it.)
Hyperscan is able to generate a very large number of compile errors, and we would prefer not to lose this expressiveness by hardening them into enums.
Assuming the semantics of both libraries are the same (as you say), are you sure you need to distinguish these cases -- can't you just always fall back to your alternative library if a pattern fails compilation with Hyperscan?
One possibility is that you could call hs_expression_info()
first, which parses the expression and does some preliminary analysis -- this will generate errors for expressions with invalid syntax without going through the full compile process.
from hyperscan.
Related Issues (20)
- Regarding hs_multi_compile and hs_scan functionality HOT 1
- Approximate match (edit distance and hamming distance)
- unit-test failed with '-march=core2' HOT 1
- Question: Would hyperscan benefit from stacked SRAM cache ?
- The issue concerning the presence of "NOT" in logical combinations. HOT 1
- Tjv
- Windows binaries HOT 1
- 'From' parameter on match callback when 'HS_MODE_STREAM' mode always as zero HOT 1
- Numbered repeat doesn't work if the lower number is omitted HOT 1
- mutiple databases use one scratch ,if a delete a database,what can i do for scratch? HOT 1
- is hyperscan abandoned? HOT 4
- encountering problems of "multiple definition of XXX" when compiling hyperscan in centos with x86_64 HOT 1
- QUEDAS_FRIAEscaneo🐧
- Hyperscan panics if bounded repeat is exactly 32767
- memory leak occurs when calling hs_compile
- giving pattern with null to hs_compile_lit_multi HOT 1
- Chimera share Library
- Can parameters limitPatternLength and limitLiteralCount be increased? HOT 1
- Combo pattern fails when operands set singlematch flag and/or max_offset HOT 1
- CMake tests failing when compiling on OpenWrt with external toolchain HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hyperscan.