Cobra | Interactive Query Language | mark | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NAMEmark — mark tokens if they match one or two patternsSYNTAXm[ark] [qualifier]* pattern [pattern2] pattern: string | @string | /re | (expr) qualifier: ir | no | & DESCRIPTIONIf used without qualifiers, the mark command can only add additional marks, but not remove them. The qualifiers can be used to restrict an existing set of marks to a subset.A pattern can be one of the following:
A qualifier is one of the three terms ir, no, or &. Qualifiers can be escaped as \no, \&, or \ir if a literal match is intended, as can the / that would otherwise identify a regular expression, or a round brace ( that would otherwise indicate a pattern expression.
m[ark] no pattern [pattern2] m[ark] & pattern [pattern2] m[ark] & ir pattern [pattern2]The command unmark is a shorthand for m no. To avoid confusion with the undo command, unmark cannot be abbreviated. Pattern expressions are general boolean clauses enclosed in round braces. For instance: m & (a <= b && (.lnr < 100 || .fnm == cobra_lib.c))The following operators are recognized in expressions:
EXAMPLES: m s ++ # mark statements s++ (note the operator is a separate token) : m @ident \( # identifiers that are followed by a ( : m else if # else keywords that are followed by if : m /^[fg]oo # names starting with either foo or goo : m \/foo # tokens that match the string '/foo' : m no goo # unmark tokens named goo : unmark goo # same : m ir default # default keywords inside ranges associated with marked tokens : m /. # mark all tokens : r : m @key : m & (.fnm == "cobra.h") # restrict to the set of marks that match the expression : m no (.lnr > 100 ) # remove marks that match the expression : m & (.fnm == /\.h$) : m [ : m ir == : >2 : m while : n \( : >1 : w (size(1) > size(2)) NOTESThe arguments to the mark command (and all others that take arguments) are separated by white space. This means that if you want a space to be part of the pattern to be matched you need an escape character, for example:: m /other\ prefix SEE ALSOback, contains, display, jump, list, next, patterns, pre, qualifiers, reset, stretch, undo, unmark, |
Return to index Manual Tutorial |
(Last Updated: 14 May 2019) |