Cobra Interactive Query Language qualifiers

NAME

qualifiers — that can be added to modify the behavior of a command

SYNTAX

	no | & | ir
	top | up

DESCRIPTION

The commands contains, mark, re, and stretch accept qualifiers to modify their default behavior. The first three qualifiers are most often used in combination with the mark command.
	m no pattern [pattern2]
	m &  pattern [pattern2]
	m ir pattern [pattern2]
The qualifier no inverts the effect of a mark command, by removing, rather than adding, marks from tokens that match the pattern(s) that follow. For instance:
	m no pattern
removes marks that do not match the pattern specified. For this common case an alternative notation is also supported, which does not have an abbreviated form:
	unmark pattern

The qualifier & adds a constraint to the earlier matches and it will only retain marks that match the additional pattern(s) provided.

The qualifier ir restricts new matches to tokens that appear within the range that is associated with currently marked tokens. That is: the mark points move to the matched token within each range. This makes a mark ir command different from the contains command, where the mark point is preserved, but is not moved, if the range contains a given pattern.

The last two qualifiers top and up can be used only with the contains and stretch commands. The qualifier top restricts the search for the matching pattern to the same nesting depth as the current token. The qualifier up matches up to one nesting level up from the current token.

EXAMPLES

	: r			# first example
	: m switch; n {		# all switch statements
	: c top no default	# without a default clause
	: r			# second example
	: m case		# all case statements
	: s up }		# stretch up to } one level up
	: c no case		# last case in switch
	: c no default		# not followed by a default clause

NOTES

Qualifiers can be escaped as \&, \no, \top, \up, or \ir if a literal match of the word or symbol is needed.

SEE ALSO

contains, mark, re, stretch

Return to index
Manual
Tutorial
(Last Updated: 8 May 2017)