Cobra Interactive Query Language commandline options

NAME

Cobra commandline options

DESCRIPTION

	$ cobra -?		# Assuming version 2.4 or later
	cobra: unrecognized option '-?'
	usage: cobra [-option]* [file]*
 	-Ada                -- recognize Ada keywords (implies -nocpp)
	-allheaderfiles     -- process all header files (also system headers)
	-C++                -- recognize C++ keywords
	-c "commands"       -- execute commands and stop (cf -e, -f)
	-c "m /regex; p"     -- find tokens matching a regular expr
	-cpp                -- enable C preprocessing
	-d and -v -d        -- debug cobra inline program executions
	-e name             -- (or -expr or -regex) print lines with tokens matching name
	-e "token_expr"     -- print lines matching a token_expr (cf -view)
	                       use meta-symbols: ( | ) . * + ?
	                       use ^name for not-matching name
	                       var-binding:   name:@ident
	                       var-reference: :name
	                       see also -pattern (or -pat)
	-f file             -- execute commands from file and stop (cf -view)
	-Idir, -Dstr, -Ustr -- preprocessing directives
	-Java               -- recognize Java keywords
	-lib                -- list available predefined cobra -f checks
	-m or -macros       -- parse text of macros (implies -nocpp)
	-n or -nocpp        -- do not do any C preprocessing (default)
	-noqualifiers       -- do not tag qualifiers
	-noheaderfiles      -- do not process header files
	-notypedefs         -- do not process typedefs
	-notypes            -- do not tag type names
	-Nn                 -- use n threads
	-pattern "tokens"   -- (or -pat) like -expr but simplified: (|)+? are regular symbols
	                       * and ] are meta-symbols unless preceded by a space
	                       [ is a meta-symbol unless followed by a space
	-preserve           -- preserve temporary files
	-Python             -- recognize Python keywords
	-quiet              -- do not print script commands executed or nr of matches
	-regex "expr"       -- see -e
	-runtimes           -- report runtimes of commands executed, if >1s
	-scrub              -- produce output in scrub-format
	-stdin              -- read source from stdin (requires -e or -f)
	-terse              -- disable output from d, l, and p commands, implies -quiet
	-tok                -- only tokenize the input
	-version            -- print version number and exit
	-v                  -- more verbose
	-view -f file       -- show dot-graph of DFA(s) of inline program(s)
	-view -e "token_expr" -- show dot-graph of NDFA for expr
	-V                  -- print version number and exit
	-var name=value     -- set name in def-script to value (cf. -f)
When preprocessing is not enabled (the default mode) beware that if source code isn't reasonably behaved the scanner can become confused about pairs of parentheses, brackets, or braces that it will try to match. In the following example, for instance, it would appear (with preprocessing disabled) that there are more closing braces than opening braces:
	badstyle()
	{	printf(
	#ifdef X
		"disk");
	#else
		*argv);
	#endif
	}
Cobra will warn if this happens for any source file it scans.
The problem can be avoided either by allowing the preprocessor to run, or by formatting the code itself differently. For instance:
	badstyle()
	{	printf(
	#ifdef X
		"disk"
	#else
		*argv
	#endif
		);
	}
In cases where not all headerfiles from #include directives are available, it can sometimes still be better to leave preprocessing enabled, and to ignore the preprocessors error messages that result, to improve the consistency of the data structure.

Return to index
Manual
Tutorial
(Last Updated: 23 October 2017)