16 Mar 2012 14:30:47 UTC
- Distribution: Parse-RecDescent
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (15)
- Testers (8431 / 4 / 0)
- KwaliteeBus factor: 1
- 66.21% Coverage
- License: unknown
- Download (166.85KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:13 non-PAUSE users
- Damian Conway
- Jeremy T. Braun
- REQUIRED ARGUMENTS
- BUGS AND LIMITATIONS
- LICENCE AND COPYRIGHT
csourceparser.pl - extract components from sourcecode written in the C programming language
This documentation refers to csourceparser.pl version 0.1.0
./csourceparser.pl [OPTION] ... FILE ...
Print signatures of functions defined in a C-file:
./csourceparser.pl -f myprog.c
Print all declarations in a C-file:
./csourceparser.pl -d myprog.c
Print all structures in a C-file:
./csourceparser.pl -u myheader.h
One or more C-Sourcefiles to parse.
- -c, --code
Show parsed source code with line numbers
- -d, --declarations
Prints (global) declarations in the sourcefile to stdout
- -e, --errors
Print error messages generated by Parse::RecDescent to the file 'errfile'
- -f, --functions
Prints the signatures of functions defined in the source file to stdout (the function bodys are ommited)
- -h, --help
Print this help
- -p, --precompile
Generate precompiled parsers Cgrammar.pm and DecommentGrammar.pm in the current working directory. Precompiled parsers will speed up parsing. If these files are available in the current working directory they will be used automatically. Every time the --precompile option is set the precompiled parsers are generateted newly so this option should only be used only once. Also, don't forget to recreate the precompiled parseres if you modify the grammar.
- -s, --skippedlines
Show which lines had been skipped during parse due to parser errors or unrecognized tokens in the C source code
- -t, --trace
Print full tracecode generated by Parse::RecDescent. Note: this can be a lot
- -u, --structs
Print all structs and unions defined in the C sourcefile
- -v, --verbose
Each use encreases verbosity level by one.
If you don't get the output you expect try to set the -sc options to see what happens. When the parser can't handle the input it will silently get skipped (for empty lines this is a normal behaviour).
If the parser doesn't behave as you expect take a look at the tracecode, e.g. ./csourceparser -t file.c 2> trace for full tracecode or ./csourceparser -vv file.c 2> trace to see only parser level 3 (C-parser) trace code. Depending on the size of the input file(s) this could take some time and may occupy some hd-space.
Please refer to the Parse::RecDescent documentation if you get errors after modifying the grammar.
Perl >= v5.00800
Macros in C-Files could not be parsed at this time. Any declarations and definitions containing macros my cause errors. Perhaps this feature could be implemented in the future by using a "real" preprocessor like m4.
Please report problems to Hendrik Sirges (hendrik.sirges at fh-swf.de) Patches are welcome.
Hendrik Sirges <hendrik.sirges[at]fh-swf.de>
This program is Copyright 2005 by Hendrik Sirges. This program is free software; you can redistribute it and/or modify it under the terms of the Perl Artistic License or the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
If you do not have a copy of the GNU General Public License write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 780:
You forgot a '=back' before '=head1'
Module Install Instructions
To install Parse::RecDescent, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Parse::RecDescent
For more information on module installation, please visit the detailed CPAN module installation guide.
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|