[Vc mfc c ++ flex bison] flex rules (rule)

Source: Internet
Author: User
'X'
Match the character 'X'
'.'
Any character (byte) character t newline
'[Xyz]'
A "character class"; in this case, the pattern matches either 'X', 'Y', Or 'Z'
'[Abj-oZ]'
A "character class" with a range in it; matches 'A', 'B', Any letter from 'J'Through 'O', Or 'Z'
'[^ A-Z]'
A "negated character class", I. e., any character but those in the class. In this case, any character t an uppercase letter.
[^ A-Z/n]'
Any character t an uppercase letter or a newline
`R*'
Zero or more R'S, where RIs any regular expression
`R+'
One or more R'S
`R? '
Zero or one R'S (that is, "an optional R")
`R{2, 5 }'
Anywhere from two to five R'S
`R{2 ,}'
Two or more R'S
`R{4 }'
Exactly 4 R'S
'{Name}'
The expansion of" Name"Definition (see above)
'"[Xyz]/" foo "'
The literal string: '[Xyz] "foo'
'/X'
If XIs 'A', 'B', 'F', 'N', 'R', 'T', Or 'V', Then the ANSI-C interpretation/ X. Otherwise, a literal `X'(Used to escape operators such '*')
'/0'
A NUL character (ASCII code 0)
'/123'
The character with octal value 123
'/X2a'
The character with hexadecimal value 2a
'(R)'
Match R; Parentheses are used to override precedence (see below)
`RS'
The regular expression RFollowed by the regular expression S; Called "concatenation"
`R|S'
Either ROr S
`R/S'
An RBut only if it is followed by S. The text matched SIs already ded when determining whether this rule is Longest match, But is then returned to the input before the action is executed. So the action only sees the text matched R. This type of pattern is called Trailing context. (There are some combinations `R/S'That flexCannot match correctly; see notes in the Deficiencies/Bugs section below regarding "dangerous trailing context ".)
'^R'
An R, But only at the beginning of a line (I. e., which just starting to scan, or right after a newline has been scanned ).
`R$'
An R, But only at the end of a line (I. e., just before a newline). Equivalent" R// N ". note that flex's notion of "newline" is exactly whatever the C compiler used to compile flex interprets '/N' as; in particle, on some DOS systems you must either filter out/r's in the input yourself, or explicitly use R// R/n for "r$ ".
'<S>R'
An R, But only in start condition S(See below for discussion of start conditions) < S1, S2, S3> RSame, but in any of start conditions S1, S2, Or S3
'<*>R'
An RIn any start condition, even an exclusive one.
'<EOF>'
An end-of-file
'<S1,S2> <EOF>'
An end-of-file when in start condition S1Or S2

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.