Cobra Interactive Query Language with

NAME

with — restrict to marked tokens that match a constraint

SYNTAX

	w[ith] ( expr )

DESCRIPTION

This command is equivalent to a mark command that applies and additional constraint to a set of already existing marks, expressed as an expression:
	: m & ( expr )
The command name can also be written as eval instead of with, which can be abbreviated to w.

Expressions are general boolean clauses that must be enclosed in round braces. For instance:

	w (a <= b && (.lnr < 100 || .fnm == cobra_lib.c))
	m  & (a + b > c)
which also explains why a match on a literal character ( needs an escape:
	m & \(
The following operators are recognized:
  • +, !, –, *, /, %
  • >, >=, <, <=, ==, !=
  • &&, ||
The operands of an expression can be of the following types:



    stringsin double quotes if they contain spaces or tabs
    regular expressionsstrings prefixed with a /
    constantspositive or negative integer numbers
    predefined function size(n)returns the number of marks in set n


Or references to token attributes:


    .lenthe length of the token name
    .seqthe sequence number of the token
    .markthe mark value (non-zero if selected or matched)
    .rangethe number of lines in the associated range, or 0 if none


    .curlythe level of nesting of curly braces
    .roundthe level of nesting of round braces
    .bracketthe level of nesting of square brackets


    .fctthe name of the function, or "global"
    .fnmthe filename
    .lnrthe line number in the file


EXAMPLES

	: m while
	: n \(
	: with (.fnm == cobra.h)
	: eval (.lnr > 100)
	: w ( .fnm == /\.h$ )
	: >1
	: w (size(1) > size(2))

SEE ALSO

mark, patterns, reset, undo, unmark

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