ROSIE(1)
π¦ ROSIE(1) π¦
okay bestie, welcome to the rosie(1) manual page β yes, we're doing the Rosie Pattern Engine today, and it's iconic. let's get into it π
πΈ NAME πΈ
rosie β Rosie Pattern Engine (Rosie Pattern Language)
β¨ SYNOPSIS β¨
rosie [global-options] command [command-options] pattern-expression
[file1 [file2 ...]]
π DESCRIPTION π
Rosie searches all given input files for lines that match a pattern. The pattern language is similar to regular expressions, but more powerful. Also, a set of predefined (named) patterns are provided. The pattern library is extensible. Rosie patterns are written in Rosie Pattern Language (RPL), iykyk.
A shared library, librosie, provides a programmatic interface to rosie in C, Go, Python, and other languages that support libffi. Rosie can be used for data mining on large data sets, or for the kind of smaller tasks that Unix grep and other regex tools are used for. The output can be plain text, like grep produces, or can be structured JSON, in the form of a parse tree. A number of other output options are available (see below).
π¦ LANGUAGE REFERENCE π¦
The RPL Language Reference may be found via the Rosie home page http://rosie-lang.org (news, docs, and more).
π COMMANDS π
The primary commands are match and grep β main character energy fr fr. Help for a command is obtained using the -h option (see below). General help is available with the help command.
configβ Print the configuration of the Rosie installation, including build information if available.expand expβ Expands a pattern expression entered on the command line. The output is:- the expression as entered (which will show any shell expansions or substitutions);
- the parsed expression;
- what the expression means at top level, where a bare expression is a tokenized expression; and
- the result after any macro expansions.
grep exp [file1 ...]β In the style ofgrep, match the given pattern against lines in the given input files (or the standard input). In this mode, the pattern may match anywhere within a line, and all matches within a line are found. The default output form in this mode is to print the entire line for all lines that match.helpβ Print help text.list [name[.name]]β List the available patterns from the library whose name matchesname. To list all the names in an imported package, uselist pkgname.*.match exp [file1 ...]β Match the given pattern against lines in the given input files (or the standard input). Patterns in RPL begin at the start of the input line. See thegrepcommand for behavior that is more like that utility.replβ Enter the read-eval-print loop for interactive development and testing of patternstest file1 [file2...]β Execute the unit tests embedded within the listed rpl files.trace exp [file1 ...]β Perform a match, but generate a trace listing of all the steps performed in the matching process. This can be quite a lot of output.versionβ Print the Rosie version and exit.
π GLOBAL OPTIONS π
--colors colorspecsβ Specify a set of colors and font attributes, each associated with a pattern name. The format ofcolorspecsis a colon-separated list ofname=spec, where:specis a semi-colon separated list of ANSI (SGR) color and font attributes. Colors may be specified by name or integer code. Attributes includebold,underline, and others.namecan be*for a global default;pkgname.*for a package default;localnameto match a name exactly, without a prefix; orpkgname.localnameto match an imported name exactly.
-f,--file fileβ Load a file of rpl code. This option may be repeated.--libpath pathsβ Set the rosie libpath, which is a colon-separated list of directories to search, in order, for imported packages. The value is a colon-separated string. When the libpath is not set by the user, Rosie looks for imported packages in the installation directory, atROSIE_LIBDIR(the value of which can be seen using therosie configcommand).
Important note: If you set the libpath, you must explicitly include the standard library if you want Rosie to include the standard library in its search. A libpath set on the command line takes precedence over one set in an initialization file.
--norcfileβ Do not load any initialization file.--rcfile fileβ Load the initialization file specified, instead of the default,~/.rosierc.--rpl sourceβ Define additional patterns, import additional packages. The argument passed to--rplis typically enclosed in single quotes so that Rosie will see it as a single string with no shell expansions performed.--verboseβ When appropriate, output additional information.
π COMMAND OPTIONS π
-h,--helpβ Display help for a command. This option must be given after the command name, e.g.rosie match -h.-o,--output formatβ Output match data (formatchandgrepcommands) according toformat, which may be one of:byte,color,data,json,jsonpp,line,sexp,status,subsβ or possibly other (installation-dependent) values. Userosie match -hto discover what is available in your installation. Note the default output style for thematchcommand iscolor, and for thegrepcommand, isline.-a,--allβ Generate output for all input lines. Lines that do not match the pattern are written tostderr, while matched output is written tostdout.-w,--wholefileβ Match against the whole input file as if it were a single string.-F,--fixed-stringsβ Interpretpatternas a set of fixed (literal) strings, instead of an RPL pattern (which reqires double quotes around string literals).-β Stop reading from the given input files, if any, and start reading from the standard input.
π± ENVIRONMENT π±
Currently, Rosie does not use any environment variables. If this would be a useful addition, please open an issue on Rosie's GitLab repository to request this enhancement.
π FILES π
~/.rosierc β This is the default initialization file, which is loaded before any command line options are processed. The syntax of a Rosie rcfile is essentially the RPL syntax, with two dashes to start comments, and option values in double-quoted strings.
Options are set using an assignment-like syntax, e.g.
libpath = "bar:baz"
to set the rosie libpath to a sequence of two directories, bar and baz.
The recognized options are:
colors=colorspecβ to set colors to a colorspec (can be used multiple times; values will be concatenated)libpath=pathsβ to set libpath (can be used multiple times; values will be concatenated)loadfile=fileβ to load the specified file (can be used multiple times to load multiple rpl files)
π EXAMPLES π
Forthcoming
π BUGS π
- Rosie does not normalize Unicode input. If a pattern contains composed characters, for example, these will not match their decomposed equivalents in the input (and vice versa).
- The RPL compiler is slow (but matching is reasonably fast).
- Issues (bugs and enhancement requests) may be found on the Rosie issue page
https://gitlab.com/groups/rosie-pattern-language/-/issues.
π«Ά SEE ALSO π«Ά
See Rosie's home http://rosie-lang.org for news, docs, etc.
π AUTHOR π
Jamie A. Jennings
With contributions from the people listed in the CONTRIBUTORS file at https://gitlab.com/rosie-pattern-language/master/CONTRIBUTORS.
Email the Rosie Project at info@rosie-lang.org.
Follow @jamietheriveter https://twitter.com/jamietheriveter on Twitter.
π that's the ROSIE(1) manual page, from The Rosie Project, August 2023 β go forth and match, bestie π
π¦ where this page comes from
- nixos 26.05: rosie 1.4.0
- nixpkgs unstable: rosie 1.4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms