44 lines
1.5 KiB
Groff
44 lines
1.5 KiB
Groff
.\" generated with Ronn/v0.7.3
|
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
|
.
|
|
.TH "LEXESIS" "5" "May 2016" "" ""
|
|
.
|
|
.SH "NAME"
|
|
\fBLexesis\fR \- Syntax rules for Lexesis \.lxs files
|
|
.
|
|
.SH "DESCRIPTION"
|
|
Input files for Lexesis(1) have a \fB\.lxs\fR extension and have a set of some very simple rules: On each line, a new type of token is specified with a different priority, starting with the highest at the top of the file and lowest at the bottom\. If your input matches more than one of the regexes in your input file, the generated lexer will choose the token with the highest priority\. The line begins with the name for the new type of token, following a \fB=\fR and finally the regex used to match tokens of that type\. If you want to add a comment to the file, make sure the line starts with a \fB#\fR and Lexesis will ignore that line\.
|
|
.
|
|
.P
|
|
Consider the following example:
|
|
.
|
|
.IP "" 4
|
|
.
|
|
.nf
|
|
|
|
CAPITAL = [A\-Z]
|
|
NUMBER = [0\-9]
|
|
|
|
# This is a comment
|
|
ALL = [a\-zA\-Z]
|
|
.
|
|
.fi
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.P
|
|
Here we have 3 different tokens \fBCAPITAL\fR, \fBNUMBER\fR and \fBALL\fR\. Note that the names for the tokens only consist of capital letters, small letter and underscores, other characters are not recommended, in order to work for most possible backends\. When we run \fBA\fR through the generated lexer, it will return that it\'s a \fBCAPITAL\fR, since it is specified higher than \fBALL\fR\.
|
|
.
|
|
.SH "AUTHORS"
|
|
.
|
|
.IP "\(bu" 4
|
|
Thomas Avé
|
|
.
|
|
.IP "\(bu" 4
|
|
Robin Jadoul
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.SH "SEE ALSO"
|
|
Lexesis(1)
|