Coder Social home page Coder Social logo

google / effcee Goto Github PK

View Code? Open in Web Editor NEW
88.0 10.0 37.0 105 KB

Effcee is a C++ library for stateful pattern matching of strings, inspired by LLVM's FileCheck

License: Apache License 2.0

CMake 7.16% C++ 75.04% Starlark 2.04% Python 2.43% Shell 10.22% Batchfile 3.11%
regular-expression testing-tools string-matching

effcee's Issues

Capture variables from successful combination of sub-matches

Hi there (cross-post from re2),

Hopefully not a silly question, but is there a way to capture the variables of all possible matches and perform checks with them?

For example, if I use the following made-up SPIR-V:

    %end = OpVariable %_ptr_Function_int Function
     %15 = OpLoad %int %n
     %16 = OpLoad %int %n
           OpStore %end %16

...the following checks will return false...

const std::string check = R"(
    CHECK:    [[END:%\w+]] = OpVariable
    CHECK: [[LOADED:%\w+]] = OpLoad %int %n
    CHECK:                   OpStore [[END]] [[LOADED]]
)";

...despite OpStore %end %16 being a possibility.

Is there a better syntactical way to capture all possible versions of what LOADED might be and return success if a match is found with one of these versions (instead of stopping after the first match)?

CHECK-NOT looks too far ahead.

If I add the following test to effcee, it fails. It seems like CHECK-NOT is checking right to the end of the string stead of checking just to the line that matches the following CHECK.

TEST(Match, AppearsAfterNextCheck) {
  const auto result =
      Match("Hello\nWorld\nBorg", "CHECK: Hello\nCHECK-NOT: Borg\nCHECK: World");
  EXPECT_TRUE(result);
}

Compiling with MSVC

There is no a single windows DLL export, it would be good to add
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) in CMakeLists.txt

Don't use StringPiece.as_string()

absl::string_view and std::string_view do not have a as_string() operator. This makes porting effcee to other environments a bit difficult. It would be nice to change such code to use an explicit std::string conversion, e.g. std::string(StringPiece), or to use a helper function.

Migrate to GitHub Actions

It's annoying to maintain both Travis and AppVeyor configurations, and this is a small enough project that GitHub Actions is a better fit than Kokoro.

Integrating with OSS-Fuzz

Greetings effcee developers and contributors,

We’re reaching out because your project is an important part of the open source ecosystem, and we’d like to invite you to integrate with our fuzzing service, OSS-Fuzz. OSS-Fuzz is a free fuzzing infrastructure you can use to identify security vulnerabilities and stability bugs in your project. OSS-Fuzz will:

  • Continuously run all the fuzzers you write.
  • Alert you when it finds issues.
  • Automatically close issues after they’ve been fixed by a commit.

Many widely used open source projects like OpenSSL, FFmpeg, LibreOffice, and ImageMagick are fuzzing via OSS-Fuzz, which helps them find and remediate critical issues.

Even though typical integrations can be done in < 100 LoC, we have a reward program in place which aims to recognize folks who are not just contributing to open source, but are also working hard to make it more secure.

We want to stress that anyone who meets the eligibility criteria and integrates a project with OSS-Fuzz is eligible for a reward.

To help you getting started, we can provide an internal fuzzer for your project that you are welcome to use directly, or to use it as a starting point.

If you're not interested in integrating with OSS-Fuzz, it would be helpful for us to understand why—lack of interest, lack of time, or something else—so we can better support projects like yours in the future.

If we’ve missed your question in our FAQ, feel free to reply or reach out to us at [email protected].

Thanks!

Tommy
OSS-Fuzz Team

Assert when subtracting stringpiece iterators

When using the latest RE2, the windows debug builds give an assert.

input->remove_prefix(captured->end() - input->begin());

This subtraction with two iterators from different stringpieces gives an assert:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\xstring(1086) : Assertion failed: cannot subtract incompatible string_view iterators

This is caused by the definition of the re2 StringPiece class being replaced with std::string_view.

Is there another way to do what we want to do in effcee?

fix compilation of tests for MSVC

From the bot run for #59

FAILED: effcee/CMakeFiles/effcee-test.dir/cursor_test.cc.obj
C:\PROGRA2\MIB0551\2019\COMMUN1\VC\Tools\MSVC\14291.301\bin\Hostx64\x64\cl.exe /nologo /TP -DGTEST_HAS_COMBINE=1 -IT:\src\github\effcee\effcee.. -IT:\src\github\effcee\third_party\re2 -IT:\src\github\effcee\third_party\abseil_cpp -external:IT:\src\github\effcee\third_party\googletest\googlemock\include -external:IT:\src\github\effcee\third_party\googletest\googletest\include -external:IT:\src\github\effcee\third_party\googletest\googlemock -external:IT:\src\github\effcee\third_party\googletest\googletest -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /Zi /O2 /Ob1 /DNDEBUG -MD /wd4800 -std:c++17 /showIncludes /Foeffcee\CMakeFiles\effcee-test.dir\cursor_test.cc.obj /Fdeffcee\CMakeFiles\effcee-test.dir\ /FS -c T:\src\github\effcee\effcee\cursor_test.cc
T:\src\github\effcee\effcee\cursor_test.cc(139): error C2664: 'std::basic_string_view<char,std::char_traits>::basic_string_view(const char *const ,const std::basic_string_view<char,std::char_traits>::size_type) noexcept': cannot convert argument 1 from 'std::_String_view_iterator<_Traits>' to 'const char *const '
with
[
_Traits=std::char_traits
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.