Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to use strings.TrimLeft instead of regexp #197

Merged
merged 1 commit into from Jul 7, 2017
Merged

Change to use strings.TrimLeft instead of regexp #197

merged 1 commit into from Jul 7, 2017

Conversation

lestrrat
Copy link
Contributor

@lestrrat lestrrat commented Jul 7, 2017

Was fooling around with parsing libxml2, and got this output

|-TypedefDecl 0x7fd88090c5d8 <line:845:1, line:847:9> line:845:17 referenced xmlGenericErrorFunc 'void (*)(void *, const char *, ...)'
| |-PointerType 0x7fd88090c570 'void (*)(void *, const char *, ...)'
| | `-ParenType 0x7fd88090c510 'void (void *, const char *, ...)' sugar
| |   `-FunctionProtoType 0x7fd88090c4d0 'void (void *, const char *,
...)' cdecl
| |     |-BuiltinType 0x7fd88081c520 'void'
| |     |-PointerType 0x7fd88081c950 'void *'
| |     | `-BuiltinType 0x7fd88081c520 'void'
| |     |-PointerType 0x7fd88081cb90 'const char *'
| |     | `-QualType 0x7fd88081c561 'const char' const
| |     |   `-BuiltinType 0x7fd88081c560 'char'
| |     `-...

And c2go choked on the last line, saying

  panic: Cannot understand line '| |     `-...'

In this case the prefix matches, but the dots don't match against \w, so
this line fails.

Anyway, using regular expression with this particular pattern seems
overkill, so it has been changed to strings.TrimLeft


This change is Reviewable

Was fooling around with parsing libxml2, and got this output

|-TypedefDecl 0x7fd88090c5d8 <line:845:1, line:847:9> line:845:17
referenced xmlGenericErrorFunc 'void (*)(void *, const char *, ...)'
| |-PointerType 0x7fd88090c570 'void (*)(void *, const char *, ...)'
| | `-ParenType 0x7fd88090c510 'void (void *, const char *, ...)' sugar
| |   `-FunctionProtoType 0x7fd88090c4d0 'void (void *, const char *,
...)' cdecl
| |     |-BuiltinType 0x7fd88081c520 'void'
| |     |-PointerType 0x7fd88081c950 'void *'
| |     | `-BuiltinType 0x7fd88081c520 'void'
| |     |-PointerType 0x7fd88081cb90 'const char *'
| |     | `-QualType 0x7fd88081c561 'const char' const
| |     |   `-BuiltinType 0x7fd88081c560 'char'
| |     `-...

And c2go choked on the last line, saying

  panic: Cannot understand line '| |     `-...'

In this case the prefix matches, but the dots don't match against \w, so
this line fails.

Anyway, using regular expression with this particular pattern seems
overkill, so it has been changed to strings.TrimLeft
@codecov
Copy link

codecov bot commented Jul 7, 2017

Codecov Report

Merging #197 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #197      +/-   ##
==========================================
+ Coverage   71.31%   71.33%   +0.01%     
==========================================
  Files         126      126              
  Lines        4459     4455       -4     
==========================================
- Hits         3180     3178       -2     
+ Misses       1141     1140       -1     
+ Partials      138      137       -1
Impacted Files Coverage Δ
main.go 45% <100%> (-0.14%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4928f67...c1081e0. Read the comment docs.

@elliotchance
Copy link
Owner

Reviewed 1 of 1 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@elliotchance elliotchance merged commit aa3b8e7 into elliotchance:master Jul 7, 2017
@elliotchance elliotchance modified the milestone: v0.13.x Aug 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants