| Cobra | Interactive Query Language | symbols | ||
|---|---|---|---|---|
| NAMEsymbols — link variables to their point of declarationSYNTAXsymbols DESCRIPTIONThe symbols command (supported in Cobra versions after May 2021) attempts to quickly identify the location of the declaration for each identifier used in C code. The location is stored in the .bound attribute of the identifier token. This field is normally not cleared by a reset command, but can be if the argument all is added, as in reset all.EXAMPLES
	$ cobra *.c
	1 core, 14 files, 122230 tokens
	: symbols
	symbols: linked 3573 params, 6116 locals, 2998 globals, 5468 unknown
	: %{
		p = .bound;
		if (p.seq > 0)	# the bounds field was set
		{	print .fnm ":" .lnr ": " .txt " is of type " p.txt "\n";
		}
	  %}
	...
	cobra_te.c:2750: no_match is of type int
	cobra_te.c:2752: p_matched is of type int
	...
	: r all		# reset all fields, including .bound
	: q
	$
The script starts by assigning
the value of the .bound field to a variable named p and
then checks if the token sequence number of p is non-zero.
The reason for doing this test in two steps is that the scripting
language does not allow chained references, so that we cannot write
the condition asif (.bound.seq > 0) # a double indirection (two dots) is not validNote that bound is an attribute of the current token (.), and seq is an attribute of that token, if it exists. If the .bound field was not set then p will evaluate as a dummy null token, with all fields null or zero. SEE ALSOreset, setlinks | ||||
| Return to index Manual Tutorial | (Last Updated: 30 September 2021) | |||