comment

/* anything but * followed by / */

newline

\n \r\n \r \f

whitespace

space \t newline

hex digit

0-9 a-f or A-F

escape

\ not newline or hex digit hex digit 1-6 times whitespace

<whitespace-token>

whitespace

ws*

<whitespace-token>

<ident-token>

- a-z A-Z _ or non-ASCII escape a-z A-Z 0-9 _ - or non-ASCII escape

<function-token>

<ident-token> (

<at-keyword-token>

@ <ident-token>

<hash-token>

# a-z A-Z 0-9 _ - or non-ASCII escape

<string-token>

" not " \ or newline escape \ newline " ' not ' \ or newline escape \ newline '

<url-token>

<ident-token "url"> ( ws* url-unquoted STRING ws* )

url-unquoted

not " ' ( ) \ whitespace or non-printable escape

<number-token>

+ - digit . digit digit . digit e E + - digit

<dimension-token>

<number-token> <ident-token>

<percentage-token>

<number-token> %

<unicode-range-token>

U u + hex digit 1-6 times hex digit 1-5 times ? 1 to (6 - digits) times hex digit 1-6 times - hex digit 1-6 times

Stylesheet

<whitespace-token> <CDC-token> <CDO-token> Qualified rule At-rule

Rule list

<whitespace-token> Qualified rule At-rule

At-rule

<at-keyword-token> Component value {} block ;

Qualified rule

Component value {} block

Declaration list

ws* Declaration ; Declaration list At-rule Declaration list

Declaration

<ident-token> ws* : Component value !important

!important

! ws* <ident-token "important"> ws*

Component value

Preserved token {} block () block [] block Function block

{} block

{ Component value }

() block

( Component value )

[] block

[ Component value ]

Function block

<function-token> Component value )

glob pattern

ident *

SQL

SELECT DISTINCT * expression AS output_name , FROM from_item , WHERE condition GROUP BY expression HAVING condition UNION INTERSECT EXCEPT ALL select ORDER BY expression ASC DESC , LIMIT count ALL OFFSET start ROWS

Group example

foo foo bar label bar

Class example

foo blue blue blue

rr-alternatingsequence

foo bar

rr-choice

1 2 3

rr-group

foo option 1 or two bar

rr-horizontalchoice

1 0 2 3 4 6 5 7 8 9 b a c d e

rr-multchoice

1 2 3 take all branches, once each, in any orderall

rr-oneormore

foo bar

rr-optional

foo bar

rr-optionalsequence

1 2 3

rr-sequence

1 2 3

rr-stack

1 2 3

rr-title

Generate some railroad diagrams and more

rr-zeroormore-1

foo bar

rr-zeroormore-2

foo bar foo bar

complicated-horizontalchoice-1

1 2 3 4 5 4 3 2 1 5 2 1 3 4 5 3 2 1 4 5 1 2 3 4 5 1 2 3 4 5

complicated-horizontalchoice-2

1 2 3 4 4 3 2 1 4

complicated-horizontalchoice-3

1 2 3 4 1 2 3 3 2 1 4

complicated-horizontalchoice-4

1 2 3 4 3 2 1 4 1 2 3

complicated-horizontalchoice-5

1 2 3 1 2 3 4 3 2 1 4

single-stack

1

complicated-optionalsequence-1

1 3 2 4 5 6 7 8 9 10 11