5.16.5. Regular definitions

Start data section to src/flx_parse.mly[5 /33 ] Next Prev First Last
   538: 
   539: regdef:
   540:   | REGEXP NAME EQUAL re1 SEMI
   541:     {
   542:       let name = snd $2 in
   543:       `AST_regdef (rstoken $1 $5,name,$4)
   544:     }
   545: 
   546: re0:
   547:   | re1 AS NAME              { REGEXP_group (snd $3, $1) }
   548:   | re1                      { $1 }
   549: 
   550: re1:
   551:   | re1 VBAR re2             { REGEXP_alt ($1, $3) }
   552:   | re2                      { $1 }
   553: 
   554: re2:
   555:   | re2 re3                  { REGEXP_seq ($1, $2) }
   556:   | re3                      { $1 }
   557: 
   558: re3:
   559:   | re4 STAR                { REGEXP_aster $1 }
   560:   | re4 PLUS                 { REGEXP_seq ($1,REGEXP_aster $1) }
   561:   | re4 QUEST                { REGEXP_alt (REGEXP_epsilon, $1) }
   562:   | re4                      { $1 }
   563: 
   564: re4:
   565:   | STRING                  { let s = snd $1 in REGEXP_string s }
   566:   | UNDERSCORE              { regexp_underscore }
   567:   | DOT                     { regexp_dot }
   568:   | LPAR re0 RPAR           { $2 }
   569:   | LSQB charset RSQB       { regexp_of_charset $2 }
   570:   | LSQB CIRCUMFLEX charset RSQB { regexp_of_charset (charset_inv $3) }
   571:   | re_name                 { REGEXP_name $1 }
   572: 
   573: re_name:
   574:   | re_name COLONCOLON NAME
   575:     {
   576:       let e = ($1 :> expr_t) in
   577:       let sr = rsrange (src_of_expr e) (slift (fst $3)) in
   578:       `AST_lookup (sr, (e, snd $3,[]))
   579:     }
   580:   | NAME { `AST_name (slift (fst $1), snd $1,[]) }
   581: 
   582: charset0:
   583:   | INTEGER MINUS INTEGER
   584:     {
   585:       let
   586:         a = match $1 with _,_,x -> Big_int.int_of_big_int x and
   587:         b = match $3 with _,_,x -> Big_int.int_of_big_int x
   588:       in
   589:       charset_of_int_range a b
   590:     }
   591:   | STRING MINUS STRING     { charset_of_range (snd $1) (snd $3) }
   592:   | STRING                  { charset_of_string (snd $1) }
   593:   | INTEGER
   594:     {
   595:       let a = match $1 with _,_,x -> Big_int.int_of_big_int x in
   596:       charset_of_int_range a a
   597:     }
   598: charset:
   599:   | charset charset0        { charset_union $1 $2 }
   600:   | charset0                { $1 }
   601: 
End data section to src/flx_parse.mly[5]


5.16.5.1. Abstract Type
5.16.5.2. Union Binding
5.16.5.3. Struct Binding
5.16.5.4. Abstract Constant Binding
5.16.5.5. Binding Header Definition
5.16.5.6. Inline C++ Code Definition
5.16.5.7. Type Alias
5.16.5.8. Export
5.16.5.9. Open
5.16.5.10. Macro Definition
5.16.5.11. Function and Procedure Definition
5.16.5.12. Object
5.16.5.13. Assert
5.16.5.14. Goto and Label
5.16.5.15. Read Statement
5.16.5.16. Module Definition
5.16.5.17. Variable and Constant Declaration
5.16.5.18. Function or Procedure Return
5.16.5.19. Procedure Call
5.16.5.20. Place Holder
5.16.5.21. Conditional Statements
5.16.5.22. Regular expression matching
5.16.5.23. Pattern Matching