mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-09-04 01:10:01 +00:00
Fall back to iterative brace removal because I suspect regex version is too slow.
Further tidying of ci.
This commit is contained in:
@@ -51,11 +51,17 @@ jobs:
|
|||||||
gem install bundler
|
gem install bundler
|
||||||
bundle install
|
bundle install
|
||||||
|
|
||||||
- name: Run Ruby Unit Tests and Style Check
|
- name: Run Ruby Unit Tests
|
||||||
env:
|
env:
|
||||||
NO_COLOR: ${{ matrix.os == 'windows-latest' && '1' || '' }}
|
NO_COLOR: ${{ matrix.os == 'windows-latest' && '1' || '' }}
|
||||||
run: |
|
run: |
|
||||||
cd test && rake test:unit style:check
|
cd test && rake test:unit
|
||||||
|
|
||||||
|
- name: Run Style Check
|
||||||
|
env:
|
||||||
|
NO_COLOR: ${{ matrix.os == 'windows-latest' && '1' || '' }}
|
||||||
|
run: |
|
||||||
|
cd test && rake style:check
|
||||||
|
|
||||||
# Job: C compilation and system tests — only needs to run on one Ruby version per OS,
|
# Job: C compilation and system tests — only needs to run on one Ruby version per OS,
|
||||||
# since the generated C code and runtime behavior don't vary with the Ruby version.
|
# since the generated C code and runtime behavior don't vary with the Ruby version.
|
||||||
@@ -102,7 +108,12 @@ jobs:
|
|||||||
- name: Run System Tests
|
- name: Run System Tests
|
||||||
env:
|
env:
|
||||||
NO_COLOR: ${{ matrix.os == 'windows-latest' && '1' || '' }}
|
NO_COLOR: ${{ matrix.os == 'windows-latest' && '1' || '' }}
|
||||||
run: cd test && rake test:system test:examples
|
run: cd test && rake test:system
|
||||||
|
|
||||||
|
- name: Run Examples
|
||||||
|
env:
|
||||||
|
NO_COLOR: ${{ matrix.os == 'windows-latest' && '1' || '' }}
|
||||||
|
run: cd test && rake test:examples
|
||||||
|
|
||||||
# Job: Valgrind memory-leak check (Linux/gcc_64 only, latest Ruby)
|
# Job: Valgrind memory-leak check (Linux/gcc_64 only, latest Ruby)
|
||||||
valgrind:
|
valgrind:
|
||||||
|
|||||||
@@ -118,15 +118,11 @@ class CMockHeaderParser
|
|||||||
|
|
||||||
def remove_nested_pairs_of_braces(source)
|
def remove_nested_pairs_of_braces(source)
|
||||||
# remove nested pairs of braces because no function declarations will be inside of them (leave outer pair for function definition detection)
|
# remove nested pairs of braces because no function declarations will be inside of them (leave outer pair for function definition detection)
|
||||||
if RUBY_VERSION.split('.')[0].to_i > 1
|
# Use iterative approach for all Ruby versions: the recursive regex \{([^\{\}]*|\g<0>)*\}
|
||||||
# we assign a string first because (no joke) if Ruby 1.9.3 sees this line as a regex, it will crash.
|
# is exponential on unbalanced brace inputs (catastrophic backtracking on Ruby < 3.2).
|
||||||
r = '\\{([^\\{\\}]*|\\g<0>)*\\}'
|
while source.gsub!(/\{[^{}]*\{[^{}]*\}[^{}]*\}/m, '{ }')
|
||||||
source.gsub!(/#{r}/m, '{ }')
|
# Keep doing it!
|
||||||
else
|
|
||||||
while source.gsub!(/\{[^{}]*\{[^{}]*\}[^{}]*\}/m, '{ }')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
source
|
source
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user